-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Quickly create ML jobs from lens visualizations #136421
[ML] Quickly create ML jobs from lens visualizations #136421
Conversation
…com:jgowdyelastic/kibana into quickly-create-jobs-from-lens-visualization
Pinging @elastic/ml-ui (:ml) |
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.
Tested latest changes and LGTM
@elastic/kibana-design you have been pinged because I have deleted a scss file. |
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.
Great job with refactoring, overall LGTM! Left some minor suggestions
startJob: boolean, | ||
runInRealTime: boolean, | ||
layerIndex: number, | ||
mlApiServices: MlApiServices |
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.
nit: I see it's only been used by createAndSaveJob
method, but maybe it's worth passing to a constructor instead?
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.
in the last refactor I moved mlApiServices
to the context after changing this, so possibly yes.
Previously it wasn't available in all of the locations QuickJobCreator
was instantiated.
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.
Changed in 336db0c
x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts
Show resolved
Hide resolved
// add job config and start and end dates to the | ||
// job cloning stash, so they can be used | ||
// by the new job wizards | ||
stashJobForCloning( |
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.
Checked the content of this function an noticed it utilizes mlJobService
which is statically exported. As an idea for further enhancements: I reckon we should provide this service from the plugin contract setup
, so the other plugins can consume it as well.
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.
mlJobService
is very old code and shouldn't be shared.
Most of it has been replaced by other, better, services. I believe it is only the results pages which still use it.
The most useful part is the job stash used for cloning. So ideally we should get rid of mlJobService
and move the cloning functionality to a separate service.
} | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.error(error); |
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.
❓ do we want to show an error toast here?
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 think it is ok to fail silently here.
includeTimeRange
is set to false
which means the wizard will not auto set the time. The user can then choose one.
}, | ||
}); | ||
|
||
window.open(url, '_blank'); |
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.
Please use navigateToUrl
from CoreStart['application']
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.
This link needs to open in a new tab, from what I can tell navigateToUrl
does not allow this as an option.
x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/utils.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts
Show resolved
Hide resolved
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.
Code LGTM
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.
Looks good!
One bit of UI feedback would be to change the background of the panel in the flyout to white (where you define the job settings). This will help contrast it against the gray background of the flyout.
Was curious if it also made sense to add in the panel title for more context? Instead of only the layer type?
Thanks @mdefazio , I've added the visualisation title to the description at the top of the flyout. 65289fd Regarding the background colour, I copied the style used in Lens: Changing the colour in my panels does make it standout from the background, but IMO they look a bit too white and strange. vs the original |
Thanks @jgowdyelastic , is there a scenario where you're setting up 2+ jobs? The one difference between Lens is that the input or area of focus is still on white ( |
If you have multiple compatible layers in a visualization it would be possible to create multiple jobs from a single flyout. The layer components are independent from each other. |
Ok...now it's coming back to me! Thanks for the reminder of the history / context! |
…com:jgowdyelastic/kibana into quickly-create-jobs-from-lens-visualization
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
* [ML] Quickly create ML jobs from lens visualizations * adding additional settings * adding model plot for single metric jobs * adding results link * form logic improvements * translations * translations * translations * changing view results link generation * handling opening already open jobs * fixing count detector * removing unused file * improving error displaying * updating tests * removing unused test code * deleting jobs after test * code clean up * fixing issue with layers sharing resources * removing fragment * moving code about * minor changes based on review * translations * updating results link for non-running job * renaming variables * refactoring job creation code into class * using context refactor * renaming things * catching isCompatible errors * fixing behaviour in canvas * removing comment * small refactor moving code * handling error * fixing typo * further refactoring based on review * adding vis title to description * white layer panels * translations
Anomaly detection jobs can now be created instantly from the flyout within the dashboard app.
The original option to create via the wizard is also still available as a link to the ML app.
Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
Unit or functional tests were updated or added to match the most common scenarios
[ x] This was checked for breaking API changes and was labeled appropriately