From 16a15f276e6207566f7cb7e78311ca36180149d9 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 28 Mar 2026 17:42:02 +0100 Subject: [PATCH] scaffolder: fix actions page list and schema rendering issues Always show descriptions in the action list regardless of selection state, use MarkdownContent for the detail description, fix the isRowHeader error by always marking the first column, and move schema expansion content outside of the table to avoid broken nesting and scroll-jump issues. Subschemas (anyOf/oneOf) now render at full width inside a Flex column layout. Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .../components/ActionsPage/ActionsPage.tsx | 55 ++---- .../components/RenderSchema/RenderSchema.tsx | 179 ++++++++---------- 2 files changed, 102 insertions(+), 132 deletions(-) diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx index df8ca2d760..dd7bf334a1 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx @@ -23,9 +23,10 @@ import { EmptyState, ErrorPanel, Header, + MarkdownContent, Page, } from '@backstage/core-components'; -import { Box, Flex, List, ListRow, SearchField, Text } from '@backstage/ui'; +import { Flex, List, ListRow, SearchField, Text } from '@backstage/ui'; import { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha'; import { useNavigate } from 'react-router-dom'; import { @@ -185,9 +186,7 @@ export const ActionPageContent = () => { key={action.id} id={action.id} textValue={action.id} - description={ - selectedAction ? undefined : action.description ?? undefined - } + description={action.description ?? undefined} > {action.id} @@ -195,9 +194,13 @@ export const ActionPageContent = () => { ); - if (!selectedAction) { - return ( - + return ( + + { /> {listElement} - ); - } - - return ( - - - - - {listElement} - - - - - - {selectedAction.id} - - {selectedAction.description && ( - - {selectedAction.description} + {selectedAction && ( + + + + {selectedAction.id} - )} + {selectedAction.description && ( + + )} + + - - + )} ); }; diff --git a/plugins/scaffolder/src/components/RenderSchema/RenderSchema.tsx b/plugins/scaffolder/src/components/RenderSchema/RenderSchema.tsx index a195da7b60..4d5511876a 100644 --- a/plugins/scaffolder/src/components/RenderSchema/RenderSchema.tsx +++ b/plugins/scaffolder/src/components/RenderSchema/RenderSchema.tsx @@ -34,7 +34,7 @@ import { JSONSchema7Definition, JSONSchema7Type, } from 'json-schema'; -import { FC, Fragment, JSX } from 'react'; +import { FC, JSX } from 'react'; import { scaffolderTranslationRef } from '../../translation'; import { SchemaRenderContext, SchemaRenderStrategy } from './types'; @@ -313,111 +313,94 @@ export const RenderSchema = ({ const [isExpanded] = context.expanded; return ( - <> + {columns && elements && ( - - - {columns.map(col => ( - - {col.title} - - ))} - - - {elements.map(el => { - const id = generateId(el, context); - const info = inspectSchema(el.schema); - const hasDetails = - typeof el.schema !== 'boolean' && - (info.canSubschema || info.hasEnum); - - return ( - + <> + + + {columns.map((col, index) => ( + + {col.title} + + ))} + + + {elements.map(el => { + const id = generateId(el, context); + return ( {col => col.render(el, context)} - {hasDetails && - typeof el.schema !== 'boolean' && - (() => { - const s = el.schema as JSONSchema7; - const isOpen = !getTypes(s) || isExpanded[id]; - if (!isOpen) { - return null; - } - return ( - - {(col: ColumnDef) => - col.key === columns![0].key ? ( - - {info.canSubschema && ( - - )} - {info.hasEnum && ( - <> - - Valid values: - - - - )} - - ) : ( - - ) - } - - ); - })()} - - ); - })} - - + ); + })} + + + {elements.map(el => { + const id = generateId(el, context); + const info = inspectSchema(el.schema); + const hasDetails = + typeof el.schema !== 'boolean' && + (info.canSubschema || info.hasEnum); + if (!hasDetails || typeof el.schema === 'boolean') { + return null; + } + const s = el.schema as JSONSchema7; + const isOpen = !getTypes(s) || isExpanded[id]; + if (!isOpen) { + return null; + } + return ( +
+ {info.canSubschema && ( + + )} + {info.hasEnum && ( + <> + + Valid values: + + + + )} +
+ ); + })} + )} {(Object.keys(subschemas) as Array).map(sk => ( - + {sk} @@ -436,9 +419,9 @@ export const RenderSchema = ({ schema={sub} /> ))} - +
))} - +
); } return undefined;