@backstage-community/plugin-azure-devops 0.4.4 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/alpha/package.json +2 -2
- package/dist/alpha/plugin.esm.js +69 -0
- package/dist/alpha/plugin.esm.js.map +1 -0
- package/dist/alpha.esm.js +1 -68
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/AzureDevOpsApi.esm.js +8 -0
- package/dist/api/AzureDevOpsApi.esm.js.map +1 -0
- package/dist/{esm/AzureDevOpsApi-GBxs-uQ7.esm.js → api/AzureDevOpsClient.esm.js} +11 -36
- package/dist/api/AzureDevOpsClient.esm.js.map +1 -0
- package/dist/components/AzureGitTagsIcon/AzureGitTagsIcon.esm.js +7 -0
- package/dist/components/AzureGitTagsIcon/AzureGitTagsIcon.esm.js.map +1 -0
- package/dist/components/AzurePipelinesIcon/AzurePipelinesIcon.esm.js +27 -0
- package/dist/components/AzurePipelinesIcon/AzurePipelinesIcon.esm.js.map +1 -0
- package/dist/{esm/AzurePullRequestsIcon-DOAkj-X3.esm.js → components/AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js} +2 -2
- package/dist/components/AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js.map +1 -0
- package/dist/{esm/index-Bwu2-Sgs.esm.js → components/BuildTable/BuildTable.esm.js} +7 -107
- package/dist/components/BuildTable/BuildTable.esm.js.map +1 -0
- package/dist/components/EntityPageAzureGitTags/EntityPageAzureGitTags.esm.js +22 -0
- package/dist/components/EntityPageAzureGitTags/EntityPageAzureGitTags.esm.js.map +1 -0
- package/dist/components/EntityPageAzureGitTags/index.esm.js +2 -0
- package/dist/components/EntityPageAzureGitTags/index.esm.js.map +1 -0
- package/dist/components/EntityPageAzurePipelines/EntityPageAzurePipelines.esm.js +32 -0
- package/dist/components/EntityPageAzurePipelines/EntityPageAzurePipelines.esm.js.map +1 -0
- package/dist/components/EntityPageAzurePipelines/index.esm.js +2 -0
- package/dist/components/EntityPageAzurePipelines/index.esm.js.map +1 -0
- package/dist/components/EntityPageAzurePullRequests/EntityPageAzurePullRequests.esm.js +22 -0
- package/dist/components/EntityPageAzurePullRequests/EntityPageAzurePullRequests.esm.js.map +1 -0
- package/dist/components/EntityPageAzurePullRequests/index.esm.js +2 -0
- package/dist/components/EntityPageAzurePullRequests/index.esm.js.map +1 -0
- package/dist/components/GitTagTable/GitTagTable.esm.js +53 -0
- package/dist/components/GitTagTable/GitTagTable.esm.js.map +1 -0
- package/dist/components/PullRequestStatusButtonGroup/PullRequestStatusButtonGroup.esm.js +41 -0
- package/dist/components/PullRequestStatusButtonGroup/PullRequestStatusButtonGroup.esm.js.map +1 -0
- package/dist/components/PullRequestTable/PullRequestTable.esm.js +90 -0
- package/dist/components/PullRequestTable/PullRequestTable.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/PullRequestsPage.esm.js +79 -0
- package/dist/components/PullRequestsPage/PullRequestsPage.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/index.esm.js +6 -0
- package/dist/components/PullRequestsPage/index.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/AutoCompleteIcon/AutoCompleteIcon.esm.js +16 -0
- package/dist/components/PullRequestsPage/lib/AutoCompleteIcon/AutoCompleteIcon.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.esm.js +85 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.esm.js +10 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicy.esm.js +66 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicy.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewer.esm.js +33 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewer.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewers.esm.js +17 -0
- package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardReviewers.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestGrid/PullRequestGrid.esm.js +29 -0
- package/dist/components/PullRequestsPage/lib/PullRequestGrid/PullRequestGrid.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/PullRequestGridColumn/PullRequestGridColumn.esm.js +50 -0
- package/dist/components/PullRequestsPage/lib/PullRequestGridColumn/PullRequestGridColumn.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/allFilter.esm.js +6 -0
- package/dist/components/PullRequestsPage/lib/filters/allFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamFilter.esm.js +17 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamsFilter.esm.js +20 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamsFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToUserFilter.esm.js +20 -0
- package/dist/components/PullRequestsPage/lib/filters/assignedToUserFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/createFilter.esm.js +45 -0
- package/dist/components/PullRequestsPage/lib/filters/createFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamFilter.esm.js +17 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamsFilter.esm.js +32 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamsFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByUserFilter.esm.js +18 -0
- package/dist/components/PullRequestsPage/lib/filters/createdByUserFilter.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/filters/types.esm.js +17 -0
- package/dist/components/PullRequestsPage/lib/filters/types.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/hooks/useFilterProcessor.esm.js +37 -0
- package/dist/components/PullRequestsPage/lib/hooks/useFilterProcessor.esm.js.map +1 -0
- package/dist/components/PullRequestsPage/lib/utils.esm.js +47 -0
- package/dist/components/PullRequestsPage/lib/utils.esm.js.map +1 -0
- package/dist/{esm/index-BJ_pWnMh.esm.js → components/ReadmeCard/ReadmeCard.esm.js} +8 -31
- package/dist/components/ReadmeCard/ReadmeCard.esm.js.map +1 -0
- package/dist/components/ReadmeCard/index.esm.js +2 -0
- package/dist/components/ReadmeCard/index.esm.js.map +1 -0
- package/dist/hooks/useBuildRuns.esm.js +37 -0
- package/dist/hooks/useBuildRuns.esm.js.map +1 -0
- package/dist/hooks/useDashboardPullRequests.esm.js +43 -0
- package/dist/hooks/useDashboardPullRequests.esm.js.map +1 -0
- package/dist/hooks/useGitTags.esm.js +30 -0
- package/dist/hooks/useGitTags.esm.js.map +1 -0
- package/dist/hooks/usePullRequests.esm.js +41 -0
- package/dist/hooks/usePullRequests.esm.js.map +1 -0
- package/dist/hooks/useReadme.esm.js +32 -0
- package/dist/hooks/useReadme.esm.js.map +1 -0
- package/dist/hooks/useUserEmail.esm.js +11 -0
- package/dist/hooks/useUserEmail.esm.js.map +1 -0
- package/dist/hooks/useUserTeamIds.esm.js +23 -0
- package/dist/hooks/useUserTeamIds.esm.js.map +1 -0
- package/dist/index.esm.js +7 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +68 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +17 -0
- package/dist/routes.esm.js.map +1 -0
- package/dist/utils/arrayHas.esm.js +15 -0
- package/dist/utils/arrayHas.esm.js.map +1 -0
- package/dist/utils/equalsIgnoreCase.esm.js +6 -0
- package/dist/utils/equalsIgnoreCase.esm.js.map +1 -0
- package/dist/{esm/getAnnotationValuesFromEntity-G8YVs-3R.esm.js → utils/getAnnotationValuesFromEntity.esm.js} +7 -8
- package/dist/utils/getAnnotationValuesFromEntity.esm.js.map +1 -0
- package/dist/utils/getDurationFromDates.esm.js +34 -0
- package/dist/utils/getDurationFromDates.esm.js.map +1 -0
- package/package.json +19 -13
- package/dist/esm/AzureDevOpsApi-GBxs-uQ7.esm.js.map +0 -1
- package/dist/esm/AzurePullRequestsIcon-DOAkj-X3.esm.js.map +0 -1
- package/dist/esm/PullRequestsPage-CkhRQsgx.esm.js +0 -610
- package/dist/esm/PullRequestsPage-CkhRQsgx.esm.js.map +0 -1
- package/dist/esm/getAnnotationValuesFromEntity-G8YVs-3R.esm.js.map +0 -1
- package/dist/esm/index-1Rl7C23d.esm.js +0 -102
- package/dist/esm/index-1Rl7C23d.esm.js.map +0 -1
- package/dist/esm/index-BJ_pWnMh.esm.js.map +0 -1
- package/dist/esm/index-Bo-6jkQA.esm.js +0 -178
- package/dist/esm/index-Bo-6jkQA.esm.js.map +0 -1
- package/dist/esm/index-Bwu2-Sgs.esm.js.map +0 -1
- package/dist/esm/index-W1pvc5vi.esm.js +0 -25
- package/dist/esm/index-W1pvc5vi.esm.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BuildTable } from '../BuildTable/BuildTable.esm.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import '../../api/AzureDevOpsApi.esm.js';
|
|
4
|
+
import '@backstage/errors';
|
|
5
|
+
import '@backstage/core-plugin-api';
|
|
6
|
+
import 'react-use/esm/useAsync';
|
|
7
|
+
import 'react-use/esm/useAsyncRetry';
|
|
8
|
+
import 'react-use/esm/useInterval';
|
|
9
|
+
import { azureDevOpsPipelineReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
10
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
11
|
+
import 'luxon';
|
|
12
|
+
import 'humanize-duration';
|
|
13
|
+
import { useBuildRuns } from '../../hooks/useBuildRuns.esm.js';
|
|
14
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
15
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
16
|
+
|
|
17
|
+
const EntityPageAzurePipelines = (props) => {
|
|
18
|
+
const { entity } = useEntity();
|
|
19
|
+
const { items, loading, error } = useBuildRuns(entity, props.defaultLimit);
|
|
20
|
+
return /* @__PURE__ */ React.createElement(
|
|
21
|
+
RequirePermission,
|
|
22
|
+
{
|
|
23
|
+
permission: azureDevOpsPipelineReadPermission,
|
|
24
|
+
resourceRef: stringifyEntityRef(entity),
|
|
25
|
+
errorPage: null
|
|
26
|
+
},
|
|
27
|
+
/* @__PURE__ */ React.createElement(BuildTable, { items, loading, error })
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { EntityPageAzurePipelines };
|
|
32
|
+
//# sourceMappingURL=EntityPageAzurePipelines.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPageAzurePipelines.esm.js","sources":["../../../src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BuildTable } from '../BuildTable/BuildTable';\nimport React from 'react';\nimport { useBuildRuns } from '../../hooks';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { azureDevOpsPipelineReadPermission } from '@backstage-community/plugin-azure-devops-common';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\n\nexport const EntityPageAzurePipelines = (props: { defaultLimit?: number }) => {\n const { entity } = useEntity();\n\n const { items, loading, error } = useBuildRuns(entity, props.defaultLimit);\n\n return (\n <RequirePermission\n permission={azureDevOpsPipelineReadPermission}\n resourceRef={stringifyEntityRef(entity)}\n errorPage={null}\n >\n <BuildTable items={items} loading={loading} error={error} />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwBa,MAAA,wBAAA,GAA2B,CAAC,KAAqC,KAAA;AAC5E,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAM,MAAA,EAAE,OAAO,OAAS,EAAA,KAAA,KAAU,YAAa,CAAA,MAAA,EAAQ,MAAM,YAAY,CAAA,CAAA;AAEzE,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,iCAAA;AAAA,MACZ,WAAA,EAAa,mBAAmB,MAAM,CAAA;AAAA,MACtC,SAAW,EAAA,IAAA;AAAA,KAAA;AAAA,oBAEV,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,OAAA,EAAkB,KAAc,EAAA,CAAA;AAAA,GAC5D,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { azureDevOpsPullRequestReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
import { PullRequestTable } from '../PullRequestTable/PullRequestTable.esm.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
5
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
7
|
+
|
|
8
|
+
const EntityPageAzurePullRequests = (props) => {
|
|
9
|
+
const { entity } = useEntity();
|
|
10
|
+
return /* @__PURE__ */ React.createElement(
|
|
11
|
+
RequirePermission,
|
|
12
|
+
{
|
|
13
|
+
permission: azureDevOpsPullRequestReadPermission,
|
|
14
|
+
resourceRef: stringifyEntityRef(entity),
|
|
15
|
+
errorPage: null
|
|
16
|
+
},
|
|
17
|
+
/* @__PURE__ */ React.createElement(PullRequestTable, { defaultLimit: props.defaultLimit })
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { EntityPageAzurePullRequests };
|
|
22
|
+
//# sourceMappingURL=EntityPageAzurePullRequests.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPageAzurePullRequests.esm.js","sources":["../../../src/components/EntityPageAzurePullRequests/EntityPageAzurePullRequests.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { azureDevOpsPullRequestReadPermission } from '@backstage-community/plugin-azure-devops-common';\nimport { PullRequestTable } from '../PullRequestTable/PullRequestTable';\nimport React from 'react';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport const EntityPageAzurePullRequests = (props: {\n defaultLimit?: number;\n}) => {\n const { entity } = useEntity();\n return (\n <RequirePermission\n permission={azureDevOpsPullRequestReadPermission}\n resourceRef={stringifyEntityRef(entity)}\n errorPage={null}\n >\n <PullRequestTable defaultLimit={props.defaultLimit} />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,2BAAA,GAA8B,CAAC,KAEtC,KAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,oCAAA;AAAA,MACZ,WAAA,EAAa,mBAAmB,MAAM,CAAA;AAAA,MACtC,SAAW,EAAA,IAAA;AAAA,KAAA;AAAA,oBAEV,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,YAAc,EAAA,KAAA,CAAM,YAAc,EAAA,CAAA;AAAA,GACtD,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Box from '@material-ui/core/Box';
|
|
2
|
+
import { ResponseErrorPanel, Table, Link } from '@backstage/core-components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { AzureGitTagsIcon } from '../AzureGitTagsIcon/AzureGitTagsIcon.esm.js';
|
|
5
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { useGitTags } from '../../hooks/useGitTags.esm.js';
|
|
7
|
+
|
|
8
|
+
const columns = [
|
|
9
|
+
{
|
|
10
|
+
title: "Tag",
|
|
11
|
+
field: "name",
|
|
12
|
+
highlight: false,
|
|
13
|
+
defaultSort: "desc",
|
|
14
|
+
width: "auto",
|
|
15
|
+
render: (row) => /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Link, { to: row.link ?? "" }, row.name))
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "Commit",
|
|
19
|
+
field: "peeledObjectId",
|
|
20
|
+
width: "auto",
|
|
21
|
+
render: (row) => /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Link, { to: row.commitLink ?? "" }, row.peeledObjectId))
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Created By",
|
|
25
|
+
field: "createdBy",
|
|
26
|
+
width: "auto"
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
const GitTagTable = () => {
|
|
30
|
+
const { entity } = useEntity();
|
|
31
|
+
const { items, loading, error } = useGitTags(entity);
|
|
32
|
+
if (error) {
|
|
33
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ React.createElement(
|
|
36
|
+
Table,
|
|
37
|
+
{
|
|
38
|
+
isLoading: loading,
|
|
39
|
+
columns,
|
|
40
|
+
options: {
|
|
41
|
+
search: true,
|
|
42
|
+
paging: true,
|
|
43
|
+
pageSize: 5,
|
|
44
|
+
showEmptyDataSourceMessage: !loading
|
|
45
|
+
},
|
|
46
|
+
title: /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(AzureGitTagsIcon, { style: { fontSize: 30 } }), /* @__PURE__ */ React.createElement(Box, { mr: 1 }), "Azure Repos - Git Tags (", items ? items.length : 0, ")"),
|
|
47
|
+
data: items ?? []
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { GitTagTable };
|
|
53
|
+
//# sourceMappingURL=GitTagTable.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitTagTable.esm.js","sources":["../../../src/components/GitTagTable/GitTagTable.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport {\n Link,\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { GitTag } from '@backstage-community/plugin-azure-devops-common';\nimport React from 'react';\n\nimport { AzureGitTagsIcon } from '../AzureGitTagsIcon';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { useGitTags } from '../../hooks/useGitTags';\n\nconst columns: TableColumn[] = [\n {\n title: 'Tag',\n field: 'name',\n highlight: false,\n defaultSort: 'desc',\n width: 'auto',\n render: (row: Partial<GitTag>) => (\n <Box display=\"flex\" alignItems=\"center\">\n <Link to={row.link ?? ''}>{row.name}</Link>\n </Box>\n ),\n },\n {\n title: 'Commit',\n field: 'peeledObjectId',\n width: 'auto',\n render: (row: Partial<GitTag>) => (\n <Box display=\"flex\" alignItems=\"center\">\n <Link to={row.commitLink ?? ''}>{row.peeledObjectId}</Link>\n </Box>\n ),\n },\n {\n title: 'Created By',\n field: 'createdBy',\n width: 'auto',\n },\n];\n\nexport const GitTagTable = () => {\n const { entity } = useEntity();\n\n const { items, loading, error } = useGitTags(entity);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <Table\n isLoading={loading}\n columns={columns}\n options={{\n search: true,\n paging: true,\n pageSize: 5,\n showEmptyDataSourceMessage: !loading,\n }}\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <AzureGitTagsIcon style={{ fontSize: 30 }} />\n <Box mr={1} />\n Azure Repos - Git Tags ({items ? items.length : 0})\n </Box>\n }\n data={items ?? []}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8BA,MAAM,OAAyB,GAAA;AAAA,EAC7B;AAAA,IACE,KAAO,EAAA,KAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,SAAW,EAAA,KAAA;AAAA,IACX,WAAa,EAAA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ACR,MAAQ,EAAA,IAAA;AAAA,QACR,QAAU,EAAA,CAAA;AAAA,QACV,4BAA4B,CAAC,OAAA;AAAA,OAC/B;AAAA,MACA,KAAA,kBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,OAAQ,EAAA,MAAA,EAAO,YAAW,QAC7B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBAAiB,EAAA,EAAA,KAAA,EAAO,EAAE,QAAA,EAAU,IAAM,EAAA,CAAA,kBAC1C,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,CAAE,EAAA,0BAAA,EACW,KAAQ,GAAA,KAAA,CAAM,MAAS,GAAA,CAAA,EAAE,GACpD,CAAA;AAAA,MAEF,IAAA,EAAM,SAAS,EAAC;AAAA,KAAA;AAAA,GAClB,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Button from '@material-ui/core/Button';
|
|
2
|
+
import ButtonGroup from '@material-ui/core/ButtonGroup';
|
|
3
|
+
import { PullRequestStatus } from '@backstage-community/plugin-azure-devops-common';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const PullRequestStatusButtonGroup = ({
|
|
7
|
+
status,
|
|
8
|
+
setStatus
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ React.createElement(ButtonGroup, { "aria-label": "outlined button group" }, /* @__PURE__ */ React.createElement(
|
|
11
|
+
Button,
|
|
12
|
+
{
|
|
13
|
+
color: status === PullRequestStatus.Active ? "primary" : "default",
|
|
14
|
+
onClick: () => {
|
|
15
|
+
setStatus(PullRequestStatus.Active);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"Active"
|
|
19
|
+
), /* @__PURE__ */ React.createElement(
|
|
20
|
+
Button,
|
|
21
|
+
{
|
|
22
|
+
color: status === PullRequestStatus.Completed ? "primary" : "default",
|
|
23
|
+
onClick: () => {
|
|
24
|
+
setStatus(PullRequestStatus.Completed);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"Completed"
|
|
28
|
+
), /* @__PURE__ */ React.createElement(
|
|
29
|
+
Button,
|
|
30
|
+
{
|
|
31
|
+
color: status === PullRequestStatus.Abandoned ? "primary" : "default",
|
|
32
|
+
onClick: () => {
|
|
33
|
+
setStatus(PullRequestStatus.Abandoned);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"Abandoned"
|
|
37
|
+
));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { PullRequestStatusButtonGroup };
|
|
41
|
+
//# sourceMappingURL=PullRequestStatusButtonGroup.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PullRequestStatusButtonGroup.esm.js","sources":["../../../src/components/PullRequestStatusButtonGroup/PullRequestStatusButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Button from '@material-ui/core/Button';\nimport ButtonGroup from '@material-ui/core/ButtonGroup';\n\nimport { PullRequestStatus } from '@backstage-community/plugin-azure-devops-common';\nimport React from 'react';\n\nexport const PullRequestStatusButtonGroup = ({\n status,\n setStatus,\n}: {\n status: PullRequestStatus;\n setStatus: (pullRequestStatus: PullRequestStatus) => void;\n}) => {\n return (\n <ButtonGroup aria-label=\"outlined button group\">\n <Button\n color={status === PullRequestStatus.Active ? 'primary' : 'default'}\n onClick={() => {\n setStatus(PullRequestStatus.Active);\n }}\n >\n Active\n </Button>\n <Button\n color={status === PullRequestStatus.Completed ? 'primary' : 'default'}\n onClick={() => {\n setStatus(PullRequestStatus.Completed);\n }}\n >\n Completed\n </Button>\n <Button\n color={status === PullRequestStatus.Abandoned ? 'primary' : 'default'}\n onClick={() => {\n setStatus(PullRequestStatus.Abandoned);\n }}\n >\n Abandoned\n </Button>\n </ButtonGroup>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,+BAA+B,CAAC;AAAA,EAC3C,MAAA;AAAA,EACA,SAAA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,YAAA,EAAW,uBACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,MAAA,KAAW,iBAAkB,CAAA,MAAA,GAAS,SAAY,GAAA,SAAA;AAAA,MACzD,SAAS,MAAM;AACb,QAAA,SAAA,CAAU,kBAAkB,MAAM,CAAA,CAAA;AAAA,OACpC;AAAA,KAAA;AAAA,IACD,QAAA;AAAA,GAGD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,MAAA,KAAW,iBAAkB,CAAA,SAAA,GAAY,SAAY,GAAA,SAAA;AAAA,MAC5D,SAAS,MAAM;AACb,QAAA,SAAA,CAAU,kBAAkB,SAAS,CAAA,CAAA;AAAA,OACvC;AAAA,KAAA;AAAA,IACD,WAAA;AAAA,GAGD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,MAAA,KAAW,iBAAkB,CAAA,SAAA,GAAY,SAAY,GAAA,SAAA;AAAA,MAC5D,SAAS,MAAM;AACb,QAAA,SAAA,CAAU,kBAAkB,SAAS,CAAA,CAAA;AAAA,OACvC;AAAA,KAAA;AAAA,IACD,WAAA;AAAA,GAGH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Box from '@material-ui/core/Box';
|
|
2
|
+
import Chip from '@material-ui/core/Chip';
|
|
3
|
+
import { ResponseErrorPanel, Table, Link } from '@backstage/core-components';
|
|
4
|
+
import { PullRequestStatus } from '@backstage-community/plugin-azure-devops-common';
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { AzurePullRequestsIcon } from '../AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js';
|
|
7
|
+
import { DateTime } from 'luxon';
|
|
8
|
+
import { PullRequestStatusButtonGroup } from '../PullRequestStatusButtonGroup/PullRequestStatusButtonGroup.esm.js';
|
|
9
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
10
|
+
import { usePullRequests } from '../../hooks/usePullRequests.esm.js';
|
|
11
|
+
|
|
12
|
+
const columns = [
|
|
13
|
+
{
|
|
14
|
+
title: "ID",
|
|
15
|
+
field: "pullRequestId",
|
|
16
|
+
highlight: false,
|
|
17
|
+
width: "auto"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "Title",
|
|
21
|
+
field: "title",
|
|
22
|
+
width: "auto",
|
|
23
|
+
render: (row) => /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Link, { to: row.link ?? "" }, row.title), row.isDraft && /* @__PURE__ */ React.createElement(Box, { paddingLeft: 1 }, /* @__PURE__ */ React.createElement(
|
|
24
|
+
Chip,
|
|
25
|
+
{
|
|
26
|
+
label: "Draft",
|
|
27
|
+
variant: "outlined",
|
|
28
|
+
color: "secondary",
|
|
29
|
+
size: "small"
|
|
30
|
+
}
|
|
31
|
+
)))
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: "Source",
|
|
35
|
+
field: "sourceRefName",
|
|
36
|
+
width: "auto"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Target",
|
|
40
|
+
field: "targetRefName",
|
|
41
|
+
width: "auto"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Created By",
|
|
45
|
+
field: "createdBy",
|
|
46
|
+
width: "auto"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: "Created",
|
|
50
|
+
field: "creationDate",
|
|
51
|
+
width: "auto",
|
|
52
|
+
render: (row) => (row.creationDate ? DateTime.fromISO(row.creationDate) : DateTime.now()).toRelative()
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const PullRequestTable = ({ defaultLimit }) => {
|
|
56
|
+
const [pullRequestStatusState, setPullRequestStatusState] = useState(PullRequestStatus.Active);
|
|
57
|
+
const { entity } = useEntity();
|
|
58
|
+
const { items, loading, error } = usePullRequests(
|
|
59
|
+
entity,
|
|
60
|
+
defaultLimit,
|
|
61
|
+
pullRequestStatusState
|
|
62
|
+
);
|
|
63
|
+
if (error) {
|
|
64
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ React.createElement(
|
|
67
|
+
Table,
|
|
68
|
+
{
|
|
69
|
+
isLoading: loading,
|
|
70
|
+
columns,
|
|
71
|
+
options: {
|
|
72
|
+
search: true,
|
|
73
|
+
paging: true,
|
|
74
|
+
pageSize: 5,
|
|
75
|
+
showEmptyDataSourceMessage: !loading
|
|
76
|
+
},
|
|
77
|
+
title: /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(AzurePullRequestsIcon, { style: { fontSize: 30 } }), /* @__PURE__ */ React.createElement(Box, { mr: 1 }), "Azure Repos - Pull Requests (", items ? items.length : 0, ")", /* @__PURE__ */ React.createElement(Box, { position: "absolute", right: 320, top: 20 }, /* @__PURE__ */ React.createElement(
|
|
78
|
+
PullRequestStatusButtonGroup,
|
|
79
|
+
{
|
|
80
|
+
status: pullRequestStatusState,
|
|
81
|
+
setStatus: setPullRequestStatusState
|
|
82
|
+
}
|
|
83
|
+
))),
|
|
84
|
+
data: items ?? []
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export { PullRequestTable };
|
|
90
|
+
//# sourceMappingURL=PullRequestTable.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PullRequestTable.esm.js","sources":["../../../src/components/PullRequestTable/PullRequestTable.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport {\n Link,\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport {\n PullRequest,\n PullRequestStatus,\n} from '@backstage-community/plugin-azure-devops-common';\nimport React, { useState } from 'react';\n\nimport { AzurePullRequestsIcon } from '../AzurePullRequestsIcon';\nimport { DateTime } from 'luxon';\nimport { PullRequestStatusButtonGroup } from '../PullRequestStatusButtonGroup';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { usePullRequests } from '../../hooks/usePullRequests';\n\nconst columns: TableColumn[] = [\n {\n title: 'ID',\n field: 'pullRequestId',\n highlight: false,\n width: 'auto',\n },\n {\n title: 'Title',\n field: 'title',\n width: 'auto',\n render: (row: Partial<PullRequest>) => (\n <Box display=\"flex\" alignItems=\"center\">\n <Link to={row.link ?? ''}>{row.title}</Link>\n {row.isDraft && (\n <Box paddingLeft={1}>\n <Chip\n label=\"Draft\"\n variant=\"outlined\"\n color=\"secondary\"\n size=\"small\"\n />\n </Box>\n )}\n </Box>\n ),\n },\n {\n title: 'Source',\n field: 'sourceRefName',\n width: 'auto',\n },\n {\n title: 'Target',\n field: 'targetRefName',\n width: 'auto',\n },\n {\n title: 'Created By',\n field: 'createdBy',\n width: 'auto',\n },\n {\n title: 'Created',\n field: 'creationDate',\n width: 'auto',\n render: (row: Partial<PullRequest>) =>\n (row.creationDate\n ? DateTime.fromISO(row.creationDate)\n : DateTime.now()\n ).toRelative(),\n },\n];\n\ntype PullRequestTableProps = {\n defaultLimit?: number;\n};\n\nexport const PullRequestTable = ({ defaultLimit }: PullRequestTableProps) => {\n const [pullRequestStatusState, setPullRequestStatusState] =\n useState<PullRequestStatus>(PullRequestStatus.Active);\n const { entity } = useEntity();\n\n const { items, loading, error } = usePullRequests(\n entity,\n defaultLimit,\n pullRequestStatusState,\n );\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <Table\n isLoading={loading}\n columns={columns}\n options={{\n search: true,\n paging: true,\n pageSize: 5,\n showEmptyDataSourceMessage: !loading,\n }}\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <AzurePullRequestsIcon style={{ fontSize: 30 }} />\n <Box mr={1} />\n Azure Repos - Pull Requests ({items ? items.length : 0})\n <Box position=\"absolute\" right={320} top={20}>\n <PullRequestStatusButtonGroup\n status={pullRequestStatusState}\n setStatus={setPullRequestStatusState}\n />\n </Box>\n </Box>\n }\n data={items ?? []}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAoCA,MAAM,OAAyB,GAAA;AAAA,EAC7B;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,KAAO,EAAA,eAAA;AAAA,IACP,SAAW,EAAA,KAAA;AAAA,IACX,KAAO,EAAA,MAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,OAAA;AAAA,IACP,KAAO,EAAA,OAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GACP,qBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,OAAQ,EAAA,MAAA,EAAO,UAAW,EAAA,QAAA,EAAA,kBAC5B,KAAA,CAA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;;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Page, Header, Content, Progress, ResponseErrorPanel } from '@backstage/core-components';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { getPullRequestGroupConfigs, getPullRequestGroups } from './lib/utils.esm.js';
|
|
4
|
+
import { FilterType } from './lib/filters/types.esm.js';
|
|
5
|
+
import 'luxon';
|
|
6
|
+
import 'humanize-duration';
|
|
7
|
+
import { azureDevOpsPullRequestDashboardReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
8
|
+
import { PullRequestGrid } from './lib/PullRequestGrid/PullRequestGrid.esm.js';
|
|
9
|
+
import '../../api/AzureDevOpsApi.esm.js';
|
|
10
|
+
import '@backstage/errors';
|
|
11
|
+
import '@backstage/core-plugin-api';
|
|
12
|
+
import 'react-use/esm/useAsync';
|
|
13
|
+
import { useDashboardPullRequests } from '../../hooks/useDashboardPullRequests.esm.js';
|
|
14
|
+
import '@backstage/catalog-model';
|
|
15
|
+
import { useFilterProcessor } from './lib/hooks/useFilterProcessor.esm.js';
|
|
16
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
17
|
+
|
|
18
|
+
const PullRequestsPageContent = ({
|
|
19
|
+
pullRequestGroups,
|
|
20
|
+
loading,
|
|
21
|
+
error
|
|
22
|
+
}) => {
|
|
23
|
+
if (loading && (!pullRequestGroups || pullRequestGroups.length <= 0)) {
|
|
24
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
25
|
+
}
|
|
26
|
+
if (error) {
|
|
27
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ React.createElement(PullRequestGrid, { pullRequestGroups: pullRequestGroups ?? [] });
|
|
30
|
+
};
|
|
31
|
+
const DEFAULT_COLUMN_CONFIGS = [
|
|
32
|
+
{
|
|
33
|
+
title: "Created by me",
|
|
34
|
+
filters: [{ type: FilterType.CreatedByCurrentUser }],
|
|
35
|
+
simplified: false
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "Other PRs",
|
|
39
|
+
filters: [{ type: FilterType.All }],
|
|
40
|
+
simplified: true
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
const PullRequestsPage = (props) => {
|
|
44
|
+
const { projectName, pollingInterval, defaultColumnConfigs, teamsLimit } = props;
|
|
45
|
+
const { pullRequests, loading, error } = useDashboardPullRequests(
|
|
46
|
+
projectName,
|
|
47
|
+
pollingInterval,
|
|
48
|
+
teamsLimit
|
|
49
|
+
);
|
|
50
|
+
const [columnConfigs] = useState(
|
|
51
|
+
defaultColumnConfigs ?? DEFAULT_COLUMN_CONFIGS
|
|
52
|
+
);
|
|
53
|
+
const filterProcessor = useFilterProcessor();
|
|
54
|
+
const pullRequestGroupConfigs = getPullRequestGroupConfigs(
|
|
55
|
+
columnConfigs,
|
|
56
|
+
filterProcessor
|
|
57
|
+
);
|
|
58
|
+
const pullRequestGroups = getPullRequestGroups(
|
|
59
|
+
pullRequests,
|
|
60
|
+
pullRequestGroupConfigs
|
|
61
|
+
);
|
|
62
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Azure Pull Requests" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(
|
|
63
|
+
RequirePermission,
|
|
64
|
+
{
|
|
65
|
+
permission: azureDevOpsPullRequestDashboardReadPermission
|
|
66
|
+
},
|
|
67
|
+
/* @__PURE__ */ React.createElement(
|
|
68
|
+
PullRequestsPageContent,
|
|
69
|
+
{
|
|
70
|
+
pullRequestGroups,
|
|
71
|
+
loading,
|
|
72
|
+
error
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
)));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { PullRequestsPage };
|
|
79
|
+
//# sourceMappingURL=PullRequestsPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PullRequestsPage.esm.js","sources":["../../../src/components/PullRequestsPage/PullRequestsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n Header,\n Page,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { PullRequestColumnConfig, PullRequestGroup } from './lib/types';\nimport React, { useState } from 'react';\nimport { getPullRequestGroupConfigs, getPullRequestGroups } from './lib/utils';\nimport { FilterType } from './lib/filters';\nimport { PullRequestGrid } from './lib/PullRequestGrid';\nimport { useDashboardPullRequests } from '../../hooks';\nimport { useFilterProcessor } from './lib/hooks';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { azureDevOpsPullRequestDashboardReadPermission } from '@backstage-community/plugin-azure-devops-common';\n\ntype PullRequestsPageContentProps = {\n pullRequestGroups: PullRequestGroup[] | undefined;\n loading: boolean;\n error?: Error;\n};\n\nconst PullRequestsPageContent = ({\n pullRequestGroups,\n loading,\n error,\n}: PullRequestsPageContentProps) => {\n if (loading && (!pullRequestGroups || pullRequestGroups.length <= 0)) {\n return <Progress />;\n }\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return <PullRequestGrid pullRequestGroups={pullRequestGroups ?? []} />;\n};\n\nconst DEFAULT_COLUMN_CONFIGS: PullRequestColumnConfig[] = [\n {\n title: 'Created by me',\n filters: [{ type: FilterType.CreatedByCurrentUser }],\n simplified: false,\n },\n {\n title: 'Other PRs',\n filters: [{ type: FilterType.All }],\n simplified: true,\n },\n];\n\ntype PullRequestsPageProps = {\n projectName?: string;\n pollingInterval?: number;\n defaultColumnConfigs?: PullRequestColumnConfig[];\n teamsLimit?: number;\n};\n\nexport const PullRequestsPage = (props: PullRequestsPageProps) => {\n const { projectName, pollingInterval, defaultColumnConfigs, teamsLimit } =\n props;\n\n const { pullRequests, loading, error } = useDashboardPullRequests(\n projectName,\n pollingInterval,\n teamsLimit,\n );\n\n const [columnConfigs] = useState(\n defaultColumnConfigs ?? DEFAULT_COLUMN_CONFIGS,\n );\n\n const filterProcessor = useFilterProcessor();\n\n const pullRequestGroupConfigs = getPullRequestGroupConfigs(\n columnConfigs,\n filterProcessor,\n );\n\n const pullRequestGroups = getPullRequestGroups(\n pullRequests,\n pullRequestGroupConfigs,\n );\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Azure Pull Requests\" />\n <Content>\n <RequirePermission\n permission={azureDevOpsPullRequestDashboardReadPermission}\n >\n <PullRequestsPageContent\n pullRequestGroups={pullRequestGroups}\n loading={loading}\n error={error}\n />\n </RequirePermission>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAuCA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,iBAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AACF,CAAoC,KAAA;AAClC,EAAA,IAAI,OAAY,KAAA,CAAC,iBAAqB,IAAA,iBAAA,CAAkB,UAAU,CAAI,CAAA,EAAA;AACpE,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA,CAAA;AAAA,GAC3C;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,EAAgB,iBAAmB,EAAA,iBAAA,IAAqB,EAAI,EAAA,CAAA,CAAA;AACtE,CAAA,CAAA;AAEA,MAAM,sBAAoD,GAAA;AAAA,EACxD;AAAA,IACE,KAAO,EAAA,eAAA;A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;AAAA,MAAA;AAAA,QACC,iBAAA;AAAA,QACA,OAAA;AAAA,QACA,KAAA;AAAA,OAAA;AAAA,KACF;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import DoneAllIcon from '@material-ui/icons/DoneAll';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
+
|
|
5
|
+
const useStyles = makeStyles((theme) => ({
|
|
6
|
+
root: (props) => ({
|
|
7
|
+
color: props.hasAutoComplete ? theme.palette.success.main : theme.palette.grey[400]
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
const AutoCompleteIcon = (props) => {
|
|
11
|
+
const classes = useStyles(props);
|
|
12
|
+
return /* @__PURE__ */ React.createElement(DoneAllIcon, { className: classes.root });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { AutoCompleteIcon };
|
|
16
|
+
//# sourceMappingURL=AutoCompleteIcon.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoCompleteIcon.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/AutoCompleteIcon/AutoCompleteIcon.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport DoneAllIcon from '@material-ui/icons/DoneAll';\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n root: (props: { hasAutoComplete: boolean }) => ({\n color: props.hasAutoComplete\n ? theme.palette.success.main\n : theme.palette.grey[400],\n }),\n}));\n\nexport const AutoCompleteIcon = (props: { hasAutoComplete: boolean }) => {\n const classes = useStyles(props);\n return <DoneAllIcon className={classes.root} />;\n};\n"],"names":[],"mappings":";;;;AAoBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAA,EAAM,CAAC,KAAyC,MAAA;AAAA,IAC9C,KAAA,EAAO,KAAM,CAAA,eAAA,GACT,KAAM,CAAA,OAAA,CAAQ,QAAQ,IACtB,GAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA,GAC5B,CAAA;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,gBAAA,GAAmB,CAAC,KAAwC,KAAA;AACvE,EAAM,MAAA,OAAA,GAAU,UAAU,KAAK,CAAA,CAAA;AAC/B,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,SAAW,EAAA,OAAA,CAAQ,IAAM,EAAA,CAAA,CAAA;AAC/C;;;;"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Link, Avatar } from '@backstage/core-components';
|
|
2
|
+
import Card from '@material-ui/core/Card';
|
|
3
|
+
import CardContent from '@material-ui/core/CardContent';
|
|
4
|
+
import CardHeader from '@material-ui/core/CardHeader';
|
|
5
|
+
import Typography from '@material-ui/core/Typography';
|
|
6
|
+
import { AutoCompleteIcon } from '../AutoCompleteIcon/AutoCompleteIcon.esm.js';
|
|
7
|
+
import { DateTime } from 'luxon';
|
|
8
|
+
import { PullRequestCardPolicies } from './PullRequestCardPolicies.esm.js';
|
|
9
|
+
import { PullRequestCardReviewers } from './PullRequestCardReviewers.esm.js';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
12
|
+
|
|
13
|
+
const useStyles = makeStyles(
|
|
14
|
+
(theme) => ({
|
|
15
|
+
card: {
|
|
16
|
+
backgroundColor: theme.palette.type === "dark" ? theme.palette.grey[700] : theme.palette.common.white
|
|
17
|
+
},
|
|
18
|
+
cardHeaderSimplified: {
|
|
19
|
+
paddingBottom: theme.spacing(2)
|
|
20
|
+
},
|
|
21
|
+
cardHeaderAction: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignSelf: "center",
|
|
24
|
+
margin: 0
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "row"
|
|
29
|
+
},
|
|
30
|
+
policies: {
|
|
31
|
+
flex: 1
|
|
32
|
+
},
|
|
33
|
+
avatar: { width: "2.5rem", height: "2.5rem" },
|
|
34
|
+
avatarText: { fontSize: "1rem" }
|
|
35
|
+
}),
|
|
36
|
+
{ name: "PullRequestCard" }
|
|
37
|
+
);
|
|
38
|
+
const PullRequestCard = ({
|
|
39
|
+
pullRequest,
|
|
40
|
+
simplified
|
|
41
|
+
}) => {
|
|
42
|
+
const classes = useStyles();
|
|
43
|
+
const title = /* @__PURE__ */ React.createElement(Link, { to: pullRequest.link ?? "", title: pullRequest.description }, pullRequest.title);
|
|
44
|
+
const repoLink = /* @__PURE__ */ React.createElement(Link, { to: pullRequest.repository?.url ?? "", color: "inherit" }, pullRequest.repository?.name);
|
|
45
|
+
const creationDate = pullRequest.creationDate ? DateTime.fromISO(pullRequest.creationDate).toRelative() : void 0;
|
|
46
|
+
const subheader = /* @__PURE__ */ React.createElement(Typography, { component: "span" }, repoLink, " \xB7 ", creationDate);
|
|
47
|
+
const avatar = /* @__PURE__ */ React.createElement(
|
|
48
|
+
Avatar,
|
|
49
|
+
{
|
|
50
|
+
displayName: pullRequest.createdBy?.displayName,
|
|
51
|
+
picture: pullRequest.createdBy?.imageUrl,
|
|
52
|
+
classes: { avatar: classes.avatar, avatarText: classes.avatarText }
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
return /* @__PURE__ */ React.createElement(
|
|
56
|
+
Card,
|
|
57
|
+
{
|
|
58
|
+
classes: { root: classes.card },
|
|
59
|
+
"data-pull-request-id": pullRequest.pullRequestId
|
|
60
|
+
},
|
|
61
|
+
/* @__PURE__ */ React.createElement(
|
|
62
|
+
CardHeader,
|
|
63
|
+
{
|
|
64
|
+
avatar,
|
|
65
|
+
title,
|
|
66
|
+
subheader,
|
|
67
|
+
action: /* @__PURE__ */ React.createElement(AutoCompleteIcon, { hasAutoComplete: pullRequest.hasAutoComplete }),
|
|
68
|
+
classes: {
|
|
69
|
+
...simplified && { root: classes.cardHeaderSimplified },
|
|
70
|
+
action: classes.cardHeaderAction
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
!simplified && /* @__PURE__ */ React.createElement(CardContent, { className: classes.content }, pullRequest.policies && /* @__PURE__ */ React.createElement(
|
|
75
|
+
PullRequestCardPolicies,
|
|
76
|
+
{
|
|
77
|
+
policies: pullRequest.policies,
|
|
78
|
+
className: classes.policies
|
|
79
|
+
}
|
|
80
|
+
), pullRequest.reviewers && /* @__PURE__ */ React.createElement(PullRequestCardReviewers, { reviewers: pullRequest.reviewers }))
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { PullRequestCard };
|
|
85
|
+
//# sourceMappingURL=PullRequestCard.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PullRequestCard.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Avatar, Link } from '@backstage/core-components';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Typography from '@material-ui/core/Typography';\n\nimport { AutoCompleteIcon } from '../AutoCompleteIcon';\nimport { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { DateTime } from 'luxon';\nimport { PullRequestCardPolicies } from './PullRequestCardPolicies';\nimport { PullRequestCardReviewers } from './PullRequestCardReviewers';\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(\n theme => ({\n card: {\n backgroundColor:\n theme.palette.type === 'dark'\n ? theme.palette.grey[700]\n : theme.palette.common.white,\n },\n cardHeaderSimplified: {\n paddingBottom: theme.spacing(2),\n },\n cardHeaderAction: {\n display: 'flex',\n alignSelf: 'center',\n margin: 0,\n },\n content: {\n display: 'flex',\n flexDirection: 'row',\n },\n policies: {\n flex: 1,\n },\n avatar: { width: '2.5rem', height: '2.5rem' },\n avatarText: { fontSize: '1rem' },\n }),\n { name: 'PullRequestCard' },\n);\n\ntype PullRequestCardProps = {\n pullRequest: DashboardPullRequest;\n simplified?: boolean;\n};\n\nexport const PullRequestCard = ({\n pullRequest,\n simplified,\n}: PullRequestCardProps) => {\n const classes = useStyles();\n\n const title = (\n <Link to={pullRequest.link ?? ''} title={pullRequest.description}>\n {pullRequest.title}\n </Link>\n );\n\n const repoLink = (\n <Link to={pullRequest.repository?.url ?? ''} color=\"inherit\">\n {pullRequest.repository?.name}\n </Link>\n );\n\n const creationDate = pullRequest.creationDate\n ? DateTime.fromISO(pullRequest.creationDate).toRelative()\n : undefined;\n\n const subheader = (\n <Typography component=\"span\">\n {repoLink} · {creationDate}\n </Typography>\n );\n\n const avatar = (\n <Avatar\n displayName={pullRequest.createdBy?.displayName}\n picture={pullRequest.createdBy?.imageUrl}\n classes={{ avatar: classes.avatar, avatarText: classes.avatarText }}\n />\n );\n\n return (\n <Card\n classes={{ root: classes.card }}\n data-pull-request-id={pullRequest.pullRequestId}\n >\n <CardHeader\n avatar={avatar}\n title={title}\n subheader={subheader}\n action={\n <AutoCompleteIcon hasAutoComplete={pullRequest.hasAutoComplete} />\n }\n classes={{\n ...(simplified && { root: classes.cardHeaderSimplified }),\n action: classes.cardHeaderAction,\n }}\n />\n\n {!simplified && (\n <CardContent className={classes.content}>\n {pullRequest.policies && (\n <PullRequestCardPolicies\n policies={pullRequest.policies}\n className={classes.policies}\n />\n )}\n\n {pullRequest.reviewers && (\n <PullRequestCardReviewers reviewers={pullRequest.reviewers} />\n )}\n </CardContent>\n )}\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,eACE,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,MACnB,GAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA,GACtB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,KAC7B;AAAA,IACA,oBAAsB,EAAA;AAAA,MACpB,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAChC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,OAAS,EAAA,MAAA;AAAA,MACT,SAAW,EAAA,QAAA;AAAA,MACX,MAAQ,EAAA,CAAA;AAAA,KACV;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,KACjB;AAAA,IACA,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,CAAA;AAAA,KACR;AAAA,IACA,MAAQ,EAAA,EAAE,KAAO,EAAA,QAAA,EAAU,QAAQ,QAAS,EAAA;AAAA,IAC5C,UAAA,EAAY,EAAE,Q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;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,IAAK,EAAA;AAAA,MAC9B,wBAAsB,WAAY,CAAA,aAAA;AAAA,KAAA;AAAA,oBAElC,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,KAAA;AAAA,QACA,SAAA;AAAA,QACA,MACE,kBAAA,KAAA,CAAA,aAAA,CAAC,gBAAiB,EAAA,EAAA,eAAA,EAAiB,YAAY,eAAiB,EAAA,CAAA;AAAA,QAElE,OAAS,EAAA;AAAA,UACP,GAAI,UAAA,IAAc,EAAE,IAAA,EAAM,QAAQ,oBAAqB,EAAA;AAAA,UACvD,QAAQ,OAAQ,CAAA,gBAAA;AAAA,SAClB;AAAA,OAAA;AAAA,KACF;AAAA,IAEC,CAAC,8BACC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,WAAW,OAAQ,CAAA,OAAA,EAAA,EAC7B,YAAY,QACX,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,uBAAA;AAAA,MAAA;AAAA,QACC,UAAU,WAAY,CAAA,QAAA;AAAA,QACtB,WAAW,OAAQ,CAAA,QAAA;AAAA,OAAA;AAAA,KACrB,EAGD,YAAY,SACX,oBAAA,KAAA,CAAA,aAAA,CAAC,4BAAyB,SAAW,EAAA,WAAA,CAAY,WAAW,CAEhE,CAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PullRequestCardPolicy } from './PullRequestCardPolicy.esm.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const PullRequestCardPolicies = ({
|
|
5
|
+
policies,
|
|
6
|
+
className
|
|
7
|
+
}) => /* @__PURE__ */ React.createElement("div", { className }, policies.map((policy) => /* @__PURE__ */ React.createElement(PullRequestCardPolicy, { key: policy.id, policy })));
|
|
8
|
+
|
|
9
|
+
export { PullRequestCardPolicies };
|
|
10
|
+
//# sourceMappingURL=PullRequestCardPolicies.esm.js.map
|
package/dist/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.esm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PullRequestCardPolicies.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/PullRequestCard/PullRequestCardPolicies.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Policy } from '@backstage-community/plugin-azure-devops-common';\nimport { PullRequestCardPolicy } from './PullRequestCardPolicy';\nimport React from 'react';\n\ntype PullRequestCardProps = {\n policies: Policy[];\n className: string;\n};\n\nexport const PullRequestCardPolicies = ({\n policies,\n className,\n}: PullRequestCardProps) => (\n <div className={className}>\n {policies.map(policy => (\n <PullRequestCardPolicy key={policy.id} policy={policy} />\n ))}\n </div>\n);\n"],"names":[],"mappings":";;;AAyBO,MAAM,0BAA0B,CAAC;AAAA,EACtC,QAAA;AAAA,EACA,SAAA;AACF,CAAA,qBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SACF,EAAA,EAAA,QAAA,CAAS,GAAI,CAAA,CAAA,MAAA,qBACX,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAsB,GAAK,EAAA,MAAA,CAAO,EAAI,EAAA,MAAA,EAAgB,CACxD,CACH;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PolicyType, PolicyEvaluationStatus } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
import { withStyles, styled } from '@material-ui/core/styles';
|
|
3
|
+
import Typography from '@material-ui/core/Typography';
|
|
4
|
+
import CancelIcon from '@material-ui/icons/Cancel';
|
|
5
|
+
import GroupWorkIcon from '@material-ui/icons/GroupWork';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import WatchLaterIcon from '@material-ui/icons/WatchLater';
|
|
8
|
+
|
|
9
|
+
const PolicyRequiredIcon = withStyles(
|
|
10
|
+
(theme) => ({
|
|
11
|
+
root: {
|
|
12
|
+
color: theme.palette.info.main
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
{ name: "PolicyRequiredIcon" }
|
|
16
|
+
)(WatchLaterIcon);
|
|
17
|
+
const PolicyIssueIcon = withStyles(
|
|
18
|
+
(theme) => ({
|
|
19
|
+
root: {
|
|
20
|
+
color: theme.palette.error.main
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
{ name: "PolicyIssueIcon" }
|
|
24
|
+
)(CancelIcon);
|
|
25
|
+
const PolicyInProgressIcon = withStyles(
|
|
26
|
+
(theme) => ({
|
|
27
|
+
root: {
|
|
28
|
+
color: theme.palette.info.main
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
{ name: "PolicyInProgressIcon" }
|
|
32
|
+
)(GroupWorkIcon);
|
|
33
|
+
function getPolicyIcon(policy) {
|
|
34
|
+
switch (policy.type) {
|
|
35
|
+
case PolicyType.Build:
|
|
36
|
+
switch (policy.status) {
|
|
37
|
+
case PolicyEvaluationStatus.Running:
|
|
38
|
+
return /* @__PURE__ */ React.createElement(PolicyInProgressIcon, null);
|
|
39
|
+
case PolicyEvaluationStatus.Rejected:
|
|
40
|
+
return /* @__PURE__ */ React.createElement(PolicyIssueIcon, null);
|
|
41
|
+
case PolicyEvaluationStatus.Queued:
|
|
42
|
+
return /* @__PURE__ */ React.createElement(PolicyRequiredIcon, null);
|
|
43
|
+
default:
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
case PolicyType.MinimumReviewers:
|
|
47
|
+
case PolicyType.RequiredReviewers:
|
|
48
|
+
return /* @__PURE__ */ React.createElement(PolicyRequiredIcon, null);
|
|
49
|
+
case PolicyType.Status:
|
|
50
|
+
case PolicyType.Comments:
|
|
51
|
+
return /* @__PURE__ */ React.createElement(PolicyIssueIcon, null);
|
|
52
|
+
default:
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const PullRequestCardPolicyContainer = styled("div")({
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
flexWrap: "wrap"
|
|
60
|
+
});
|
|
61
|
+
const PullRequestCardPolicy = ({
|
|
62
|
+
policy
|
|
63
|
+
}) => /* @__PURE__ */ React.createElement(PullRequestCardPolicyContainer, null, getPolicyIcon(policy), " ", /* @__PURE__ */ React.createElement(Typography, { component: "span" }, policy.text));
|
|
64
|
+
|
|
65
|
+
export { PullRequestCardPolicy };
|
|
66
|
+
//# sourceMappingURL=PullRequestCardPolicy.esm.js.map
|