-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ML] Anomaly Detection: Adds a page to list supplied job configurations #191564
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
Merged
alvarezmelissa87
merged 23 commits into
elastic:main
from
alvarezmelissa87:ml-preconfigured-jobs-page
Sep 12, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
640874b
add preconfigured jobs page in anomaly detection
alvarezmelissa87 e3b05a8
ensure link to job wizard works
alvarezmelissa87 9290b99
add links to kibana dashboards if they exist
alvarezmelissa87 1e7f95f
rename to supplied configurations
alvarezmelissa87 9838277
update copy
alvarezmelissa87 f9a9bbc
add suppliedConfigs to serverless security project
alvarezmelissa87 67df24b
Merge branch 'main' into ml-preconfigured-jobs-page
alvarezmelissa87 1d2d0f4
Merge branch 'main' into ml-preconfigured-jobs-page
alvarezmelissa87 1574beb
fix types
alvarezmelissa87 cdb1656
update permissions for viewing supplied configs and add permission to…
alvarezmelissa87 483c2bb
update endpoint to run query against index pattern
alvarezmelissa87 5666926
add basic functional test
alvarezmelissa87 b21695c
remove app reference when in serverless
alvarezmelissa87 c95eeaa
update manifest and endpoint
alvarezmelissa87 f06624c
Merge branch 'main' into ml-preconfigured-jobs-page
alvarezmelissa87 e472817
fix api integration test
alvarezmelissa87 17e2732
Merge branch 'main' into ml-preconfigured-jobs-page
elasticmachine c81e7f6
ensure promise all does not fail with one rejection
alvarezmelissa87 7cba584
ensure mounted check in right place
alvarezmelissa87 9a0214e
Merge branch 'main' into ml-preconfigured-jobs-page
elasticmachine 1022636
add check for existing logo in moduleConfig
alvarezmelissa87 7d8cbbd
ensure job ids bold in job tab
alvarezmelissa87 c05ad0c
remove unnecessary error callout
alvarezmelissa87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/ml/public/application/routing/routes/supplied_configurations/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| export * from './supplied_configurations_view'; |
86 changes: 86 additions & 0 deletions
86
...ublic/application/routing/routes/supplied_configurations/supplied_configurations_view.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import type { FC } from 'react'; | ||
| import React from 'react'; | ||
| import { FormattedMessage } from '@kbn/i18n-react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; | ||
| import { dynamic } from '@kbn/shared-ux-utility'; | ||
| import { ML_PAGES } from '../../../../locator'; | ||
| import type { NavigateToPath } from '../../../contexts/kibana'; | ||
| import type { MlRoute } from '../../router'; | ||
| import { createPath, PageLoader } from '../../router'; | ||
| import { useRouteResolver } from '../../use_resolver'; | ||
| import { basicResolvers } from '../../resolvers'; | ||
| import { getBreadcrumbWithUrlForApp } from '../../breadcrumbs'; | ||
| import { MlPageHeader } from '../../../components/page_header'; | ||
|
|
||
| const SuppliedConfigurations = dynamic(async () => ({ | ||
| default: (await import('../../../supplied_configurations/supplied_configurations')) | ||
| .SuppliedConfigurations, | ||
| })); | ||
|
|
||
| export const suppliedConfigurationsRouteFactory = ( | ||
| navigateToPath: NavigateToPath, | ||
| basePath: string | ||
| ): MlRoute => ({ | ||
| id: 'supplied_configurations', | ||
| path: createPath(ML_PAGES.SUPPLIED_CONFIGURATIONS), | ||
| title: i18n.translate('xpack.ml.suppliedConfigurations.suppliedConfigurations.docTitle', { | ||
| defaultMessage: 'Supplied configurations', | ||
| }), | ||
| render: () => <PageWrapper />, | ||
| breadcrumbs: [ | ||
| getBreadcrumbWithUrlForApp('ML_BREADCRUMB', navigateToPath, basePath), | ||
| getBreadcrumbWithUrlForApp('ANOMALY_DETECTION_BREADCRUMB', navigateToPath, basePath), | ||
| { | ||
| text: i18n.translate( | ||
| 'xpack.ml.suppliedConfigurationsBreadcrumbs.suppliedConfigurationsLabel', | ||
| { | ||
| defaultMessage: 'Supplied configurations', | ||
| } | ||
| ), | ||
| }, | ||
| ], | ||
| enableDatePicker: false, | ||
| 'data-test-subj': 'mlPageSuppliedConfigurations', | ||
| }); | ||
|
|
||
| const PageWrapper: FC = () => { | ||
| const { context } = useRouteResolver('full', ['canGetJobs'], basicResolvers()); | ||
|
|
||
| return ( | ||
| <PageLoader context={context}> | ||
| <MlPageHeader> | ||
| <EuiFlexGroup | ||
| responsive={false} | ||
| wrap={false} | ||
| alignItems={'flexStart'} | ||
| gutterSize={'m'} | ||
| direction="column" | ||
| > | ||
| <EuiFlexItem grow={false}> | ||
| <FormattedMessage | ||
| id="xpack.ml.suppliedConfigurations.preconfigurecJobsHeader" | ||
| defaultMessage="Supplied configurations" | ||
| /> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem grow={false}> | ||
| <EuiText size="s"> | ||
| <FormattedMessage | ||
| id="xpack.ml.suppliedConfigurations.preconfigurecJobsHeaderDescription" | ||
| defaultMessage="This page lists pre-defined anomaly detection job configurations with related Kibana assets." | ||
| /> | ||
| </EuiText> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| </MlPageHeader> | ||
| <SuppliedConfigurations /> | ||
| </PageLoader> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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 seeing 404 errors from this call in the console if the dashboard doesn't exist.

I think we should catch these and just return an empty array if they can't be found.
Uh oh!
There was an error while loading. Please reload this page.
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.
These errors are actually not thrown from here -
findByIdshas it's own error handling internally insrc/plugins/dashboard/public/services/dashboard_content_management/lib/find_dashboards.tsand returns the caught error in an object with a 'status' and 'error' property. The response is typeFindDashboardsByIdResponse- which is defined in that same file I shared. That's why here - we simply filter out the results with error status.I think if we want to do something to remove the logged 404s, it will need to be in a separate PR and would need to chat with whoever maintains that service.