diff --git a/.changeset/tiny-kangaroos-speak.md b/.changeset/tiny-kangaroos-speak.md new file mode 100644 index 0000000000..436466c82d --- /dev/null +++ b/.changeset/tiny-kangaroos-speak.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Show input type array correctly on installed actions page. diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.test.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.test.tsx index 8e2184edf1..02f3c066ca 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.test.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.test.tsx @@ -115,6 +115,48 @@ describe('TemplatePage', () => { expect(rendered.getByText('Test output')).toBeInTheDocument(); }); + it('renders action with multipel input types', async () => { + scaffolderApiMock.listActions.mockResolvedValue([ + { + id: 'test', + description: 'example description', + schema: { + input: { + type: 'object', + required: ['foobar'], + properties: { + foobar: { + title: 'Test title', + type: ['array', 'number'], + }, + }, + }, + output: { + type: 'object', + properties: { + buzz: { + title: 'Test output', + type: 'string', + }, + }, + }, + }, + }, + ]); + const rendered = await renderInTestApp( + + + , + { + mountedRoutes: { + '/create/actions': rootRouteRef, + }, + }, + ); + expect(rendered.getByText('array')).toBeInTheDocument(); + expect(rendered.getByText('number')).toBeInTheDocument(); + }); + it('renders action with oneOf input', async () => { scaffolderApiMock.listActions.mockResolvedValue([ { diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx index 78efaa43ff..29951d7cb1 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx @@ -22,6 +22,7 @@ import { Table, TableBody, Box, + Chip, TableCell, TableContainer, TableHead, @@ -107,7 +108,11 @@ export const ActionsPage = () => { {props.title} {props.description} - {props.type} + <> + {[props.type].flat().map(type => ( + + ))} + );