From d7eba6cab4e9533a5e8929a25fb918220345a5f8 Mon Sep 17 00:00:00 2001 From: Yevhenii Huselietov Date: Sun, 1 Oct 2023 17:07:03 +0300 Subject: [PATCH] Export DashboardSnapshotList for NewRelic Signed-off-by: Yevhenii Huselietov --- .changeset/rotten-rings-confess.md | 9 ++++++ plugins/newrelic-dashboard/api-report.md | 10 +++++++ plugins/newrelic-dashboard/src/index.ts | 2 ++ plugins/newrelic-dashboard/src/plugin.ts | 38 +++++++++++++++++++++--- 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .changeset/rotten-rings-confess.md diff --git a/.changeset/rotten-rings-confess.md b/.changeset/rotten-rings-confess.md new file mode 100644 index 0000000000..8948a90347 --- /dev/null +++ b/.changeset/rotten-rings-confess.md @@ -0,0 +1,9 @@ +--- +'@backstage/plugin-newrelic-dashboard': minor +--- + +Changes in `newrelic-dashboard` plugin: + +- Make DashboardSnapshotList component public +- Settle discrepancies in the exported API +- Deprecate DashboardSnapshotComponent diff --git a/plugins/newrelic-dashboard/api-report.md b/plugins/newrelic-dashboard/api-report.md index ce7b8d5b7e..283523d781 100644 --- a/plugins/newrelic-dashboard/api-report.md +++ b/plugins/newrelic-dashboard/api-report.md @@ -11,12 +11,22 @@ import { JSX as JSX_2 } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; // @public +export const DashboardSnapshot: (props: { + guid: string; + name: string; + permalink: string; +}) => JSX_2.Element; + +// @public @deprecated export const DashboardSnapshotComponent: (props: { guid: string; name: string; permalink: string; }) => JSX_2.Element; +// @public +export const DashboardSnapshotList: (props: { guid: string }) => JSX_2.Element; + // @public (undocumented) export const EntityNewRelicDashboardCard: () => JSX_2.Element; diff --git a/plugins/newrelic-dashboard/src/index.ts b/plugins/newrelic-dashboard/src/index.ts index ba87b8a514..bbdfb70190 100644 --- a/plugins/newrelic-dashboard/src/index.ts +++ b/plugins/newrelic-dashboard/src/index.ts @@ -18,6 +18,8 @@ export { newRelicDashboardPlugin, EntityNewRelicDashboardCard, EntityNewRelicDashboardContent, + DashboardSnapshot, + DashboardSnapshotList, DashboardSnapshotComponent, } from './plugin'; export { isNewRelicDashboardAvailable } from './Router'; diff --git a/plugins/newrelic-dashboard/src/plugin.ts b/plugins/newrelic-dashboard/src/plugin.ts index 51be731ca7..360f1cb911 100644 --- a/plugins/newrelic-dashboard/src/plugin.ts +++ b/plugins/newrelic-dashboard/src/plugin.ts @@ -52,7 +52,7 @@ export const newRelicDashboardPlugin = createPlugin({ /** @public */ export const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide( createComponentExtension({ - name: 'EntityNewRelicDashboardPage', + name: 'EntityNewRelicDashboardContent', component: { lazy: () => import('./Router').then(m => m.Router), }, @@ -62,7 +62,7 @@ export const EntityNewRelicDashboardContent = newRelicDashboardPlugin.provide( /** @public */ export const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide( createComponentExtension({ - name: 'EntityNewRelicDashboardListComponent', + name: 'EntityNewRelicDashboardCard', component: { lazy: () => import('./components/NewRelicDashboard/DashboardEntityList').then( @@ -80,9 +80,9 @@ export const EntityNewRelicDashboardCard = newRelicDashboardPlugin.provide( * * @public */ -export const DashboardSnapshotComponent = newRelicDashboardPlugin.provide( +export const DashboardSnapshot = newRelicDashboardPlugin.provide( createComponentExtension({ - name: 'DashboardSnapshotComponent', + name: 'DashboardSnapshot', component: { lazy: () => import( @@ -91,3 +91,33 @@ export const DashboardSnapshotComponent = newRelicDashboardPlugin.provide( }, }), ); + +/** + * Render dashboard snapshots from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true` + * + * @deprecated + * Use DashboardSnapshot export name instead + * + * @public + */ +export const DashboardSnapshotComponent = DashboardSnapshot; + +/** + * Render a dashboard snapshots list from Newrelic in backstage. Use dashboards which have the tag `isDashboardPage: true` + * + * @remarks + * This can be helpful for rendering dashboards outside of Entity Catalog. + * + * @public + */ +export const DashboardSnapshotList = newRelicDashboardPlugin.provide( + createComponentExtension({ + name: 'DashboardSnapshotList', + component: { + lazy: () => + import( + './components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList' + ).then(m => m.DashboardSnapshotList), + }, + }), +);