partial progress on threshold watch form including validation#34819
Merged
bmcconaghy merged 3 commits intoelastic:watcher-portfrom Apr 10, 2019
Merged
partial progress on threshold watch form including validation#34819bmcconaghy merged 3 commits intoelastic:watcher-portfrom
bmcconaghy merged 3 commits intoelastic:watcher-portfrom
Conversation
Contributor
|
Pinging @elastic/es-ui |
Contributor
💔 Build Failed |
Contributor
alisonelizabeth
left a comment
There was a problem hiding this comment.
@bmcconaghy this looks good!
Two other things I noticed:
- I see this react warning in the console when I do a full page refresh on the threshold page:
Warning: React does not recognize the `isInvalid` prop on a DOM element.I didn't immediately find what was causing it. - Also, the
json_watch_edit_componentis still referencingkbnUrlrather thanurlService, but I can address that when I adopt the new validation approach.
| this.isNew = get(props, 'isNew', true); | ||
|
|
||
| this.name = get(props, 'name', ''); | ||
| this.name = get(props, 'name'); |
Contributor
There was a problem hiding this comment.
don't we need to set an initial value for name to avoid this react warning?
A component is changing an uncontrolled input of type text to be controlled.
| } else if (!regex.test(id)) { | ||
| return i18n.translate('xpack.watcher.sections.watchEdit.json.error.invalidIdText', { | ||
| defaultMessage: 'ID must only letters, underscores, dashes, and numbers.', | ||
| defaultMessage: 'ID can only contain letters, underscores, dashes, and numbers.', |
Contributor
There was a problem hiding this comment.
thanks for fixing this!
| @@ -66,7 +66,7 @@ export async function saveWatch(watch: BaseWatch, kbnUrl: any, licenseService: a | |||
| }) | |||
| ); | |||
| // TODO: Not correctly redirecting back to /watches route | |||
Contributor
There was a problem hiding this comment.
i think we can remove this todo now
| */ | ||
| export class ThresholdWatch extends BaseWatch { | ||
| constructor(props = {}) { | ||
| console.log('CONSTRUCT', props); |
Contributor
There was a problem hiding this comment.
nit: remove at some point
Contributor
|
@bmcconaghy ignore my second comment, I see you fixed the |
alisonelizabeth
approved these changes
Apr 10, 2019
Contributor
💔 Build Failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces a new strategy for saving watch changes and adds save + form validation to the threshold watcher edit screen.