-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Migrate internal urls to non-hash paths #76735
Conversation
- Overview page create job/create dfa - AE configure rules: filter link
- Update link to jobs page when no SMV jobs found
…meSeriesExplorerUrlStateManager
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.
Had a first look, overall the refactor and use of utils looks good. I added some smaller questions/suggestions.
One thing i noticed I'm not sure why this is necessary: I see the use of async/await
with navigateToUrl
or await mlUrlGenerator.createUrl
but I'm not sure this is required?
export const ANALYSIS_CONFIG_TYPE = { | ||
OUTLIER_DETECTION: 'outlier_detection', | ||
REGRESSION: 'regression', | ||
CLASSIFICATION: 'classification', | ||
} as const; |
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.
We have the same as an enum
already in plugins/ml/public/application/data_frame_analytics/common/analytics.ts
. This one using the const
approach as well as the location here LGTM so suggest to try to get rid of the on mentioned in this comment.
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.
Went through and updated the usage of enum ANALYSIS_CONFIG_TYPE
to const ANALYSIS_CONFIG_TYPE
here dd3517b
@@ -79,3 +80,5 @@ export interface DataFrameAnalyticsConfig { | |||
version: string; | |||
allow_lazy_start?: boolean; | |||
} | |||
|
|||
export type DataFrameAnalyticsType = typeof ANALYSIS_CONFIG_TYPE[keyof typeof ANALYSIS_CONFIG_TYPE]; |
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 don't think we use the Type
postfix in other places so suggest to just name this DataFrameAnalytics
.
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.
Renamed here d3edff7
}; | ||
|
||
useEffect(() => { | ||
document.title = `ML - ${TAB_DATA[selectedTabId].name} - Kibana`; |
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 wonder if Kibana offers a way to do this more "officially" without directly manipulating document.title
?
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.
That's a good point! I do see coreStart.docTitle.change('My Title')
that the Kibana team has exposed out ... Gonna take a look to see if we an implement this using that 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.
Changed to using Kibana's chrome.docTitle.change()
here c62a924
// globalState (e.g. selected jobs and time range) should be retained when changing pages. | ||
// appState will not be considered. | ||
const fullGlobalStateString = globalState !== undefined ? `?_g=${encode(globalState)}` : ''; |
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.
Why is the global state no longer necessary?
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 still retaining the globalState here, just within redirectToTab
instead of the encoded string.
…al-urls # Conflicts: # x-pack/plugins/ml/public/application/settings/filter_lists/list/table.js
analysisType: Object.keys( | ||
item.metadata?.analytics_config.analysis | ||
)[0] as DataFrameAnalyticsType, |
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.
We have getAnalysisType()
available in plugins/ml/public/application/data_frame_analytics/common/analytics.ts
.
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.
Updated here cc8f5dd
@@ -290,7 +291,7 @@ export function getFormStateFromJobConfig( | |||
analyticsJobConfig: Readonly<CloneDataFrameAnalyticsConfig>, | |||
isClone: boolean = true | |||
): Partial<State['form']> { | |||
const jobType = Object.keys(analyticsJobConfig.analysis)[0] as ANALYSIS_CONFIG_TYPE; | |||
const jobType = Object.keys(analyticsJobConfig.analysis)[0] as DataFrameAnalyticsType; |
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.
We have getAnalysisType()
available in plugins/ml/public/application/data_frame_analytics/common/analytics.ts
.
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.
Updated here cc8f5dd
@@ -143,7 +140,7 @@ export const getAnalyticsFactory = ( | |||
checkpointing: {}, | |||
config, | |||
id: config.id, | |||
job_type: Object.keys(config.analysis)[0] as ANALYSIS_CONFIG_TYPE, | |||
job_type: Object.keys(config.analysis)[0] as DataFrameAnalyticsType, |
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.
We have getAnalysisType()
available in plugins/ml/public/application/data_frame_analytics/common/analytics.ts
.
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.
Updated here cc8f5dd
} = useMlKibana(); | ||
|
||
useEffect(() => { | ||
let unamounted = false; |
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.
should this be unmounted
?
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.
Updated here cc8f5dd
/> | ||
); | ||
import { ML_PAGES } from '../../../../../common/constants/ml_url_generator'; | ||
import { Link } from 'react-router-dom'; |
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: This import could be at the top of the 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.
Updated here cc8f5dd
@@ -71,7 +71,7 @@ export class JobsList extends Component { | |||
return id; | |||
} | |||
|
|||
return <ADJobIdLink id={id} />; | |||
return <ADJobIdLink key={id} id={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.
Nit: Besides Ml
as a prefix we hardly use any abbreviations in component names so I was wondering if we should make this the full written <AnomalyDetectionJobIdLink ... />
.
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.
Updated here cc8f5dd
Gave latest edits a test, and all looks good. Only issue I have found is when coming into the Anomaly Detection jobs list from the Management app jobs list, and deleting the search query, the address bar URL ends up as e.g.
The page loads fine, but you get the extra |
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.
Functional test fix LGTM
…, update addItemToRecentlyAccessed
Thanks for catching that. This issue should now be fixed in 92dad64. I also realized I missed a few spots in the process of working on this issue and have made updates to those:
|
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
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 edits and LGTM
@elasticmachine merge upstream |
💚 Build SucceededBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
This is WIP to migrate ML internal URLs to non-hash paths. Follow up of #75696 and part of meta issue to switch from HashRouter to BrowserRouter #75696.
refreshInterval
in the_g
parameterredirectToMlAccessDeniedPage
as a new field inPageDependencies
redirectToMlAccessDeniedPage
as required argredirectToMlAccessDeniedPage
as required argredirectToJobsManagementPage
as required argredirectToJobsManagementPage
as required argPotential Follow-up PRs
Checklist
Delete any items that are not applicable to this PR.