[8.x] [Infra] Fix Actions on Charts (#202443) (#202692)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Infra] Fix Actions on Charts
(#202443)](https://github.com/elastic/kibana/pull/202443)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sergi
Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2024-12-03T11:54:12Z","message":"[Infra]
Fix Actions on Charts (#202443)\n\n## Summary\n\nCloses #201535 \n\nThis
PR fixes the actions not displayed on Infra charts while hovering\nwith
the mouse, while also modifying the actions that should
be\ndisplayed.\n\nRight now, the following actions are displayed:\n-
Explore in Discover\n- Inspect\n- Open in Lens (as a custom action,
clicking the 3 dots)\n\n### How to test\n1. Start Kibana and fill it
with data, `node scripts/synthtrace\ninfra_hosts_with_apm_hosts` can be
used if you don't have data.\n2. Navigate to Host list, check if
hovering a chart displays the actions\n3. Navigate to Host details,
check if hovering a chart displays the\nactions\n\n\n###
Screenshots\nBefore|After\n-|-\n\n![image](fa37a6ba-9074-403f-ad10-1b6b58e3f64a)","sha":"ea4ebb4f597a8908443ecc1f2664a5562a618234","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[Infra]
Fix Actions on
Charts","number":202443,"url":"https://github.com/elastic/kibana/pull/202443","mergeCommit":{"message":"[Infra]
Fix Actions on Charts (#202443)\n\n## Summary\n\nCloses #201535 \n\nThis
PR fixes the actions not displayed on Infra charts while hovering\nwith
the mouse, while also modifying the actions that should
be\ndisplayed.\n\nRight now, the following actions are displayed:\n-
Explore in Discover\n- Inspect\n- Open in Lens (as a custom action,
clicking the 3 dots)\n\n### How to test\n1. Start Kibana and fill it
with data, `node scripts/synthtrace\ninfra_hosts_with_apm_hosts` can be
used if you don't have data.\n2. Navigate to Host list, check if
hovering a chart displays the actions\n3. Navigate to Host details,
check if hovering a chart displays the\nactions\n\n\n###
Screenshots\nBefore|After\n-|-\n\n![image](fa37a6ba-9074-403f-ad10-1b6b58e3f64a)","sha":"ea4ebb4f597a8908443ecc1f2664a5562a618234"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202443","number":202443,"mergeCommit":{"message":"[Infra]
Fix Actions on Charts (#202443)\n\n## Summary\n\nCloses #201535 \n\nThis
PR fixes the actions not displayed on Infra charts while hovering\nwith
the mouse, while also modifying the actions that should
be\ndisplayed.\n\nRight now, the following actions are displayed:\n-
Explore in Discover\n- Inspect\n- Open in Lens (as a custom action,
clicking the 3 dots)\n\n### How to test\n1. Start Kibana and fill it
with data, `node scripts/synthtrace\ninfra_hosts_with_apm_hosts` can be
used if you don't have data.\n2. Navigate to Host list, check if
hovering a chart displays the actions\n3. Navigate to Host details,
check if hovering a chart displays the\nactions\n\n\n###
Screenshots\nBefore|After\n-|-\n\n![image](fa37a6ba-9074-403f-ad10-1b6b58e3f64a)","sha":"ea4ebb4f597a8908443ecc1f2664a5562a618234"}}]}]
BACKPORT-->

Co-authored-by: Sergi Romeu <sergi.romeu@elastic.co>
This commit is contained in:
Kibana Machine 2024-12-04 00:56:03 +11:00 committed by GitHub
parent f9ed685636
commit b05111c955
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,12 @@ import { ChartLoadError } from './chart_load_error';
import { HOST_MISSING_FIELDS } from '../../common/visualizations/constants';
const MIN_HEIGHT = 300;
const DEFAULT_DISABLED_ACTIONS = [
'ACTION_CUSTOMIZE_PANEL',
'ACTION_EXPORT_CSV',
'embeddable_addToExistingCase',
'create-ml-ad-job-action',
];
export type LensChartProps = BaseChartProps &
Pick<EuiPanelProps, 'borderRadius'> & {
@ -33,6 +39,8 @@ export type LensChartProps = BaseChartProps &
description?: string;
} & {
lensAttributes: UseLensAttributesParams;
withDefaultActions?: boolean;
disabledActions?: string[];
};
export const LensChart = React.memo(
@ -52,6 +60,8 @@ export const LensChart = React.memo(
height = MIN_HEIGHT,
loading = false,
lensAttributes,
withDefaultActions = true,
disabledActions = DEFAULT_DISABLED_ACTIONS,
}: LensChartProps) => {
const { formula, attributes, getExtraActions, error } = useLensAttributes(lensAttributes);
@ -122,6 +132,8 @@ export const LensChart = React.memo(
dateRange={dateRange}
disableTriggers={disableTriggers}
extraActions={extraActions}
withDefaultActions={withDefaultActions}
disabledActions={disabledActions}
filters={filters}
hidePanelTitles={hidePanelTitles}
loading={isLoading}

View file

@ -93,7 +93,6 @@ export const LensWrapper = ({
<div
css={css`
position: relative;
overflow: hidden;
height: 100%;
.echMetric {
border-radius: ${euiTheme.border.radius.medium};