-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/widget validation #86
Conversation
const validationSchema = createWidgetValidationSchema(values.type, generalFields, constraints) | ||
setValidationSchema(validationSchema) | ||
// eslint-disable-next-line | ||
}, [values.type]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add all dependencies, react will handle which will be updated - values.type in this case anyway, because rest are the same :)
cogboard-webapp/src/components/widgets/dialogFields/MultilineTextInput.js
Outdated
Show resolved
Hide resolved
cogboard-webapp/src/components/widgets/dialogFields/SonarQubeMetricsInput.js
Outdated
Show resolved
Hide resolved
cogboard-webapp/src/components/widgets/dialogFields/TextInput.js
Outdated
Show resolved
Hide resolved
cogboard-webapp/src/hooks/index.js
Outdated
validationSchema.validate(values, {abortEarly: false}) | ||
.then(value => func(value)) | ||
validationSchema.validate(values, {abortEarly: false, stripUnknown: true}) | ||
.then(value => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a oneliner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…get-validation # Conflicts: # cogboard-webapp/src/components/BoardForm/index.js # cogboard-webapp/src/components/DropdownField.js # cogboard-webapp/src/components/WidgetForm/helpers.js # cogboard-webapp/src/components/WidgetForm/index.js # cogboard-webapp/src/components/WidgetTypeForm/helpers.js # cogboard-webapp/src/components/widgets/dialogFields/AemHealthcheckInput.js # cogboard-webapp/src/components/widgets/dialogFields/SonarQubeMetricsInput.js # cogboard-webapp/src/components/widgets/dialogFields/index.js # cogboard-webapp/src/components/widgets/index.js # cogboard-webapp/src/constants/index.js # cogboard-webapp/src/helpers/index.js # cogboard-webapp/src/hooks/index.js
@@ -13,7 +13,9 @@ const conditionallyHidden = (Component, conditionField, condition) => ({values, | |||
} | |||
|
|||
conditionallyHidden.propTypes = { | |||
component: node | |||
Component: node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change it to elementType.
…get-validation # Conflicts: # cogboard-webapp/src/components/AddWidget.js # cogboard-webapp/src/components/BoardForm/index.js # cogboard-webapp/src/components/BoardForm/styled.js # cogboard-webapp/src/components/BoardForm/validators.js # cogboard-webapp/src/components/EditBoard.js # cogboard-webapp/src/components/EditWidget.js # cogboard-webapp/src/components/ValidationMessages.js # cogboard-webapp/src/components/WidgetForm/helpers.js # cogboard-webapp/src/components/WidgetForm/index.js # cogboard-webapp/src/components/WidgetForm/styled.js # cogboard-webapp/src/components/WidgetTypeForm/helpers.js # cogboard-webapp/src/components/WidgetTypeForm/index.js # cogboard-webapp/src/components/widgets/dialogFields/AemHealthcheckInput.js # cogboard-webapp/src/components/widgets/dialogFields/CheckboxInput.js # cogboard-webapp/src/components/widgets/dialogFields/NumberInput.js # cogboard-webapp/src/components/widgets/dialogFields/SonarQubeMetricsInput.js # cogboard-webapp/src/components/widgets/dialogFields/index.js # cogboard-webapp/src/components/widgets/index.js # cogboard-webapp/src/helpers/index.js # cogboard-webapp/src/hooks/index.js
Please let me know in the comments about validation rules for the widget's fields.