From 30e24f280ccc18e37aec1561e34f07aeb3f11cc0 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 11 Mar 2022 14:23:30 +0100 Subject: [PATCH] chore: reworking some other bits and bob Signed-off-by: blam --- .../components/CreateButton/CreateButton.tsx | 4 ---- plugins/scaffolder/api-report.md | 21 +++++++++++++++++++ plugins/scaffolder/src/index.ts | 1 + plugins/scaffolder/src/next/Router/Router.tsx | 14 +++++++++++-- plugins/scaffolder/src/next/Router/index.ts | 1 + .../TemplateCard/TemplateCard.test.tsx | 10 --------- .../TemplateListPage.test.tsx | 1 + .../TemplateWizardPage/TemplateWizardPage.tsx | 8 +++++-- plugins/scaffolder/src/next/index.ts | 18 ++++++++++++++++ 9 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 plugins/scaffolder/src/next/index.ts diff --git a/packages/core-components/src/components/CreateButton/CreateButton.tsx b/packages/core-components/src/components/CreateButton/CreateButton.tsx index 056ead5811..d5d7080851 100644 --- a/packages/core-components/src/components/CreateButton/CreateButton.tsx +++ b/packages/core-components/src/components/CreateButton/CreateButton.tsx @@ -25,7 +25,6 @@ import AddCircleOutline from '@material-ui/icons/AddCircleOutline'; /** * Properties for {@link CreateButton} * - * @deprecated * @public */ export type CreateButtonProps = { @@ -36,9 +35,6 @@ export type CreateButtonProps = { * Responsive Button giving consistent UX for creation of different things * * @public - * - * @deprecated Please use IconButton directly and have your own implementation of this component. - * It doesn't really fit as a core-component. */ export function CreateButton(props: CreateButtonProps) { const { title, to } = props; diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 90fee1fc66..f805e0bea3 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -20,6 +20,7 @@ import { JsonObject } from '@backstage/types'; import { JSONSchema7 } from 'json-schema'; import { JsonValue } from '@backstage/types'; import { Observable } from '@backstage/types'; +import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; import { ScmIntegrationRegistry } from '@backstage/integration'; @@ -126,6 +127,22 @@ export type LogEvent = { taskId: string; }; +// @public +export type NextRouterProps = { + components?: { + TemplateCardComponent?: React_2.ComponentType<{ + template: TemplateEntityV1beta3; + }>; + TaskPageComponent?: React_2.ComponentType<{}>; + }; + groups?: TemplateGroupFilter[]; +}; + +// @alpha +export const NextScaffolderPage: ( + props: PropsWithChildren, +) => JSX.Element; + // @public export const OwnedEntityPickerFieldExtension: FieldExtensionComponent< string, @@ -368,4 +385,8 @@ export const TemplateTypePicker: () => JSX.Element | null; // @public export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets; + +// Warnings were encountered during analysis: +// +// src/next/Router/Router.d.ts:16:5 - (ae-forgotten-export) The symbol "TemplateGroupFilter" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index 87e2860fd3..20d11c441d 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -58,4 +58,5 @@ export { NextScaffolderPage, } from './plugin'; export * from './components'; +export type { NextRouterProps } from './next'; export type { TaskPageProps } from './components/TaskPage'; diff --git a/plugins/scaffolder/src/next/Router/Router.tsx b/plugins/scaffolder/src/next/Router/Router.tsx index 5aa55440e6..9ac5aa8f40 100644 --- a/plugins/scaffolder/src/next/Router/Router.tsx +++ b/plugins/scaffolder/src/next/Router/Router.tsx @@ -29,7 +29,12 @@ import { useElementFilter } from '@backstage/core-plugin-api'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups'; -export type RouterProps = { +/** + * The Props for the Scaffolder Router + * + * @public + */ +export type NextRouterProps = { components?: { TemplateCardComponent?: React.ComponentType<{ template: TemplateEntityV1beta3; @@ -39,7 +44,12 @@ export type RouterProps = { groups?: TemplateGroupFilter[]; }; -export const Router = (props: PropsWithChildren) => { +/** + * The Scaffolder Router + * + * @public + */ +export const Router = (props: PropsWithChildren) => { const { components: { TemplateCardComponent } = {} } = props; const outlet = useOutlet() || props.children; diff --git a/plugins/scaffolder/src/next/Router/index.ts b/plugins/scaffolder/src/next/Router/index.ts index 5ad2ae6e6a..dac1db7b3a 100644 --- a/plugins/scaffolder/src/next/Router/index.ts +++ b/plugins/scaffolder/src/next/Router/index.ts @@ -14,3 +14,4 @@ * limitations under the License. */ export { Router } from './Router'; +export type { NextRouterProps } from './Router'; diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/TemplateCard.test.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/TemplateCard.test.tsx index 088727a5a0..45f4dc6317 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/TemplateCard.test.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/TemplateCard.test.tsx @@ -166,8 +166,6 @@ describe('TemplateCard', () => { { targetRef: 'group:default/my-test-user', type: RELATION_OWNED_BY, - /** remove when target is removed as it's deprecated */ - target: { kind: 'User', name: 'my-test-user', namespace: 'default' }, }, ], }; @@ -209,14 +207,6 @@ describe('TemplateCard', () => { steps: [], type: 'service', }, - relations: [ - { - targetRef: 'group:default/my-test-user', - type: RELATION_OWNED_BY, - /** remove when target is removed as it's deprecated */ - target: { kind: 'User', name: 'my-test-user', namespace: 'default' }, - }, - ], }; const { getByRole } = await renderInTestApp( diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateListPage.test.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateListPage.test.tsx index 4f12bde863..9f8c3b3c49 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateListPage.test.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateListPage.test.tsx @@ -110,6 +110,7 @@ describe('TemplateListPage', () => { expect(getByText('Categories')).toBeInTheDocument(); }); + // eslint-disable-next-line jest/no-disabled-tests it.skip('should render the EntityTag picker', async () => { const { getByText } = await renderInTestApp( []; } -export const TemplateWizardPage = (props: TemplateWizardPageProps) => { + +export const TemplateWizardPage = (_props: TemplateWizardPageProps) => { return null; }; diff --git a/plugins/scaffolder/src/next/index.ts b/plugins/scaffolder/src/next/index.ts new file mode 100644 index 0000000000..089c268b0b --- /dev/null +++ b/plugins/scaffolder/src/next/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './Router'; +export * from './TemplateListPage'; +export * from './TemplateWizardPage';