Skip to content

[ML] New job wizards UI#40748

Merged
jgowdyelastic merged 15 commits intoelastic:feature-new-ml-job-wizards-newfrom
jgowdyelastic:new-job-wizards-ui
Jul 12, 2019
Merged

[ML] New job wizards UI#40748
jgowdyelastic merged 15 commits intoelastic:feature-new-ml-job-wizards-newfrom
jgowdyelastic:new-job-wizards-ui

Conversation

@jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Jul 10, 2019

First PR for the jobs wizard remake UI.
In this initial version, single metric, multi metric and population jobs can be created.
For multi metric and population jobs, the data can be split in a similar way to the original wizards.

2019-07-03 14-46-21 2019-07-03 14_47_04

As with the original wizards, when starting the jobs the results will be polled and drawn over the charts.

2019-07-03 14-52-51 2019-07-03 14_54_41

Basic things missing in this PR which will be added in follow ups:

  • internationalisation - there are very few translated strings
  • tests - there are none
  • replace placeholder text for all form inputs

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@jgowdyelastic jgowdyelastic requested a review from a team as a code owner July 10, 2019 13:11
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM overall, just a bunch of questions/thoughts.


// @ts-ignore: incomplete kibana types
const bounds = timefilter.getActiveBounds();
const tf = timefilter as any;
Copy link
Contributor

Choose a reason for hiding this comment

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

Once Melissa's navbar PR is in this shouldn't be necessary anymore if you merge master then, she added the missing types to timefilter.

Copy link
Member Author

Choose a reason for hiding this comment

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

{metricsValid && isActive && (
<Fragment>
<EuiHorizontalRule margin="l" />
<MultiMetricSettings isActive={isActive} setIsValid={setSettingsValid} />
Copy link
Contributor

Choose a reason for hiding this comment

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

ultra-semantics-nit: since setIsValid is the callback inside the component and not the setter itself, what if these kind of props were called onIsValid (similar to onChange exposed by EUI components or native listeners).

Copy link
Member Author

@jgowdyelastic jgowdyelastic Jul 12, 2019

Choose a reason for hiding this comment

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

onIsValid doesn't describe this as well as setIsValid IMO.
The prop is allowing the component to report whether it is valid. something like onSettingsChange or something like that would be more accurate, but then it loses the point that it's for validation. I'm going to leave this name as is, although it's not the great, it's better than alternatives.

marginBottom: `-${SPACING}px`,
marginLeft: `${sideMargin}px`,
marginRight: `${sideMargin}px`,
transition: 'margin 0.2s',
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need cross-browser alternatives since it's not running through SCSS compilation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I think it should probably be moved to SCSS.
I'll look into that in a follow up https://github.com/elastic/kibana/projects/30#card-23885080

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is how the cards split on IE11:

image

<EuiPageContentBody>
<EuiSpacer size="l" />
<Wizard
jobCreator={jobCreator}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could jobCreatorContext already be created in this component and be applied in the jsx here using <JobCreatorContext.Provider value={jobCreatorContext}>? Then it wouldn't be necessary to pass it down here as a prop and the code to create it wouldn't be spread across 2 files.

Copy link
Member Author

Choose a reason for hiding this comment

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

possibly yes, i think i tried that but hit a problem. i'll revisit it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I remember now, the creation of the jobCreator needs to be in a higher level component otherwise it gets recreated on re-render.
The jobCreator, chartInterval and chartLoader classes could be created in a separate factory function above the page component.
This whole structure can be revisited later in a refactor.

Copy link
Member Author

Choose a reason for hiding this comment

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

});
},

newJobLineChart(
Copy link
Contributor

Choose a reason for hiding this comment

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

could we just pass a data object then we wouldn't have to list all the args/properties twice? (guess this might make sense once migrating to typescript because then the data object could be defined by an interface instead of having single functions args here)

Copy link
Member Author

Choose a reason for hiding this comment

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

This can be addressed when we typescriptify the ml_api_service file.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Just some minor comments and questions.
Is adding data-test-subj attributes on the TODO list too?

this._timeFieldName,
start,
end,
intervalMs * 3
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is 3 being used here? Could it be moved to a const with a comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Short answer is it makes the chart look nicer by widening the buckets.
I'll see if there is a nicer way to do it, or make it a const

Copy link
Member Author

Choose a reason for hiding this comment

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

jobIdFilterStr += `"${String(firstSplitField.value).replace(/\\/g, '\\\\')}"`;
}

