@backstage-community/plugin-azure-devops 0.4.4
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 +1830 -0
- package/README.md +399 -0
- package/alpha/package.json +7 -0
- package/dist/alpha.d.ts +6 -0
- package/dist/alpha.esm.js +69 -0
- package/dist/alpha.esm.js.map +1 -0
- package/dist/esm/AzureDevOpsApi-GBxs-uQ7.esm.js +184 -0
- package/dist/esm/AzureDevOpsApi-GBxs-uQ7.esm.js.map +1 -0
- package/dist/esm/AzurePullRequestsIcon-DOAkj-X3.esm.js +63 -0
- package/dist/esm/AzurePullRequestsIcon-DOAkj-X3.esm.js.map +1 -0
- package/dist/esm/PullRequestsPage-CkhRQsgx.esm.js +610 -0
- package/dist/esm/PullRequestsPage-CkhRQsgx.esm.js.map +1 -0
- package/dist/esm/getAnnotationValuesFromEntity-G8YVs-3R.esm.js +84 -0
- package/dist/esm/getAnnotationValuesFromEntity-G8YVs-3R.esm.js.map +1 -0
- package/dist/esm/index-1Rl7C23d.esm.js +102 -0
- package/dist/esm/index-1Rl7C23d.esm.js.map +1 -0
- package/dist/esm/index-BJ_pWnMh.esm.js +110 -0
- package/dist/esm/index-BJ_pWnMh.esm.js.map +1 -0
- package/dist/esm/index-Bo-6jkQA.esm.js +178 -0
- package/dist/esm/index-Bo-6jkQA.esm.js.map +1 -0
- package/dist/esm/index-Bwu2-Sgs.esm.js +200 -0
- package/dist/esm/index-Bwu2-Sgs.esm.js.map +1 -0
- package/dist/esm/index-W1pvc5vi.esm.js +25 -0
- package/dist/esm/index-W1pvc5vi.esm.js.map +1 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.esm.js +95 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { PullRequestStatus, AZURE_DEVOPS_DEFAULT_TOP, azureDevOpsPullRequestReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
import Box from '@material-ui/core/Box';
|
|
3
|
+
import Chip from '@material-ui/core/Chip';
|
|
4
|
+
import { ResponseErrorPanel, Table, Link } from '@backstage/core-components';
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { A as AzurePullRequestsIcon } from './AzurePullRequestsIcon-DOAkj-X3.esm.js';
|
|
7
|
+
import { DateTime } from 'luxon';
|
|
8
|
+
import Button from '@material-ui/core/Button';
|
|
9
|
+
import ButtonGroup from '@material-ui/core/ButtonGroup';
|
|
10
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
11
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
12
|
+
import { a as azureDevOpsApiRef } from './AzureDevOpsApi-GBxs-uQ7.esm.js';
|
|
13
|
+
import '@backstage/errors';
|
|
14
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
15
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
16
|
+
import 'humanize-duration';
|
|
17
|
+
import { g as getAnnotationValuesFromEntity } from './getAnnotationValuesFromEntity-G8YVs-3R.esm.js';
|
|
18
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
19
|
+
import '@material-ui/core/SvgIcon';
|
|
20
|
+
|
|
21
|
+
function usePullRequests(entity, defaultLimit, requestedStatus, defaultTeamsLimit) {
|
|
22
|
+
const top = defaultLimit != null ? defaultLimit : AZURE_DEVOPS_DEFAULT_TOP;
|
|
23
|
+
const teamsLimit = defaultTeamsLimit != null ? defaultTeamsLimit : void 0;
|
|
24
|
+
const status = requestedStatus != null ? requestedStatus : PullRequestStatus.Active;
|
|
25
|
+
const options = {
|
|
26
|
+
top,
|
|
27
|
+
status,
|
|
28
|
+
teamsLimit
|
|
29
|
+
};
|
|
30
|
+
const api = useApi(azureDevOpsApiRef);
|
|
31
|
+
const { value, loading, error } = useAsync(() => {
|
|
32
|
+
const { project, repo, host, org } = getAnnotationValuesFromEntity(entity);
|
|
33
|
+
const entityRef = stringifyEntityRef(entity);
|
|
34
|
+
return api.getPullRequests(
|
|
35
|
+
project,
|
|
36
|
+
repo,
|
|
37
|
+
entityRef,
|
|
38
|
+
host,
|
|
39
|
+
org,
|
|
40
|
+
options
|
|
41
|
+
);
|
|
42
|
+
}, [api, top, status]);
|
|
43
|
+
return {
|
|
44
|
+
items: value == null ? void 0 : value.items,
|
|
45
|
+
loading,
|
|
46
|
+
error
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const PullRequestStatusButtonGroup = ({
|
|
51
|
+
status,
|
|
52
|
+
setStatus
|
|
53
|
+
}) => {
|
|
54
|
+
return /* @__PURE__ */ React.createElement(ButtonGroup, { "aria-label": "outlined button group" }, /* @__PURE__ */ React.createElement(
|
|
55
|
+
Button,
|
|
56
|
+
{
|
|
57
|
+
color: status === PullRequestStatus.Active ? "primary" : "default",
|
|
58
|
+
onClick: () => {
|
|
59
|
+
setStatus(PullRequestStatus.Active);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"Active"
|
|
63
|
+
), /* @__PURE__ */ React.createElement(
|
|
64
|
+
Button,
|
|
65
|
+
{
|
|
66
|
+
color: status === PullRequestStatus.Completed ? "primary" : "default",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
setStatus(PullRequestStatus.Completed);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"Completed"
|
|
72
|
+
), /* @__PURE__ */ React.createElement(
|
|
73
|
+
Button,
|
|
74
|
+
{
|
|
75
|
+
color: status === PullRequestStatus.Abandoned ? "primary" : "default",
|
|
76
|
+
onClick: () => {
|
|
77
|
+
setStatus(PullRequestStatus.Abandoned);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"Abandoned"
|
|
81
|
+
));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const columns = [
|
|
85
|
+
{
|
|
86
|
+
title: "ID",
|
|
87
|
+
field: "pullRequestId",
|
|
88
|
+
highlight: false,
|
|
89
|
+
width: "auto"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: "Title",
|
|
93
|
+
field: "title",
|
|
94
|
+
width: "auto",
|
|
95
|
+
render: (row) => {
|
|
96
|
+
var _a;
|
|
97
|
+
return /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Link, { to: (_a = row.link) != null ? _a : "" }, row.title), row.isDraft && /* @__PURE__ */ React.createElement(Box, { paddingLeft: 1 }, /* @__PURE__ */ React.createElement(
|
|
98
|
+
Chip,
|
|
99
|
+
{
|
|
100
|
+
label: "Draft",
|
|
101
|
+
variant: "outlined",
|
|
102
|
+
color: "secondary",
|
|
103
|
+
size: "small"
|
|
104
|
+
}
|
|
105
|
+
)));
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: "Source",
|
|
110
|
+
field: "sourceRefName",
|
|
111
|
+
width: "auto"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: "Target",
|
|
115
|
+
field: "targetRefName",
|
|
116
|
+
width: "auto"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: "Created By",
|
|
120
|
+
field: "createdBy",
|
|
121
|
+
width: "auto"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: "Created",
|
|
125
|
+
field: "creationDate",
|
|
126
|
+
width: "auto",
|
|
127
|
+
render: (row) => (row.creationDate ? DateTime.fromISO(row.creationDate) : DateTime.now()).toRelative()
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
const PullRequestTable = ({ defaultLimit }) => {
|
|
131
|
+
const [pullRequestStatusState, setPullRequestStatusState] = useState(PullRequestStatus.Active);
|
|
132
|
+
const { entity } = useEntity();
|
|
133
|
+
const { items, loading, error } = usePullRequests(
|
|
134
|
+
entity,
|
|
135
|
+
defaultLimit,
|
|
136
|
+
pullRequestStatusState
|
|
137
|
+
);
|
|
138
|
+
if (error) {
|
|
139
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
140
|
+
}
|
|
141
|
+
return /* @__PURE__ */ React.createElement(
|
|
142
|
+
Table,
|
|
143
|
+
{
|
|
144
|
+
isLoading: loading,
|
|
145
|
+
columns,
|
|
146
|
+
options: {
|
|
147
|
+
search: true,
|
|
148
|
+
paging: true,
|
|
149
|
+
pageSize: 5,
|
|
150
|
+
showEmptyDataSourceMessage: !loading
|
|
151
|
+
},
|
|
152
|
+
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(
|
|
153
|
+
PullRequestStatusButtonGroup,
|
|
154
|
+
{
|
|
155
|
+
status: pullRequestStatusState,
|
|
156
|
+
setStatus: setPullRequestStatusState
|
|
157
|
+
}
|
|
158
|
+
))),
|
|
159
|
+
data: items != null ? items : []
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const EntityPageAzurePullRequests = (props) => {
|
|
165
|
+
const { entity } = useEntity();
|
|
166
|
+
return /* @__PURE__ */ React.createElement(
|
|
167
|
+
RequirePermission,
|
|
168
|
+
{
|
|
169
|
+
permission: azureDevOpsPullRequestReadPermission,
|
|
170
|
+
resourceRef: stringifyEntityRef(entity),
|
|
171
|
+
errorPage: null
|
|
172
|
+
},
|
|
173
|
+
/* @__PURE__ */ React.createElement(PullRequestTable, { defaultLimit: props.defaultLimit })
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { EntityPageAzurePullRequests };
|
|
178
|
+
//# sourceMappingURL=index-Bo-6jkQA.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bo-6jkQA.esm.js","sources":["../../src/hooks/usePullRequests.ts","../../src/components/PullRequestStatusButtonGroup/PullRequestStatusButtonGroup.tsx","../../src/components/PullRequestTable/PullRequestTable.tsx","../../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 {\n AZURE_DEVOPS_DEFAULT_TOP,\n PullRequest,\n PullRequestOptions,\n PullRequestStatus,\n} from '@backstage-community/plugin-azure-devops-common';\n\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { azureDevOpsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getAnnotationValuesFromEntity } from '../utils';\n\nexport function usePullRequests(\n entity: Entity,\n defaultLimit?: number,\n requestedStatus?: PullRequestStatus,\n defaultTeamsLimit?: number,\n): {\n items?: PullRequest[];\n loading: boolean;\n error?: Error;\n} {\n const top = defaultLimit ?? AZURE_DEVOPS_DEFAULT_TOP;\n const teamsLimit = defaultTeamsLimit ?? undefined;\n const status = requestedStatus ?? PullRequestStatus.Active;\n const options: PullRequestOptions = {\n top,\n status,\n teamsLimit,\n };\n\n const api = useApi(azureDevOpsApiRef);\n\n const { value, loading, error } = useAsync(() => {\n const { project, repo, host, org } = getAnnotationValuesFromEntity(entity);\n const entityRef = stringifyEntityRef(entity);\n return api.getPullRequests(\n project,\n repo as string,\n entityRef,\n host,\n org,\n options,\n );\n }, [api, top, status]);\n\n return {\n items: value?.items,\n loading,\n error,\n };\n}\n","/*\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","/*\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","/*\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":";;;;;;;;;;;;;;;;;;;;AA6BO,SAAS,eACd,CAAA,MAAA,EACA,YACA,EAAA,eAAA,EACA,iBAKA,EAAA;AACA,EAAA,MAAM,MAAM,YAAgB,IAAA,IAAA,GAAA,YAAA,GAAA,wBAAA,CAAA;AAC5B,EAAA,MAAM,aAAa,iBAAqB,IAAA,IAAA,GAAA,iBAAA,GAAA,KAAA,CAAA,CAAA;AACxC,EAAM,MAAA,MAAA,GAAS,4CAAmB,iBAAkB,CAAA,MAAA,CA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AAa,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,200 @@
|
|
|
1
|
+
import Box from '@material-ui/core/Box';
|
|
2
|
+
import Typography from '@material-ui/core/Typography';
|
|
3
|
+
import { AZURE_DEVOPS_DEFAULT_TOP, BuildStatus, BuildResult, azureDevOpsPipelineReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
4
|
+
import { ResponseErrorPanel, Table, Link, StatusWarning, StatusAborted, StatusPending, StatusRunning, StatusError, StatusOK } from '@backstage/core-components';
|
|
5
|
+
import SvgIcon from '@material-ui/core/SvgIcon';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { DateTime, Interval } from 'luxon';
|
|
8
|
+
import humanizeDuration from 'humanize-duration';
|
|
9
|
+
import { a as azureDevOpsApiRef } from './AzureDevOpsApi-GBxs-uQ7.esm.js';
|
|
10
|
+
import '@backstage/errors';
|
|
11
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
12
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
13
|
+
import 'react-use/esm/useAsyncRetry';
|
|
14
|
+
import 'react-use/esm/useInterval';
|
|
15
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
16
|
+
import { g as getAnnotationValuesFromEntity } from './getAnnotationValuesFromEntity-G8YVs-3R.esm.js';
|
|
17
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
18
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
19
|
+
|
|
20
|
+
const getDurationFromDates = (startTime, finishTime) => {
|
|
21
|
+
if (!startTime || !startTime && !finishTime) {
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
const start = DateTime.fromISO(startTime);
|
|
25
|
+
const finish = finishTime ? DateTime.fromISO(finishTime) : DateTime.now();
|
|
26
|
+
const formatted = Interval.fromDateTimes(start, finish).toDuration().valueOf();
|
|
27
|
+
const shortEnglishHumanizer = humanizeDuration.humanizer({
|
|
28
|
+
language: "shortEn",
|
|
29
|
+
languages: {
|
|
30
|
+
shortEn: {
|
|
31
|
+
y: () => "y",
|
|
32
|
+
mo: () => "mo",
|
|
33
|
+
w: () => "w",
|
|
34
|
+
d: () => "d",
|
|
35
|
+
h: () => "h",
|
|
36
|
+
m: () => "m",
|
|
37
|
+
s: () => "s",
|
|
38
|
+
ms: () => "ms"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return shortEnglishHumanizer(formatted, {
|
|
43
|
+
largest: 2,
|
|
44
|
+
round: true,
|
|
45
|
+
spacer: ""
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function useBuildRuns(entity, defaultLimit) {
|
|
50
|
+
const top = defaultLimit != null ? defaultLimit : AZURE_DEVOPS_DEFAULT_TOP;
|
|
51
|
+
const options = {
|
|
52
|
+
top
|
|
53
|
+
};
|
|
54
|
+
const api = useApi(azureDevOpsApiRef);
|
|
55
|
+
const { value, loading, error } = useAsync(() => {
|
|
56
|
+
const { project, repo, definition, host, org } = getAnnotationValuesFromEntity(entity);
|
|
57
|
+
return api.getBuildRuns(
|
|
58
|
+
project,
|
|
59
|
+
stringifyEntityRef(entity),
|
|
60
|
+
repo,
|
|
61
|
+
definition,
|
|
62
|
+
host,
|
|
63
|
+
org,
|
|
64
|
+
options
|
|
65
|
+
);
|
|
66
|
+
}, [api]);
|
|
67
|
+
return {
|
|
68
|
+
items: value == null ? void 0 : value.items,
|
|
69
|
+
loading,
|
|
70
|
+
error
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const AzurePipelinesIcon = (props) => /* @__PURE__ */ React.createElement(SvgIcon, { ...props, viewBox: "0 0 512 512" }, /* @__PURE__ */ React.createElement(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
fill: "none",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeLinecap: "round",
|
|
80
|
+
strokeLinejoin: "round",
|
|
81
|
+
strokeWidth: "32",
|
|
82
|
+
d: "M461.81 53.81a4.4 4.4 0 00-3.3-3.39c-54.38-13.3-180 34.09-248.13 102.17a294.9 294.9 0 00-33.09 39.08c-21-1.9-42-.3-59.88 7.5-50.49 22.2-65.18 80.18-69.28 105.07a9 9 0 009.8 10.4l81.07-8.9a180.29 180.29 0 001.1 18.3 18.15 18.15 0 005.3 11.09l31.39 31.39a18.15 18.15 0 0011.1 5.3 179.91 179.91 0 0018.19 1.1l-8.89 81a9 9 0 0010.39 9.79c24.9-4 83-18.69 105.07-69.17 7.8-17.9 9.4-38.79 7.6-59.69a293.91 293.91 0 0039.19-33.09c68.38-68 115.47-190.86 102.37-247.95zM298.66 213.67a42.7 42.7 0 1160.38 0 42.65 42.65 0 01-60.38 0z"
|
|
83
|
+
}
|
|
84
|
+
), /* @__PURE__ */ React.createElement(
|
|
85
|
+
"path",
|
|
86
|
+
{
|
|
87
|
+
fill: "none",
|
|
88
|
+
stroke: "currentColor",
|
|
89
|
+
strokeLinecap: "round",
|
|
90
|
+
strokeLinejoin: "round",
|
|
91
|
+
strokeWidth: "32",
|
|
92
|
+
d: "M109.64 352a45.06 45.06 0 00-26.35 12.84C65.67 382.52 64 448 64 448s65.52-1.67 83.15-19.31A44.73 44.73 0 00160 402.32"
|
|
93
|
+
}
|
|
94
|
+
));
|
|
95
|
+
|
|
96
|
+
const getBuildResultComponent = (result) => {
|
|
97
|
+
switch (result) {
|
|
98
|
+
case BuildResult.Succeeded:
|
|
99
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusOK, null), " Succeeded");
|
|
100
|
+
case BuildResult.PartiallySucceeded:
|
|
101
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusWarning, null), " Partially Succeeded");
|
|
102
|
+
case BuildResult.Failed:
|
|
103
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusError, null), " Failed");
|
|
104
|
+
case BuildResult.Canceled:
|
|
105
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusAborted, null), " Canceled");
|
|
106
|
+
case BuildResult.None:
|
|
107
|
+
default:
|
|
108
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusWarning, null), " Unknown");
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const getBuildStateComponent = (status, result) => {
|
|
112
|
+
switch (status) {
|
|
113
|
+
case BuildStatus.InProgress:
|
|
114
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusRunning, null), " In Progress");
|
|
115
|
+
case BuildStatus.Completed:
|
|
116
|
+
return getBuildResultComponent(result);
|
|
117
|
+
case BuildStatus.Cancelling:
|
|
118
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusAborted, null), " Cancelling");
|
|
119
|
+
case BuildStatus.Postponed:
|
|
120
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusPending, null), " Postponed");
|
|
121
|
+
case BuildStatus.NotStarted:
|
|
122
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusAborted, null), " Not Started");
|
|
123
|
+
case BuildStatus.None:
|
|
124
|
+
default:
|
|
125
|
+
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, /* @__PURE__ */ React.createElement(StatusWarning, null), " Unknown");
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const columns = [
|
|
129
|
+
{
|
|
130
|
+
title: "ID",
|
|
131
|
+
field: "id",
|
|
132
|
+
highlight: false,
|
|
133
|
+
width: "auto"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: "Build",
|
|
137
|
+
field: "title",
|
|
138
|
+
width: "auto",
|
|
139
|
+
render: (row) => /* @__PURE__ */ React.createElement(Link, { to: row.link || "" }, row.title)
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
title: "Source",
|
|
143
|
+
field: "source",
|
|
144
|
+
width: "auto"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: "State",
|
|
148
|
+
width: "auto",
|
|
149
|
+
render: (row) => /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, getBuildStateComponent(row.status, row.result)))
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: "Duration",
|
|
153
|
+
field: "queueTime",
|
|
154
|
+
width: "auto",
|
|
155
|
+
render: (row) => /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Typography, null, getDurationFromDates(row.startTime, row.finishTime)))
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: "Age",
|
|
159
|
+
field: "queueTime",
|
|
160
|
+
width: "auto",
|
|
161
|
+
render: (row) => (row.queueTime ? DateTime.fromISO(row.queueTime) : DateTime.now()).toRelative()
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
const BuildTable = ({ items, loading, error }) => {
|
|
165
|
+
if (error) {
|
|
166
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error }));
|
|
167
|
+
}
|
|
168
|
+
return /* @__PURE__ */ React.createElement(
|
|
169
|
+
Table,
|
|
170
|
+
{
|
|
171
|
+
isLoading: loading,
|
|
172
|
+
columns,
|
|
173
|
+
options: {
|
|
174
|
+
search: true,
|
|
175
|
+
paging: true,
|
|
176
|
+
pageSize: 5,
|
|
177
|
+
showEmptyDataSourceMessage: !loading
|
|
178
|
+
},
|
|
179
|
+
title: /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(AzurePipelinesIcon, { style: { fontSize: 30 } }), /* @__PURE__ */ React.createElement(Box, { mr: 1 }), "Azure Pipelines - Builds (", items ? items.length : 0, ")"),
|
|
180
|
+
data: items != null ? items : []
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const EntityPageAzurePipelines = (props) => {
|
|
186
|
+
const { entity } = useEntity();
|
|
187
|
+
const { items, loading, error } = useBuildRuns(entity, props.defaultLimit);
|
|
188
|
+
return /* @__PURE__ */ React.createElement(
|
|
189
|
+
RequirePermission,
|
|
190
|
+
{
|
|
191
|
+
permission: azureDevOpsPipelineReadPermission,
|
|
192
|
+
resourceRef: stringifyEntityRef(entity),
|
|
193
|
+
errorPage: null
|
|
194
|
+
},
|
|
195
|
+
/* @__PURE__ */ React.createElement(BuildTable, { items, loading, error })
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { EntityPageAzurePipelines };
|
|
200
|
+
//# sourceMappingURL=index-Bwu2-Sgs.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bwu2-Sgs.esm.js","sources":["../../src/utils/getDurationFromDates.ts","../../src/hooks/useBuildRuns.ts","../../src/components/AzurePipelinesIcon/AzurePipelinesIcon.tsx","../../src/components/BuildTable/BuildTable.tsx","../../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 { DateTime, Interval } from 'luxon';\nimport humanizeDuration from 'humanize-duration';\n\nexport const getDurationFromDates = (\n startTime?: string,\n finishTime?: string,\n): string => {\n if (!startTime || (!startTime && !finishTime)) {\n return '';\n }\n\n const start = DateTime.fromISO(startTime);\n const finish = finishTime ? DateTime.fromISO(finishTime) : DateTime.now();\n\n const formatted = Interval.fromDateTimes(start, finish)\n .toDuration()\n .valueOf();\n\n const shortEnglishHumanizer = humanizeDuration.humanizer({\n language: 'shortEn',\n languages: {\n shortEn: {\n y: () => 'y',\n mo: () => 'mo',\n w: () => 'w',\n d: () => 'd',\n h: () => 'h',\n m: () => 'm',\n s: () => 's',\n ms: () => 'ms',\n },\n },\n });\n\n return shortEnglishHumanizer(formatted, {\n largest: 2,\n round: true,\n spacer: '',\n });\n};\n","/*\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 AZURE_DEVOPS_DEFAULT_TOP,\n BuildRun,\n BuildRunOptions,\n} from '@backstage-community/plugin-azure-devops-common';\n\nimport { azureDevOpsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getAnnotationValuesFromEntity } from '../utils';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\n\nexport function useBuildRuns(\n entity: Entity,\n defaultLimit?: number,\n): {\n items?: BuildRun[];\n loading: boolean;\n error?: Error;\n} {\n const top = defaultLimit ?? AZURE_DEVOPS_DEFAULT_TOP;\n const options: BuildRunOptions = {\n top: top,\n };\n\n const api = useApi(azureDevOpsApiRef);\n\n const { value, loading, error } = useAsync(() => {\n const { project, repo, definition, host, org } =\n getAnnotationValuesFromEntity(entity);\n return api.getBuildRuns(\n project,\n stringifyEntityRef(entity),\n repo,\n definition,\n host,\n org,\n options,\n );\n }, [api]);\n\n return {\n items: value?.items,\n loading,\n error,\n };\n}\n","/*\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 SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon';\n\nimport React from 'react';\n\nexport const AzurePipelinesIcon = (props: SvgIconProps) => (\n <SvgIcon {...props} viewBox=\"0 0 512 512\">\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"32\"\n d=\"M461.81 53.81a4.4 4.4 0 00-3.3-3.39c-54.38-13.3-180 34.09-248.13 102.17a294.9 294.9 0 00-33.09 39.08c-21-1.9-42-.3-59.88 7.5-50.49 22.2-65.18 80.18-69.28 105.07a9 9 0 009.8 10.4l81.07-8.9a180.29 180.29 0 001.1 18.3 18.15 18.15 0 005.3 11.09l31.39 31.39a18.15 18.15 0 0011.1 5.3 179.91 179.91 0 0018.19 1.1l-8.89 81a9 9 0 0010.39 9.79c24.9-4 83-18.69 105.07-69.17 7.8-17.9 9.4-38.79 7.6-59.69a293.91 293.91 0 0039.19-33.09c68.38-68 115.47-190.86 102.37-247.95zM298.66 213.67a42.7 42.7 0 1160.38 0 42.65 42.65 0 01-60.38 0z\"\n />\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"32\"\n d=\"M109.64 352a45.06 45.06 0 00-26.35 12.84C65.67 382.52 64 448 64 448s65.52-1.67 83.15-19.31A44.73 44.73 0 00160 402.32\"\n />\n </SvgIcon>\n);\n","/*\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 Typography from '@material-ui/core/Typography';\nimport {\n BuildResult,\n BuildRun,\n BuildStatus,\n} from '@backstage-community/plugin-azure-devops-common';\nimport {\n Link,\n ResponseErrorPanel,\n StatusAborted,\n StatusError,\n StatusOK,\n StatusPending,\n StatusRunning,\n StatusWarning,\n Table,\n TableColumn,\n} from '@backstage/core-components';\n\nimport { AzurePipelinesIcon } from '../AzurePipelinesIcon';\nimport { DateTime } from 'luxon';\nimport React from 'react';\nimport { getDurationFromDates } from '../../utils/getDurationFromDates';\n\nexport const getBuildResultComponent = (result: number | undefined) => {\n switch (result) {\n case BuildResult.Succeeded:\n return (\n <Typography component=\"span\">\n <StatusOK /> Succeeded\n </Typography>\n );\n case BuildResult.PartiallySucceeded:\n return (\n <Typography component=\"span\">\n <StatusWarning /> Partially Succeeded\n </Typography>\n );\n case BuildResult.Failed:\n return (\n <Typography component=\"span\">\n <StatusError /> Failed\n </Typography>\n );\n case BuildResult.Canceled:\n return (\n <Typography component=\"span\">\n <StatusAborted /> Canceled\n </Typography>\n );\n case BuildResult.None:\n default:\n return (\n <Typography component=\"span\">\n <StatusWarning /> Unknown\n </Typography>\n );\n }\n};\n\nexport const getBuildStateComponent = (\n status: number | undefined,\n result: number | undefined,\n) => {\n switch (status) {\n case BuildStatus.InProgress:\n return (\n <Typography component=\"span\">\n <StatusRunning /> In Progress\n </Typography>\n );\n case BuildStatus.Completed:\n return getBuildResultComponent(result);\n case BuildStatus.Cancelling:\n return (\n <Typography component=\"span\">\n <StatusAborted /> Cancelling\n </Typography>\n );\n case BuildStatus.Postponed:\n return (\n <Typography component=\"span\">\n <StatusPending /> Postponed\n </Typography>\n );\n case BuildStatus.NotStarted:\n return (\n <Typography component=\"span\">\n <StatusAborted /> Not Started\n </Typography>\n );\n case BuildStatus.None:\n default:\n return (\n <Typography component=\"span\">\n <StatusWarning /> Unknown\n </Typography>\n );\n }\n};\n\nconst columns: TableColumn[] = [\n {\n title: 'ID',\n field: 'id',\n highlight: false,\n width: 'auto',\n },\n {\n title: 'Build',\n field: 'title',\n width: 'auto',\n render: (row: Partial<BuildRun>) => (\n <Link to={row.link || ''}>{row.title}</Link>\n ),\n },\n {\n title: 'Source',\n field: 'source',\n width: 'auto',\n },\n {\n title: 'State',\n width: 'auto',\n render: (row: Partial<BuildRun>) => (\n <Box display=\"flex\" alignItems=\"center\">\n <Typography variant=\"button\">\n {getBuildStateComponent(row.status, row.result)}\n </Typography>\n </Box>\n ),\n },\n {\n title: 'Duration',\n field: 'queueTime',\n width: 'auto',\n render: (row: Partial<BuildRun>) => (\n <Box display=\"flex\" alignItems=\"center\">\n <Typography>\n {getDurationFromDates(row.startTime, row.finishTime)}\n </Typography>\n </Box>\n ),\n },\n {\n title: 'Age',\n field: 'queueTime',\n width: 'auto',\n render: (row: Partial<BuildRun>) =>\n (row.queueTime\n ? DateTime.fromISO(row.queueTime)\n : DateTime.now()\n ).toRelative(),\n },\n];\n\ntype BuildTableProps = {\n items?: BuildRun[];\n loading: boolean;\n error?: Error;\n};\n\nexport const BuildTable = ({ items, loading, error }: BuildTableProps) => {\n if (error) {\n return (\n <div>\n <ResponseErrorPanel error={error} />\n </div>\n );\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 <AzurePipelinesIcon style={{ fontSize: 30 }} />\n <Box mr={1} />\n Azure Pipelines - Builds ({items ? items.length : 0})\n </Box>\n }\n data={items ?? []}\n />\n );\n};\n","/*\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":";;;;;;;;;;;;;;;;;;;AAmBa,MAAA,oBAAA,GAAuB,CAClC,SAAA,EACA,UACW,KAAA;AACX,EAAA,IAAI,CAAC,SAAA,IAAc,CAAC,SAAA,IAAa,CAAC,UAAa,EAAA;AAC7C,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,OAAA,CAAQ,SAAS,CAA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OAAQ,EAAA,MAAA,EAAO,YAAW,QAC7B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAO,EAAE,QAAA,EAAU,IAAM,EAAA,CAAA,kBAC5C,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,CAAE,EAAA,4BAAA,EACa,KAAQ,GAAA,KAAA,CAAM,MAAS,GAAA,CAAA,EAAE,GACtD,CAAA;AAAA,MAEF,IAAA,EAAM,wBAAS,EAAC;AAAA,KAAA;AAAA,GAClB,CAAA;AAEJ,CAAA;;ACxLa,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,25 @@
|
|
|
1
|
+
export { F as FilterType, P as PullRequestsPage } from './PullRequestsPage-CkhRQsgx.esm.js';
|
|
2
|
+
import 'luxon';
|
|
3
|
+
import 'humanize-duration';
|
|
4
|
+
import '@backstage-community/plugin-azure-devops-common';
|
|
5
|
+
import '@backstage/core-components';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@material-ui/core/Paper';
|
|
8
|
+
import '@material-ui/core/Typography';
|
|
9
|
+
import '@material-ui/core/styles';
|
|
10
|
+
import '@material-ui/core/Card';
|
|
11
|
+
import '@material-ui/core/CardContent';
|
|
12
|
+
import '@material-ui/core/CardHeader';
|
|
13
|
+
import '@material-ui/icons/DoneAll';
|
|
14
|
+
import '@material-ui/icons/Cancel';
|
|
15
|
+
import '@material-ui/icons/GroupWork';
|
|
16
|
+
import '@material-ui/icons/WatchLater';
|
|
17
|
+
import './AzureDevOpsApi-GBxs-uQ7.esm.js';
|
|
18
|
+
import '@backstage/core-plugin-api';
|
|
19
|
+
import '@backstage/errors';
|
|
20
|
+
import 'react-use/esm/useAsync';
|
|
21
|
+
import 'react-use/esm/useAsyncRetry';
|
|
22
|
+
import 'react-use/esm/useInterval';
|
|
23
|
+
import '@backstage/catalog-model';
|
|
24
|
+
import '@backstage/plugin-permission-react';
|
|
25
|
+
//# sourceMappingURL=index-W1pvc5vi.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-W1pvc5vi.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import { DashboardPullRequest, RepoBuildOptions, RepoBuild, GitTag, PullRequestOptions, PullRequest, Team, BuildRunOptions, BuildRun, ReadmeConfig, Readme } from '@backstage-community/plugin-azure-devops-common';
|
|
5
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
6
|
+
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
7
|
+
import { Entity } from '@backstage/catalog-model';
|
|
8
|
+
import { SvgIconProps } from '@material-ui/core/SvgIcon';
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
type AllFilter = BaseFilter & {
|
|
12
|
+
type: FilterType.All;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
type AssignedToTeamFilter = BaseFilter & {
|
|
17
|
+
type: FilterType.AssignedToTeam;
|
|
18
|
+
teamId: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
type AssignedToTeamsFilter = BaseFilter & ({
|
|
23
|
+
type: FilterType.AssignedToTeams;
|
|
24
|
+
teamIds: string[];
|
|
25
|
+
} | {
|
|
26
|
+
type: FilterType.AssignedToCurrentUsersTeams;
|
|
27
|
+
teamIds?: string[];
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** @public */
|
|
31
|
+
type AssignedToUserFilter = BaseFilter & ({
|
|
32
|
+
type: FilterType.AssignedToUser;
|
|
33
|
+
email: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: FilterType.AssignedToCurrentUser;
|
|
36
|
+
email?: string;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** @public */
|
|
40
|
+
type CreatedByTeamFilter = BaseFilter & ({
|
|
41
|
+
type: FilterType.CreatedByTeam;
|
|
42
|
+
} & ({
|
|
43
|
+
teamId: string;
|
|
44
|
+
} | {
|
|
45
|
+
teamName: string;
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
/** @public */
|
|
49
|
+
type CreatedByTeamsFilter = BaseFilter & (({
|
|
50
|
+
type: FilterType.CreatedByTeams;
|
|
51
|
+
} & ({
|
|
52
|
+
teamIds: string[];
|
|
53
|
+
} | {
|
|
54
|
+
teamNames: string[];
|
|
55
|
+
})) | {
|
|
56
|
+
type: FilterType.CreatedByCurrentUsersTeams;
|
|
57
|
+
teamIds?: string[];
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/** @public */
|
|
61
|
+
type CreatedByUserFilter = BaseFilter & ({
|
|
62
|
+
type: FilterType.CreatedByUser;
|
|
63
|
+
email: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: FilterType.CreatedByCurrentUser;
|
|
66
|
+
email?: string;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/** @public */
|
|
70
|
+
declare enum FilterType {
|
|
71
|
+
All = "All",
|
|
72
|
+
AssignedToUser = "AssignedToUser",
|
|
73
|
+
AssignedToCurrentUser = "AssignedToCurrentUser",
|
|
74
|
+
AssignedToTeam = "AssignedToTeam",
|
|
75
|
+
AssignedToTeams = "AssignedToTeams",
|
|
76
|
+
AssignedToCurrentUsersTeams = "AssignedToCurrentUsersTeams",
|
|
77
|
+
CreatedByUser = "CreatedByUser",
|
|
78
|
+
CreatedByCurrentUser = "CreatedByCurrentUser",
|
|
79
|
+
CreatedByTeam = "CreatedByTeam",
|
|
80
|
+
CreatedByTeams = "CreatedByTeams",
|
|
81
|
+
CreatedByCurrentUsersTeams = "CreatedByCurrentUsersTeams"
|
|
82
|
+
}
|
|
83
|
+
/** @public */
|
|
84
|
+
type BaseFilter = {
|
|
85
|
+
type: FilterType;
|
|
86
|
+
};
|
|
87
|
+
/** @public */
|
|
88
|
+
type Filter = AssignedToUserFilter | CreatedByUserFilter | AssignedToTeamFilter | CreatedByTeamFilter | AssignedToTeamsFilter | CreatedByTeamsFilter | AllFilter;
|
|
89
|
+
|
|
90
|
+
/** @public */
|
|
91
|
+
type PullRequestFilter = (pullRequest: DashboardPullRequest) => boolean;
|
|
92
|
+
|
|
93
|
+
/** @public */
|
|
94
|
+
interface PullRequestColumnConfig {
|
|
95
|
+
title: string;
|
|
96
|
+
filters: Filter[];
|
|
97
|
+
simplified?: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @public */
|
|
101
|
+
declare const isAzureDevOpsAvailable: (entity: Entity) => boolean;
|
|
102
|
+
/** @public */
|
|
103
|
+
declare const isAzurePipelinesAvailable: (entity: Entity) => boolean;
|
|
104
|
+
/** @public */
|
|
105
|
+
declare const azureDevOpsPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
|
|
106
|
+
/** @public */
|
|
107
|
+
declare const AzurePullRequestsPage: (props: {
|
|
108
|
+
projectName?: string | undefined;
|
|
109
|
+
pollingInterval?: number | undefined;
|
|
110
|
+
defaultColumnConfigs?: PullRequestColumnConfig[] | undefined;
|
|
111
|
+
teamsLimit?: number | undefined;
|
|
112
|
+
}) => react.JSX.Element;
|
|
113
|
+
/** @public */
|
|
114
|
+
declare const EntityAzurePipelinesContent: (props: {
|
|
115
|
+
defaultLimit?: number | undefined;
|
|
116
|
+
}) => react.JSX.Element;
|
|
117
|
+
/** @public */
|
|
118
|
+
declare const EntityAzureGitTagsContent: () => react.JSX.Element;
|
|
119
|
+
/** @public */
|
|
120
|
+
declare const EntityAzurePullRequestsContent: (props: {
|
|
121
|
+
defaultLimit?: number | undefined;
|
|
122
|
+
}) => react.JSX.Element;
|
|
123
|
+
/** @public */
|
|
124
|
+
declare const EntityAzureReadmeCard: (props: {
|
|
125
|
+
maxHeight?: number | undefined;
|
|
126
|
+
}) => react.JSX.Element;
|
|
127
|
+
|
|
128
|
+
/** @public */
|
|
129
|
+
declare const AzurePullRequestsIcon: (props: SvgIconProps) => react__default.JSX.Element;
|
|
130
|
+
|
|
131
|
+
/** @public */
|
|
132
|
+
declare const azureDevOpsApiRef: _backstage_core_plugin_api.ApiRef<AzureDevOpsApi>;
|
|
133
|
+
/** @public */
|
|
134
|
+
interface AzureDevOpsApi {
|
|
135
|
+
getRepoBuilds(projectName: string, repoName: string, host?: string, org?: string, options?: RepoBuildOptions): Promise<{
|
|
136
|
+
items: RepoBuild[];
|
|
137
|
+
}>;
|
|
138
|
+
getGitTags(projectName: string, repoName: string, entityRef: string, host?: string, org?: string): Promise<{
|
|
139
|
+
items: GitTag[];
|
|
140
|
+
}>;
|
|
141
|
+
getPullRequests(projectName: string, repoName: string, entityRef: string, host?: string, org?: string, options?: PullRequestOptions): Promise<{
|
|
142
|
+
items: PullRequest[];
|
|
143
|
+
}>;
|
|
144
|
+
getDashboardPullRequests(projectName: string, teamsLimit?: number): Promise<DashboardPullRequest[]>;
|
|
145
|
+
getAllTeams(limit?: number): Promise<Team[]>;
|
|
146
|
+
getUserTeamIds(userId: string): Promise<string[]>;
|
|
147
|
+
getBuildRuns(projectName: string, entityRef: string, repoName?: string, definitionName?: string, host?: string, org?: string, options?: BuildRunOptions): Promise<{
|
|
148
|
+
items: BuildRun[];
|
|
149
|
+
}>;
|
|
150
|
+
getReadme(opts: ReadmeConfig): Promise<Readme>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** @public */
|
|
154
|
+
declare class AzureDevOpsClient implements AzureDevOpsApi {
|
|
155
|
+
private readonly discoveryApi;
|
|
156
|
+
private readonly fetchApi;
|
|
157
|
+
constructor(options: {
|
|
158
|
+
discoveryApi: DiscoveryApi;
|
|
159
|
+
fetchApi: FetchApi;
|
|
160
|
+
});
|
|
161
|
+
getRepoBuilds(projectName: string, repoName: string, host?: string, org?: string, options?: RepoBuildOptions): Promise<{
|
|
162
|
+
items: RepoBuild[];
|
|
163
|
+
}>;
|
|
164
|
+
getGitTags(projectName: string, repoName: string, entityRef: string, host?: string, org?: string): Promise<{
|
|
165
|
+
items: GitTag[];
|
|
166
|
+
}>;
|
|
167
|
+
getPullRequests(projectName: string, repoName: string, entityRef: string, host?: string, org?: string, options?: PullRequestOptions): Promise<{
|
|
168
|
+
items: PullRequest[];
|
|
169
|
+
}>;
|
|
170
|
+
getDashboardPullRequests(projectName: string, teamsLimit?: number): Promise<DashboardPullRequest[]>;
|
|
171
|
+
getAllTeams(limit?: number): Promise<Team[]>;
|
|
172
|
+
getUserTeamIds(userId: string): Promise<string[]>;
|
|
173
|
+
getBuildRuns(projectName: string, entityRef: string, repoName?: string, definitionName?: string, host?: string, org?: string, options?: BuildRunOptions): Promise<{
|
|
174
|
+
items: BuildRun[];
|
|
175
|
+
}>;
|
|
176
|
+
getReadme(opts: ReadmeConfig): Promise<Readme>;
|
|
177
|
+
private get;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { type AllFilter, type AssignedToTeamFilter, type AssignedToTeamsFilter, type AssignedToUserFilter, type AzureDevOpsApi, AzureDevOpsClient, AzurePullRequestsIcon, AzurePullRequestsPage, type BaseFilter, type CreatedByTeamFilter, type CreatedByTeamsFilter, type CreatedByUserFilter, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, type Filter, FilterType, type PullRequestColumnConfig, type PullRequestFilter, azureDevOpsApiRef, azureDevOpsPlugin, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
|