Skip to content

Commit

Permalink
SLO plugin registers panel placement in setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpeihl committed May 6, 2024
1 parent a649b03 commit 79d8d9c
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions x-pack/plugins/observability_solution/slo/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,17 @@ export class SloPlugin

const hasPlatinumLicense = license.hasAtLeast('platinum');
if (hasPlatinumLicense) {
const [coreStart, pluginsStart] = await coreSetup.getStartServices();
pluginsStart.dashboard.registerDashboardPanelPlacementSetting(
SLO_OVERVIEW_EMBEDDABLE_ID,
(serializedState: SloOverviewEmbeddableState | undefined) => {
if (serializedState?.showAllGroupByInstances || serializedState?.groupFilters) {
return { width: 24, height: 8 };
}
return { width: 12, height: 8 };
}
);
registerReactEmbeddableFactory(SLO_OVERVIEW_EMBEDDABLE_ID, async () => {
const [coreStart, pluginsStart] = await coreSetup.getStartServices();

const deps = { ...coreStart, ...pluginsStart };

const { getOverviewEmbeddableFactory } = await import(
Expand All @@ -117,8 +125,6 @@ export class SloPlugin
registerSloAlertsEmbeddableFactory();

registerReactEmbeddableFactory(SLO_ERROR_BUDGET_ID, async () => {
const [coreStart, pluginsStart] = await coreSetup.getStartServices();

const deps = { ...coreStart, ...pluginsStart };

const { getErrorBudgetEmbeddableFactory } = await import(
Expand Down Expand Up @@ -149,16 +155,6 @@ export class SloPlugin
const kibanaVersion = this.initContext.env.packageInfo.version;
const { ruleTypeRegistry, actionTypeRegistry } = pluginsStart.triggersActionsUi;

pluginsStart.dashboard.registerDashboardPanelPlacementSetting(
SLO_OVERVIEW_EMBEDDABLE_ID,
(serializedState: SloOverviewEmbeddableState | undefined) => {
if (serializedState?.showAllGroupByInstances || serializedState?.groupFilters) {
return { width: 24, height: 8 };
}
return { width: 12, height: 8 };
}
);

return {
getCreateSLOFlyout: getCreateSLOFlyoutLazy({
core: coreStart,
Expand Down

0 comments on commit 79d8d9c

Please sign in to comment.