diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx index 10bc593cf9..a9f96d8d09 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx @@ -22,20 +22,14 @@ import { Header, Page, ErrorPage, - Button, - ItemCardGrid, - ItemCardHeader, } from '@backstage/core'; import { scaffolderApiRef } from '../../api'; import { - Card, - CardMedia, - CardContent, - CardActions, Typography, Paper, Table, TableBody, + Box, TableCell, TableContainer, TableHead, @@ -44,11 +38,35 @@ import { } from '@material-ui/core'; import { JSONSchema } from '@backstage/catalog-model'; -const useStyles = makeStyles({ +const useStyles = makeStyles(theme => ({ table: { // minWidth: 650, }, -}); + + code: { + fontFamily: 'Menlo, monospaced', + padding: theme.spacing(1), + backgroundColor: + theme.palette.type === 'dark' + ? theme.palette.grey[700] + : theme.palette.grey[300], + display: 'inline-block', + borderRadius: 5, + border: `1px solid ${theme.palette.grey[500]}`, + position: 'relative', + }, + + codeRequired: { + '&::after': { + position: 'absolute', + content: '"*"', + top: 0, + right: theme.spacing(0.5), + fontWeight: 'bolder', + color: theme.palette.error.light, + }, + }, +})); export const ActionsPage = () => { const api = useApi(scaffolderApiRef); @@ -80,64 +98,65 @@ export const ActionsPage = () => { return Object.entries(properties).map(entry => { const [key, props] = entry; const isRequired = required.includes(key); + + const codeClassname = `${classes.code} ${ + isRequired ? classes.codeRequired : '' + }`; return ( - {key} - {isRequired && *} +
{key}
{props.title} {props.description} - {props.type} + + {props.type} +
); }); }; + const renderTable = (input: JSONSchema) => { + return ( + + + + + Name + Title + Description + Type + + + {formatRows(input)} +
+
+ ); + }; + const items = value?.map(action => { if (action.id.startsWith('legacy:')) { return undefined; } return ( - <> - {action.id} + + + {action.id} + {action.schema?.input && ( - <> + Input - - - - - Name - Title - Description - Type - - - {formatRows(action.schema?.input)} -
-
- + {renderTable(action.schema.input)} +
)} {action.schema?.output && ( - <> + Output - - - - - Name - Title - Description - Type - - - {formatRows(action.schema?.output)} -
-
- + {renderTable(action.schema.output)} +
)} - +
); });