diff --git a/.changeset/great-ways-switch.md b/.changeset/great-ways-switch.md new file mode 100644 index 0000000000..82ad1d7d26 --- /dev/null +++ b/.changeset/great-ways-switch.md @@ -0,0 +1,8 @@ +--- +'@backstage/plugin-github-pull-requests-board': patch +--- + +Add a new "Archived" Filter Options to the Github Pull Requests Dashboard. + +When toggling this option on, the dashboard will displays PRs in archived repositories. +These PRs will not be displayed in the default filter. diff --git a/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts b/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts index 3f818c63fc..a276c8fe9d 100644 --- a/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts +++ b/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts @@ -36,6 +36,7 @@ export const useGetPullRequestDetails = () => { owner { login } + isArchived } title url diff --git a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.tsx b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.tsx index 95d7745c62..ea605327ab 100644 --- a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.tsx +++ b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.tsx @@ -29,6 +29,7 @@ import { PRCardFormating } from '../../utils/types'; import { shouldDisplayCard } from '../../utils/functions'; import { DraftPrIcon } from '../icons/DraftPr'; import { useUserRepositoriesAndTeam } from '../../hooks/useUserRepositoriesAndTeam'; +import UnarchiveIcon from '@material-ui/icons/Unarchive'; /** @public */ export interface EntityTeamPullRequestsCardProps { @@ -71,6 +72,11 @@ const EntityTeamPullRequestsCard = (props: EntityTeamPullRequestsCardProps) => { value: 'draft', ariaLabel: 'Show draft PRs', }, + { + icon: , + value: 'archivedRepo', + ariaLabel: 'Show archived repos', + }, { icon: , value: 'fullscreen', @@ -127,6 +133,7 @@ const EntityTeamPullRequestsCard = (props: EntityTeamPullRequestsCardProps) => { url={url} reviews={latestReviews.nodes} repositoryName={repository.name} + repositoryIsArchived={repository.isArchived} isDraft={isDraft} /> ), diff --git a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx index 2b4c298e83..662e6f4265 100644 --- a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx +++ b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx @@ -27,6 +27,7 @@ import { PRCardFormating } from '../../utils/types'; import { shouldDisplayCard } from '../../utils/functions'; import { DraftPrIcon } from '../icons/DraftPr'; import { useUserRepositoriesAndTeam } from '../../hooks/useUserRepositoriesAndTeam'; +import UnarchiveIcon from '@material-ui/icons/Unarchive'; /** @public */ export interface EntityTeamPullRequestsContentProps { @@ -71,6 +72,11 @@ const EntityTeamPullRequestsContent = ( value: 'draft', ariaLabel: 'Show draft PRs', }, + { + icon: , + value: 'archivedRepo', + ariaLabel: 'Show archived repos', + }, ]} /> @@ -119,6 +125,7 @@ const EntityTeamPullRequestsContent = ( url={url} reviews={latestReviews.nodes} repositoryName={repository.name} + repositoryIsArchived={repository.isArchived} isDraft={isDraft} /> ), diff --git a/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx b/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx index 7e1596f5c2..51ee162555 100644 --- a/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx +++ b/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx @@ -31,6 +31,7 @@ type Props = { url: string; reviews: Reviews; repositoryName: string; + repositoryIsArchived: boolean; isDraft: boolean; }; @@ -43,6 +44,7 @@ const PullRequestCard: FunctionComponent = (props: Props) => { url, reviews, repositoryName, + repositoryIsArchived, isDraft, } = props; @@ -50,7 +52,11 @@ const PullRequestCard: FunctionComponent = (props: Props) => { const commentsReviews = getCommentedReviews(reviews); const changeRequests = getChangeRequests(reviews); - const cardTitle = isDraft ? `🔧 DRAFT - ${title}` : title; + // Resolved in this way to satisfy merge - Author: tylerhekman-procore + // This information should probably be moved into dedicated CardHeader fields + // instead of title prefixes + const cardTitleModifiers = [isDraft && '🔧 DRAFT', repositoryIsArchived && '📁 ARCHIVED'].filter(Boolean); + const cardTitle = cardTitleModifiers.length > 0 ? `(${cardTitleModifiers.join(' | ')}) - ${title}` : title; return (