-
Notifications
You must be signed in to change notification settings - Fork 8k
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] Single Metric Viewer embeddable in dashboards: move all config to flyout #182756
[ML] Single Metric Viewer embeddable in dashboards: move all config to flyout #182756
Conversation
Pinging @elastic/ml-ui (:ml) |
4d3ca40
to
778ebf2
Compare
...ugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_embeddable_factory.tsx
Show resolved
Hide resolved
...ugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_embeddable_factory.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_initializer.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_initializer.tsx
Outdated
Show resolved
Hide resolved
} | ||
} | ||
}, | ||
[isMounted, jobIds, mlApiServices, panelTitle, initialValuesRef.current.isNewJob, job?.job_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.
Just realized, both here and in the anomaly swim lane initializer, we need to introduce a debounce on job IDs change.
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'm not sure we do in this case since we only do the fetch if a new job has been selected (that hasn't already been loaded). Also - are people rapidly clicking around a ton on job ids? I think the dropdown closes after each selection (at least on single selection) so it would be difficult for a user to be changing job ids extremely quickly.
x-pack/plugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_initializer.tsx
Outdated
Show resolved
Hide resolved
{ | ||
type: 'push', | ||
ownFocus: true, | ||
size: 's', | ||
onClose: () => { | ||
flyoutSession.close(); | ||
reject(); | ||
}, | ||
} | ||
); | ||
// Close the flyout when user navigates out of the current plugin | ||
currentAppId$ | ||
.pipe(skip(1), takeUntil(from(flyoutSession.onClose)), distinctUntilChanged()) | ||
.subscribe(() => { | ||
flyoutSession.close(); |
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.
as this logic has been copied from the anomaly swim lane initializer, shall we consolidate it in a single function, e.g. initMlEmbeddalbeFlyout
?
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.
Agreed - this is going to be very similar boiler plate code for all the embeddables 👍
Though I'm okay leaving it until the rest of the embeddables are converted to make sure we account for all potential cases.
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.
It's definitely the case for every embeddable, i.e. for anomaly charts 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.
@alvarezmelissa87 important update! we need to track overlay a bit differently, you can look up in the recent change point detection PR, where I also update the swim lane edit and add flow
kibana/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_setup_flyout.tsx
Line 64 in 4419370
if (tracksOverlays(parentApi)) { |
it will automatically track if the user navigates away from the dashboard app and disables all controls on the active dashboard.
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.
Added in 7603fd4 🙏
x-pack/plugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_initializer.tsx
Outdated
Show resolved
Hide resolved
...ugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_embeddable_factory.tsx
Outdated
Show resolved
Hide resolved
Testing this I also found an issue when changing the selected job (also happens on Looks like Screen.Recording.2024-05-09.at.11.22.06.mov |
Created a separate PR for the fix for the issue you found, @peteharverson so we can backport to 8.14. 👍 |
This is ready for another look when you get a chance cc @darnautov, @peteharverson |
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.
Latest changes LGTM
…fferent job works as expected (#183086) ## Summary Fixes #182756 (comment) This PR ensures the loaded job and the selected job id are synced to ensure the chart loads correctly. After: https://github.com/elastic/kibana/assets/6446462/4c80bdd6-54cd-4404-8fa4-8930aca1b3f9
x-pack/plugins/ml/public/embeddables/single_metric_viewer/single_metric_viewer_initializer.tsx
Outdated
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.
LGTM
@elasticmachine merge upstream |
@elasticmachine merge upstream |
merge conflict between base and head |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
Part of #182042
This PR also fixes the issue in the swimlane embeddable that fails to close the flyout if navigating into the main dashboards page.
Related meta issue: #181272
Item:
https://github.com/elastic/kibana/issues/181272
Checklist
Delete any items that are not applicable to this PR.