-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add widget to show recent git workflow runs #2563
Conversation
render: data => ( | ||
<Link | ||
component={RouterLink} | ||
to={generatePath('./ci-cd/:id', { id: data.id! })} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link assumes that the Entity page in the user's application is configured like the sample app. It could be made more configurable down the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly one of the cases we are in the process of discussing how to solve moving forward! cc @Rugvip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! More info about the plan going forward in #2565
@@ -61,14 +62,15 @@ const CICDSwitcher = ({ entity }: { entity: Entity }) => { | |||
|
|||
const OverviewContent = ({ entity }: { entity: Entity }) => ( | |||
<Grid container spacing={3}> | |||
<Grid item> | |||
<Grid item md={6}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this entire item be surrounded with essentially if (isJenkinsAvailable(entity) || isGitHubActionsAvailable(entity))
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should most likely not be before the about card in the flow, by the way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted to the way it was before where each widget definition is separate.
|
||
beforeEach(() => { | ||
(useWorkflowRuns as jest.Mock).mockReturnValue([{ runs: workflowRuns }]); | ||
(useApi as jest.Mock).mockReturnValue(mockErrorApi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove this mocking, and instead inject it in the component tree when rendering - see this example https://github.com/spotify/backstage/blob/8b53edb47489cb9e60cfc25f9981e4bb066852a1/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.test.tsx#L49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, otherwise
export const RecentWorkflowRunsCard = ({ | ||
entity, | ||
branch, | ||
dense = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iain-b that does not look better. Let's stick with dense=false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good, let's nail those small comments and 🚢 it 😄
<JenkinsLatestRunCard branch="master" /> | ||
</Grid> | ||
)} | ||
{isGitHubActionsAvailable(entity) && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't you want to do something similar to the https://github.com/spotify/backstage/blob/309bd1750f06d01953da1b5ae6d845e97b85eb0c/packages/app/src/components/catalog/EntityPage.tsx#L43 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shmidt-i I could write something like:
const RecentCICDRunsSwitcher = ({ entity }: { entity: Entity }) => {
let content: ReactNode;
switch (true) {
case isJenkinsAvailable(entity):
content = <JenkinsLatestRunCard branch="master" />;
break;
case isGitHubActionsAvailable(entity):
content = <RecentWorkflowRunsCard entity={entity} />;
break;
default:
content = null;
}
if (!content) {
// Don't want to render the grid if there's no matching plugin
return null;
}
return (
<Grid item sm={6}>
{content}
</Grid>
);
};
What do you think? Seems a little overly specific to me but anything more generic is a bit beyond the scope of this pull request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ done
render: data => ( | ||
<Link | ||
component={RouterLink} | ||
to={generatePath('./ci-cd/:id', { id: data.id! })} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly one of the cases we are in the process of discussing how to solve moving forward! cc @Rugvip
Adds a widget to show recent git workflow runs to the github actions plugin. The default setting is the last 5 runs across all branches but both branch and the number of runs are configurable.
* Fix Entity Page layout * Fix mock api injection
* Add switcher for recent CI/CD widgets
12e9166
to
3b2e301
Compare
@shmidt-i can you take another look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, thanks!
Adds a widget to show recent git workflow runs to the github actions plugin. The default setting is the last 5 runs across all branches but both branch and the number of runs are configurable.
https://www.loom.com/share/db09c13f059843ceac09494a7b72199d
Hey, I just made a Pull Request!
✔️ Checklist
yarn test