diff --git a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.tsx b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.tsx
index 85fc337aae..c7a472c082 100644
--- a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.tsx
+++ b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.tsx
@@ -19,6 +19,8 @@ import { Card, CardContent, CardHeader, Link } from '@material-ui/core';
import { AutoCompleteIcon } from '../AutoCompleteIcon';
import { Avatar } from '@backstage/core-components';
import { PullRequest } from '../../../../api/types';
+import { PullRequestCardPolicies } from './PullRequestCardPolicies';
+import { PullRequestCardReviewers } from './PullRequestCardReviewers';
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
@@ -33,15 +35,18 @@ const useStyles = makeStyles(
cardHeaderSimplified: {
paddingBottom: theme.spacing(2),
},
- content: {
- display: 'flex',
- flexDirection: 'row',
- },
cardHeaderAction: {
display: 'flex',
alignSelf: 'center',
margin: 0,
},
+ content: {
+ display: 'flex',
+ flexDirection: 'row',
+ },
+ policies: {
+ flex: 1,
+ },
}),
{ name: 'PullRequestCard' },
);
@@ -90,7 +95,16 @@ export const PullRequestCard = ({
}}
/>
- {!simplified && }
+ {!simplified && (
+
+
+
+
+
+ )}
);
};
diff --git a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.tsx b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.tsx
new file mode 100644
index 0000000000..eeb78b32f8
--- /dev/null
+++ b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.tsx
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2021 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {
+ PolicyInProgressIcon,
+ PolicyIssueIcon,
+ PolicyRequiredIcon,
+ PullRequestCardPolicy,
+} from './PullRequestCardPolicy';
+
+import { Policy } from '../../../../api/types';
+import React from 'react';
+
+function getPullRequestCardPolicy(policy: Policy): JSX.Element | null {
+ switch (policy.type) {
+ case 'Build':
+ switch (policy.status) {
+ case 'Running':
+ return (
+ }
+ />
+ );
+ case 'Rejected':
+ return (
+ } />
+ );
+ case 'Queued':
+ return (
+ }
+ />
+ );
+ default:
+ return null;
+ }
+ case 'MinimumReviewers':
+ return (
+ } />
+ );
+ case 'Status':
+ case 'Comments':
+ return (
+ } />
+ );
+ default:
+ return null;
+ }
+}
+
+type PullRequestCardProps = {
+ policies: Policy[];
+ className: string;
+};
+
+export const PullRequestCardPolicies = ({
+ policies,
+ className,
+}: PullRequestCardProps) => (
+
{policies.map(getPullRequestCardPolicy)}
+);
diff --git a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicy.tsx b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicy.tsx
new file mode 100644
index 0000000000..479c31f8c1
--- /dev/null
+++ b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicy.tsx
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2021 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { styled, withStyles } from '@material-ui/core/styles';
+
+import CancelIcon from '@material-ui/icons/Cancel';
+import GroupWorkIcon from '@material-ui/icons/GroupWork';
+import { Policy } from '../../../../api/types';
+import React from 'react';
+import WatchLaterIcon from '@material-ui/icons/WatchLater';
+
+export const PolicyRequiredIcon = withStyles(
+ theme => ({
+ root: {
+ color: theme.palette.info.main,
+ },
+ }),
+ { name: 'PolicyRequiredIcon' },
+)(WatchLaterIcon);
+
+export const PolicyIssueIcon = withStyles(
+ theme => ({
+ root: {
+ color: theme.palette.error.main,
+ },
+ }),
+ { name: 'PolicyIssueIcon' },
+)(CancelIcon);
+
+export const PolicyInProgressIcon = withStyles(
+ theme => ({
+ root: {
+ color: theme.palette.info.main,
+ },
+ }),
+ { name: 'PolicyInProgressIcon' },
+)(GroupWorkIcon);
+
+const PullRequestCardPolicyContainer = styled('div')({
+ display: 'flex',
+ alignItems: 'center',
+ flexWrap: 'wrap',
+});
+
+type PullRequestCardPolicyProps = {
+ policy: Policy;
+ icon: React.ReactNode;
+};
+
+export const PullRequestCardPolicy = ({
+ policy,
+ icon,
+}: PullRequestCardPolicyProps) => (
+
+ {icon} {policy.text}
+
+);
diff --git a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewer.tsx b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewer.tsx
new file mode 100644
index 0000000000..87dbb6118b
--- /dev/null
+++ b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewer.tsx
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2021 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Avatar } from '@backstage/core-components';
+import React from 'react';
+import { Reviewer } from '../../../../api/types';
+import { Tooltip } from '@material-ui/core';
+
+type PullRequestCardReviewerProps = {
+ reviewer: Reviewer;
+};
+
+export const PullRequestCardReviewer = ({
+ reviewer,
+}: PullRequestCardReviewerProps) => (
+
+
+
+);
diff --git a/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewers.tsx b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewers.tsx
new file mode 100644
index 0000000000..b46223e0cb
--- /dev/null
+++ b/plugins/azure-devops/src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewers.tsx
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2021 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { PullRequestCardReviewer } from './PullRequestCardReviewer';
+import React from 'react';
+import { Reviewer } from '../../../../api/types';
+import { styled } from '@material-ui/core/styles';
+
+const PullRequestCardReviewersContainer = styled('div')({
+ '& > *': {
+ marginTop: 4,
+ marginBottom: 4,
+ },
+});
+
+type PullRequestCardReviewersProps = {
+ reviewers: Reviewer[];
+};
+
+export const PullRequestCardReviewers = ({
+ reviewers,
+}: PullRequestCardReviewersProps) => (
+
+ {reviewers.map(reviewer => (
+
+ ))}
+
+);