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.
[ObsUx][Inventory] Add actions column with link to discover for inven…
…tory (elastic#199306) Closes elastic#199025 ## Summary This PR adds an actions column with a link to discover for inventory. It is available in the inventory grid(s) in both the group view and the unified inventory view. The column header tooltip text will change when it's available: [issue](elastic#199500) added⚠️ If the discover link is not available I added a logic to hide the whole actions column as this is the only available option for now. Once we add more actions we should refactor that to just not add the action and to keep the column visible (which doesn't make sense atm) ## Testing - Enable the Inventory - Check with/without grouping both the action link and the button - combination of kuery / drop-down filter - without any filters - With just one kuery or drop-down filter - When the link is clicked from the table we should see a filter by identity field in the query in discover (like `service.name: 'test'`, `conteainer.id: 'test'`) https://github.com/user-attachments/assets/bb4a89f5-2b30-457f-bf13-7580ff162a7e https://github.com/user-attachments/assets/2894ef5c-6622-4488-ab84-c453f5b6e318 --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
c92775a
commit fcc3b06
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.