-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ML] Data Frame Analytics: add analytics ID to url when using selector flyout #128222
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
Changes from all commits
e52e463
6845b03
6325e2f
ba88ada
1e70565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { useMlKibana, useMlApiContext } from '../../../contexts/kibana'; | |
| import { MlPageHeader } from '../../../components/page_header'; | ||
| import { AnalyticsIdSelector, AnalyticsSelectorIds } from '../components/analytics_selector'; | ||
| import { AnalyticsEmptyPrompt } from '../analytics_management/components/empty_prompt'; | ||
| import { useUrlState } from '../../../util/url_state'; | ||
|
|
||
| export const Page: FC<{ | ||
| jobId: string; | ||
|
|
@@ -37,6 +38,8 @@ export const Page: FC<{ | |
| const jobIdToUse = jobId ?? analyticsId?.job_id; | ||
| const analysisTypeToUse = analysisType || analyticsId?.analysis_type; | ||
|
|
||
| const [, setGlobalState] = useUrlState('_g'); | ||
|
|
||
| const checkJobsExist = async () => { | ||
| try { | ||
| const { count } = await getDataFrameAnalytics(undefined, undefined, 0); | ||
|
|
@@ -51,6 +54,20 @@ export const Page: FC<{ | |
| checkJobsExist(); | ||
| }, []); | ||
|
|
||
| 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] | ||
| ); | ||
|
Comment on lines
57
to
69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we store it in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reckon we don't need an intermediate
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| const getEmptyState = () => { | ||
| if (jobsExist === false) { | ||
| return <AnalyticsEmptyPrompt />; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.