Make last step (a summary page of scaffolder template) configurable.
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -20,6 +20,12 @@ import { Step } from './types';
|
||||
import { UiSchema } from '@rjsf/core';
|
||||
import { JsonObject } from '@backstage/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;
|
||||
finishButtonLabel?: string;
|
||||
@@ -84,6 +90,12 @@ export function getReviewData(formData: Record<string, any>, steps: Step[]) {
|
||||
return reviewData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
disableButtons,
|
||||
@@ -123,6 +135,11 @@ export const LastStepForm = (props: LastStepFormProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates LastStepForm from provided properties.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const lastStepFormComponent = (props: LastStepFormProps) => (
|
||||
<LastStepForm {...props} />
|
||||
);
|
||||
|
||||
@@ -53,6 +53,11 @@ type Props = {
|
||||
layouts: LayoutOptions[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the dynamic form for a scaffolder template.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const MultistepJsonForm = (props: Props) => {
|
||||
const {
|
||||
formData,
|
||||
|
||||
@@ -16,3 +16,4 @@
|
||||
export { MultistepJsonForm } from './MultistepJsonForm';
|
||||
export { lastStepFormComponent, LastStepForm } from './LastStepForm';
|
||||
export type { LastStepFormProps } from './LastStepForm';
|
||||
export type { Step } from './types';
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
import { FormProps } from '@rjsf/core';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
|
||||
/**
|
||||
* The props for the Step in scaffolder template.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type Step = {
|
||||
schema: JsonObject;
|
||||
title: string;
|
||||
|
||||
@@ -19,3 +19,4 @@ export { TemplateTypePicker } from './TemplateTypePicker';
|
||||
export * from './secrets';
|
||||
export { TaskPage } from './TaskPage';
|
||||
export type { RouterProps } from './Router';
|
||||
export * from './MultistepJsonForm';
|
||||
|
||||
@@ -67,6 +67,10 @@ 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,
|
||||
|
||||
@@ -16,13 +16,22 @@
|
||||
|
||||
import { usePluginOptions } from '@backstage/core-plugin-api';
|
||||
import { ReactElement } from 'react';
|
||||
import { LastStepFormProps } from './components/MultistepJsonForm';
|
||||
import { LastStepFormProps } from './components';
|
||||
|
||||
/**
|
||||
* Scaffolder Plugin options to override default plugin behavior.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ScaffolderPluginOptions = {
|
||||
lastStepFormComponent: (props: LastStepFormProps) => ReactElement;
|
||||
};
|
||||
|
||||
/** @ignore */
|
||||
/**
|
||||
* Scaffolder Plugin options to override default plugin behavior.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ScaffolderInputPluginOptionsOptions = {
|
||||
lastStepFormComponent: (props: LastStepFormProps) => ReactElement;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
ScaffolderInputPluginOptionsOptions,
|
||||
ScaffolderPluginOptions,
|
||||
} from './options';
|
||||
import { lastStepFormComponent } from './components/MultistepJsonForm';
|
||||
import { lastStepFormComponent } from './components';
|
||||
|
||||
/**
|
||||
* The main plugin export for the scaffolder.
|
||||
|
||||
Reference in New Issue
Block a user