Skip to content

Commit

Permalink
[ML] Anomaly Detection anomaly charts: remove filter icons for charts…
Browse files Browse the repository at this point in the history
… displayed in cases (elastic#200821)

## Summary

Fixes elastic#199549

This PR hides the filter icons for anomaly charts embeddable in cases as
they do not have any functionality there.

Cases:
<img width="947" alt="image"
src="https://github.com/user-attachments/assets/78c7c059-f289-4dcc-97bd-8eadcd03e37c">

Dashboards:
<img width="737" alt="image"
src="https://github.com/user-attachments/assets/368c718a-62bb-4277-90d1-ad0f156a7d08">

explorer:
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/20b2bda8-a81a-4d57-b831-be6e0fb3e170">

### 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 <[email protected]>
  • Loading branch information
alvarezmelissa87 and elasticmachine authored Nov 26, 2024
1 parent 9ddb459 commit f635b32
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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:
//
Expand Down Expand Up @@ -51,13 +52,15 @@ export function ExplorerChartLabel({
return (
<Fragment key={`badge-wrapper-${key}`}>
<ExplorerChartLabelBadge entity={entity} />
{onSelectEntity !== undefined && (
{onSelectEntity !== undefined && showFilterIcons === true ? (
<EntityFilter
isEmbeddable={isEmbeddable}
onFilter={applyFilter}
influencerFieldName={entity.fieldName}
influencerFieldValue={entity.fieldValue}
/>
) : (
<>&nbsp;</>
)}
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface ExplorerAnomaliesContainerProps {
showSelectedInterval?: boolean;
chartsService: ChartsPluginStart;
timeRange: { from: string; to: string } | undefined;
showFilterIcons: boolean;
}

const tooManyBucketsCalloutMsg = i18n.translate(
Expand All @@ -63,6 +64,7 @@ export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = (
showSelectedInterval,
chartsService,
timeRange,
showFilterIcons,
}) => {
return (
// TODO: Remove data-shared-item and data-rendering-count as part of https://github.com/elastic/kibana/issues/179376
Expand Down Expand Up @@ -102,6 +104,7 @@ export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = (
showSelectedInterval,
chartsService,
id,
showFilterIcons,
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function ExplorerChartContainer({
tooManyBucketsCalloutMsg,
showSelectedInterval,
chartsService,
showFilterIcons,
}) {
const [explorerSeriesLink, setExplorerSeriesLink] = useState('');
const [mapsLink, setMapsLink] = useState('');
Expand Down Expand Up @@ -258,6 +259,7 @@ function ExplorerChartContainer({
infoTooltip={{ ...series.infoTooltip, chartType }}
wrapLabel={wrapLabel}
onSelectEntity={onSelectEntity}
showFilterIcons={showFilterIcons}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down Expand Up @@ -394,6 +396,7 @@ export const ExplorerChartsContainerUI = ({
tooManyBucketsCalloutMsg,
showSelectedInterval,
chartsService,
showFilterIcons = true,
}) => {
const {
services: { embeddable: embeddablePlugin, maps: mapsPlugin },
Expand Down Expand Up @@ -460,6 +463,7 @@ export const ExplorerChartsContainerUI = ({
tooManyBucketsCalloutMsg={tooManyBucketsCalloutMsg}
showSelectedInterval={showSelectedInterval}
chartsService={chartsService}
showFilterIcons={showFilterIcons}
/>
</EuiFlexItem>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const AnomalyChartsCaseAttachment = ({
onRenderComplete={api.onRenderComplete}
onError={api.onError}
timeRange$={api.parentApi.timeRange$}
showFilterIcons={false}
/>
</KibanaContextProvider>
</KibanaRenderContextProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface AnomalyChartsContainerProps
onRenderComplete: () => void;
onLoading: (v: boolean) => void;
onError: (error: Error) => void;
showFilterIcons?: boolean;
}

const AnomalyChartsContainer: FC<AnomalyChartsContainerProps> = ({
Expand All @@ -62,6 +63,7 @@ const AnomalyChartsContainer: FC<AnomalyChartsContainerProps> = ({
onError,
onLoading,
api,
showFilterIcons = true,
}) => {
const isMounted = useMountedState();

Expand Down Expand Up @@ -284,6 +286,7 @@ const AnomalyChartsContainer: FC<AnomalyChartsContainerProps> = ({
showSelectedInterval={false}
chartsService={chartsService}
timeRange={timeRange}
showFilterIcons={showFilterIcons}
/>
) : null}
</div>
Expand Down

0 comments on commit f635b32

Please sign in to comment.