@backstage-community/plugin-azure-devops 0.4.4 → 0.4.5
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 +10 -0
- package/alpha/package.json +1 -1
- 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} +2 -20
- 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} +6 -106
- 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 +59 -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 +93 -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 +86 -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 +18 -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 +21 -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 +18 -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 +19 -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} +6 -27
- 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 +12 -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 +74 -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} +2 -2
- 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 +10 -10
- 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,43 @@
|
|
|
1
|
+
import { useApi, errorApiRef } from '@backstage/core-plugin-api';
|
|
2
|
+
import useAsyncRetry from 'react-use/esm/useAsyncRetry';
|
|
3
|
+
import useInterval from 'react-use/esm/useInterval';
|
|
4
|
+
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
5
|
+
import '@backstage/errors';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
const POLLING_INTERVAL = 1e4;
|
|
9
|
+
function useDashboardPullRequests(project, pollingInterval = POLLING_INTERVAL, teamsLimit) {
|
|
10
|
+
const api = useApi(azureDevOpsApiRef);
|
|
11
|
+
const errorApi = useApi(errorApiRef);
|
|
12
|
+
const getDashboardPullRequests = useCallback(async () => {
|
|
13
|
+
if (!project) {
|
|
14
|
+
return Promise.reject(new Error("Missing project name"));
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return await api.getDashboardPullRequests(project, teamsLimit);
|
|
18
|
+
} catch (error2) {
|
|
19
|
+
if (error2 instanceof Error) {
|
|
20
|
+
errorApi.post(error2);
|
|
21
|
+
}
|
|
22
|
+
return Promise.reject(error2);
|
|
23
|
+
}
|
|
24
|
+
}, [project, api, teamsLimit, errorApi]);
|
|
25
|
+
const {
|
|
26
|
+
value: pullRequests,
|
|
27
|
+
loading,
|
|
28
|
+
error,
|
|
29
|
+
retry
|
|
30
|
+
} = useAsyncRetry(
|
|
31
|
+
() => getDashboardPullRequests(),
|
|
32
|
+
[getDashboardPullRequests]
|
|
33
|
+
);
|
|
34
|
+
useInterval(() => retry(), pollingInterval);
|
|
35
|
+
return {
|
|
36
|
+
pullRequests,
|
|
37
|
+
loading,
|
|
38
|
+
error
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useDashboardPullRequests };
|
|
43
|
+
//# sourceMappingURL=useDashboardPullRequests.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDashboardPullRequests.esm.js","sources":["../../src/hooks/useDashboardPullRequests.ts"],"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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport useInterval from 'react-use/esm/useInterval';\n\nimport { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { azureDevOpsApiRef } from '../api';\nimport { useCallback } from 'react';\n\nconst POLLING_INTERVAL = 10000;\n\nexport function useDashboardPullRequests(\n project?: string,\n pollingInterval: number = POLLING_INTERVAL,\n teamsLimit?: number,\n): {\n pullRequests?: DashboardPullRequest[];\n loading: boolean;\n error?: Error;\n} {\n const api = useApi(azureDevOpsApiRef);\n const errorApi = useApi(errorApiRef);\n\n const getDashboardPullRequests = useCallback(async (): Promise<\n DashboardPullRequest[]\n > => {\n if (!project) {\n return Promise.reject(new Error('Missing project name'));\n }\n\n try {\n return await api.getDashboardPullRequests(project, teamsLimit);\n } catch (error) {\n if (error instanceof Error) {\n errorApi.post(error);\n }\n\n return Promise.reject(error);\n }\n }, [project, api, teamsLimit, errorApi]);\n\n const {\n value: pullRequests,\n loading,\n error,\n retry,\n } = useAsyncRetry(\n () => getDashboardPullRequests(),\n [getDashboardPullRequests],\n );\n\n useInterval(() => retry(), pollingInterval);\n\n return {\n pullRequests,\n loading,\n error,\n };\n}\n"],"names":["error"],"mappings":";;;;;;;AAwBA,MAAM,gBAAmB,GAAA,GAAA,CAAA;AAElB,SAAS,wBACd,CAAA,OAAA,EACA,eAA0B,GAAA,gBAAA,EAC1B,UAKA,EAAA;AACA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA,CAAA;AACpC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AAEnC,EAAM,MAAA,wBAAA,GAA2B,YAAY,YAExC;AACH,IAAA,IAAI,CAAC,OAAS,EAAA;AACZ,MAAA,OAAO,OAAQ,CAAA,MAAA,CAAO,IAAI,KAAA,CAAM,sBAAsB,CAAC,CAAA,CAAA;AAAA,KACzD;AAEA,IAAI,IAAA;AACF,MAAA,OAAO,MAAM,GAAA,CAAI,wBAAyB,CAAA,OAAA,EAAS,UAAU,CAAA,CAAA;AAAA,aACtDA,MAAO,EAAA;AACd,MAAA,IAAIA,kBAAiB,KAAO,EAAA;AAC1B,QAAA,QAAA,CAAS,KAAKA,MAAK,CAAA,CAAA;AAAA,OACrB;AAEA,MAAO,OAAA,OAAA,CAAQ,OAAOA,MAAK,CAAA,CAAA;AAAA,KAC7B;AAAA,KACC,CAAC,OAAA,EAAS,GAAK,EAAA,UAAA,EAAY,QAAQ,CAAC,CAAA,CAAA;AAEvC,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,YAAA;AAAA,IACP,OAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,GACE,GAAA,aAAA;AAAA,IACF,MAAM,wBAAyB,EAAA;AAAA,IAC/B,CAAC,wBAAwB,CAAA;AAAA,GAC3B,CAAA;AAEA,EAAY,WAAA,CAAA,MAAM,KAAM,EAAA,EAAG,eAAe,CAAA,CAAA;AAE1C,EAAO,OAAA;AAAA,IACL,YAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
2
|
+
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
3
|
+
import '@backstage/errors';
|
|
4
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
6
|
+
import 'luxon';
|
|
7
|
+
import 'humanize-duration';
|
|
8
|
+
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
9
|
+
|
|
10
|
+
function useGitTags(entity) {
|
|
11
|
+
const api = useApi(azureDevOpsApiRef);
|
|
12
|
+
const { value, loading, error } = useAsync(() => {
|
|
13
|
+
const { project, repo, host, org } = getAnnotationValuesFromEntity(entity);
|
|
14
|
+
return api.getGitTags(
|
|
15
|
+
project,
|
|
16
|
+
repo,
|
|
17
|
+
stringifyEntityRef(entity),
|
|
18
|
+
host,
|
|
19
|
+
org
|
|
20
|
+
);
|
|
21
|
+
}, [api]);
|
|
22
|
+
return {
|
|
23
|
+
items: value == null ? void 0 : value.items,
|
|
24
|
+
loading,
|
|
25
|
+
error
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useGitTags };
|
|
30
|
+
//# sourceMappingURL=useGitTags.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGitTags.esm.js","sources":["../../src/hooks/useGitTags.ts"],"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 { GitTag } 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 useGitTags(entity: Entity): {\n items?: GitTag[];\n loading: boolean;\n error?: Error;\n} {\n const api = useApi(azureDevOpsApiRef);\n\n const { value, loading, error } = useAsync(() => {\n const { project, repo, host, org } = getAnnotationValuesFromEntity(entity);\n return api.getGitTags(\n project,\n repo as string,\n stringifyEntityRef(entity),\n host,\n org,\n );\n }, [api]);\n\n return {\n items: value?.items,\n loading,\n error,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAwBO,SAAS,WAAW,MAIzB,EAAA;AACA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA,CAAA;AAEpC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,MAAM;AAC/C,IAAA,MAAM,EAAE,OAAS,EAAA,IAAA,EAAM,MAAM,GAAI,EAAA,GAAI,8BAA8B,MAAM,CAAA,CAAA;AACzE,IAAA,OAAO,GAAI,CAAA,UAAA;AAAA,MACT,OAAA;AAAA,MACA,IAAA;AAAA,MACA,mBAAmB,MAAM,CAAA;AAAA,MACzB,IAAA;AAAA,MACA,GAAA;AAAA,KACF,CAAA;AAAA,GACF,EAAG,CAAC,GAAG,CAAC,CAAA,CAAA;AAER,EAAO,OAAA;AAAA,IACL,OAAO,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,KAAA;AAAA,IACd,OAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PullRequestStatus, AZURE_DEVOPS_DEFAULT_TOP } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
3
|
+
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
4
|
+
import '@backstage/errors';
|
|
5
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
6
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
7
|
+
import 'luxon';
|
|
8
|
+
import 'humanize-duration';
|
|
9
|
+
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
10
|
+
|
|
11
|
+
function usePullRequests(entity, defaultLimit, requestedStatus, defaultTeamsLimit) {
|
|
12
|
+
const top = defaultLimit != null ? defaultLimit : AZURE_DEVOPS_DEFAULT_TOP;
|
|
13
|
+
const teamsLimit = defaultTeamsLimit != null ? defaultTeamsLimit : void 0;
|
|
14
|
+
const status = requestedStatus != null ? requestedStatus : PullRequestStatus.Active;
|
|
15
|
+
const options = {
|
|
16
|
+
top,
|
|
17
|
+
status,
|
|
18
|
+
teamsLimit
|
|
19
|
+
};
|
|
20
|
+
const api = useApi(azureDevOpsApiRef);
|
|
21
|
+
const { value, loading, error } = useAsync(() => {
|
|
22
|
+
const { project, repo, host, org } = getAnnotationValuesFromEntity(entity);
|
|
23
|
+
const entityRef = stringifyEntityRef(entity);
|
|
24
|
+
return api.getPullRequests(
|
|
25
|
+
project,
|
|
26
|
+
repo,
|
|
27
|
+
entityRef,
|
|
28
|
+
host,
|
|
29
|
+
org,
|
|
30
|
+
options
|
|
31
|
+
);
|
|
32
|
+
}, [api, top, status]);
|
|
33
|
+
return {
|
|
34
|
+
items: value == null ? void 0 : value.items,
|
|
35
|
+
loading,
|
|
36
|
+
error
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { usePullRequests };
|
|
41
|
+
//# sourceMappingURL=usePullRequests.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePullRequests.esm.js","sources":["../../src/hooks/usePullRequests.ts"],"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"],"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,CAAA;AACpD,EAAA,MAAM,OAA8B,GAAA;AAAA,IAClC,GAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA,CAAA;AAEpC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,MAAM;AAC/C,IAAA,MAAM,EAAE,OAAS,EAAA,IAAA,EAAM,MAAM,GAAI,EAAA,GAAI,8BAA8B,MAAM,CAAA,CAAA;AACzE,IAAM,MAAA,SAAA,GAAY,mBAAmB,MAAM,CAAA,CAAA;AAC3C,IAAA,OAAO,GAAI,CAAA,eAAA;AAAA,MACT,OAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,OAAA;AAAA,KACF,CAAA;AAAA,GACC,EAAA,CAAC,GAAK,EAAA,GAAA,EAAK,MAAM,CAAC,CAAA,CAAA;AAErB,EAAO,OAAA;AAAA,IACL,OAAO,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,KAAA;AAAA,IACd,OAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
2
|
+
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
3
|
+
import '@backstage/errors';
|
|
4
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
6
|
+
import 'luxon';
|
|
7
|
+
import 'humanize-duration';
|
|
8
|
+
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
9
|
+
|
|
10
|
+
function useReadme(entity) {
|
|
11
|
+
const api = useApi(azureDevOpsApiRef);
|
|
12
|
+
const { value, loading, error } = useAsync(() => {
|
|
13
|
+
const { project, repo, host, org, readmePath } = getAnnotationValuesFromEntity(entity);
|
|
14
|
+
const entityRef = stringifyEntityRef(entity);
|
|
15
|
+
return api.getReadme({
|
|
16
|
+
project,
|
|
17
|
+
repo,
|
|
18
|
+
entityRef,
|
|
19
|
+
host,
|
|
20
|
+
org,
|
|
21
|
+
path: readmePath
|
|
22
|
+
});
|
|
23
|
+
}, [api]);
|
|
24
|
+
return {
|
|
25
|
+
item: value,
|
|
26
|
+
loading,
|
|
27
|
+
error
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { useReadme };
|
|
32
|
+
//# sourceMappingURL=useReadme.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReadme.esm.js","sources":["../../src/hooks/useReadme.ts"],"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 { Readme } 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 useReadme(entity: Entity): {\n item?: Readme;\n loading: boolean;\n error?: Error;\n} {\n const api = useApi(azureDevOpsApiRef);\n\n const { value, loading, error } = useAsync(() => {\n const { project, repo, host, org, readmePath } =\n getAnnotationValuesFromEntity(entity);\n const entityRef = stringifyEntityRef(entity);\n return api.getReadme({\n project,\n repo: repo as string,\n entityRef,\n host,\n org,\n path: readmePath,\n });\n }, [api]);\n\n return {\n item: value,\n loading,\n error,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAwBO,SAAS,UAAU,MAIxB,EAAA;AACA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA,CAAA;AAEpC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,MAAM;AAC/C,IAAM,MAAA,EAAE,SAAS,IAAM,EAAA,IAAA,EAAM,KAAK,UAAW,EAAA,GAC3C,8BAA8B,MAAM,CAAA,CAAA;AACtC,IAAM,MAAA,SAAA,GAAY,mBAAmB,MAAM,CAAA,CAAA;AAC3C,IAAA,OAAO,IAAI,SAAU,CAAA;AAAA,MACnB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,IAAM,EAAA,UAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH,EAAG,CAAC,GAAG,CAAC,CAAA,CAAA;AAER,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,KAAA;AAAA,IACN,OAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useApi, identityApiRef } from '@backstage/core-plugin-api';
|
|
2
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
3
|
+
|
|
4
|
+
function useUserEmail() {
|
|
5
|
+
var _a;
|
|
6
|
+
const identityApi = useApi(identityApiRef);
|
|
7
|
+
const state = useAsync(() => identityApi.getProfileInfo(), [identityApi]);
|
|
8
|
+
return (_a = state.value) == null ? void 0 : _a.email;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { useUserEmail };
|
|
12
|
+
//# sourceMappingURL=useUserEmail.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserEmail.esm.js","sources":["../../src/hooks/useUserEmail.ts"],"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 { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\n\nexport function useUserEmail(): string | undefined {\n const identityApi = useApi(identityApiRef);\n const state = useAsync(() => identityApi.getProfileInfo(), [identityApi]);\n return state.value?.email;\n}\n"],"names":[],"mappings":";;;AAmBO,SAAS,YAAmC,GAAA;AAnBnD,EAAA,IAAA,EAAA,CAAA;AAoBE,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,KAAA,GAAQ,SAAS,MAAM,WAAA,CAAY,gBAAkB,EAAA,CAAC,WAAW,CAAC,CAAA,CAAA;AACxE,EAAO,OAAA,CAAA,EAAA,GAAA,KAAA,CAAM,UAAN,IAAa,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,CAAA;AACtB;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
2
|
+
import '@backstage/errors';
|
|
3
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
4
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
5
|
+
|
|
6
|
+
function useUserTeamIds(userId) {
|
|
7
|
+
const api = useApi(azureDevOpsApiRef);
|
|
8
|
+
const {
|
|
9
|
+
value: teamIds,
|
|
10
|
+
loading,
|
|
11
|
+
error
|
|
12
|
+
} = useAsync(() => {
|
|
13
|
+
return userId ? api.getUserTeamIds(userId) : Promise.resolve(void 0);
|
|
14
|
+
}, [userId, api]);
|
|
15
|
+
return {
|
|
16
|
+
teamIds,
|
|
17
|
+
loading,
|
|
18
|
+
error
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { useUserTeamIds };
|
|
23
|
+
//# sourceMappingURL=useUserTeamIds.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserTeamIds.esm.js","sources":["../../src/hooks/useUserTeamIds.ts"],"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 { azureDevOpsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\n\nexport function useUserTeamIds(userId: string | undefined): {\n teamIds?: string[];\n loading: boolean;\n error?: Error;\n} {\n const api = useApi(azureDevOpsApiRef);\n\n const {\n value: teamIds,\n loading,\n error,\n } = useAsync(() => {\n return userId ? api.getUserTeamIds(userId) : Promise.resolve(undefined);\n }, [userId, api]);\n\n return {\n teamIds,\n loading,\n error,\n };\n}\n"],"names":[],"mappings":";;;;;AAoBO,SAAS,eAAe,MAI7B,EAAA;AACA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA,CAAA;AAEpC,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,OAAA;AAAA,IACP,OAAA;AAAA,IACA,KAAA;AAAA,GACF,GAAI,SAAS,MAAM;AACjB,IAAA,OAAO,SAAS,GAAI,CAAA,cAAA,CAAe,MAAM,CAAI,GAAA,OAAA,CAAQ,QAAQ,KAAS,CAAA,CAAA,CAAA;AAAA,GACrE,EAAA,CAAC,MAAQ,EAAA,GAAG,CAAC,CAAA,CAAA;AAEhB,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,95 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
1
|
+
export { AzurePullRequestsPage, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, azureDevOpsPlugin, isAzureDevOpsAvailable, isAzurePipelinesAvailable } from './plugin.esm.js';
|
|
2
|
+
export { AzurePullRequestsIcon } from './components/AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js';
|
|
3
|
+
export { azureDevOpsApiRef } from './api/AzureDevOpsApi.esm.js';
|
|
4
|
+
export { AzureDevOpsClient } from './api/AzureDevOpsClient.esm.js';
|
|
5
|
+
import './components/PullRequestsPage/PullRequestsPage.esm.js';
|
|
6
|
+
export { FilterType } from './components/PullRequestsPage/lib/filters/types.esm.js';
|
|
6
7
|
import 'luxon';
|
|
7
8
|
import 'humanize-duration';
|
|
8
|
-
import '@backstage/
|
|
9
|
-
import 'react';
|
|
10
|
-
import '@material-ui/core/SvgIcon';
|
|
11
|
-
import '@backstage/core-components';
|
|
12
|
-
import '@material-ui/core/Paper';
|
|
13
|
-
import '@material-ui/core/Typography';
|
|
14
|
-
import '@material-ui/core/styles';
|
|
15
|
-
import '@material-ui/core/Card';
|
|
16
|
-
import '@material-ui/core/CardContent';
|
|
17
|
-
import '@material-ui/core/CardHeader';
|
|
18
|
-
import '@material-ui/icons/DoneAll';
|
|
19
|
-
import '@material-ui/icons/Cancel';
|
|
20
|
-
import '@material-ui/icons/GroupWork';
|
|
21
|
-
import '@material-ui/icons/WatchLater';
|
|
22
|
-
import 'react-use/esm/useAsync';
|
|
23
|
-
import 'react-use/esm/useAsyncRetry';
|
|
24
|
-
import 'react-use/esm/useInterval';
|
|
25
|
-
import '@backstage/catalog-model';
|
|
26
|
-
import '@backstage/plugin-permission-react';
|
|
27
|
-
|
|
28
|
-
const isAzureDevOpsAvailable = (entity) => {
|
|
29
|
-
var _a;
|
|
30
|
-
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[AZURE_DEVOPS_REPO_ANNOTATION]);
|
|
31
|
-
};
|
|
32
|
-
const isAzurePipelinesAvailable = (entity) => {
|
|
33
|
-
var _a, _b, _c;
|
|
34
|
-
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[AZURE_DEVOPS_REPO_ANNOTATION]) || Boolean((_b = entity.metadata.annotations) == null ? void 0 : _b[AZURE_DEVOPS_PROJECT_ANNOTATION]) && Boolean(
|
|
35
|
-
(_c = entity.metadata.annotations) == null ? void 0 : _c[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION]
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
const azureDevOpsPlugin = createPlugin({
|
|
39
|
-
id: "azureDevOps",
|
|
40
|
-
apis: [
|
|
41
|
-
createApiFactory({
|
|
42
|
-
api: azureDevOpsApiRef,
|
|
43
|
-
deps: {
|
|
44
|
-
discoveryApi: discoveryApiRef,
|
|
45
|
-
fetchApi: fetchApiRef
|
|
46
|
-
},
|
|
47
|
-
factory: ({ discoveryApi, fetchApi }) => new AzureDevOpsClient({ discoveryApi, fetchApi })
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
const AzurePullRequestsPage = azureDevOpsPlugin.provide(
|
|
52
|
-
createRoutableExtension({
|
|
53
|
-
name: "AzurePullRequestsPage",
|
|
54
|
-
component: () => import('./esm/index-W1pvc5vi.esm.js').then((m) => m.PullRequestsPage),
|
|
55
|
-
mountPoint: azurePullRequestDashboardRouteRef
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
const EntityAzurePipelinesContent = azureDevOpsPlugin.provide(
|
|
59
|
-
createRoutableExtension({
|
|
60
|
-
name: "EntityAzurePipelinesContent",
|
|
61
|
-
component: () => import('./esm/index-Bwu2-Sgs.esm.js').then(
|
|
62
|
-
(m) => m.EntityPageAzurePipelines
|
|
63
|
-
),
|
|
64
|
-
mountPoint: azurePipelinesEntityContentRouteRef
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
const EntityAzureGitTagsContent = azureDevOpsPlugin.provide(
|
|
68
|
-
createRoutableExtension({
|
|
69
|
-
name: "EntityAzureGitTagsContent",
|
|
70
|
-
component: () => import('./esm/index-1Rl7C23d.esm.js').then(
|
|
71
|
-
(m) => m.EntityPageAzureGitTags
|
|
72
|
-
),
|
|
73
|
-
mountPoint: azureGitTagsEntityContentRouteRef
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
const EntityAzurePullRequestsContent = azureDevOpsPlugin.provide(
|
|
77
|
-
createRoutableExtension({
|
|
78
|
-
name: "EntityAzurePullRequestsContent",
|
|
79
|
-
component: () => import('./esm/index-Bo-6jkQA.esm.js').then(
|
|
80
|
-
(m) => m.EntityPageAzurePullRequests
|
|
81
|
-
),
|
|
82
|
-
mountPoint: azurePullRequestsEntityContentRouteRef
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
const EntityAzureReadmeCard = azureDevOpsPlugin.provide(
|
|
86
|
-
createComponentExtension({
|
|
87
|
-
name: "EntityAzureReadmeCard",
|
|
88
|
-
component: {
|
|
89
|
-
lazy: () => import('./esm/index-BJ_pWnMh.esm.js').then((m) => m.ReadmeCard)
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
export { AzureDevOpsClient, AzurePullRequestsPage, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, azureDevOpsApiRef, azureDevOpsPlugin, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
|
|
9
|
+
import '@backstage-community/plugin-azure-devops-common';
|
|
95
10
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { azurePullRequestDashboardRouteRef, azurePipelinesEntityContentRouteRef, azureGitTagsEntityContentRouteRef, azurePullRequestsEntityContentRouteRef } from './routes.esm.js';
|
|
2
|
+
import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
3
|
+
import { AzureDevOpsClient } from './api/AzureDevOpsClient.esm.js';
|
|
4
|
+
import { azureDevOpsApiRef } from './api/AzureDevOpsApi.esm.js';
|
|
5
|
+
import { AZURE_DEVOPS_REPO_ANNOTATION, AZURE_DEVOPS_PROJECT_ANNOTATION, AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION } from '@backstage-community/plugin-azure-devops-common';
|
|
6
|
+
|
|
7
|
+
const isAzureDevOpsAvailable = (entity) => {
|
|
8
|
+
var _a;
|
|
9
|
+
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[AZURE_DEVOPS_REPO_ANNOTATION]);
|
|
10
|
+
};
|
|
11
|
+
const isAzurePipelinesAvailable = (entity) => {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[AZURE_DEVOPS_REPO_ANNOTATION]) || Boolean((_b = entity.metadata.annotations) == null ? void 0 : _b[AZURE_DEVOPS_PROJECT_ANNOTATION]) && Boolean(
|
|
14
|
+
(_c = entity.metadata.annotations) == null ? void 0 : _c[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION]
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
const azureDevOpsPlugin = createPlugin({
|
|
18
|
+
id: "azureDevOps",
|
|
19
|
+
apis: [
|
|
20
|
+
createApiFactory({
|
|
21
|
+
api: azureDevOpsApiRef,
|
|
22
|
+
deps: {
|
|
23
|
+
discoveryApi: discoveryApiRef,
|
|
24
|
+
fetchApi: fetchApiRef
|
|
25
|
+
},
|
|
26
|
+
factory: ({ discoveryApi, fetchApi }) => new AzureDevOpsClient({ discoveryApi, fetchApi })
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
const AzurePullRequestsPage = azureDevOpsPlugin.provide(
|
|
31
|
+
createRoutableExtension({
|
|
32
|
+
name: "AzurePullRequestsPage",
|
|
33
|
+
component: () => import('./components/PullRequestsPage/index.esm.js').then((m) => m.PullRequestsPage),
|
|
34
|
+
mountPoint: azurePullRequestDashboardRouteRef
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
const EntityAzurePipelinesContent = azureDevOpsPlugin.provide(
|
|
38
|
+
createRoutableExtension({
|
|
39
|
+
name: "EntityAzurePipelinesContent",
|
|
40
|
+
component: () => import('./components/EntityPageAzurePipelines/index.esm.js').then(
|
|
41
|
+
(m) => m.EntityPageAzurePipelines
|
|
42
|
+
),
|
|
43
|
+
mountPoint: azurePipelinesEntityContentRouteRef
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
const EntityAzureGitTagsContent = azureDevOpsPlugin.provide(
|
|
47
|
+
createRoutableExtension({
|
|
48
|
+
name: "EntityAzureGitTagsContent",
|
|
49
|
+
component: () => import('./components/EntityPageAzureGitTags/index.esm.js').then(
|
|
50
|
+
(m) => m.EntityPageAzureGitTags
|
|
51
|
+
),
|
|
52
|
+
mountPoint: azureGitTagsEntityContentRouteRef
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
const EntityAzurePullRequestsContent = azureDevOpsPlugin.provide(
|
|
56
|
+
createRoutableExtension({
|
|
57
|
+
name: "EntityAzurePullRequestsContent",
|
|
58
|
+
component: () => import('./components/EntityPageAzurePullRequests/index.esm.js').then(
|
|
59
|
+
(m) => m.EntityPageAzurePullRequests
|
|
60
|
+
),
|
|
61
|
+
mountPoint: azurePullRequestsEntityContentRouteRef
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
const EntityAzureReadmeCard = azureDevOpsPlugin.provide(
|
|
65
|
+
createComponentExtension({
|
|
66
|
+
name: "EntityAzureReadmeCard",
|
|
67
|
+
component: {
|
|
68
|
+
lazy: () => import('./components/ReadmeCard/index.esm.js').then((m) => m.ReadmeCard)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export { AzurePullRequestsPage, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, azureDevOpsPlugin, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
|
|
74
|
+
//# sourceMappingURL=plugin.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 azurePipelinesEntityContentRouteRef,\n azurePullRequestDashboardRouteRef,\n azureGitTagsEntityContentRouteRef,\n azurePullRequestsEntityContentRouteRef,\n} from './routes';\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createComponentExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { AzureDevOpsClient } from './api/AzureDevOpsClient';\nimport { Entity } from '@backstage/catalog-model';\nimport { azureDevOpsApiRef } from './api/AzureDevOpsApi';\nimport {\n AZURE_DEVOPS_REPO_ANNOTATION,\n AZURE_DEVOPS_PROJECT_ANNOTATION,\n AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION,\n} from '@backstage-community/plugin-azure-devops-common';\n\n/** @public */\nexport const isAzureDevOpsAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_REPO_ANNOTATION]);\n\n/** @public */\nexport const isAzurePipelinesAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_REPO_ANNOTATION]) ||\n (Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION]) &&\n Boolean(\n entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION],\n ));\n\n/** @public */\nexport const azureDevOpsPlugin = createPlugin({\n id: 'azureDevOps',\n apis: [\n createApiFactory({\n api: azureDevOpsApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new AzureDevOpsClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/** @public */\nexport const AzurePullRequestsPage = azureDevOpsPlugin.provide(\n createRoutableExtension({\n name: 'AzurePullRequestsPage',\n component: () =>\n import('./components/PullRequestsPage').then(m => m.PullRequestsPage),\n mountPoint: azurePullRequestDashboardRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityAzurePipelinesContent = azureDevOpsPlugin.provide(\n createRoutableExtension({\n name: 'EntityAzurePipelinesContent',\n component: () =>\n import('./components/EntityPageAzurePipelines').then(\n m => m.EntityPageAzurePipelines,\n ),\n mountPoint: azurePipelinesEntityContentRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityAzureGitTagsContent = azureDevOpsPlugin.provide(\n createRoutableExtension({\n name: 'EntityAzureGitTagsContent',\n component: () =>\n import('./components/EntityPageAzureGitTags').then(\n m => m.EntityPageAzureGitTags,\n ),\n mountPoint: azureGitTagsEntityContentRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityAzurePullRequestsContent = azureDevOpsPlugin.provide(\n createRoutableExtension({\n name: 'EntityAzurePullRequestsContent',\n component: () =>\n import('./components/EntityPageAzurePullRequests').then(\n m => m.EntityPageAzurePullRequests,\n ),\n mountPoint: azurePullRequestsEntityContentRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityAzureReadmeCard = azureDevOpsPlugin.provide(\n createComponentExtension({\n name: 'EntityAzureReadmeCard',\n component: {\n lazy: () => import('./components/ReadmeCard').then(m => m.ReadmeCard),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;;AAyCa,MAAA,sBAAA,GAAyB,CAAC,MAAgB,KAAA;AAzCvD,EAAA,IAAA,EAAA,CAAA;AA0CE,EAAA,OAAA,OAAA,CAAA,CAAQ,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,WAAhB,KAAA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DashboardRouteRef = createRouteRef({
|
|
4
|
+
id: "azure-pull-request-dashboard"
|
|
5
|
+
});
|
|
6
|
+
const azurePipelinesEntityContentRouteRef = createRouteRef({
|
|
7
|
+
id: "azure-pipelines-entity-content"
|
|
8
|
+
});
|
|
9
|
+
const azureGitTagsEntityContentRouteRef = createRouteRef({
|
|
10
|
+
id: "azure-git-tags-entity-content"
|
|
11
|
+
});
|
|
12
|
+
const azurePullRequestsEntityContentRouteRef = createRouteRef({
|
|
13
|
+
id: "azure-pull-requests-entity-content"
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { azureGitTagsEntityContentRouteRef, azurePipelinesEntityContentRouteRef, azurePullRequestDashboardRouteRef, azurePullRequestsEntityContentRouteRef };
|
|
17
|
+
//# sourceMappingURL=routes.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const azurePullRequestDashboardRouteRef = createRouteRef({\n id: 'azure-pull-request-dashboard',\n});\n\nexport const azurePipelinesEntityContentRouteRef = createRouteRef({\n id: 'azure-pipelines-entity-content',\n});\n\nexport const azureGitTagsEntityContentRouteRef = createRouteRef({\n id: 'azure-git-tags-entity-content',\n});\n\nexport const azurePullRequestsEntityContentRouteRef = createRouteRef({\n id: 'azure-pull-requests-entity-content',\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,oCAAoC,cAAe,CAAA;AAAA,EAC9D,EAAI,EAAA,8BAAA;AACN,CAAC,EAAA;AAEM,MAAM,sCAAsC,cAAe,CAAA;AAAA,EAChE,EAAI,EAAA,gCAAA;AACN,CAAC,EAAA;AAEM,MAAM,oCAAoC,cAAe,CAAA;AAAA,EAC9D,EAAI,EAAA,+BAAA;AACN,CAAC,EAAA;AAEM,MAAM,yCAAyC,cAAe,CAAA;AAAA,EACnE,EAAI,EAAA,oCAAA;AACN,CAAC;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function arrayHas(arr, value) {
|
|
2
|
+
return new Set(arr).has(value);
|
|
3
|
+
}
|
|
4
|
+
function stringArrayHas(arr, value, ignoreCase = false) {
|
|
5
|
+
if (ignoreCase) {
|
|
6
|
+
return arrayHas(
|
|
7
|
+
arr.map((a) => a == null ? void 0 : a.toLocaleLowerCase("en-US")),
|
|
8
|
+
value == null ? void 0 : value.toLocaleLowerCase("en-US")
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return arrayHas(arr, value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { arrayHas, stringArrayHas };
|
|
15
|
+
//# sourceMappingURL=arrayHas.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayHas.esm.js","sources":["../../src/utils/arrayHas.ts"],"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\nexport function arrayHas<T>(arr: T[], value: T): boolean {\n return new Set<T>(arr).has(value);\n}\n\nexport function stringArrayHas(\n arr: Array<string | undefined>,\n value: string | undefined,\n ignoreCase: boolean = false,\n): boolean {\n if (ignoreCase) {\n return arrayHas(\n arr.map(a => a?.toLocaleLowerCase('en-US')),\n value?.toLocaleLowerCase('en-US'),\n );\n }\n\n return arrayHas(arr, value);\n}\n"],"names":[],"mappings":"AAgBgB,SAAA,QAAA,CAAY,KAAU,KAAmB,EAAA;AACvD,EAAA,OAAO,IAAI,GAAA,CAAO,GAAG,CAAA,CAAE,IAAI,KAAK,CAAA,CAAA;AAClC,CAAA;AAEO,SAAS,cACd,CAAA,GAAA,EACA,KACA,EAAA,UAAA,GAAsB,KACb,EAAA;AACT,EAAA,IAAI,UAAY,EAAA;AACd,IAAO,OAAA,QAAA;AAAA,MACL,GAAI,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAA,CAAG,kBAAkB,OAAQ,CAAA,CAAA;AAAA,MAC1C,+BAAO,iBAAkB,CAAA,OAAA,CAAA;AAAA,KAC3B,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,QAAA,CAAS,KAAK,KAAK,CAAA,CAAA;AAC5B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equalsIgnoreCase.esm.js","sources":["../../src/utils/equalsIgnoreCase.ts"],"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\nexport function equalsIgnoreCase(str1: string, str2: string): boolean {\n return str1.toLocaleLowerCase('en-US') === str2.toLocaleLowerCase('en-US');\n}\n"],"names":[],"mappings":"AAgBgB,SAAA,gBAAA,CAAiB,MAAc,IAAuB,EAAA;AACpE,EAAA,OAAO,KAAK,iBAAkB,CAAA,OAAO,CAAM,KAAA,IAAA,CAAK,kBAAkB,OAAO,CAAA,CAAA;AAC3E;;;;"}
|
|
@@ -80,5 +80,5 @@ function getHostOrg(annotations) {
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export { getAnnotationValuesFromEntity
|
|
84
|
-
//# sourceMappingURL=getAnnotationValuesFromEntity
|
|
83
|
+
export { getAnnotationValuesFromEntity };
|
|
84
|
+
//# sourceMappingURL=getAnnotationValuesFromEntity.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAnnotationValuesFromEntity.esm.js","sources":["../../src/utils/getAnnotationValuesFromEntity.ts"],"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 { Entity } from '@backstage/catalog-model';\nimport {\n AZURE_DEVOPS_PROJECT_ANNOTATION,\n AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION,\n AZURE_DEVOPS_README_ANNOTATION,\n AZURE_DEVOPS_REPO_ANNOTATION,\n AZURE_DEVOPS_HOST_ORG_ANNOTATION,\n} from '@backstage-community/plugin-azure-devops-common';\n\nexport function getAnnotationValuesFromEntity(entity: Entity): {\n project: string;\n repo?: string;\n definition?: string;\n host?: string;\n org?: string;\n readmePath?: string;\n} {\n const hostOrg = getHostOrg(entity.metadata.annotations);\n const projectRepo = getProjectRepo(entity.metadata.annotations);\n const project =\n entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION];\n const definition =\n entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION];\n const readmePath =\n entity.metadata.annotations?.[AZURE_DEVOPS_README_ANNOTATION];\n\n if (definition) {\n if (project) {\n return {\n project,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_PROJECT_ANNOTATION}\" was not found`,\n );\n } else {\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n\n if (project) {\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION}\" was not found`,\n );\n }\n }\n\n throw new Error('Expected \"dev.azure.com\" annotations were not found');\n}\n\nfunction getProjectRepo(annotations?: Record<string, string>): {\n project?: string;\n repo?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_REPO_ANNOTATION];\n if (!annotation) {\n return { project: undefined, repo: undefined };\n }\n\n if (annotation.split('/').length === 2) {\n const [project, repo] = annotation.split('/');\n if (project && repo) {\n return { project, repo };\n }\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_REPO_ANNOTATION}\"; expected format is: <project-name>/<repo-name>, found: \"${annotation}\"`,\n );\n}\n\nfunction getHostOrg(annotations?: Record<string, string>): {\n host?: string;\n org?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_HOST_ORG_ANNOTATION];\n if (!annotation) {\n return { host: undefined, org: undefined };\n }\n\n const segments = annotation.split('/');\n if (segments.length === 2) {\n const [host, org] = segments;\n if (host && org) {\n return { host, org };\n }\n } else if (segments.length === 3) {\n const [host, subpath, org] = segments;\n return { host: `${host}/${subpath}`, org };\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_HOST_ORG_ANNOTATION}\"; expected format is: <host-name>/<organization-name>, found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AAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAA,OAAO,EAAE,IAAA,EAAM,KAAW,CAAA,EAAA,GAAA,EAAK,KAAU,CAAA,EAAA,CAAA;AAAA,GAC3C;AAEA,EAAM,MAAA,QAAA,GAAW,UAAW,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AACrC,EAAI,IAAA,QAAA,CAAS,WAAW,CAAG,EAAA;AACzB,IAAM,MAAA,CAAC,IAAM,EAAA,GAAG,CAAI,GAAA,QAAA,CAAA;AACpB,IAAA,IAAI,QAAQ,GAAK,EAAA;AACf,MAAO,OAAA,EAAE,MAAM,GAAI,EAAA,CAAA;AAAA,KACrB;AAAA,GACF,MAAA,IAAW,QAAS,CAAA,MAAA,KAAW,CAAG,EAAA;AAChC,IAAA,MAAM,CAAC,IAAA,EAAM,OAAS,EAAA,GAAG,CAAI,GAAA,QAAA,CAAA;AAC7B,IAAA,OAAO,EAAE,IAAM,EAAA,CAAA,EAAG,IAAI,CAAI,CAAA,EAAA,OAAO,IAAI,GAAI,EAAA,CAAA;AAAA,GAC3C;AAEA,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,CAAA,8BAAA,EAAiC,gCAAgC,CAAA,gEAAA,EAAmE,UAAU,CAAA,CAAA,CAAA;AAAA,GAChJ,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DateTime, Interval } from 'luxon';
|
|
2
|
+
import humanizeDuration from 'humanize-duration';
|
|
3
|
+
|
|
4
|
+
const getDurationFromDates = (startTime, finishTime) => {
|
|
5
|
+
if (!startTime || !startTime && !finishTime) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
const start = DateTime.fromISO(startTime);
|
|
9
|
+
const finish = finishTime ? DateTime.fromISO(finishTime) : DateTime.now();
|
|
10
|
+
const formatted = Interval.fromDateTimes(start, finish).toDuration().valueOf();
|
|
11
|
+
const shortEnglishHumanizer = humanizeDuration.humanizer({
|
|
12
|
+
language: "shortEn",
|
|
13
|
+
languages: {
|
|
14
|
+
shortEn: {
|
|
15
|
+
y: () => "y",
|
|
16
|
+
mo: () => "mo",
|
|
17
|
+
w: () => "w",
|
|
18
|
+
d: () => "d",
|
|
19
|
+
h: () => "h",
|
|
20
|
+
m: () => "m",
|
|
21
|
+
s: () => "s",
|
|
22
|
+
ms: () => "ms"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return shortEnglishHumanizer(formatted, {
|
|
27
|
+
largest: 2,
|
|
28
|
+
round: true,
|
|
29
|
+
spacer: ""
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { getDurationFromDates };
|
|
34
|
+
//# sourceMappingURL=getDurationFromDates.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDurationFromDates.esm.js","sources":["../../src/utils/getDurationFromDates.ts"],"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"],"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,CAAA,CAAA;AACxC,EAAA,MAAM,SAAS,UAAa,GAAA,QAAA,CAAS,QAAQ,UAAU,CAAA,GAAI,SAAS,GAAI,EAAA,CAAA;AAExE,EAAM,MAAA,SAAA,GAAY,SAAS,aAAc,CAAA,KAAA,EAAO,MAAM,CACnD,CAAA,UAAA,GACA,OAAQ,EAAA,CAAA;AAEX,EAAM,MAAA,qBAAA,GAAwB,iBAAiB,SAAU,CAAA;AAAA,IACvD,QAAU,EAAA,SAAA;AAAA,IACV,SAAW,EAAA;AAAA,MACT,OAAS,EAAA;AAAA,QACP,GAAG,MAAM,GAAA;AAAA,QACT,IAAI,MAAM,IAAA;AAAA,QACV,GAAG,MAAM,GAAA;AAAA,QACT,GAAG,MAAM,GAAA;AAAA,QACT,GAAG,MAAM,GAAA;AAAA,QACT,GAAG,MAAM,GAAA;AAAA,QACT,GAAG,MAAM,GAAA;AAAA,QACT,IAAI,MAAM,IAAA;AAAA,OACZ;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,sBAAsB,SAAW,EAAA;AAAA,IACtC,OAAS,EAAA,CAAA;AAAA,IACT,KAAO,EAAA,IAAA;AAAA,IACP,MAAQ,EAAA,EAAA;AAAA,GACT,CAAA,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-azure-devops",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin"
|
|
6
6
|
},
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"test": "backstage-cli package test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage-community/plugin-azure-devops-common": "^0.4.
|
|
48
|
-
"@backstage/catalog-model": "^1.
|
|
49
|
-
"@backstage/core-compat-api": "^0.2.
|
|
50
|
-
"@backstage/core-components": "^0.14.
|
|
47
|
+
"@backstage-community/plugin-azure-devops-common": "^0.4.3",
|
|
48
|
+
"@backstage/catalog-model": "^1.5.0",
|
|
49
|
+
"@backstage/core-compat-api": "^0.2.5",
|
|
50
|
+
"@backstage/core-components": "^0.14.7",
|
|
51
51
|
"@backstage/core-plugin-api": "^1.9.2",
|
|
52
52
|
"@backstage/errors": "^1.2.4",
|
|
53
|
-
"@backstage/frontend-plugin-api": "^0.6.
|
|
54
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
53
|
+
"@backstage/frontend-plugin-api": "^0.6.5",
|
|
54
|
+
"@backstage/plugin-catalog-react": "^1.12.0",
|
|
55
55
|
"@backstage/plugin-permission-react": "^0.4.22",
|
|
56
56
|
"@material-ui/core": "^4.12.2",
|
|
57
57
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"react-use": "^17.2.4"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@backstage/cli": "^0.26.
|
|
65
|
-
"@backstage/dev-utils": "^1.0.
|
|
66
|
-
"@backstage/test-utils": "^1.5.
|
|
64
|
+
"@backstage/cli": "^0.26.6",
|
|
65
|
+
"@backstage/dev-utils": "^1.0.32",
|
|
66
|
+
"@backstage/test-utils": "^1.5.5",
|
|
67
67
|
"@testing-library/dom": "^10.0.0",
|
|
68
68
|
"@testing-library/jest-dom": "^6.0.0",
|
|
69
69
|
"@testing-library/react": "^15.0.0",
|