diff --git a/plugins/circleci/src/components/ActionOutput/ActionOutput.tsx b/plugins/circleci/src/components/ActionOutput/ActionOutput.tsx index 79f8954a73..b8d1564040 100644 --- a/plugins/circleci/src/components/ActionOutput/ActionOutput.tsx +++ b/plugins/circleci/src/components/ActionOutput/ActionOutput.tsx @@ -1,14 +1,47 @@ import React, { useEffect, useState, FC } from 'react'; +import { + ExpansionPanel, + ExpansionPanelSummary, + Typography, + ExpansionPanelDetails, +} from '@material-ui/core'; -export const ActionOutput: FC<{ url: string }> = ({ url }) => { - //@ts-ignore +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import { BuildStepAction } from 'circleci-api'; + +export const ActionOutput: FC<{ + url: string; + name: string; + action: BuildStepAction; +}> = ({ url, name }) => { const [messages, setMessages] = useState([]); useEffect(() => { fetch(url) .then(res => res.json()) - .then((messages) => { - messages && setMessages(messages.map(({message}: {message: string}) => message)) - }); + .then(actionOutput => { + actionOutput && + setMessages( + actionOutput.map(({ message }: { message: string }) => message), + ); + }); }, [url]); - return
{messages}
; + console.log(messages); + return ( + + } + aria-controls="panel1a-content" + id="panel1a-header" + > + {name} + + + {messages.length === 0 + ? 'Nothing here...' + : messages.map(message => ( +

{message}

+ ))} +
+
+ ); }; diff --git a/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx b/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx index ce1b87b36a..53fe2fea3e 100644 --- a/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx +++ b/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx @@ -1,6 +1,6 @@ import React, { FC } from 'react'; import { Content, InfoCard, useApi } from '@backstage/core'; -import { Grid, List, ListItem } from '@material-ui/core'; +import { Grid, Box } from '@material-ui/core'; import { PluginHeader } from 'components/PluginHeader'; import { BuildWithSteps, BuildStepAction } from 'circleci-api'; import { circleCIApiRef } from 'api'; @@ -37,8 +37,9 @@ export const DetailedViewPage: FC<{}> = () => { ) : ( - + + )} @@ -47,27 +48,21 @@ export const DetailedViewPage: FC<{}> = () => { }; const BuildsList: FC<{ build: BuildWithSteps | null }> = ({ build }) => ( - + {build && build.steps && build.steps.map( ({ name, actions }: { name: string; actions: BuildStepAction[] }) => ( - - {name} -
- -
+ ), )} -
+ ); -const ActionsList: FC<{ actions: BuildStepAction[] }> = ({ actions }) => ( - +const ActionsList: FC<{ actions: BuildStepAction[], name: string }> = ({ actions, name }) => ( + {actions.map((action: BuildStepAction) => ( - - - + ))} - + );