From c1c117da99406f64e87e9aae807cc53196d59f0c Mon Sep 17 00:00:00 2001 From: bogdannechyporenko Date: Thu, 20 Oct 2022 00:00:41 +0200 Subject: [PATCH] Incorporated the feedback Signed-off-by: bnechyporenko Signed-off-by: bogdannechyporenko --- .../MultistepJsonForm/LastStepForm.tsx | 4 -- .../MultistepJsonForm/MultistepJsonForm.tsx | 2 - .../TemplatePage/TemplatePage.test.tsx | 25 +++--------- plugins/scaffolder/src/components/types.ts | 2 - plugins/scaffolder/src/index.ts | 4 -- plugins/scaffolder/src/options.ts | 40 ------------------- plugins/scaffolder/src/plugin.tsx | 13 ------ 7 files changed, 5 insertions(+), 85 deletions(-) delete mode 100644 plugins/scaffolder/src/options.ts diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/LastStepForm.tsx b/plugins/scaffolder/src/components/MultistepJsonForm/LastStepForm.tsx index 04ac867a23..8cdd8581d1 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/LastStepForm.tsx +++ b/plugins/scaffolder/src/components/MultistepJsonForm/LastStepForm.tsx @@ -23,8 +23,6 @@ import { Step } from '../types'; /** * The props for the Last Step in scaffolder template form. * Which represents the summary of the input provided by the end user. - * - * @public */ export type LastStepFormProps = { disableButtons: boolean; @@ -93,8 +91,6 @@ export function getReviewData(formData: Record, steps: Step[]) { /** * The component displaying the Last Step in scaffolder template form. * Which represents the summary of the input provided by the end user. - * - * @public */ export const LastStepForm = (props: LastStepFormProps) => { const { diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx b/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx index 0c54e84ead..0faa6653c7 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx +++ b/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx @@ -61,8 +61,6 @@ export type MultistepJsonFormProps = { /** * Creates the dynamic form for a scaffolder template. - * - * @public */ export const MultistepJsonForm = (props: MultistepJsonFormProps) => { const { diff --git a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.test.tsx b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.test.tsx index 6090ae370d..d35b561f2b 100644 --- a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.test.tsx +++ b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.test.tsx @@ -22,15 +22,12 @@ import { ScaffolderApi } from '../../types'; import { rootRouteRef } from '../../routes'; import { TemplatePage } from './TemplatePage'; import { - BackstagePlugin, - errorApiRef, - FeatureFlagsApi, featureFlagsApiRef, - PluginProvider, + FeatureFlagsApi, } from '@backstage/core-plugin-api'; import { ApiProvider } from '@backstage/core-app-api'; -import { lastStepFormComponent } from '../MultistepJsonForm'; +import { errorApiRef } from '@backstage/core-plugin-api'; jest.mock('react-router-dom', () => { return { @@ -110,12 +107,6 @@ const apis = TestApiRegistry.from( [featureFlagsApiRef, featureFlagsApiMock], ); -const plugin = { - getPluginOptions: () => ({ - lastStepFormComponent, - }), -} as unknown as BackstagePlugin; - describe('TemplatePage', () => { beforeEach(() => jest.resetAllMocks()); @@ -126,9 +117,7 @@ describe('TemplatePage', () => { }); const rendered = await renderInTestApp( - - - + , { mountedRoutes: { @@ -230,9 +219,7 @@ describe('TemplatePage', () => { const { findByText, findByLabelText, findAllByRole, findByRole } = await renderInTestApp( - - - + , { mountedRoutes: { @@ -276,9 +263,7 @@ describe('TemplatePage', () => { const { queryByText } = await renderInTestApp( - - - + , { mountedRoutes: { diff --git a/plugins/scaffolder/src/components/types.ts b/plugins/scaffolder/src/components/types.ts index 9717db97a8..ee5efdbeee 100644 --- a/plugins/scaffolder/src/components/types.ts +++ b/plugins/scaffolder/src/components/types.ts @@ -19,8 +19,6 @@ import { JsonObject } from '@backstage/types'; /** * The props for the Step in scaffolder template. - * - * @public */ export type Step = { schema: JsonObject; diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index 12aa8e28ec..e68eece8e5 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -67,10 +67,6 @@ export type { TaskPageProps } from './components/TaskPage'; export { NextScaffolderPage } from './plugin'; export type { NextRouterProps } from './next'; export type { TemplateGroupFilter } from './next'; -export type { - ScaffolderInputPluginOptionsOptions, - ScaffolderPluginOptions, -} from './options'; export { createNextScaffolderFieldExtension, type NextCustomFieldValidator, diff --git a/plugins/scaffolder/src/options.ts b/plugins/scaffolder/src/options.ts deleted file mode 100644 index 90cdd9ba2a..0000000000 --- a/plugins/scaffolder/src/options.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2020 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. - */ - -import { usePluginOptions } from '@backstage/core-plugin-api'; -import { ReactElement } from 'react'; -import { LastStepFormProps } from './components'; - -/** - * Scaffolder Plugin options to override default plugin behavior. - * - * @public - */ -export type ScaffolderPluginOptions = { - lastStepFormComponent: (props: LastStepFormProps) => ReactElement; -}; - -/** - * Scaffolder Plugin options to override default plugin behavior. - * - * @public - */ -export type ScaffolderInputPluginOptionsOptions = { - lastStepFormComponent: (props: LastStepFormProps) => ReactElement; -}; - -export const useScaffolderPluginOptions = () => - usePluginOptions(); diff --git a/plugins/scaffolder/src/plugin.tsx b/plugins/scaffolder/src/plugin.tsx index 324bd1bf28..670ed37ad9 100644 --- a/plugins/scaffolder/src/plugin.tsx +++ b/plugins/scaffolder/src/plugin.tsx @@ -39,11 +39,6 @@ import { } from '@backstage/core-plugin-api'; import { OwnedEntityPicker } from './components/fields/OwnedEntityPicker/OwnedEntityPicker'; import { EntityTagsPicker } from './components/fields/EntityTagsPicker/EntityTagsPicker'; -import { - ScaffolderInputPluginOptionsOptions, - ScaffolderPluginOptions, -} from './options'; -import { lastStepFormComponent } from './components'; /** * The main plugin export for the scaffolder. @@ -76,14 +71,6 @@ export const scaffolderPlugin = createPlugin({ registerComponent: registerComponentRouteRef, viewTechDoc: viewTechDocRouteRef, }, - __experimentalConfigure( - options?: ScaffolderInputPluginOptionsOptions, - ): ScaffolderPluginOptions { - const defaultOptions = { - lastStepFormComponent, - }; - return { ...defaultOptions, ...options }; - }, }); /**