Removed testing code
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -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: () => <div>Contact Support</div>,
|
||||
} as CatalogPluginMetadata);
|
||||
|
||||
const routes = (
|
||||
<FlatRoutes>
|
||||
<Navigate key="/" to="catalog" />
|
||||
|
||||
@@ -235,11 +235,6 @@ export function createReactExtension<
|
||||
| { id?: string }
|
||||
| undefined;
|
||||
|
||||
const metadata = plugin.getMetadata();
|
||||
const componentProperties = metadata
|
||||
? { ...props, metadata }
|
||||
: { ...props };
|
||||
|
||||
return (
|
||||
<Suspense fallback={<Progress />}>
|
||||
<PluginErrorBoundary app={app} plugin={plugin}>
|
||||
@@ -250,7 +245,7 @@ export function createReactExtension<
|
||||
...(mountPoint && { routeRef: mountPoint.id }),
|
||||
}}
|
||||
>
|
||||
<Component {...componentProperties} />
|
||||
<Component {...{ ...props, metadata: plugin.getMetadata() }} />
|
||||
</AnalyticsContext>
|
||||
</PluginErrorBoundary>
|
||||
</Suspense>
|
||||
|
||||
@@ -55,7 +55,7 @@ export class PluginImpl<
|
||||
}
|
||||
|
||||
getMetadata(): PluginMetadata {
|
||||
return this.config.metadata!!;
|
||||
return this.config.metadata ?? ({} as PluginMetadata);
|
||||
}
|
||||
|
||||
get routes(): Routes {
|
||||
|
||||
@@ -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<CatalogTableRow>['actions'];
|
||||
initialKind?: string;
|
||||
tableOptions?: TableProps<CatalogTableRow>['options'];
|
||||
metadata?: CatalogPluginMetadata;
|
||||
}
|
||||
|
||||
export function DefaultCatalogPage(props: DefaultCatalogPageProps) {
|
||||
@@ -73,10 +72,10 @@ export function DefaultCatalogPage(props: DefaultCatalogPageProps) {
|
||||
titleComponent={<CatalogKindHeader initialFilter={initialKind} />}
|
||||
>
|
||||
<CreateButton
|
||||
title={props.metadata?.createComponentTitle || ''}
|
||||
title="Create Component"
|
||||
to={createComponentLink && createComponentLink()}
|
||||
/>
|
||||
{props.metadata?.supportButton()}
|
||||
<SupportButton>All your software catalog entities</SupportButton>
|
||||
</ContentHeader>
|
||||
<CatalogFilterLayout>
|
||||
<CatalogFilterLayout.Filters>
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user