-
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] Data Frame Analytics: add analytics ID to url when using selector flyout #128222
[ML] Data Frame Analytics: add analytics ID to url when using selector flyout #128222
Conversation
Pinging @elastic/ml-ui (:ml) |
useEffect( | ||
function updateUrl() { | ||
if (analyticsId !== undefined) { | ||
setGlobalState({ | ||
ml: { | ||
...(analyticsId.analysis_type ? { analysisType: analyticsId.analysis_type } : {}), | ||
...(analyticsId.job_id ? { jobId: analyticsId.job_id } : {}), | ||
}, | ||
}); | ||
} | ||
}, | ||
[analyticsId?.job_id, analyticsId?.model_id] | ||
); |
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.
shall we store it in the _a
state instead? the _g
is intended to be used as a global Kibana URL state
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 reckon we don't need an intermediate analyticsId
state here. The value should be provided directly from the URL and updated 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.
In this case the value wouldn't be in the url - we're adding it into the url when the user selects the analytics id from the selection flyout. Moving it to _a
would require some refactoring so I think it's outside the scope of this for now and better suited as an improvements or maintenance task.
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.
The _g
parameter was originally intended for any settings which might want to be preserved across pages. This is why we put the job ID for the anomaly detection pages in _g
, so that on switching from the Anomaly Explorer to the Single Metric Viewer for example, the selected job would be retained. So using _g
would make sense here too, so that in theory the job would be retained if the user switched from the Results view to the Map view. Whether using _g
and _a
in the long term still makes sense is another matter entirely, but here makes total sense to use _g
for analytics job ID.
x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx
Show resolved
Hide resolved
Tested and functionally LGTM 🎉 |
This has been updated and is ready for another look when you get a chance 🙏 cc @peteharverson, @darnautov |
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 and LGTM
2c2bd35
to
1e70565
Compare
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
When using the DFA job selector flyout - ensure url is updated with the selected analytics ID so that the url is shareable.
This PR also fixes the model id selection for the explorer.
Checklist
Delete any items that are not applicable to this PR.