From 69c590b0ff9682580e48fff049a7a52f0151d6da Mon Sep 17 00:00:00 2001 From: bnechyporenko Date: Tue, 10 May 2022 08:54:04 +0200 Subject: [PATCH] Removed testing code Signed-off-by: bnechyporenko --- packages/app/src/App.tsx | 6 ------ .../src/extensions/extensions.tsx | 7 +------ packages/core-plugin-api/src/plugin/Plugin.tsx | 2 +- .../CatalogPage/DefaultCatalogPage.tsx | 7 +++---- plugins/catalog/src/index.ts | 1 - plugins/catalog/src/plugin.ts | 16 ---------------- 6 files changed, 5 insertions(+), 34 deletions(-) diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index 4c2d8aabcb..4cf2c02e55 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -94,7 +94,6 @@ import { techDocsPage } from './components/techdocs/TechDocsPage'; import { ApacheAirflowPage } from '@backstage/plugin-apache-airflow'; import { PermissionedRoute } from '@backstage/plugin-permission-react'; import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common'; -import { CatalogPluginMetadata } from '@backstage/plugin-catalog'; const app = createApp({ apis, @@ -135,11 +134,6 @@ const app = createApp({ const AppProvider = app.getProvider(); const AppRouter = app.getRouter(); -catalogPlugin.reconfigure({ - createComponentTitle: 'Create!!', - supportButton: () =>
Contact Support
, -} as CatalogPluginMetadata); - const routes = ( diff --git a/packages/core-plugin-api/src/extensions/extensions.tsx b/packages/core-plugin-api/src/extensions/extensions.tsx index 408cf054e2..8f1efe3b65 100644 --- a/packages/core-plugin-api/src/extensions/extensions.tsx +++ b/packages/core-plugin-api/src/extensions/extensions.tsx @@ -235,11 +235,6 @@ export function createReactExtension< | { id?: string } | undefined; - const metadata = plugin.getMetadata(); - const componentProperties = metadata - ? { ...props, metadata } - : { ...props }; - return ( }> @@ -250,7 +245,7 @@ export function createReactExtension< ...(mountPoint && { routeRef: mountPoint.id }), }} > - + diff --git a/packages/core-plugin-api/src/plugin/Plugin.tsx b/packages/core-plugin-api/src/plugin/Plugin.tsx index 6c4c77f58b..61b8a5db8c 100644 --- a/packages/core-plugin-api/src/plugin/Plugin.tsx +++ b/packages/core-plugin-api/src/plugin/Plugin.tsx @@ -55,7 +55,7 @@ export class PluginImpl< } getMetadata(): PluginMetadata { - return this.config.metadata!!; + return this.config.metadata ?? ({} as PluginMetadata); } get routes(): Routes { diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx index d74b413dbe..5250dcec0d 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx @@ -19,6 +19,7 @@ import { ContentHeader, CreateButton, PageWithHeader, + SupportButton, TableColumn, TableProps, } from '@backstage/core-components'; @@ -37,7 +38,6 @@ import React from 'react'; import { createComponentRouteRef } from '../../routes'; import { CatalogTable, CatalogTableRow } from '../CatalogTable'; import { CatalogKindHeader } from '../CatalogKindHeader'; -import { CatalogPluginMetadata } from '../../plugin'; /** * Props for root catalog pages. @@ -50,7 +50,6 @@ export interface DefaultCatalogPageProps { actions?: TableProps['actions']; initialKind?: string; tableOptions?: TableProps['options']; - metadata?: CatalogPluginMetadata; } export function DefaultCatalogPage(props: DefaultCatalogPageProps) { @@ -73,10 +72,10 @@ export function DefaultCatalogPage(props: DefaultCatalogPageProps) { titleComponent={} > - {props.metadata?.supportButton()} + All your software catalog entities diff --git a/plugins/catalog/src/index.ts b/plugins/catalog/src/index.ts index ca55bac335..cfe4851d09 100644 --- a/plugins/catalog/src/index.ts +++ b/plugins/catalog/src/index.ts @@ -53,7 +53,6 @@ export { RelatedEntitiesCard, } from './plugin'; -export type { CatalogPluginMetadata } from './plugin'; export type { DependencyOfComponentsCardProps } from './components/DependencyOfComponentsCard'; export type { DependsOnComponentsCardProps } from './components/DependsOnComponentsCard'; export type { DependsOnResourcesCardProps } from './components/DependsOnResourcesCard'; diff --git a/plugins/catalog/src/plugin.ts b/plugins/catalog/src/plugin.ts index 264b3bdaf9..1b9083e7ca 100644 --- a/plugins/catalog/src/plugin.ts +++ b/plugins/catalog/src/plugin.ts @@ -30,9 +30,7 @@ import { discoveryApiRef, fetchApiRef, storageApiRef, - AnyMetadata, } from '@backstage/core-plugin-api'; -import { SupportButton } from '@backstage/core-components'; import { DefaultStarredEntitiesApi } from './apis'; import { AboutCardProps } from './components/AboutCard'; import { DefaultCatalogPageProps } from './components/CatalogPage'; @@ -46,19 +44,6 @@ import { HasSystemsCardProps } from './components/HasSystemsCard'; import { RelatedEntitiesCardProps } from './components/RelatedEntitiesCard'; import { rootRouteRef } from './routes'; -export interface CatalogPluginMetadata extends AnyMetadata { - createComponentTitle: string; - supportButton: () => JSX.Element; - supportButtonText: string; -} - -const metadata = { - createComponentTitle: 'Create Component', - // eslint-disable-next-line new-cap - supportButton: () => SupportButton({}), - supportButtonText: 'All your software catalog entities', -} as CatalogPluginMetadata; - /** @public */ export const catalogPlugin = createPlugin({ id: 'catalog', @@ -87,7 +72,6 @@ export const catalogPlugin = createPlugin({ createComponent: createComponentRouteRef, viewTechDoc: viewTechDocRouteRef, }, - metadata, }); /** @public */