Skip to content

Commit e29ca5e

Browse files
committed
[Exploratory View] Hide Lens warning badges on embeddables by default (#285305)
- Hide Lens visualization warning badges **by default** on Exploratory View embeddables - Every consumer (Synthetics, APM, Uptime, etc.) gets the same behavior — no per-app wrap - Callers can still pass `onBeforeBadgesRender` to keep or remap badges Those yellow warning+count badges are Lens inspector warnings (usually incomplete ES/CCS results). They sit on compact KPI/sparkline widgets where users cannot act on them. The full Exploratory View editor is unchanged, so warnings still show when building a chart. | Before | After | | --- | --- | | Yellow warning badges overlap the Errors / Alerts KPI widgets | Badges hidden; metric and sparkline unchanged | | ![Before](https://raw.githubusercontent.com/shahzad31/kibana/screenshots/screenshots/285305/before.png) | ![After](https://raw.githubusercontent.com/shahzad31/kibana/screenshots/screenshots/285305/after.png) | - [ ] Synthetics overview Errors / Alerts widgets no longer show the yellow warning badge - [ ] Other Exploratory View embeddables (monitor details, APM KPIs) also hide the badge - [ ] Metric value and sparkline still render - [ ] A real Lens failure still replaces the chart (blocking error) - [ ] Open in Lens and other panel actions still work - [ ] Exploratory View app editor still shows Lens warnings when editing a visualization (cherry picked from commit 3d466b2)
1 parent 77fb069 commit e29ca5e

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/embeddable/embeddable.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,30 @@ describe('Embeddable', () => {
171171
expect((mockLens.EmbeddableComponent as jest.Mock).mock.calls[0][0].withDefaultActions).toEqual(
172172
true
173173
);
174+
expect(
175+
(mockLens.EmbeddableComponent as jest.Mock).mock.calls[0][0].onBeforeBadgesRender()
176+
).toEqual([]);
177+
});
178+
179+
it('forwards onBeforeBadgesRender to the Lens embeddable', () => {
180+
const onBeforeBadgesRender = jest.fn((messages) => messages);
181+
182+
render(
183+
<Embeddable
184+
caseOwner={mockOwner}
185+
customTimeRange={mockTimeRange}
186+
dataViewState={mockDataViews}
187+
lens={mockLens}
188+
reportType={mockReportType}
189+
withActions={mockActions}
190+
attributes={[]}
191+
onBeforeBadgesRender={onBeforeBadgesRender}
192+
/>
193+
);
194+
195+
expect((mockLens.EmbeddableComponent as jest.Mock).mock.calls[0][0].onBeforeBadgesRender).toBe(
196+
onBeforeBadgesRender
197+
);
174198
});
175199

176200
it('disables the built-in cases action to avoid a duplicate "Add to case" entry', () => {

x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/embeddable/embeddable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
99
import { Position } from '@elastic/charts';
1010
import React, { useState } from 'react';
1111
import { EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';
12-
import { FormulaPublicApi, LensPublicStart, XYState } from '@kbn/lens-plugin/public';
12+
import { FormulaPublicApi, LensPublicStart, UserMessage, XYState } from '@kbn/lens-plugin/public';
1313
import { observabilityFeatureId } from '@kbn/observability-shared-plugin/public';
1414
import styled from 'styled-components';
1515
import { AnalyticsServiceSetup } from '@kbn/core-analytics-browser';
@@ -29,6 +29,9 @@ import { useEmbeddableAttributes } from './use_embeddable_attributes';
2929
// disable the built-in one to avoid a duplicate menu entry (see issue #231475).
3030
const DISABLED_ACTIONS = ['embeddable_addToExistingCase'];
3131

32+
// Compact KPI/sparkline embeddables cannot surface Lens inspector warnings usefully.
33+
const hideLensWarningBadges = () => [];
34+
3235
export interface ExploratoryEmbeddableProps {
3336
id?: string;
3437
appendTitle?: JSX.Element;
@@ -44,6 +47,7 @@ export interface ExploratoryEmbeddableProps {
4447
hideTicks?: boolean;
4548
onBrushEnd?: (param: { range: number[] }) => void;
4649
onLoad?: (loading: boolean) => void;
50+
onBeforeBadgesRender?: (userMessages: UserMessage[]) => UserMessage[];
4751
caseOwner?: string;
4852
reportConfigMap?: ReportConfigMap;
4953
reportType: ReportViewType;
@@ -92,6 +96,7 @@ export default function Embeddable(props: ExploratoryEmbeddableComponentProps) {
9296
lineHeight = 32,
9397
searchSessionId,
9498
onLoad,
99+
onBeforeBadgesRender,
95100
analytics,
96101
} = props;
97102
const LensComponent = lens?.EmbeddableComponent;
@@ -213,6 +218,7 @@ export default function Embeddable(props: ExploratoryEmbeddableComponentProps) {
213218
extraActions={actions}
214219
viewMode={'view'}
215220
searchSessionId={searchSessionId}
221+
onBeforeBadgesRender={onBeforeBadgesRender ?? hideLensWarningBadges}
216222
onLoad={(loading, inspectorAdapters) => {
217223
reportEvent(inspectorAdapters);
218224
onLoad?.(loading);

0 commit comments

Comments
 (0)