Skip to content

Commit

Permalink
feat(scaffolder): add support for field extensions in entity-scaffold…
Browse files Browse the repository at this point in the history
…er-content (#68)
  • Loading branch information
roope-t authored Sep 24, 2024
1 parent 9d30f86 commit f48e47b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugins/entity-scaffolder-content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const systemPage = (
<EntityScaffolderContent
templateGroupFilters={[
// We show all resource templates that have the label `forEntity:system``
// on our systen EntityPage
// on our system EntityPage
{
title: 'Resources',
filter: (_, template) =>
Expand All @@ -51,6 +51,11 @@ const systemPage = (
},
]}
buildInitialState={entity => ({ system: stringifyEntityRef(entity) })}
ScaffolderFieldExtensions={
<ScaffolderFieldExtensions>
{/* Any field extensions you need */}
</ScaffolderFieldExtensions>
}
/>
</EntityLayout.Route>
</EntityLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type EntityScaffolderContentProps = {
entity: Entity,
template: TemplateEntityV1beta3,
) => Record<string, JsonValue>;
ScaffolderFieldExtensions?: React.ReactNode;
};

/**
Expand All @@ -42,6 +43,7 @@ export type EntityScaffolderContentProps = {
export const EntityScaffolderContent = ({
templateGroupFilters,
buildInitialState,
ScaffolderFieldExtensions,
}: EntityScaffolderContentProps) => {
const { entity } = useEntity();
const [selectedTemplate, setSelectedTemplate] =
Expand All @@ -64,7 +66,9 @@ export const EntityScaffolderContent = ({
onError={(error: Error | undefined) => (
<h2>{error?.message ?? 'Error running workflow'}</h2>
)}
/>
>
{ScaffolderFieldExtensions ?? null}
</EmbeddedScaffolderWorkflow>
<Button
variant="contained"
color="primary"
Expand Down

0 comments on commit f48e47b

Please sign in to comment.