Incorporated the feedback
Signed-off-by: bnechyporenko <bnechyporenko@bol.com> Signed-off-by: bogdannechyporenko <bogdannechiporenko@gmail.com>
This commit is contained in:
@@ -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<string, any>, 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 {
|
||||
|
||||
@@ -61,8 +61,6 @@ export type MultistepJsonFormProps = {
|
||||
|
||||
/**
|
||||
* Creates the dynamic form for a scaffolder template.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const MultistepJsonForm = (props: MultistepJsonFormProps) => {
|
||||
const {
|
||||
|
||||
@@ -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(
|
||||
<ApiProvider apis={apis}>
|
||||
<PluginProvider plugin={plugin}>
|
||||
<TemplatePage />
|
||||
</PluginProvider>
|
||||
<TemplatePage />
|
||||
</ApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
@@ -230,9 +219,7 @@ describe('TemplatePage', () => {
|
||||
const { findByText, findByLabelText, findAllByRole, findByRole } =
|
||||
await renderInTestApp(
|
||||
<ApiProvider apis={apis}>
|
||||
<PluginProvider plugin={plugin}>
|
||||
<TemplatePage />
|
||||
</PluginProvider>
|
||||
<TemplatePage />
|
||||
</ApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
@@ -276,9 +263,7 @@ describe('TemplatePage', () => {
|
||||
|
||||
const { queryByText } = await renderInTestApp(
|
||||
<ApiProvider apis={apis}>
|
||||
<PluginProvider plugin={plugin}>
|
||||
<TemplatePage />
|
||||
</PluginProvider>
|
||||
<TemplatePage />
|
||||
</ApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
|
||||
@@ -19,8 +19,6 @@ import { JsonObject } from '@backstage/types';
|
||||
|
||||
/**
|
||||
* The props for the Step in scaffolder template.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type Step = {
|
||||
schema: JsonObject;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<ScaffolderPluginOptions>();
|
||||
@@ -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 };
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user