From 56c52cb9f0f2c401c9e8519a41a12dfc5c430b34 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Tue, 26 Nov 2024 11:36:58 -0700 Subject: [PATCH] [ML] Anomaly Detection anomaly charts: remove filter icons for charts displayed in cases (#200821) ## Summary Fixes https://github.com/elastic/kibana/issues/199549 This PR hides the filter icons for anomaly charts embeddable in cases as they do not have any functionality there. Cases: image Dashboards: image explorer: image ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) Co-authored-by: Elastic Machine --- .../__snapshots__/explorer_chart_label.test.js.snap | 2 ++ .../components/explorer_chart_label/explorer_chart_label.js | 5 ++++- .../explorer_charts/explorer_anomalies_container.tsx | 3 +++ .../explorer/explorer_charts/explorer_charts_container.js | 4 ++++ .../plugins/ml/public/cases/anomaly_charts_attachments.tsx | 1 + .../anomaly_charts/anomaly_charts_react_container.tsx | 3 +++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap b/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap index a02a73a20e008..3e30127f6eb98 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap @@ -20,6 +20,7 @@ exports[`ExplorerChartLabelBadge Render the chart label in one line. 1`] = ` } } /> +   +   `; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js index a83b1a5a472a6..e1788be7ff765 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js @@ -22,6 +22,7 @@ export function ExplorerChartLabel({ isEmbeddable, wrapLabel = false, onSelectEntity, + showFilterIcons, }) { // Depending on whether we wrap the entityField badges to a new line, we render this differently: // @@ -51,13 +52,15 @@ export function ExplorerChartLabel({ return ( - {onSelectEntity !== undefined && ( + {onSelectEntity !== undefined && showFilterIcons === true ? ( + ) : ( + <>  )} ); diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_anomalies_container.tsx b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_anomalies_container.tsx index 17b867ff008ad..97b30b66ff156 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_anomalies_container.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_anomalies_container.tsx @@ -39,6 +39,7 @@ interface ExplorerAnomaliesContainerProps { showSelectedInterval?: boolean; chartsService: ChartsPluginStart; timeRange: { from: string; to: string } | undefined; + showFilterIcons: boolean; } const tooManyBucketsCalloutMsg = i18n.translate( @@ -63,6 +64,7 @@ export const ExplorerAnomaliesContainer: FC = ( showSelectedInterval, chartsService, timeRange, + showFilterIcons, }) => { return ( // TODO: Remove data-shared-item and data-rendering-count as part of https://github.com/elastic/kibana/issues/179376 @@ -102,6 +104,7 @@ export const ExplorerAnomaliesContainer: FC = ( showSelectedInterval, chartsService, id, + showFilterIcons, }} /> )} diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js index 360d7e8212173..9bc1317a9aa50 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js @@ -100,6 +100,7 @@ function ExplorerChartContainer({ tooManyBucketsCalloutMsg, showSelectedInterval, chartsService, + showFilterIcons, }) { const [explorerSeriesLink, setExplorerSeriesLink] = useState(''); const [mapsLink, setMapsLink] = useState(''); @@ -258,6 +259,7 @@ function ExplorerChartContainer({ infoTooltip={{ ...series.infoTooltip, chartType }} wrapLabel={wrapLabel} onSelectEntity={onSelectEntity} + showFilterIcons={showFilterIcons} /> @@ -394,6 +396,7 @@ export const ExplorerChartsContainerUI = ({ tooManyBucketsCalloutMsg, showSelectedInterval, chartsService, + showFilterIcons = true, }) => { const { services: { embeddable: embeddablePlugin, maps: mapsPlugin }, @@ -460,6 +463,7 @@ export const ExplorerChartsContainerUI = ({ tooManyBucketsCalloutMsg={tooManyBucketsCalloutMsg} showSelectedInterval={showSelectedInterval} chartsService={chartsService} + showFilterIcons={showFilterIcons} /> ); diff --git a/x-pack/plugins/ml/public/cases/anomaly_charts_attachments.tsx b/x-pack/plugins/ml/public/cases/anomaly_charts_attachments.tsx index 71b854100bd4d..716078512e883 100644 --- a/x-pack/plugins/ml/public/cases/anomaly_charts_attachments.tsx +++ b/x-pack/plugins/ml/public/cases/anomaly_charts_attachments.tsx @@ -80,6 +80,7 @@ const AnomalyChartsCaseAttachment = ({ onRenderComplete={api.onRenderComplete} onError={api.onError} timeRange$={api.parentApi.timeRange$} + showFilterIcons={false} /> diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_react_container.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_react_container.tsx index aefdac533f859..8f64ec88411c9 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_react_container.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_react_container.tsx @@ -51,6 +51,7 @@ export interface AnomalyChartsContainerProps onRenderComplete: () => void; onLoading: (v: boolean) => void; onError: (error: Error) => void; + showFilterIcons?: boolean; } const AnomalyChartsContainer: FC = ({ @@ -62,6 +63,7 @@ const AnomalyChartsContainer: FC = ({ onError, onLoading, api, + showFilterIcons = true, }) => { const isMounted = useMountedState(); @@ -284,6 +286,7 @@ const AnomalyChartsContainer: FC = ({ showSelectedInterval={false} chartsService={chartsService} timeRange={timeRange} + showFilterIcons={showFilterIcons} /> ) : null}