Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
715 defence successfully configured message should not disappear after a delay #778
715 defence successfully configured message should not disappear after a delay #778
Changes from all commits
bf2294a
34aaafc
9cefe34
bd88920
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I notice you've removed the validation. Do you plan to add it back in (here or in a fresh ticket) or do you think we don't need validation? It means that, for instance, you can configure things like this:
I went through and put invalid configurations and none of them actually stop the site from working, and the backend even comes back with somewhat sensible responses. If we decided to remove validation, then we should also remove
validateDefence
from defenceService.tsThere 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.
Yep I think that was a mistake when @dhinrichs-scottlogic pulled out the disappearing messages. We want to keep validation, and only call setDefenceConfiguration if we have a valid value.
That then leaves the question of what to show when the value is not valid; we would want an error message that persists beneath the input until the value is changed to a valid one, probably with error styling / validation state on the input to match.
That is not trivial, because we don't currently have validation on our themed inputs - ThemedNumberInput and ThemedTextArea.
Doro, I suggest you move the validation check into DefenceConfiguration, so we can have input-specific validation errors. We can put it in setDefenceConfigurationValueIfDifferent, and only call
setDefenceConfiguration
if the value is valid. We will want some local state to store whether the config input is valid or not, and will display some generic error-styled message underneath the DefenceConfigurationInput component when invalid.As I anticipate some accessibility concerns, you could add a new issue to add accessible validation states to our themed inputs, unless you want to tackle that in this issue; in that case, you could do that part in a subsequent PR.
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.
You have these two lines duplicated now; may as well pull out into a separate function, which takes param 'reset' or 'configured' for the message to add.