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;