Skip to content
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

Merged
merged 12 commits into from
Nov 13, 2019
Merged

Feature/widget validation #86

merged 12 commits into from
Nov 13, 2019

Conversation

Cich0sza
Copy link
Contributor

Please let me know in the comments about validation rules for the widget's fields.

cogboard-webapp/src/components/BoardForm/index.js Outdated Show resolved Hide resolved
cogboard-webapp/src/components/EditWidget.js Outdated Show resolved Hide resolved
cogboard-webapp/src/components/ValidationMessages.js Outdated Show resolved Hide resolved
cogboard-webapp/src/components/WidgetForm/index.js Outdated Show resolved Hide resolved
const validationSchema = createWidgetValidationSchema(values.type, generalFields, constraints)
setValidationSchema(validationSchema)
// eslint-disable-next-line
}, [values.type])
Copy link
Collaborator

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 :)

validationSchema.validate(values, {abortEarly: false})
.then(value => func(value))
validationSchema.validate(values, {abortEarly: false, stripUnknown: true})
.then(value => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a oneliner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

cogboard-webapp/src/components/BoardForm/index.js Outdated Show resolved Hide resolved
@Cich0sza Cich0sza marked this pull request as ready for review November 6, 2019 10:14
Bartlomiej Jackowiak added 2 commits November 7, 2019 13:16
…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,
Copy link
Collaborator

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.

Bartlomiej Jackowiak added 2 commits November 12, 2019 08:28
…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
@Cich0sza Cich0sza merged commit 7a8939f into master Nov 13, 2019
@Cich0sza Cich0sza deleted the feature/widget-validation branch November 13, 2019 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants