prefill template content

Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
Paul Cowan
2022-12-08 15:59:28 +00:00
parent 1106b7ee04
commit e2789aea3d
3 changed files with 15 additions and 3 deletions
@@ -21,10 +21,14 @@ import {
} from '@backstage/plugin-scaffolder';
interface SecurityTabProps {
namespace: string;
templateName: string;
customExtensionsElement?: React.ReactNode;
}
export function SecurityTab({
namespace,
templateName,
customExtensionsElement = <></>,
}: SecurityTabProps): JSX.Element | null {
// eslint-disable-next-line no-alert
@@ -38,11 +42,17 @@ export function SecurityTab({
return (
<TemplateContent
namespace="default"
templateName="docs-template"
namespace={namespace}
templateName={templateName}
onComplete={onComplete}
onError={onError}
customFieldExtensions={fieldExtensions}
initialFormState={{
name: 'prefilled-name',
description: 'prefilled description',
owner: 'acme-corp',
repoUrl: 'github.com?owner=component&repo=component',
}}
/>
);
}
@@ -404,7 +404,7 @@ const overviewContent = (
const securityContent = (
<EntityLayout.Route path="/security" title="Security" if={showSecurityTab}>
<SecurityTab />
<SecurityTab namespace="default" templateName="docs-template" />
</EntityLayout.Route>
);
@@ -55,6 +55,7 @@ export interface TemplateWizardContentProps {
transformErrors?: ErrorTransformer;
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
onError(error: Error | undefined): JSX.Element | null;
initialFormState?: Record<string, JsonValue>;
}
export const TemplateWizardContent = (
@@ -107,6 +108,7 @@ export const TemplateWizardContent = (
extensions={props.customFieldExtensions}
onComplete={props.onComplete}
transformErrors={props.transformErrors}
initialFormState={props.initialFormState}
/>
</InfoCard>
)}