Skip to content

Commit

Permalink
remove observability dashboards from core flow with MDS disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
  • Loading branch information
ps48 committed Oct 9, 2024
1 parent ab78b53 commit 29e159b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,11 @@ exports[`Added Integration View Test Renders added integration view using dummy
>
<EuiFlexGroup
alignItems="center"
gutterSize="m"
gutterSize="s"
wrap={true}
>
<div
className="euiFlexGroup euiFlexGroup--gutterMedium euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive euiFlexGroup--wrap"
className="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive euiFlexGroup--wrap"
>
<EuiFlexItem
className="euiSearchBar__searchHolder"
Expand Down
80 changes: 41 additions & 39 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,47 @@ export class ObservabilityPlugin
window.location.assign(convertLegacyTraceAnalyticsUrl(window.location));
}

const BASE_URL = core.http.basePath.prepend('/app/observability-dashboards#');
setupDeps.dashboard.registerDashboardProvider({
appId: 'observability-panel',
savedObjectsType: 'observability-panel',
savedObjectsName: 'Observability',
editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`,
viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`,
createLinkText: 'Observability Dashboard',
createSortText: 'Observability Dashboard',
createUrl: `${BASE_URL}/create`,
});
// if MDS is not enabled register observability dashboards & PPL visualizations in core
if (!setupDeps.dataSource) {
const BASE_URL = core.http.basePath.prepend('/app/observability-dashboards#');
setupDeps.dashboard.registerDashboardProvider({
appId: 'observability-panel',
savedObjectsType: 'observability-panel',
savedObjectsName: 'Observability',
editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`,
viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`,
createLinkText: 'Observability Dashboard',
createSortText: 'Observability Dashboard',
createUrl: `${BASE_URL}/create`,
});

setupDeps.visualizations.registerAlias({
name: OBSERVABILITY_EMBEDDABLE_ID,
title: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME,
description: OBSERVABILITY_EMBEDDABLE_DESCRIPTION,
icon: OBSERVABILITY_EMBEDDABLE_ICON,
aliasApp: observabilityLogsID,
aliasPath: `#/explorer/?${CREATE_TAB_PARAM_KEY}=${CREATE_TAB_PARAM[TAB_CHART_ID]}`,
stage: 'production',
appExtensions: {
visualizations: {
docTypes: [VISUALIZATION_SAVED_OBJECT],
toListItem: ({ id, attributes, updated_at: updatedAt }) => ({
description: attributes?.description,
editApp: observabilityLogsID,
editUrl: `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${id}`,
icon: OBSERVABILITY_EMBEDDABLE_ICON,
id,
savedObjectType: VISUALIZATION_SAVED_OBJECT,
title: attributes?.title,
typeTitle: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME,
stage: 'production',
updated_at: updatedAt,
}),
},
},
});
}

const OBSERVABILITY_APP_CATEGORIES: Record<string, AppCategory> = Object.freeze({
observability: {
Expand Down Expand Up @@ -401,34 +431,6 @@ export class ObservabilityPlugin
}));
setupDeps.embeddable.registerEmbeddableFactory(OBSERVABILITY_EMBEDDABLE, embeddableFactory);

if (!setupDeps.dataSource)
setupDeps.visualizations.registerAlias({
name: OBSERVABILITY_EMBEDDABLE_ID,
title: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME,
description: OBSERVABILITY_EMBEDDABLE_DESCRIPTION,
icon: OBSERVABILITY_EMBEDDABLE_ICON,
aliasApp: observabilityLogsID,
aliasPath: `#/explorer/?${CREATE_TAB_PARAM_KEY}=${CREATE_TAB_PARAM[TAB_CHART_ID]}`,
stage: 'production',
appExtensions: {
visualizations: {
docTypes: [VISUALIZATION_SAVED_OBJECT],
toListItem: ({ id, attributes, updated_at: updatedAt }) => ({
description: attributes?.description,
editApp: observabilityLogsID,
editUrl: `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${id}`,
icon: OBSERVABILITY_EMBEDDABLE_ICON,
id,
savedObjectType: VISUALIZATION_SAVED_OBJECT,
title: attributes?.title,
typeTitle: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME,
stage: 'production',
updated_at: updatedAt,
}),
},
},
});

registerAsssitantDependencies(setupDeps.assistantDashboards);

// Return methods that should be available to other plugins
Expand Down

0 comments on commit 29e159b

Please sign in to comment.