From f3d3d30787eed437c6132b85bc8f2ddf69e14e92 Mon Sep 17 00:00:00 2001 From: Melissa Date: Tue, 19 Nov 2024 12:49:23 -0700 Subject: [PATCH] remove filter icons when charts shown in cases --- .../__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 cb5a705a48709..b4bb042663270 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}