Skip to content

[ML] Add validation of label and time range when editing custom URLs#21960

Merged
peteharverson merged 2 commits intoelastic:masterfrom
peteharverson:ml-custom-url-validate
Aug 15, 2018
Merged

[ML] Add validation of label and time range when editing custom URLs#21960
peteharverson merged 2 commits intoelastic:masterfrom
peteharverson:ml-custom-url-validate

Conversation

@peteharverson
Copy link
Contributor

Adds validation to the label and time range when editing custom URLs in the Jobs List edit job flyout.

Also adds a 'Test' button to the section for creating new URLs, so that the settings can be tested before hitting the 'Add' button (fixes #18211)

image

Also adds in units tests for ml/public/util/custom_url_utils.js.

PR refactors ml/public/jobs/components/custom_url_editor/editor.js and ml/public/jobs/components/custom_url_editor/list.js to convert them into classes, to avoid having to pass properties to all the event handlers, as raised in a review of #21094.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

Added a couple of nit-picks, but otherwise LGTM

jobModelMemoryLimitValidationError,
jobGroupsValidationError,
valid,
validJobDetails,
Copy link
Member

Choose a reason for hiding this comment

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

this variable name makes it sound like a filtered list of valid job details.
perhaps something like jobDetailsValid or isJobDetailsValid would be clearer

const validJobCustomUrls = isValidCustomUrls(jobCustomUrls);
this.setState({
jobCustomUrls,
validJobCustomUrls,
Copy link
Member

Choose a reason for hiding this comment

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

same as issue with validJobDetails

@@ -96,3 +100,24 @@ function buildKibanaUrl(urlConfig, record) {
return tokenValue !== null ? tokenValue : match;
Copy link
Member

Choose a reason for hiding this comment

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

i know this is old code, but this condition should be wrapped in parentheses.
return (tokenValue !== null) ? tokenValue : match;

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@peteharverson peteharverson merged commit 4a63e17 into elastic:master Aug 15, 2018
@peteharverson peteharverson deleted the ml-custom-url-validate branch August 15, 2018 12:49
peteharverson added a commit to peteharverson/kibana that referenced this pull request Aug 16, 2018
…lastic#21960)

* [ML] Add validation of label and time range when editing custom URLs

* [ML] Edits to custom URL validation following review
peteharverson added a commit that referenced this pull request Aug 16, 2018
…21960) (#21993)

* [ML] Add validation of label and time range when editing custom URLs

* [ML] Edits to custom URL validation following review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ML] Custom URL Wizard - Ensure unique labels [ML] Custom URL Wizard - Add a preview to the wizard

3 participants