-
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] Fix appState/globalState #52987
[ML] Fix appState/globalState #52987
Conversation
Pinging @elastic/ml-ui (:ml) |
c4875a3
to
2354a4c
Compare
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.
Was there also some legacy code around the severity and interval controls that needed to be removed once this work was done?
a70d4c9
to
796a062
Compare
💔 Build Failed
History
To update your PR or re-run it, just comment with: |
💔 Build Failed
To update your PR or re-run it, just comment with: |
💔 Build Failed
To update your PR or re-run it, just comment with: |
@peteharverson I pushed some updates:
I'm still working on fixing Single Metric Viewer but Anomaly Explorer should be ready for another go at testing. |
df9770d
to
8a58e37
Compare
I've found an issue when switching jobs with multiple detectors in the single metric viewer. Open job A, select the second detector so the URL contains It appears it attempts to load the detector at index 1 in job B which doesn't exist. This causes the page to crash. |
@jgowdyelastic thx for spotting the issue with |
@alvarezmelissa87 I pushed another fix for restoring the correct view-by field when multiple jobs are selected in 8edb24d. |
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 latest edits LGTM ⚡️
Probably one for a follow-up, but for a job with multiple influencer fields, if I'm viewing by one of the influencers, but then filter by one of the other influencers, the combination of the view by dropdown value and info message is confusing: Ideally the dropdown value above should stay as 'instance'. or it should be changed to by 'region'. |
@peteharverson thanks for identifying those, suggest to do those in a follow up. |
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. Great job!
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.
Overall LGTM! Only found a couple of minor edge cases, which can be addressed in follow-up fixes.
Replaces appState/globalState with a custom hook useUrlState().
Replaces appState/globalState with a custom hook useUrlState(). Co-authored-by: Elastic Machine <[email protected]>
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Replaces appState/globalState with a custom hook useUrlState().
Summary
Fixes #52986.
Fixes #54317.
Replaces
appState/globalState
with a custom hookuseUrlState()
.Some notes for reviewers:
injectObservablesAsProps()
utility, replaced with a pattern based onuseObservable()
hook.jobSelectService$
, events are no longer passed around using it, insteaduseUrlState()
replaces it to subscribe and update these settings.skipRefresh
in the job selector is no longer necessary because updates are no longer triggered by both date picker and job selector.useJobSelection()
replaces some utilities from explorer and relies no longer on internal mutable state.switchMap()
to avoid triggering multiple updates.Explorer
(explorer.js
) component is quite large because it's no longer necessary to wrap it ininjectObservablesAsProps
andinjectI18n
, but the interals didn't change that much.EXPLORER_ACTION
,appStateReducer
is no longer necessary. Instead,explorerAppState$
now transforms the explorer's internal state into the format we store in the URL.setAppState
fromuseUrlState()
is then used to update the URL. The custom hookuseSelectedCells()
is now used to manage cell selection and store in it the URL (instead ofappStateReducer
).<TimeSeriesExplorer />
component no longer relies on the customrefresh()
method, instead React'scomponentDidUpdate()
lifecycle method is used to react to updating props. Its internal methods have been revamped to trigger lesssetStates()
and rerenders.timefilter
, instead just passes downbounds
as props.useUrlState()
and provide custom hooks to access/set their setting via a custom hook.Todo
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n supportDocumentation was added for features that require explanation or tutorialsFor maintainers