-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Ingest] Datastream list: add icons and dashboard links #65048
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c25a081
Read package saved objects in data stream handler.
skh 14e78fd
Render package icon.
skh 5cb8189
Make TableRowAction more generic
skh 31b8a72
Add Actions column to data stream list
skh 846d9cd
Disable dashboard link if no dashboards present.
skh 5527755
Data stream list: link to first dashbord found
skh 2ce2b62
Update i18n strings
skh d0c6abc
Add nested context menu to link to dashboards
skh 95a0d71
Fix i18n label.
skh 1f5e7b9
Merge branch 'master' into 64369-datastream-links-icons
skh e39a28c
Re-add translated strings removed by mistake
skh c9251f2
Fix i18n issues
skh 4fa4012
Add helper to read a saved object installed by EPM
skh 745707b
Display titles from within dashboard saved objects
skh 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
38 changes: 38 additions & 0 deletions
38
...ingest_manager/public/applications/ingest_manager/components/table_row_actions_nested.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,38 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React, { useCallback, useState } from 'react'; | ||
| import { EuiButtonIcon, EuiContextMenu, EuiPopover } from '@elastic/eui'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { EuiContextMenuProps } from '@elastic/eui/src/components/context_menu/context_menu'; | ||
|
|
||
| export const TableRowActionsNested = React.memo<{ panels: EuiContextMenuProps['panels'] }>( | ||
| ({ panels }) => { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const handleCloseMenu = useCallback(() => setIsOpen(false), [setIsOpen]); | ||
| const handleToggleMenu = useCallback(() => setIsOpen(!isOpen), [isOpen]); | ||
|
|
||
| return ( | ||
| <EuiPopover | ||
| anchorPosition="downRight" | ||
| panelPaddingSize="none" | ||
| button={ | ||
| <EuiButtonIcon | ||
| iconType="boxesHorizontal" | ||
| onClick={handleToggleMenu} | ||
| aria-label={i18n.translate('xpack.ingestManager.genericActionsMenuText', { | ||
| defaultMessage: 'Open', | ||
| })} | ||
| /> | ||
| } | ||
| isOpen={isOpen} | ||
| closePopover={handleCloseMenu} | ||
| > | ||
| <EuiContextMenu panels={panels} initialPanelId={0} /> | ||
| </EuiPopover> | ||
| ); | ||
| } | ||
| ); |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_kibana_link.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,14 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { useCore } from './'; | ||
|
|
||
| const BASE_PATH = '/app/kibana'; | ||
|
|
||
| export function useKibanaLink(path: string = '/') { | ||
| const core = useCore(); | ||
| return core.http.basePath.prepend(`${BASE_PATH}#${path}`); | ||
| } |
82 changes: 82 additions & 0 deletions
82
...ions/ingest_manager/sections/data_stream/list_page/components/data_stream_row_actions.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,82 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React, { memo } from 'react'; | ||
|
|
||
| import { FormattedMessage } from '@kbn/i18n/react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { useKibanaLink } from '../../../../hooks/use_kibana_link'; | ||
| import { DataStream } from '../../../../types'; | ||
| import { TableRowActionsNested } from '../../../../components/table_row_actions_nested'; | ||
|
|
||
| export const DataStreamRowActions = memo<{ datastream: DataStream }>(({ datastream }) => { | ||
| const { dashboards } = datastream; | ||
| const panels = []; | ||
| const actionNameSingular = ( | ||
| <FormattedMessage | ||
| id="xpack.ingestManager.dataStreamList.viewDashboardActionText" | ||
| defaultMessage="View dashboard" | ||
| /> | ||
| ); | ||
| const actionNamePlural = ( | ||
| <FormattedMessage | ||
| id="xpack.ingestManager.dataStreamList.viewDashboardsActionText" | ||
| defaultMessage="View dashboards" | ||
| /> | ||
| ); | ||
|
|
||
| const panelTitle = i18n.translate('xpack.ingestManager.dataStreamList.viewDashboardsPanelTitle', { | ||
| defaultMessage: 'View dashboards', | ||
| }); | ||
|
|
||
| if (!dashboards || dashboards.length === 0) { | ||
| panels.push({ | ||
| id: 0, | ||
| items: [ | ||
| { | ||
| icon: 'dashboardApp', | ||
| disabled: true, | ||
| name: actionNameSingular, | ||
| }, | ||
| ], | ||
| }); | ||
| } else if (dashboards.length === 1) { | ||
| panels.push({ | ||
| id: 0, | ||
| items: [ | ||
| { | ||
| icon: 'dashboardApp', | ||
| href: useKibanaLink(`/dashboard/${dashboards[0].id || ''}`), | ||
| name: actionNameSingular, | ||
| }, | ||
| ], | ||
| }); | ||
| } else { | ||
| panels.push({ | ||
| id: 0, | ||
| items: [ | ||
| { | ||
| icon: 'dashboardApp', | ||
| panel: 1, | ||
| name: actionNamePlural, | ||
| }, | ||
| ], | ||
| }); | ||
| panels.push({ | ||
| id: 1, | ||
| title: panelTitle, | ||
| items: dashboards.map(dashboard => { | ||
| return { | ||
| icon: 'dashboardApp', | ||
| href: useKibanaLink(`/dashboard/${dashboard.id || ''}`), | ||
| name: dashboard.title, | ||
| }; | ||
| }), | ||
| }); | ||
| } | ||
|
|
||
| return <TableRowActionsNested panels={panels} />; | ||
| }); |
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
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.
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 locally, I realized we still display the package id instead of the nice name (
systemvsSystem). Now that we have the package saved objects here, what do you think about restructuringDataStreamtype to include package name?:Not a blocker for FF tho :)
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.
Yes, we should do that for beta1. We'll need to add the
titlefrom the registry package information to ourepm-packagessaved object type, and I'm reluctant to do that right now, so this is #65230 now.