ml.esSearch({
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this search be moved to the server-side results_service?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes hopefully that can happen in a later PR. I'd like all searches to happen server side

Copy link
Member Author

Choose a reason for hiding this comment

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

@peteharverson
Copy link
Contributor

Is adding in the created_by prop into the job's custom_settings on the TODO list?

@jgowdyelastic
Copy link
Member Author

Is adding in the created_by prop into the job's custom_settings on the TODO list?

it is now.

@alvarezmelissa87
Copy link
Contributor

Overall, LGTM - the only thing I'd feel more strongly about are the places Walter pointed out that the subscription to the observable could be returned so that on unmount unsubscribe can be called on it. (when using jobCreator.subscribe... and resultsLoader.subscribe..
Sounds like it would be fine to be done in a follow-up as you've already got some planned.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Latest changes and comments LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM ⚡️

};

function getTitle(agg: Aggregation, field: Field, splitField: SplitField): string {
// let title = ${agg.title}(${field.name})`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ever going to be needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was raised by Pete also #40748 (comment)
I'm going to leave it in for now as there is outstanding work on the detector titles

@jgowdyelastic jgowdyelastic merged commit 35a4dc5 into elastic:feature-new-ml-job-wizards-new Jul 12, 2019
jgowdyelastic added a commit that referenced this pull request Jul 31, 2019
* [ML] Adding new job wizards services (#40718)

* [ML] Adding new job wizards services

* adding ts-ignore for incomplte kibana timefilter type

* [ML] New job wizards UI (#40748)

* [ML] New job wizards UI

* small refactor

* fixing type problems

* updating snapshots

* updating translations ids for temporary new job links

* updating translation ids

* fixing population by field selection

* small refactor to by field select

* moving component descriptions to separate files

* moving chart grid component into own file

* fixing event rate count detector

* fixing decimal place rounding

* changes based on review

* more changes based on review

* fixing test

* [ML] Adding created_by to job (#41015)

* [ML] Adding json preview (#41078)

* [ML] Adding job json preview

* fix typo

* [ML] Fixing view results button (#41077)

* [ML] Adding generic custom settings functions to job creator (#41046)

* [ML] Adding generic custom settings functions to job creator

* fixing typo

* [ML] Adding advanced section to job details step (#41157)

* [ML] Adding advanced section to job details step

* disabling model plot for population

* changes based on review

* updating include paths

* [ML] Adding additional settings section to job details step (#41339)

* [ML] Adding additional settings section to job details step

* changes based on review

* [ML] Adding basic job validation (#41459)

* [ML] Adding basic job validation

* removing observable

* small refactor

* comments and refactors

* disabling create job button

* adding duplicate job and group id checks

* disabling next on invalid wizard step

* changes based on review

* removing unused includes

* [ML] Adding advanced job validation (#41634)

* [ML] Adding advanced job validation

* clean up

* function rename

* updating tests

* show some previous step info

* removing . from validation titles

* fixes advanced validation duration check

* removing include

* [ML] Changing wizard layout (#41802)

* [ML] Changing wizard layout

* adding a comment

* fixing wizard step link issue

* removing greyed out controls in summary

* filtering out basic validation results

* adding wizards steps back into summary

* moving idFilterList

* removing unused includes

* [ML] Adding date picker to time range step (#41978)

* [ML] Adding date picker to time range step

* adding comments

* sorting influencers

* removing euiSize for width

* [ML] Displaying job creation errors (#42165)

* [ML] Displaying job creation errors

* removing unnecessary try/catch

* [ML] Updating index pattern type (#42269)

* [ML] Updating index pattern type

* changes based on review
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Aug 5, 2019
* [ML] Adding new job wizards services (elastic#40718)

* [ML] Adding new job wizards services

* adding ts-ignore for incomplte kibana timefilter type

* [ML] New job wizards UI (elastic#40748)

* [ML] New job wizards UI

* small refactor

* fixing type problems

* updating snapshots

* updating translations ids for temporary new job links

* updating translation ids

* fixing population by field selection

* small refactor to by field select

* moving component descriptions to separate files

* moving chart grid component into own file

* fixing event rate count detector

* fixing decimal place rounding

* changes based on review

* more changes based on review

* fixing test

* [ML] Adding created_by to job (elastic#41015)

* [ML] Adding json preview (elastic#41078)

* [ML] Adding job json preview

* fix typo

* [ML] Fixing view results button (elastic#41077)

* [ML] Adding generic custom settings functions to job creator (elastic#41046)

* [ML] Adding generic custom settings functions to job creator

* fixing typo

* [ML] Adding advanced section to job details step (elastic#41157)

* [ML] Adding advanced section to job details step

* disabling model plot for population

* changes based on review

* updating include paths

* [ML] Adding additional settings section to job details step (elastic#41339)

* [ML] Adding additional settings section to job details step

* changes based on review

* [ML] Adding basic job validation (elastic#41459)

* [ML] Adding basic job validation

* removing observable

* small refactor

* comments and refactors

* disabling create job button

* adding duplicate job and group id checks

* disabling next on invalid wizard step

* changes based on review

* removing unused includes

* [ML] Adding advanced job validation (elastic#41634)

* [ML] Adding advanced job validation

* clean up

* function rename

* updating tests

* show some previous step info

* removing . from validation titles

* fixes advanced validation duration check

* removing include

* [ML] Changing wizard layout (elastic#41802)

* [ML] Changing wizard layout

* adding a comment

* fixing wizard step link issue

* removing greyed out controls in summary

* filtering out basic validation results

* adding wizards steps back into summary

* moving idFilterList

* removing unused includes

* [ML] Adding date picker to time range step (elastic#41978)

* [ML] Adding date picker to time range step

* adding comments

* sorting influencers

* removing euiSize for width

* [ML] Displaying job creation errors (elastic#42165)

* [ML] Displaying job creation errors

* removing unnecessary try/catch

* [ML] Updating index pattern type (elastic#42269)

* [ML] Updating index pattern type

* changes based on review
jgowdyelastic added a commit that referenced this pull request Aug 5, 2019
* [ML] Adding new job wizards services (#40718)

* [ML] Adding new job wizards services

* adding ts-ignore for incomplte kibana timefilter type

* [ML] New job wizards UI (#40748)

* [ML] New job wizards UI

* small refactor

* fixing type problems

* updating snapshots

* updating translations ids for temporary new job links

* updating translation ids

* fixing population by field selection

* small refactor to by field select

* moving component descriptions to separate files

* moving chart grid component into own file

* fixing event rate count detector

* fixing decimal place rounding

* changes based on review

* more changes based on review

* fixing test

* [ML] Adding created_by to job (#41015)

* [ML] Adding json preview (#41078)

* [ML] Adding job json preview

* fix typo

* [ML] Fixing view results button (#41077)

* [ML] Adding generic custom settings functions to job creator (#41046)

* [ML] Adding generic custom settings functions to job creator

* fixing typo

* [ML] Adding advanced section to job details step (#41157)

* [ML] Adding advanced section to job details step

* disabling model plot for population

* changes based on review

* updating include paths

* [ML] Adding additional settings section to job details step (#41339)

* [ML] Adding additional settings section to job details step

* changes based on review

* [ML] Adding basic job validation (#41459)

* [ML] Adding basic job validation

* removing observable

* small refactor

* comments and refactors

* disabling create job button

* adding duplicate job and group id checks

* disabling next on invalid wizard step

* changes based on review

* removing unused includes

* [ML] Adding advanced job validation (#41634)

* [ML] Adding advanced job validation

* clean up

* function rename

* updating tests

* show some previous step info

* removing . from validation titles

* fixes advanced validation duration check

* removing include

* [ML] Changing wizard layout (#41802)

* [ML] Changing wizard layout

* adding a comment

* fixing wizard step link issue

* removing greyed out controls in summary

* filtering out basic validation results

* adding wizards steps back into summary

* moving idFilterList

* removing unused includes

* [ML] Adding date picker to time range step (#41978)

* [ML] Adding date picker to time range step

* adding comments

* sorting influencers

* removing euiSize for width

* [ML] Displaying job creation errors (#42165)

* [ML] Displaying job creation errors

* removing unnecessary try/catch

* [ML] Updating index pattern type (#42269)

* [ML] Updating index pattern type

* changes based on review
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.

5 participants