prefill template content
Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user