Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scaffolder): add support for field extensions in entity-scaffolder-content. #68

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading