-
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] ML on Kibana Management: Add ability to pass a group ID filter to job management page #74533
[ML] ML on Kibana Management: Add ability to pass a group ID filter to job management page #74533
Conversation
Pinging @elastic/ml-ui (:ml) |
Tested and functionality works well 👍 |
|
||
export function getSelectedJobIdFromUrl(url) { | ||
export function getSelectedIdFromUrl(url) { | ||
const result = {}; |
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.
total nit, result
isn't really needed. there could be two return statements in this function.
const urlParams = getUrlVars(url); | ||
const decodedJson = rison.decode(urlParams.mlManagement); | ||
return decodedJson.jobId; | ||
|
||
result.ids = isGroup ? decodedJson.groupIds : decodedJson.jobId; |
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.
a simpler approach here might be to have this function return jobId: string
or groupIds: string[]
as having a property called ids
contain a single string is confusing.
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.
edit after testing, i see that decodedJson.jobId
is now a string array. I've added a comment below about how I think this probably should still be a single string, seeing as we can't filter on multiple job ids.
|
||
export function getSelectedIdsUrl( | ||
tabId: string, | ||
ids: string | string[], |
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.
getSelectedIdsUrl
is only ever called with a single group Id in an array.
Why does this need to support multiple group ids? should it also support multiple job ids?
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.
After testing this I see that we do create a URL containing an array of job IDs, but using the property jobId
.
IMO this should be a single 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.
rather than having a isGroup
modifier parameter, we could have two functions getJobIdUrl
and getGroupIdsUrl
which both call a non-exported common function for creating the url
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.
Thanks for taking a look @jgowdyelastic 🙏
- Support for multiple group ids is requested in the related issue for this as the table also supports it.
- I'd originally put the job Id in the array for consistency and possible support of multiple ids. Taking your feedback into account, I agree it should be just a string until we do support multiple ids (which I don't think we need to anytime soon).
To conclude, groupIds will be an array of ids and jobId will be a string of just one id. I agree that breaking it up into two functions instead of using the isGroup
parameter would be cleaner. 👍
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.
@jgowdyelastic - all suggestions added in 812cd04
7245d89
to
3e9c17b
Compare
ANOMALY_DETECTION = 'jobs', | ||
} | ||
|
||
function getSelectedIdsUrl(tabId, settings: any): string { |
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.
sorry to be nit-picky. for type-completeness we should give settings
its real type here, even if it's basic like [key: string]: string | string[]
Tested and LGTM! Although I also agree with Jame's comment to define the type of the settings in |
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, LGTM
@@ -0,0 +1,39 @@ | |||
/* |
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.
Could you please implement it as a method in ML URL generator?
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.
There is an existing issue for consolidating the url generating functions for 7.10 that @qn895 is working on so this will be addressed by that afaik.
#69265 (comment)
setSelectedJobIdFromUrlInitialized(true); | ||
setSearchQueryText(selectedJobIdFromUrl); | ||
if (selectedIdFromUrlInitialized === false && analytics.length > 0) { | ||
const { jobId, groupIds } = getSelectedIdFromUrl(window.location.href); |
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 should not access window.location.href
directly. Would be great to receive it from the router state 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.
👍 To be done in a follow up.
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
…o job management page (elastic#74533) * handle group id in url for anomaly detection * filter analytics list by group id. * handle list of groupIds * ensure analytics can handle jobid in url. rename util function * add tests for getSelectedIdFromUrl and getGroupQueryText * keep groupIds as array of strings and jobId as single string * fix tests and update types # Conflicts: # x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js
…o job management page (#74533) (#74713) * handle group id in url for anomaly detection * filter analytics list by group id. * handle list of groupIds * ensure analytics can handle jobid in url. rename util function * add tests for getSelectedIdFromUrl and getGroupQueryText * keep groupIds as array of strings and jobId as single string * fix tests and update types # Conflicts: # x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js
…-task * master: (42 commits) Allow any hostname for chromium proxy bypass (elastic#74693) [ML] ML on Kibana Management: Add ability to pass a group ID filter to job management page (elastic#74533) [Metrics UI] Fix No Data preview pluralization (elastic#74399) [Bug][Security_Solution][Telemetry] Capitalize S in macOS (elastic#74688) Remove karma tests from legacy maps (elastic#74668) [Ingest Manager] stop creating events-* index pattern and placeholder index (elastic#74683) [Enterprise Search] Update the browser/document title on plugin navigation (elastic#74392) [visualizations] Add i18n translation for 'No results found' (elastic#74619) [maps] convert vector style properties to TS (elastic#74553) bump geckodriver binary to 0.27 (elastic#74638) fix: update apm agents to catch abort requests (elastic#74658) [Security Solution] Resolver children pagination (elastic#74603) add memoryStatus to df analytics page and analytics table in management (elastic#74570) [Ingest Manager] Allow prerelease in package version (elastic#74452) [App Arch]: remove legacy karma tests (elastic#74599) [i18n] revert reverted changes (elastic#74633) [Lens] Clear out all attribute properties before updating (elastic#74483) [Uptime] Fix full reloads while navigating to alert/ml (elastic#73796) Index pattern field class refactor (elastic#73180) [ML] Functional tests - stabilize DFA job type check (elastic#74631) ...
* master: (339 commits) [Ingest Node Pipelines] Sentence-case processor names (elastic#74645) Bump angular dependency from 1.7.9 to 1.8.0 (elastic#74482) [ML] Fixing schema for custom rule conditions (elastic#74676) [ML] Refactor in preparation for new es client (elastic#74552) [ML] Adding initial file analysis overrides (elastic#74376) Allow any hostname for chromium proxy bypass (elastic#74693) [ML] ML on Kibana Management: Add ability to pass a group ID filter to job management page (elastic#74533) [Metrics UI] Fix No Data preview pluralization (elastic#74399) [Bug][Security_Solution][Telemetry] Capitalize S in macOS (elastic#74688) Remove karma tests from legacy maps (elastic#74668) [Ingest Manager] stop creating events-* index pattern and placeholder index (elastic#74683) [Enterprise Search] Update the browser/document title on plugin navigation (elastic#74392) [visualizations] Add i18n translation for 'No results found' (elastic#74619) [maps] convert vector style properties to TS (elastic#74553) bump geckodriver binary to 0.27 (elastic#74638) fix: update apm agents to catch abort requests (elastic#74658) [Security Solution] Resolver children pagination (elastic#74603) add memoryStatus to df analytics page and analytics table in management (elastic#74570) [Ingest Manager] Allow prerelease in package version (elastic#74452) [App Arch]: remove legacy karma tests (elastic#74599) ...
…nes/processor-forms-a-d * 'master' of github.com:elastic/kibana: (26 commits) [Telemetry][API Integration] size_in_bytes to be a number (elastic#74664) [ILM] Convert node details flyout to TS (elastic#73707) [Ingest Node Pipelines] Sentence-case processor names (elastic#74645) Bump angular dependency from 1.7.9 to 1.8.0 (elastic#74482) [ML] Fixing schema for custom rule conditions (elastic#74676) [ML] Refactor in preparation for new es client (elastic#74552) [ML] Adding initial file analysis overrides (elastic#74376) Allow any hostname for chromium proxy bypass (elastic#74693) [ML] ML on Kibana Management: Add ability to pass a group ID filter to job management page (elastic#74533) [Metrics UI] Fix No Data preview pluralization (elastic#74399) [Bug][Security_Solution][Telemetry] Capitalize S in macOS (elastic#74688) Remove karma tests from legacy maps (elastic#74668) [Ingest Manager] stop creating events-* index pattern and placeholder index (elastic#74683) [Enterprise Search] Update the browser/document title on plugin navigation (elastic#74392) [visualizations] Add i18n translation for 'No results found' (elastic#74619) [maps] convert vector style properties to TS (elastic#74553) bump geckodriver binary to 0.27 (elastic#74638) fix: update apm agents to catch abort requests (elastic#74658) [Security Solution] Resolver children pagination (elastic#74603) add memoryStatus to df analytics page and analytics table in management (elastic#74570) ...
Summary
Fixes #70574
mlManagement
groupIds
set in the URLmlManagement
jobId
set in the URLKibana management page anomaly detection jobs table:
Updates
getJobIdUrl
to create urls for group ids as well as job ids and updates function name togetSelectedIdsUrl
to be more general.Checklist
Delete any items that are not applicable to this PR.