forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ObsUx][Inventory] Add actions column with link to discover for…
… inventory (elastic#199306) (elastic#199789) # Backport This will backport the following commits from `main` to `8.x`: - [[ObsUx][Inventory] Add actions column with link to discover for inventory (elastic#199306)](elastic#199306) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-08T18:18:07Z","message":"[ObsUx][Inventory] Add actions column with link to discover for inventory (elastic#199306)\n\nCloses elastic#199025 \r\n## Summary\r\n\r\nThis PR adds an actions column with a link to discover for inventory. It\r\nis available in the inventory grid(s) in both the group view and the\r\nunified inventory view.\r\n\r\nThe column header tooltip text will change when it's available:\r\n[issue](elastic#199500) added\r\n\r\n⚠️ If the discover link is not available I added a logic to hide the\r\nwhole actions column as this is the only available option for now. Once\r\nwe add more actions we should refactor that to just not add the action\r\nand to keep the column visible (which doesn't make sense atm)\r\n\r\n## Testing\r\n- Enable the Inventory\r\n- Check with/without grouping both the action link and the button\r\n - combination of kuery / drop-down filter\r\n - without any filters\r\n - With just one kuery or drop-down filter \r\n- When the link is clicked from the table we should see a filter by\r\nidentity field in the query in discover (like `service.name: 'test'`,\r\n`conteainer.id: 'test'`)\r\n \r\n\r\n\r\nhttps://github.com/user-attachments/assets/bb4a89f5-2b30-457f-bf13-7580ff162a7e\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2894ef5c-6622-4488-ab84-c453f5b6e318\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"fcc3b0654525d67d34cc5916b4b6f7351892f650","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":199306,"url":"https://github.com/elastic/kibana/pull/199306","mergeCommit":{"message":"[ObsUx][Inventory] Add actions column with link to discover for inventory (elastic#199306)\n\nCloses elastic#199025 \r\n## Summary\r\n\r\nThis PR adds an actions column with a link to discover for inventory. It\r\nis available in the inventory grid(s) in both the group view and the\r\nunified inventory view.\r\n\r\nThe column header tooltip text will change when it's available:\r\n[issue](elastic#199500) added\r\n\r\n⚠️ If the discover link is not available I added a logic to hide the\r\nwhole actions column as this is the only available option for now. Once\r\nwe add more actions we should refactor that to just not add the action\r\nand to keep the column visible (which doesn't make sense atm)\r\n\r\n## Testing\r\n- Enable the Inventory\r\n- Check with/without grouping both the action link and the button\r\n - combination of kuery / drop-down filter\r\n - without any filters\r\n - With just one kuery or drop-down filter \r\n- When the link is clicked from the table we should see a filter by\r\nidentity field in the query in discover (like `service.name: 'test'`,\r\n`conteainer.id: 'test'`)\r\n \r\n\r\n\r\nhttps://github.com/user-attachments/assets/bb4a89f5-2b30-457f-bf13-7580ff162a7e\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2894ef5c-6622-4488-ab84-c453f5b6e318\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"fcc3b0654525d67d34cc5916b4b6f7351892f650"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199306","number":199306,"mergeCommit":{"message":"[ObsUx][Inventory] Add actions column with link to discover for inventory (elastic#199306)\n\nCloses elastic#199025 \r\n## Summary\r\n\r\nThis PR adds an actions column with a link to discover for inventory. It\r\nis available in the inventory grid(s) in both the group view and the\r\nunified inventory view.\r\n\r\nThe column header tooltip text will change when it's available:\r\n[issue](elastic#199500) added\r\n\r\n⚠️ If the discover link is not available I added a logic to hide the\r\nwhole actions column as this is the only available option for now. Once\r\nwe add more actions we should refactor that to just not add the action\r\nand to keep the column visible (which doesn't make sense atm)\r\n\r\n## Testing\r\n- Enable the Inventory\r\n- Check with/without grouping both the action link and the button\r\n - combination of kuery / drop-down filter\r\n - without any filters\r\n - With just one kuery or drop-down filter \r\n- When the link is clicked from the table we should see a filter by\r\nidentity field in the query in discover (like `service.name: 'test'`,\r\n`conteainer.id: 'test'`)\r\n \r\n\r\n\r\nhttps://github.com/user-attachments/assets/bb4a89f5-2b30-457f-bf13-7580ff162a7e\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2894ef5c-6622-4488-ab84-c453f5b6e318\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"fcc3b0654525d67d34cc5916b4b6f7351892f650"}}]}] BACKPORT--> Co-authored-by: jennypavlova <[email protected]>
- Loading branch information
1 parent
6c4b869
commit 94bde2c
Showing
10 changed files
with
223 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/observability_solution/inventory/public/components/entity_actions/index.tsx
This file contains 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,62 @@ | ||
/* | ||
* 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 { EuiButtonIcon, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { useBoolean } from '@kbn/react-hooks'; | ||
|
||
interface Props { | ||
discoverUrl: string; | ||
entityIdentifyingValue?: string; | ||
} | ||
|
||
export const EntityActions = ({ discoverUrl, entityIdentifyingValue }: Props) => { | ||
const [isPopoverOpen, { toggle: togglePopover, off: closePopover }] = useBoolean(false); | ||
const actionButtonTestSubject = entityIdentifyingValue | ||
? `inventoryEntityActionsButton-${entityIdentifyingValue}` | ||
: 'inventoryEntityActionsButton'; | ||
|
||
const actions = [ | ||
<EuiContextMenuItem | ||
data-test-subj="inventoryEntityActionOpenInDiscover" | ||
key={`openInDiscover-${entityIdentifyingValue}`} | ||
color="text" | ||
icon="discoverApp" | ||
href={discoverUrl} | ||
> | ||
{i18n.translate('xpack.inventory.entityActions.discoverLink', { | ||
defaultMessage: 'Open in discover', | ||
})} | ||
</EuiContextMenuItem>, | ||
]; | ||
|
||
return ( | ||
<> | ||
<EuiPopover | ||
isOpen={isPopoverOpen} | ||
panelPaddingSize="none" | ||
anchorPosition="upCenter" | ||
button={ | ||
<EuiButtonIcon | ||
data-test-subj={actionButtonTestSubject} | ||
aria-label={i18n.translate( | ||
'xpack.inventory.entityActions.euiButtonIcon.showActionsLabel', | ||
{ defaultMessage: 'Show actions' } | ||
)} | ||
iconType="boxesHorizontal" | ||
color="text" | ||
onClick={togglePopover} | ||
/> | ||
} | ||
closePopover={closePopover} | ||
> | ||
<EuiContextMenuPanel items={actions} size="s" /> | ||
</EuiPopover> | ||
</> | ||
); | ||
}; |
This file contains 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 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 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.