From 56db7f86c90cf1771066558cced4218423ebd5b8 Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Tue, 18 Jun 2024 20:51:03 +0200 Subject: [PATCH 1/6] use generic edit actions for the overview embeddable --- .../slo/overview/slo_embeddable_factory.tsx | 46 ++++++---- .../public/embeddable/slo/overview/types.ts | 4 +- .../slo/public/plugin.ts | 2 +- .../ui_actions/edit_slo_overview_panel.tsx | 86 ------------------- .../slo/public/ui_actions/index.ts | 3 - 5 files changed, 35 insertions(+), 106 deletions(-) delete mode 100644 x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_overview_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx index 33252386c0e81a..c19604c02f2632 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx @@ -16,32 +16,44 @@ import { fetch$, } from '@kbn/presentation-publishing'; import { BehaviorSubject, Subject } from 'rxjs'; -import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; -import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; +import type { StartServicesAccessor } from '@kbn/core-lifecycle-browser'; import { SLO_OVERVIEW_EMBEDDABLE_ID } from './constants'; import { SloCardChartList } from './slo_overview_grid'; import { SloOverview } from './slo_overview'; import { GroupSloView } from './group_view/group_view'; -import { - SloOverviewEmbeddableState, - SloEmbeddableDeps, - SloOverviewApi, - GroupSloCustomInput, -} from './types'; -import { EDIT_SLO_OVERVIEW_ACTION } from '../../../ui_actions/edit_slo_overview_panel'; +import { SloOverviewEmbeddableState, SloOverviewApi, GroupSloCustomInput } from './types'; +import { SloPublicPluginsStart, SloPublicStart } from '../../../types'; import { SloEmbeddableContext } from '../common/slo_embeddable_context'; export const getOverviewPanelTitle = () => i18n.translate('xpack.slo.sloEmbeddable.displayName', { defaultMessage: 'SLO Overview', }); -export const getOverviewEmbeddableFactory = (deps: SloEmbeddableDeps) => { +export const getOverviewEmbeddableFactory = ( + getStartServices: StartServicesAccessor +) => { const factory: ReactEmbeddableFactory = { type: SLO_OVERVIEW_EMBEDDABLE_ID, deserializeState: (state) => { return state.rawState as SloOverviewEmbeddableState; }, buildEmbeddable: async (state, buildApi, uuid, parentApi) => { + const [coreStart, pluginStart] = await getStartServices(); + const deps = { ...coreStart, ...pluginStart }; + async function onEdit() { + try { + const { openSloConfiguration } = await import('./slo_overview_open_configuration'); + + const result = await openSloConfiguration( + coreStart, + pluginStart, + api.getSloGroupOverviewConfig() + ); + api.updateSloGroupOverviewConfig(result as GroupSloCustomInput); + } catch (e) { + return Promise.reject(); + } + } const { titlesApi, titleComparators, serializeTitles } = initializeTitles(state); const defaultTitle$ = new BehaviorSubject(getOverviewPanelTitle()); const sloId$ = new BehaviorSubject(state.sloId); @@ -56,6 +68,14 @@ export const getOverviewEmbeddableFactory = (deps: SloEmbeddableDeps) => { { ...titlesApi, defaultPanelTitle: defaultTitle$, + getTypeDisplayName: () => + i18n.translate('xpack.slo.editSloOverviewEmbeddableTitle.typeDisplayName', { + defaultMessage: 'criteria', + }), + isEditingEnabled: () => api.getSloGroupOverviewConfig().overviewMode === 'groups', + onEdit: async () => { + onEdit(); + }, serializeState: () => { return { rawState: { @@ -142,11 +162,7 @@ export const getOverviewEmbeddableFactory = (deps: SloEmbeddableDeps) => { { - const trigger = deps.uiActions.getTrigger(CONTEXT_MENU_TRIGGER); - deps.uiActions.getAction(EDIT_SLO_OVERVIEW_ACTION).execute({ - trigger, - embeddable: api, - } as ActionExecutionContext); + onEdit(); }} data-test-subj="o11ySloOverviewEditCriteriaLink" > diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts index 8773fba3e0998a..c64faff1f110d2 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts @@ -8,6 +8,7 @@ import { SerializedTitles, PublishesWritablePanelTitle, PublishesPanelTitle, + HasEditCapabilities, } from '@kbn/presentation-publishing'; import type { EmbeddableApiContext } from '@kbn/presentation-publishing'; import { DefaultEmbeddableApi } from '@kbn/embeddable-plugin/public'; @@ -53,7 +54,8 @@ export type SloOverviewEmbeddableState = SerializedTitles & export type SloOverviewApi = DefaultEmbeddableApi & PublishesWritablePanelTitle & PublishesPanelTitle & - HasSloGroupOverviewConfig; + HasSloGroupOverviewConfig & + HasEditCapabilities; export interface HasSloGroupOverviewConfig { getSloGroupOverviewConfig: () => GroupSloCustomInput; diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.ts b/x-pack/plugins/observability_solution/slo/public/plugin.ts index e387a7f85a7e3b..c996a0ba395608 100644 --- a/x-pack/plugins/observability_solution/slo/public/plugin.ts +++ b/x-pack/plugins/observability_solution/slo/public/plugin.ts @@ -112,7 +112,7 @@ export class SloPlugin const { getOverviewEmbeddableFactory } = await import( './embeddable/slo/overview/slo_embeddable_factory' ); - return getOverviewEmbeddableFactory(deps); + return getOverviewEmbeddableFactory(coreSetup.getStartServices); } ); diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_overview_panel.tsx b/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_overview_panel.tsx deleted file mode 100644 index 55f5c9b6feb0de..00000000000000 --- a/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_overview_panel.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; -import { ViewMode } from '@kbn/embeddable-plugin/common'; -import type { CoreSetup } from '@kbn/core/public'; -import { - apiCanAccessViewMode, - apiHasType, - apiIsOfType, - EmbeddableApiContext, - getInheritedViewMode, - CanAccessViewMode, - HasType, -} from '@kbn/presentation-publishing'; -import { - type UiActionsActionDefinition, - IncompatibleActionError, -} from '@kbn/ui-actions-plugin/public'; -import { SLO_EMBEDDABLE } from '../embeddable/slo/constants'; -import { SloPublicPluginsStart, SloPublicStart } from '..'; -import { - GroupSloCustomInput, - HasSloGroupOverviewConfig, - SloOverviewEmbeddableActionContext, - apiHasSloGroupOverviewConfig, -} from '../embeddable/slo/overview/types'; - -export const EDIT_SLO_OVERVIEW_ACTION = 'editSloOverviewPanelAction'; -type EditSloOverviewPanelApi = CanAccessViewMode & HasType & HasSloGroupOverviewConfig; -const isEditSloOverviewPanelApi = (api: unknown): api is EditSloOverviewPanelApi => - Boolean( - apiHasType(api) && - apiIsOfType(api, SLO_EMBEDDABLE) && - apiCanAccessViewMode(api) && - getInheritedViewMode(api) === ViewMode.EDIT - ); - -export function createEditSloOverviewPanelAction( - getStartServices: CoreSetup['getStartServices'] -): UiActionsActionDefinition { - return { - id: EDIT_SLO_OVERVIEW_ACTION, - type: EDIT_SLO_OVERVIEW_ACTION, - getIconType(): string { - return 'pencil'; - }, - getDisplayName: () => - i18n.translate('xpack.slo.actions.editSloOverviewEmbeddableTitle', { - defaultMessage: 'Edit criteria', - }), - async execute(context) { - const { embeddable } = context; - if (!apiHasSloGroupOverviewConfig(embeddable)) { - throw new IncompatibleActionError(); - } - - const [coreStart, pluginStart] = await getStartServices(); - - try { - const { openSloConfiguration } = await import( - '../embeddable/slo/overview/slo_overview_open_configuration' - ); - - const result = await openSloConfiguration( - coreStart, - pluginStart, - embeddable.getSloGroupOverviewConfig() - ); - embeddable.updateSloGroupOverviewConfig(result as GroupSloCustomInput); - } catch (e) { - return Promise.reject(); - } - }, - isCompatible: async ({ embeddable }: EmbeddableApiContext) => { - return ( - isEditSloOverviewPanelApi(embeddable) && - embeddable.getSloGroupOverviewConfig().overviewMode === 'groups' - ); - }, - }; -} diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts index 76862a3afe90d8..5e5b7d9357b844 100644 --- a/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts +++ b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts @@ -9,7 +9,6 @@ import type { UiActionsSetup } from '@kbn/ui-actions-plugin/public'; import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; import type { CoreSetup } from '@kbn/core/public'; import { createEditSloAlertsPanelAction } from './edit_slo_alerts_panel'; -import { createEditSloOverviewPanelAction } from './edit_slo_overview_panel'; import { createOverviewPanelAction } from './create_overview_panel_action'; import { createAddErrorBudgetPanelAction } from './create_error_budget_action'; import { createAddAlertsPanelAction } from './create_alerts_panel_action'; @@ -21,14 +20,12 @@ export function registerSloUiActions( ) { // Initialize actions const editSloAlertsPanelAction = createEditSloAlertsPanelAction(core.getStartServices); - const editSloOverviewPanelAction = createEditSloOverviewPanelAction(core.getStartServices); const addOverviewPanelAction = createOverviewPanelAction(core.getStartServices); const addErrorBudgetPanelAction = createAddErrorBudgetPanelAction(core.getStartServices); const addAlertsPanelAction = createAddAlertsPanelAction(core.getStartServices); // Assign triggers uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, editSloAlertsPanelAction); - uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, editSloOverviewPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addOverviewPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addErrorBudgetPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addAlertsPanelAction); From 4e78980fcf4db10f7f9000a48f233fe7e177ddf7 Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Tue, 18 Jun 2024 22:55:56 +0200 Subject: [PATCH 2/6] use generic edit actions in the alerts embeddable --- .../alerts/slo_alerts_embeddable_factory.tsx | 35 ++++++++- .../slo/alerts/slo_alerts_wrapper.tsx | 12 +-- .../slo/public/embeddable/slo/alerts/types.ts | 4 +- .../slo/public/plugin.ts | 2 +- .../ui_actions/edit_slo_alerts_panel.tsx | 75 ------------------- .../slo/public/ui_actions/index.ts | 4 - 6 files changed, 40 insertions(+), 92 deletions(-) delete mode 100644 x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx index 7472c43253454b..737761f9098a3a 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx @@ -21,8 +21,10 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { createBrowserHistory } from 'history'; import { Storage } from '@kbn/kibana-utils-plugin/public'; +import type { StartServicesAccessor } from '@kbn/core-lifecycle-browser'; import { SLO_ALERTS_EMBEDDABLE_ID } from './constants'; -import { SloEmbeddableDeps, SloAlertsEmbeddableState, SloAlertsApi } from './types'; +import { SloAlertsEmbeddableState, SloAlertsApi } from './types'; +import { SloPublicPluginsStart, SloPublicStart } from '../../../types'; import { SloAlertsWrapper } from './slo_alerts_wrapper'; const history = createBrowserHistory(); const queryClient = new QueryClient(); @@ -32,13 +34,33 @@ export const getAlertsPanelTitle = () => defaultMessage: 'SLO Alerts', }); -export function getAlertsEmbeddableFactory(deps: SloEmbeddableDeps, kibanaVersion: string) { +export function getAlertsEmbeddableFactory( + getStartServices: StartServicesAccessor, + kibanaVersion: string +) { const factory: ReactEmbeddableFactory = { type: SLO_ALERTS_EMBEDDABLE_ID, deserializeState: (state) => { return state.rawState as SloAlertsEmbeddableState; }, buildEmbeddable: async (state, buildApi, uuid, parentApi) => { + const [coreStart, pluginStart] = await getStartServices(); + const deps = { ...coreStart, ...pluginStart }; + async function onEdit() { + try { + const { openSloConfiguration } = await import('./slo_alerts_open_configuration'); + + const result = await openSloConfiguration( + coreStart, + pluginStart, + api.getSloAlertsConfig() + ); + api.updateSloAlertsConfig(result); + } catch (e) { + return Promise.reject(); + } + } + const { titlesApi, titleComparators, serializeTitles } = initializeTitles(state); const defaultTitle$ = new BehaviorSubject(getAlertsPanelTitle()); const slos$ = new BehaviorSubject(state.slos); @@ -48,6 +70,14 @@ export function getAlertsEmbeddableFactory(deps: SloEmbeddableDeps, kibanaVersio { ...titlesApi, defaultPanelTitle: defaultTitle$, + getTypeDisplayName: () => + i18n.translate('xpack.slo.editSloAlertswEmbeddable.typeDisplayName', { + defaultMessage: 'configuration', + }), + isEditingEnabled: () => true, + onEdit: async () => { + onEdit(); + }, serializeState: () => { return { rawState: { @@ -112,6 +142,7 @@ export function getAlertsEmbeddableFactory(deps: SloEmbeddableDeps, kibanaVersio void; reloadSubject: Subject; showAllGroupByInstances?: boolean; + onEdit: () => void; } export function SloAlertsWrapper({ @@ -39,6 +36,7 @@ export function SloAlertsWrapper({ onRenderComplete, reloadSubject, showAllGroupByInstances, + onEdit, }: Props) { const { application: { navigateToUrl }, @@ -102,11 +100,7 @@ export function SloAlertsWrapper({ { - const trigger = deps.uiActions.getTrigger(CONTEXT_MENU_TRIGGER); - deps.uiActions.getAction(EDIT_SLO_ALERTS_ACTION).execute({ - trigger, - embeddable, - } as ActionExecutionContext); + onEdit(); }} data-test-subj="o11ySloAlertsWrapperSlOsIncludedLink" > diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts index 8b660442ca7b66..7682c3f55bedfe 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts @@ -24,6 +24,7 @@ import { PublishesWritablePanelTitle, PublishesPanelTitle, EmbeddableApiContext, + HasEditCapabilities, } from '@kbn/presentation-publishing'; export interface SloItem { @@ -45,7 +46,8 @@ export type SloAlertsEmbeddableState = SerializedTitles & EmbeddableSloProps; export type SloAlertsApi = DefaultEmbeddableApi & PublishesWritablePanelTitle & PublishesPanelTitle & - HasSloAlertsConfig; + HasSloAlertsConfig & + HasEditCapabilities; export interface HasSloAlertsConfig { getSloAlertsConfig: () => EmbeddableSloProps; diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.ts b/x-pack/plugins/observability_solution/slo/public/plugin.ts index c996a0ba395608..0ee7c4b51c0cd2 100644 --- a/x-pack/plugins/observability_solution/slo/public/plugin.ts +++ b/x-pack/plugins/observability_solution/slo/public/plugin.ts @@ -125,7 +125,7 @@ export class SloPlugin './embeddable/slo/alerts/slo_alerts_embeddable_factory' ); - return getAlertsEmbeddableFactory(deps, kibanaVersion); + return getAlertsEmbeddableFactory(coreSetup.getStartServices, kibanaVersion); } ); diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx b/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx deleted file mode 100644 index ce9b4d196ffb5b..00000000000000 --- a/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; -import { ViewMode } from '@kbn/embeddable-plugin/common'; -import type { CoreSetup } from '@kbn/core/public'; -import { - apiCanAccessViewMode, - apiHasType, - apiIsOfType, - EmbeddableApiContext, - getInheritedViewMode, - CanAccessViewMode, - HasType, -} from '@kbn/presentation-publishing'; -import { type UiActionsActionDefinition } from '@kbn/ui-actions-plugin/public'; -import { SLO_ALERTS_EMBEDDABLE_ID } from '../embeddable/slo/alerts/constants'; -import { SloPublicPluginsStart, SloPublicStart } from '..'; -import { - HasSloAlertsConfig, - SloAlertsEmbeddableActionContext, -} from '../embeddable/slo/alerts/types'; -export const EDIT_SLO_ALERTS_ACTION = 'editSloAlertsPanelAction'; -type EditSloAlertsPanelApi = CanAccessViewMode & HasType & HasSloAlertsConfig; -const isEditSloAlertsPanelApi = (api: unknown): api is EditSloAlertsPanelApi => - Boolean( - apiHasType(api) && - apiIsOfType(api, SLO_ALERTS_EMBEDDABLE_ID) && - apiCanAccessViewMode(api) && - getInheritedViewMode(api) === ViewMode.EDIT - ); - -export function createEditSloAlertsPanelAction( - getStartServices: CoreSetup['getStartServices'] -): UiActionsActionDefinition { - return { - id: EDIT_SLO_ALERTS_ACTION, - type: EDIT_SLO_ALERTS_ACTION, - getIconType(): string { - return 'pencil'; - }, - getDisplayName: () => - i18n.translate('xpack.slo.actions.editSloAlertsEmbeddableTitle', { - defaultMessage: 'Edit configuration', - }), - async execute({ embeddable }) { - if (!embeddable) { - throw new Error('Not possible to execute an action without the embeddable context'); - } - - const [coreStart, pluginStart] = await getStartServices(); - - try { - const { openSloConfiguration } = await import( - '../embeddable/slo/alerts/slo_alerts_open_configuration' - ); - - const result = await openSloConfiguration( - coreStart, - pluginStart, - embeddable.getSloAlertsConfig() - ); - embeddable.updateSloAlertsConfig(result); - } catch (e) { - return Promise.reject(); - } - }, - isCompatible: async ({ embeddable }: EmbeddableApiContext) => - isEditSloAlertsPanelApi(embeddable), - }; -} diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts index 5e5b7d9357b844..61c1569f1a9d7c 100644 --- a/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts +++ b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts @@ -6,9 +6,7 @@ */ import type { UiActionsSetup } from '@kbn/ui-actions-plugin/public'; -import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; import type { CoreSetup } from '@kbn/core/public'; -import { createEditSloAlertsPanelAction } from './edit_slo_alerts_panel'; import { createOverviewPanelAction } from './create_overview_panel_action'; import { createAddErrorBudgetPanelAction } from './create_error_budget_action'; import { createAddAlertsPanelAction } from './create_alerts_panel_action'; @@ -19,13 +17,11 @@ export function registerSloUiActions( core: CoreSetup ) { // Initialize actions - const editSloAlertsPanelAction = createEditSloAlertsPanelAction(core.getStartServices); const addOverviewPanelAction = createOverviewPanelAction(core.getStartServices); const addErrorBudgetPanelAction = createAddErrorBudgetPanelAction(core.getStartServices); const addAlertsPanelAction = createAddAlertsPanelAction(core.getStartServices); // Assign triggers - uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, editSloAlertsPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addOverviewPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addErrorBudgetPanelAction); uiActions.addTriggerAction('ADD_PANEL_TRIGGER', addAlertsPanelAction); From 59f24da955c34f49a8611e051041f3c68376348a Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Wed, 19 Jun 2024 11:09:16 +0200 Subject: [PATCH 3/6] fix types --- .../embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx | 1 - .../slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx | 1 - x-pack/plugins/observability_solution/slo/public/plugin.ts | 3 --- 3 files changed, 5 deletions(-) diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx index 737761f9098a3a..b0eca2983dcd72 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx @@ -143,7 +143,6 @@ export function getAlertsEmbeddableFactory( { - const deps = { ...coreStart, ...pluginsStart }; const { getOverviewEmbeddableFactory } = await import( './embeddable/slo/overview/slo_embeddable_factory' ); @@ -119,8 +118,6 @@ export class SloPlugin pluginsSetup.embeddable.registerReactEmbeddableFactory( SLO_ALERTS_EMBEDDABLE_ID, async () => { - const deps = { ...coreStart, ...pluginsStart }; - const { getAlertsEmbeddableFactory } = await import( './embeddable/slo/alerts/slo_alerts_embeddable_factory' ); From 88ab22ad906c7ecc3a9e413785eb5171fb3ed444 Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Thu, 20 Jun 2024 21:55:13 +0200 Subject: [PATCH 4/6] remove inline edit criteria link from the overview embeddable --- .../slo/overview/slo_embeddable_factory.tsx | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx index 5e006bbd6ddc8d..f98bf48285bea1 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx @@ -154,29 +154,12 @@ export const getOverviewEmbeddableFactory = ( const groups = groupFilters?.groups ?? []; return ( - - - { - onEdit(); - }} - data-test-subj="o11ySloOverviewEditCriteriaLink" - > - {i18n.translate('xpack.slo.overviewEmbeddable.editCriteriaLabel', { - defaultMessage: 'Edit criteria', - })} - - - - Date: Thu, 20 Jun 2024 22:59:41 +0200 Subject: [PATCH 5/6] removed unused stuff --- .../public/embeddable/slo/overview/slo_embeddable_factory.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx index f98bf48285bea1..3f0a2b535714ed 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; import styled from 'styled-components'; -import { EuiFlexItem, EuiLink, EuiFlexGroup } from '@elastic/eui'; +import { EuiFlexItem } from '@elastic/eui'; import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public'; import { initializeTitles, From 8aa6e81f2e86cd63bae9ce061cd48936abdda5fc Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Fri, 21 Jun 2024 09:59:14 +0200 Subject: [PATCH 6/6] fix e2e tests --- .../slo/overview/slo_embeddable_factory.tsx | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx index 3f0a2b535714ed..2d043e85df4d44 100644 --- a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; import styled from 'styled-components'; -import { EuiFlexItem } from '@elastic/eui'; +import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public'; import { initializeTitles, @@ -154,21 +154,22 @@ export const getOverviewEmbeddableFactory = ( const groups = groupFilters?.groups ?? []; return ( - - - + + + + + ); } else {