make onComplete not required

Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
Paul Cowan
2022-12-12 08:07:07 +00:00
parent 939ec15a2e
commit 997301c066
2 changed files with 9 additions and 3 deletions
@@ -25,7 +25,10 @@ import { Box, Button } from '@material-ui/core';
import type { JsonValue } from '@backstage/types';
import type { FormProps } from '@backstage/plugin-scaffolder-react';
type EmbeddedWorkflowProps = Omit<WorkflowProps, 'customFieldExtensions'> & {
type EmbeddedWorkflowProps = Omit<
WorkflowProps,
'customFieldExtensions' | 'onComplete'
> & {
customExtensionsElement?: React.ReactNode;
initialFormState?: Record<string, JsonValue>;
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
@@ -33,7 +36,7 @@ type EmbeddedWorkflowProps = Omit<WorkflowProps, 'customFieldExtensions'> & {
FormProps: FormProps
frontPage: ReactNode;
finishPage: ReactNode;
};
} & Partial<Pick<WorkflowProps, 'onComplete'>>;
type Display = 'front' | 'workflow' | 'finish';
@@ -26,9 +26,12 @@ const ReviewWrapper = () => {
);
};
/*
* This is an exmaple component that uses the <EmbeddedScaffolderWorkflow />
*/
export function SecurityTab(): JSX.Element | null {
// eslint-disable-next-line no-console
const onComplete = async () => console.log('onComplete called from ');
const onComplete = async () => console.log('we can add to onComplete here');
const onError = (error: Error | undefined) => (
<h2>{error?.message ?? 'Houston we have a problem.'}</h2>