feat: adds last commit and its status to the github-pull-requests-board
Signed-off-by: Josh Uvi <joshuauvbiekpahor@gmail.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
"@backstage/plugin-gcalendar": "workspace:^",
|
||||
"@backstage/plugin-gcp-projects": "workspace:^",
|
||||
"@backstage/plugin-github-actions": "workspace:^",
|
||||
"@backstage/plugin-github-pull-requests-board": "workspace:^",
|
||||
"@backstage/plugin-gocd": "workspace:^",
|
||||
"@backstage/plugin-graphiql": "workspace:^",
|
||||
"@backstage/plugin-home": "workspace:^",
|
||||
|
||||
@@ -185,6 +185,7 @@ import {
|
||||
isLinguistAvailable,
|
||||
EntityLinguistCard,
|
||||
} from '@backstage/plugin-linguist';
|
||||
import { EntityTeamPullRequestsContent } from '@backstage/plugin-github-pull-requests-board';
|
||||
|
||||
const customEntityFilterKind = ['Component', 'API', 'System'];
|
||||
|
||||
@@ -809,6 +810,9 @@ const groupPage = (
|
||||
</Grid>
|
||||
</Grid>
|
||||
</EntityLayout.Route>
|
||||
<EntityLayout.Route path="/pull-requests" title="Pull Requests">
|
||||
<EntityTeamPullRequestsContent />
|
||||
</EntityLayout.Route>
|
||||
</EntityLayoutWrapper>
|
||||
);
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@ export const useGetPullRequestDetails = () => {
|
||||
state
|
||||
}
|
||||
}
|
||||
commits(last: 1) {
|
||||
nodes {
|
||||
commit {
|
||||
statusCheckRollup {
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mergeable
|
||||
state
|
||||
reviewDecision
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import React, { PropsWithChildren, FunctionComponent } from 'react';
|
||||
import { Box, Paper, CardActionArea } from '@material-ui/core';
|
||||
import CardHeader from './CardHeader';
|
||||
import { Label } from '../../utils/types';
|
||||
import { Label, Status } from '../../utils/types';
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
@@ -29,6 +29,7 @@ type Props = {
|
||||
isDraft: boolean;
|
||||
repositoryIsArchived: boolean;
|
||||
labels?: Label[];
|
||||
status: Status;
|
||||
};
|
||||
|
||||
const Card: FunctionComponent<PropsWithChildren<Props>> = (
|
||||
@@ -45,6 +46,7 @@ const Card: FunctionComponent<PropsWithChildren<Props>> = (
|
||||
isDraft,
|
||||
repositoryIsArchived,
|
||||
labels,
|
||||
status,
|
||||
children,
|
||||
} = props;
|
||||
|
||||
@@ -63,6 +65,7 @@ const Card: FunctionComponent<PropsWithChildren<Props>> = (
|
||||
isDraft={isDraft}
|
||||
repositoryIsArchived={repositoryIsArchived}
|
||||
labels={labels}
|
||||
status={status}
|
||||
/>
|
||||
{children}
|
||||
</Box>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { getElapsedTime } from '../../utils/functions';
|
||||
import { UserHeader } from '../UserHeader';
|
||||
import { DraftPrIcon } from '../icons/DraftPr';
|
||||
import UnarchiveIcon from '@material-ui/icons/Unarchive';
|
||||
import { Label } from '../../utils/types';
|
||||
import { Label, Status } from '../../utils/types';
|
||||
import { useFormClasses } from './styles';
|
||||
|
||||
type Props = {
|
||||
@@ -32,6 +32,7 @@ type Props = {
|
||||
isDraft: boolean;
|
||||
repositoryIsArchived: boolean;
|
||||
labels?: Label[];
|
||||
status: Status;
|
||||
};
|
||||
|
||||
const CardHeader: FunctionComponent<Props> = (props: Props) => {
|
||||
@@ -47,6 +48,7 @@ const CardHeader: FunctionComponent<Props> = (props: Props) => {
|
||||
isDraft,
|
||||
repositoryIsArchived,
|
||||
labels,
|
||||
status: commitStatus,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
@@ -86,6 +88,12 @@ const CardHeader: FunctionComponent<Props> = (props: Props) => {
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Box display="flex" alignItems="center" flexWrap="wrap" paddingTop={1}>
|
||||
<Typography variant="body2" component="p">
|
||||
Commit Status:{' '}
|
||||
<strong>{commitStatus.commit.statusCheckRollup.state}</strong>
|
||||
</Typography>
|
||||
</Box>
|
||||
{labels && (
|
||||
<Box display="flex" alignItems="center" flexWrap="wrap" paddingTop={1}>
|
||||
{labels.map(data => {
|
||||
|
||||
+5
@@ -87,6 +87,9 @@ const EntityTeamPullRequestsContent = (
|
||||
return <Progress />;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('pull - ', pullRequests);
|
||||
|
||||
return (
|
||||
<Grid container spacing={2}>
|
||||
{pullRequests.length ? (
|
||||
@@ -103,6 +106,7 @@ const EntityTeamPullRequestsContent = (
|
||||
author,
|
||||
url,
|
||||
latestReviews,
|
||||
commits,
|
||||
repository,
|
||||
isDraft,
|
||||
labels,
|
||||
@@ -125,6 +129,7 @@ const EntityTeamPullRequestsContent = (
|
||||
author={author}
|
||||
url={url}
|
||||
reviews={latestReviews.nodes}
|
||||
status={commits.nodes}
|
||||
repositoryName={repository.name}
|
||||
repositoryIsArchived={repository.isArchived}
|
||||
isDraft={isDraft}
|
||||
|
||||
+4
-1
@@ -19,7 +19,7 @@ import {
|
||||
getChangeRequests,
|
||||
getCommentedReviews,
|
||||
} from '../../utils/functions';
|
||||
import { Reviews, Author, Label } from '../../utils/types';
|
||||
import { Reviews, Author, Label, Status } from '../../utils/types';
|
||||
import { Card } from '../Card';
|
||||
import { UserHeaderList } from '../UserHeaderList';
|
||||
|
||||
@@ -30,6 +30,7 @@ type Props = {
|
||||
author: Author;
|
||||
url: string;
|
||||
reviews: Reviews;
|
||||
status: Status;
|
||||
repositoryName: string;
|
||||
repositoryIsArchived: boolean;
|
||||
isDraft: boolean;
|
||||
@@ -44,6 +45,7 @@ const PullRequestCard: FunctionComponent<Props> = (props: Props) => {
|
||||
author,
|
||||
url,
|
||||
reviews,
|
||||
status,
|
||||
repositoryName,
|
||||
repositoryIsArchived,
|
||||
isDraft,
|
||||
@@ -66,6 +68,7 @@ const PullRequestCard: FunctionComponent<Props> = (props: Props) => {
|
||||
isDraft={isDraft}
|
||||
repositoryIsArchived={repositoryIsArchived}
|
||||
labels={labels}
|
||||
status={status}
|
||||
>
|
||||
{!!approvedReviews.length && (
|
||||
<UserHeaderList
|
||||
|
||||
@@ -81,6 +81,14 @@ export type Label = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type Status = {
|
||||
commit: {
|
||||
statusCheckRollup: {
|
||||
state: 'SUCCESS' | 'FAILURE' | 'ERROR' | 'EXPECTED' | 'PENDING';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type PullRequest = {
|
||||
id: string;
|
||||
repository: Repository;
|
||||
@@ -90,6 +98,9 @@ export type PullRequest = {
|
||||
latestReviews: {
|
||||
nodes: Reviews;
|
||||
};
|
||||
commits: {
|
||||
nodes: Status;
|
||||
};
|
||||
mergeable: boolean;
|
||||
state: string;
|
||||
reviewDecision: ReviewDecision | null;
|
||||
|
||||
@@ -6970,7 +6970,7 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-github-pull-requests-board@workspace:plugins/github-pull-requests-board":
|
||||
"@backstage/plugin-github-pull-requests-board@workspace:^, @backstage/plugin-github-pull-requests-board@workspace:plugins/github-pull-requests-board":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-github-pull-requests-board@workspace:plugins/github-pull-requests-board"
|
||||
dependencies:
|
||||
@@ -27139,6 +27139,7 @@ __metadata:
|
||||
"@backstage/plugin-gcalendar": "workspace:^"
|
||||
"@backstage/plugin-gcp-projects": "workspace:^"
|
||||
"@backstage/plugin-github-actions": "workspace:^"
|
||||
"@backstage/plugin-github-pull-requests-board": "workspace:^"
|
||||
"@backstage/plugin-gocd": "workspace:^"
|
||||
"@backstage/plugin-graphiql": "workspace:^"
|
||||
"@backstage/plugin-home": "workspace:^"
|
||||
|
||||
Reference in New Issue
Block a user