@backstage-community/plugin-azure-devops 0.15.0 → 0.16.1
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 +25 -0
- package/README.md +34 -19
- package/dist/alpha/plugin.esm.js +1 -1
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +9 -9
- package/dist/api/AzureDevOpsApi.esm.js.map +1 -1
- package/dist/api/AzureDevOpsClient.esm.js +3 -0
- package/dist/api/AzureDevOpsClient.esm.js.map +1 -1
- package/dist/components/BuildTable/lib/BuildLogDrawer/BuildLogDrawer.esm.js +1 -3
- package/dist/components/BuildTable/lib/BuildLogDrawer/BuildLogDrawer.esm.js.map +1 -1
- package/dist/components/BuildTable/lib/EmptyBuildResults/EmptyBuildResults.esm.js +1 -3
- package/dist/components/BuildTable/lib/EmptyBuildResults/EmptyBuildResults.esm.js.map +1 -1
- package/dist/components/EntityPageAzurePipelines/EntityPageAzurePipelines.esm.js +0 -2
- package/dist/components/EntityPageAzurePipelines/EntityPageAzurePipelines.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/PullRequestsPage.esm.js +1 -1
- package/dist/components/PullRequestsPage/index.esm.js +0 -1
- package/dist/components/PullRequestsPage/index.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamFilter.esm.js +0 -1
- package/dist/components/PullRequestsPage/lib/filters/assignedToTeamFilter.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/lib/filters/assignedToUserFilter.esm.js +0 -1
- package/dist/components/PullRequestsPage/lib/filters/assignedToUserFilter.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamFilter.esm.js +0 -1
- package/dist/components/PullRequestsPage/lib/filters/createdByTeamFilter.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/lib/filters/createdByUserFilter.esm.js +0 -1
- package/dist/components/PullRequestsPage/lib/filters/createdByUserFilter.esm.js.map +1 -1
- package/dist/components/PullRequestsPage/lib/hooks/useFilterProcessor.esm.js +1 -1
- package/dist/components/ReadmeCard/ReadmeCard.esm.js +0 -2
- package/dist/components/ReadmeCard/ReadmeCard.esm.js.map +1 -1
- package/dist/deprecated.esm.js +6 -0
- package/dist/deprecated.esm.js.map +1 -0
- package/dist/hooks/useBuildRuns.esm.js +1 -4
- package/dist/hooks/useBuildRuns.esm.js.map +1 -1
- package/dist/hooks/useGitTags.esm.js +1 -3
- package/dist/hooks/useGitTags.esm.js.map +1 -1
- package/dist/hooks/usePullRequests.esm.js +1 -4
- package/dist/hooks/usePullRequests.esm.js.map +1 -1
- package/dist/hooks/useReadme.esm.js +6 -3
- package/dist/hooks/useReadme.esm.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.esm.js +3 -3
- package/package.json +12 -12
- package/dist/utils/getAnnotationValuesFromEntity.esm.js +0 -83
- package/dist/utils/getAnnotationValuesFromEntity.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage-community/plugin-azure-devops
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae70011: Moved `getAnnotationValuesFromEntity` to the common package and deprecated the current location. This will be removed in a future version.
|
|
8
|
+
- 837d67f: Updated `README` with details regarding spaces in project and repo names
|
|
9
|
+
- 9cf745c: Updated permissions section in `README` to remove legacy backend references and to make the instructions more clear
|
|
10
|
+
- 3622b13: Deprecated `getRepoBuilds` on the frontend and backend along with related code. The are no usages of this method as it was replaced by `getBuildRuns` well over a year ago. This will be removed in a future release.
|
|
11
|
+
- d813cec: Updated the `createFrontendPlugin` call to use `pluginId` instead of the deprecated `id`
|
|
12
|
+
- 764e1ef: Added a check to validate that the `dev.azure.com/readme-path` annotation value does not have a relative path and throw an error with details if it does as this is not supported by the Azure DevOps API used for this feature.
|
|
13
|
+
- 071eb9b: Added a note to the `README` regarding what value to use for the `dev.azure.com/build-definition` annotation and how you can find it in Azure DevOps if you are unsure.
|
|
14
|
+
- Updated dependencies [ae70011]
|
|
15
|
+
- @backstage-community/plugin-azure-devops-common@0.11.1
|
|
16
|
+
|
|
17
|
+
## 0.16.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- dd67a17: Backstage version bump to v1.39.0
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [dd67a17]
|
|
26
|
+
- @backstage-community/plugin-azure-devops-common@0.11.0
|
|
27
|
+
|
|
3
28
|
## 0.15.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -76,6 +76,8 @@ Then to display the `README` file that belongs to each entity you would do this:
|
|
|
76
76
|
dev.azure.com/readme-path: /<path-to>/<my-readme-file>.md
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
> Note: this annotation does not support relative paths as the API we use from Azure DevOps to power this feature does not support relative paths. If you use something like this `dev.azure.com/readme-path: ./docs/index.md` the frontend will throw an error with details about why.
|
|
80
|
+
|
|
79
81
|
#### Pipeline in different project to repo
|
|
80
82
|
|
|
81
83
|
If your pipeline is in a different project to the source code, you will need to specify this in the project annotation.
|
|
@@ -97,6 +99,8 @@ dev.azure.com/build-definition: <build-definition-name>
|
|
|
97
99
|
|
|
98
100
|
In this case `<project-name>` will be the name of your Team Project and `<build-definition-name>` will be the name of the Build Definition you would like to see Builds for, and it's possible to add more Builds separated by a comma. If the Build Definition name has spaces in it make sure to put quotes around it.
|
|
99
101
|
|
|
102
|
+
> Note: If you are unsure what your Build Definition name is you can confirm this value by going to the [Pipeline Settings in Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/pipelines/customize-pipeline?view=azure-devops#pipeline-settings) and clicking on "Rename/move" from the context menu. The current Build Definition name will be in the dialog box that opens, use this value. It will not be `<some-definition-name>.yml`.
|
|
103
|
+
|
|
100
104
|
#### Multiple Organizations
|
|
101
105
|
|
|
102
106
|
If you have multiple organizations you'll need to also add this annotation:
|
|
@@ -144,6 +148,34 @@ dev.azure.com/host-org: server.company.com/yet-another-org
|
|
|
144
148
|
|
|
145
149
|
**Note:** To save you time, effort, and confusion setting up these annotations manually you can use the `AzureDevOpsAnnotatorProcessor` processor which will add the `dev.azure.com/host-org` and `dev.azure.com/project-repo` annotations for you with the correct values. The Azure DevOps Annotator Processor backend module for the Catalog plugin has details on how to [add this processor](https://github.com/backstage/community-plugins/tree/main/workspaces/azure-devops/plugins/catalog-backend-module-azure-devops-annotator-processor).
|
|
146
150
|
|
|
151
|
+
#### Project Names and Repository Names with Spaces
|
|
152
|
+
|
|
153
|
+
Regarding spaces in project names or repository names, though the author of this plugin often says "spaces are the devil", these have been tested with this plugin and will work as is in the annotations. They will also be added correctly for you when using the `AzureDevOpsAnnotatorProcessor`.
|
|
154
|
+
|
|
155
|
+
Given a project name like "Has Spaces" and a repository name of "With Space" the `dev.azure.com/project-repo` annotation would look like this:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
dev.azure.com/project-repo: Has Spaces/With Space
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Alternatively you can put quotes around the value which would work as well, like this:
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
dev.azure.com/project-repo: 'Has Spaces/With Space'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
the same would apply to the `dev.azure.com/project` annotation using "Has Spaces" as the project name would look like this:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
dev.azure.com/project: Has Spaces
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Or using quotes, like this:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
dev.azure.com/project: 'Has Spaces'
|
|
177
|
+
```
|
|
178
|
+
|
|
147
179
|
### Azure Pipelines Component
|
|
148
180
|
|
|
149
181
|
To get the Azure Pipelines component working you'll need to do the following two steps:
|
|
@@ -322,33 +354,16 @@ To get the README component working you'll need to do the following two steps:
|
|
|
322
354
|
|
|
323
355
|
## Permission Framework
|
|
324
356
|
|
|
325
|
-
Azure DevOps plugin supports the permission framework for PRs, GitTags, Pipelines and Readme features.
|
|
357
|
+
Azure DevOps plugin supports the permission framework for PRs, GitTags, Pipelines and Readme features. To use these permissions you'll need to add the `@backstage-community/plugin-azure-devops-common` to the same location as your [Permission Policy](https://backstage.io/docs/permissions/writing-a-policy). This example assumes that your Permission Policy lives in your `packages/backend`:
|
|
326
358
|
|
|
327
359
|
```bash
|
|
328
360
|
# From your Backstage root directory
|
|
329
361
|
yarn --cwd packages/backend add @backstage-community/plugin-azure-devops-common
|
|
330
362
|
```
|
|
331
363
|
|
|
332
|
-
New Backend you can skip the below and proceed with [permission configuration](#configure-permission)
|
|
333
|
-
|
|
334
|
-
To enable permissions for the legacy backend system in `packages/backend/src/plugins/azure-devops.ts` add the following.
|
|
335
|
-
|
|
336
|
-
```diff
|
|
337
|
-
export default async function createPlugin(
|
|
338
|
-
env: PluginEnvironment,
|
|
339
|
-
): Promise<Router> {
|
|
340
|
-
return createRouter({
|
|
341
|
-
logger: env.logger,
|
|
342
|
-
config: env.config,
|
|
343
|
-
reader: env.reader,
|
|
344
|
-
+ permissions: env.permissions,
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
364
|
### Configure Permission
|
|
350
365
|
|
|
351
|
-
To apply the permission rules add the following in
|
|
366
|
+
To apply the permission rules add the following in to your [Permission Policy](https://backstage.io/docs/permissions/writing-a-policy).
|
|
352
367
|
|
|
353
368
|
> Note: the following is just an example of how you might want to setup permissions, as an Adopter you can configure this to fit your needs. Also all the permissions are Resource Permissions as they work with an Entity with the exception of `azureDevOpsPullRequestDashboardReadPermission`.
|
|
354
369
|
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 ApiBlueprint,\n createApiFactory,\n PageBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { azureDevOpsApiRef, AzureDevOpsClient } from '../api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { azurePullRequestDashboardRouteRef } from '../routes';\nimport { isAzureDevOpsAvailable, isAzurePipelinesAvailable } from '../plugin';\n\n/** @alpha */\nexport const azureDevOpsApi = ApiBlueprint.make({\n params: {\n factory: 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/** @alpha */\nexport const azureDevOpsPullRequestPage = PageBlueprint.make({\n params: {\n defaultPath: '/azure-pull-requests',\n routeRef: convertLegacyRouteRef(azurePullRequestDashboardRouteRef),\n loader: () =>\n import('../components/PullRequestsPage').then(m =>\n compatWrapper(<m.PullRequestsPage />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsPipelinesEntityContent = EntityContentBlueprint.make({\n name: 'pipelines',\n params: {\n defaultPath: '/pipelines',\n defaultTitle: 'Pipelines',\n filter: isAzurePipelinesAvailable,\n loader: () =>\n import('../components/EntityPageAzurePipelines').then(m =>\n compatWrapper(<m.EntityPageAzurePipelines />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsGitTagsEntityContent = EntityContentBlueprint.make({\n name: 'git-tags',\n params: {\n defaultPath: '/git-tags',\n defaultTitle: 'Git Tags',\n filter: isAzureDevOpsAvailable,\n loader: () =>\n import('../components/EntityPageAzureGitTags').then(m =>\n compatWrapper(<m.EntityPageAzureGitTags />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsPullRequestsEntityContent = EntityContentBlueprint.make(\n {\n name: 'pull-requests',\n params: {\n defaultPath: '/pull-requests',\n defaultTitle: 'Pull Requests',\n filter: isAzureDevOpsAvailable,\n loader: () =>\n import('../components/EntityPageAzurePullRequests').then(m =>\n compatWrapper(<m.EntityPageAzurePullRequests />),\n ),\n },\n },\n);\n\n/** @alpha */\nexport const azureDevOpsReadmeEntityCard = EntityCardBlueprint.make({\n name: 'readme',\n params: {\n filter: isAzureDevOpsAvailable,\n loader: async () =>\n import('../components/ReadmeCard').then(m =>\n compatWrapper(<m.ReadmeCard />),\n ),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 ApiBlueprint,\n createApiFactory,\n PageBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { azureDevOpsApiRef, AzureDevOpsClient } from '../api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { azurePullRequestDashboardRouteRef } from '../routes';\nimport { isAzureDevOpsAvailable, isAzurePipelinesAvailable } from '../plugin';\n\n/** @alpha */\nexport const azureDevOpsApi = ApiBlueprint.make({\n params: {\n factory: 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/** @alpha */\nexport const azureDevOpsPullRequestPage = PageBlueprint.make({\n params: {\n defaultPath: '/azure-pull-requests',\n routeRef: convertLegacyRouteRef(azurePullRequestDashboardRouteRef),\n loader: () =>\n import('../components/PullRequestsPage').then(m =>\n compatWrapper(<m.PullRequestsPage />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsPipelinesEntityContent = EntityContentBlueprint.make({\n name: 'pipelines',\n params: {\n defaultPath: '/pipelines',\n defaultTitle: 'Pipelines',\n filter: isAzurePipelinesAvailable,\n loader: () =>\n import('../components/EntityPageAzurePipelines').then(m =>\n compatWrapper(<m.EntityPageAzurePipelines />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsGitTagsEntityContent = EntityContentBlueprint.make({\n name: 'git-tags',\n params: {\n defaultPath: '/git-tags',\n defaultTitle: 'Git Tags',\n filter: isAzureDevOpsAvailable,\n loader: () =>\n import('../components/EntityPageAzureGitTags').then(m =>\n compatWrapper(<m.EntityPageAzureGitTags />),\n ),\n },\n});\n\n/** @alpha */\nexport const azureDevOpsPullRequestsEntityContent = EntityContentBlueprint.make(\n {\n name: 'pull-requests',\n params: {\n defaultPath: '/pull-requests',\n defaultTitle: 'Pull Requests',\n filter: isAzureDevOpsAvailable,\n loader: () =>\n import('../components/EntityPageAzurePullRequests').then(m =>\n compatWrapper(<m.EntityPageAzurePullRequests />),\n ),\n },\n },\n);\n\n/** @alpha */\nexport const azureDevOpsReadmeEntityCard = EntityCardBlueprint.make({\n name: 'readme',\n params: {\n filter: isAzureDevOpsAvailable,\n loader: async () =>\n import('../components/ReadmeCard').then(m =>\n compatWrapper(<m.ReadmeCard />),\n ),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'azure-devops',\n extensions: [\n azureDevOpsApi,\n azureDevOpsReadmeEntityCard,\n azureDevOpsPipelinesEntityContent,\n azureDevOpsGitTagsEntityContent,\n azureDevOpsPullRequestsEntityContent,\n azureDevOpsPullRequestPage,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;AAqCa,MAAA,cAAA,GAAiB,aAAa,IAAK,CAAA;AAAA,EAC9C,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,iBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,iBAAkB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KACnD;AAAA;AAEL,CAAC;AAGY,MAAA,0BAAA,GAA6B,cAAc,IAAK,CAAA;AAAA,EAC3D,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,sBAAA;AAAA,IACb,QAAA,EAAU,sBAAsB,iCAAiC,CAAA;AAAA,IACjE,MAAQ,EAAA,MACN,OAAO,6CAAgC,CAAE,CAAA,IAAA;AAAA,MAAK,OAC5C,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,gBAAA,EAAF,EAAmB,CAAE;AAAA;AACtC;AAEN,CAAC;AAGY,MAAA,iCAAA,GAAoC,uBAAuB,IAAK,CAAA;AAAA,EAC3E,IAAM,EAAA,WAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,YAAA;AAAA,I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EN,CAAC;AAGD,aAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,cAAA;AAAA,EACV,UAAY,EAAA;AAAA,IACV,cAAA;AAAA,IACA,2BAAA;AAAA,IACA,iCAAA;AAAA,IACA,+BAAA;AAAA,IACA,oCAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
3
3
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
@@ -29,7 +29,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
29
29
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
30
30
|
type?: "content" | "summary" | "info" | undefined;
|
|
31
31
|
};
|
|
32
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
32
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
33
33
|
optional: true;
|
|
34
34
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
35
35
|
optional: true;
|
|
@@ -39,7 +39,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
39
39
|
inputs: {};
|
|
40
40
|
params: {
|
|
41
41
|
loader: () => Promise<JSX.Element>;
|
|
42
|
-
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity:
|
|
42
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
43
43
|
type?: _backstage_plugin_catalog_react_alpha.EntityCardType | undefined;
|
|
44
44
|
};
|
|
45
45
|
}>;
|
|
@@ -60,7 +60,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
60
60
|
};
|
|
61
61
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
62
62
|
optional: true;
|
|
63
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
63
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
64
64
|
optional: true;
|
|
65
65
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
66
66
|
optional: true;
|
|
@@ -74,7 +74,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
74
74
|
defaultTitle: string;
|
|
75
75
|
defaultGroup?: (string & {}) | "development" | "deployment" | "overview" | "documentation" | "operation" | "observability" | undefined;
|
|
76
76
|
routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
77
|
-
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity:
|
|
77
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
78
78
|
};
|
|
79
79
|
}>;
|
|
80
80
|
"entity-content:azure-devops/pipelines": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -94,7 +94,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
94
94
|
};
|
|
95
95
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
96
96
|
optional: true;
|
|
97
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
97
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
98
98
|
optional: true;
|
|
99
99
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
100
100
|
optional: true;
|
|
@@ -108,7 +108,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
108
108
|
defaultTitle: string;
|
|
109
109
|
defaultGroup?: (string & {}) | "development" | "deployment" | "overview" | "documentation" | "operation" | "observability" | undefined;
|
|
110
110
|
routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
111
|
-
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity:
|
|
111
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
112
112
|
};
|
|
113
113
|
}>;
|
|
114
114
|
"entity-content:azure-devops/pull-requests": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -128,7 +128,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
128
128
|
};
|
|
129
129
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
130
130
|
optional: true;
|
|
131
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
131
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
132
132
|
optional: true;
|
|
133
133
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
134
134
|
optional: true;
|
|
@@ -142,7 +142,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
|
|
|
142
142
|
defaultTitle: string;
|
|
143
143
|
defaultGroup?: (string & {}) | "development" | "deployment" | "overview" | "documentation" | "operation" | "observability" | undefined;
|
|
144
144
|
routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
145
|
-
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity:
|
|
145
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
146
146
|
};
|
|
147
147
|
}>;
|
|
148
148
|
"page:azure-devops": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureDevOpsApi.esm.js","sources":["../../src/api/AzureDevOpsApi.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 BuildRun,\n BuildRunOptions,\n DashboardPullRequest,\n GitTag,\n PullRequest,\n PullRequestOptions,\n Readme,\n ReadmeConfig,\n RepoBuild,\n RepoBuildOptions,\n Team,\n} from '@backstage-community/plugin-azure-devops-common';\n\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const azureDevOpsApiRef = createApiRef<AzureDevOpsApi>({\n id: 'plugin.azure-devops.service',\n});\n\n/** @public */\nexport interface AzureDevOpsApi {\n getRepoBuilds(\n projectName: string,\n repoName: string,\n host?: string,\n org?: string,\n options?: RepoBuildOptions,\n ): Promise<{ items: RepoBuild[] }>;\n\n getGitTags(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n ): Promise<{ items: GitTag[] }>;\n\n getPullRequests(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n options?: PullRequestOptions,\n ): Promise<{ items: PullRequest[] }>;\n\n getDashboardPullRequests(\n projectName: string,\n teamsLimit?: number,\n ): Promise<DashboardPullRequest[]>;\n\n getAllTeams(limit?: number): Promise<Team[]>;\n\n getUserTeamIds(userId: string): Promise<string[]>;\n\n getBuildRuns(\n projectName: string,\n entityRef: string,\n repoName?: string,\n definitionName?: string,\n host?: string,\n org?: string,\n options?: BuildRunOptions,\n ): Promise<{ items: BuildRun[] }>;\n\n getReadme(opts: ReadmeConfig): Promise<Readme>;\n\n getBuildRunLog(\n projectName: string,\n entityRef: string,\n buildId: number,\n host?: string,\n org?: string,\n ): Promise<{ log: string[] }>;\n}\n"],"names":[],"mappings":";;AAiCO,MAAM,oBAAoB,YAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"AzureDevOpsApi.esm.js","sources":["../../src/api/AzureDevOpsApi.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 BuildRun,\n BuildRunOptions,\n DashboardPullRequest,\n GitTag,\n PullRequest,\n PullRequestOptions,\n Readme,\n ReadmeConfig,\n RepoBuild,\n RepoBuildOptions,\n Team,\n} from '@backstage-community/plugin-azure-devops-common';\n\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const azureDevOpsApiRef = createApiRef<AzureDevOpsApi>({\n id: 'plugin.azure-devops.service',\n});\n\n/** @public */\nexport interface AzureDevOpsApi {\n /**\n * @deprecated This method has no usages and will be removed in a future release\n */\n getRepoBuilds(\n projectName: string,\n repoName: string,\n host?: string,\n org?: string,\n options?: RepoBuildOptions,\n ): Promise<{ items: RepoBuild[] }>;\n\n getGitTags(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n ): Promise<{ items: GitTag[] }>;\n\n getPullRequests(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n options?: PullRequestOptions,\n ): Promise<{ items: PullRequest[] }>;\n\n getDashboardPullRequests(\n projectName: string,\n teamsLimit?: number,\n ): Promise<DashboardPullRequest[]>;\n\n getAllTeams(limit?: number): Promise<Team[]>;\n\n getUserTeamIds(userId: string): Promise<string[]>;\n\n getBuildRuns(\n projectName: string,\n entityRef: string,\n repoName?: string,\n definitionName?: string,\n host?: string,\n org?: string,\n options?: BuildRunOptions,\n ): Promise<{ items: BuildRun[] }>;\n\n getReadme(opts: ReadmeConfig): Promise<Readme>;\n\n getBuildRunLog(\n projectName: string,\n entityRef: string,\n buildId: number,\n host?: string,\n org?: string,\n ): Promise<{ log: string[] }>;\n}\n"],"names":[],"mappings":";;AAiCO,MAAM,oBAAoB,YAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -7,6 +7,9 @@ class AzureDevOpsClient {
|
|
|
7
7
|
this.discoveryApi = options.discoveryApi;
|
|
8
8
|
this.fetchApi = options.fetchApi;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This method has no usages and will be removed in a future release
|
|
12
|
+
*/
|
|
10
13
|
async getRepoBuilds(projectName, repoName, host, org, options) {
|
|
11
14
|
const queryString = new URLSearchParams();
|
|
12
15
|
if (options?.top) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureDevOpsClient.esm.js","sources":["../../src/api/AzureDevOpsClient.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 BuildRun,\n BuildRunOptions,\n DashboardPullRequest,\n GitTag,\n PullRequest,\n PullRequestOptions,\n Readme,\n ReadmeConfig,\n RepoBuild,\n RepoBuildOptions,\n Team,\n} from '@backstage-community/plugin-azure-devops-common';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { AzureDevOpsApi } from './AzureDevOpsApi';\n\n/** @public */\nexport class AzureDevOpsClient implements AzureDevOpsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n public constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n public async getRepoBuilds(\n projectName: string,\n repoName: string,\n host?: string,\n org?: string,\n options?: RepoBuildOptions,\n ): Promise<{ items: RepoBuild[] }> {\n const queryString = new URLSearchParams();\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n const urlSegment = `repo-builds/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<RepoBuild[]>(urlSegment);\n return { items };\n }\n\n public async getGitTags(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n ): Promise<{ items: GitTag[] }> {\n const queryString = new URLSearchParams();\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n queryString.append('entityRef', entityRef);\n const urlSegment = `git-tags/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<GitTag[]>(urlSegment);\n return { items };\n }\n\n public async getPullRequests(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n options?: PullRequestOptions,\n ): Promise<{ items: PullRequest[] }> {\n const queryString = new URLSearchParams();\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n if (options?.status) {\n queryString.append('status', options.status.toString());\n }\n if (options?.teamsLimit) {\n queryString.append('teamsLimit', options.teamsLimit.toString());\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n queryString.append('entityRef', entityRef);\n const urlSegment = `pull-requests/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<PullRequest[]>(urlSegment);\n return { items };\n }\n\n public getDashboardPullRequests(\n projectName: string,\n teamsLimit?: number,\n ): Promise<DashboardPullRequest[]> {\n const queryString = new URLSearchParams();\n queryString.append('top', '100');\n if (teamsLimit) {\n queryString.append('teamsLimit', teamsLimit.toString());\n }\n const urlSegment = `dashboard-pull-requests/${projectName}?${queryString}`;\n return this.get<DashboardPullRequest[]>(urlSegment);\n }\n\n public getAllTeams(limit?: number): Promise<Team[]> {\n const queryString = new URLSearchParams();\n if (limit) {\n queryString.append('limit', limit.toString());\n }\n let urlSegment = 'all-teams';\n if (queryString.toString()) {\n urlSegment += `?${queryString}`;\n }\n return this.get<Team[]>(urlSegment);\n }\n\n public getUserTeamIds(userId: string): Promise<string[]> {\n return this.get<string[]>(`users/${userId}/team-ids`);\n }\n\n public async getBuildRuns(\n projectName: string,\n entityRef: string,\n repoName?: string,\n definitionName?: string,\n host?: string,\n org?: string,\n options?: BuildRunOptions,\n ): Promise<{ items: BuildRun[] }> {\n const queryString = new URLSearchParams();\n queryString.append('entityRef', entityRef);\n if (repoName) {\n queryString.append('repoName', repoName);\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n if (definitionName) {\n const definitionNames = definitionName.split(',');\n if (definitionNames.length > 1) {\n const buildRuns: BuildRun[] = [];\n for (const name of definitionNames) {\n queryString.set('definitionName', name.trim());\n if (options?.top) {\n queryString.set('top', options.top.toString());\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}?${queryString}`;\n const items = await this.get<BuildRun[]>(urlSegment);\n buildRuns.push(...items);\n }\n return { items: buildRuns };\n }\n queryString.append('definitionName', definitionName.trim());\n }\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}?${queryString}`;\n const items = await this.get<BuildRun[]>(urlSegment);\n return { items };\n }\n\n public async getReadme(opts: ReadmeConfig): Promise<Readme> {\n const queryString = new URLSearchParams();\n if (opts.host) {\n queryString.append('host', opts.host);\n }\n if (opts.org) {\n queryString.append('org', opts.org);\n }\n if (opts.path) {\n queryString.append('path', opts.path);\n }\n queryString.append('entityRef', opts.entityRef);\n\n return await this.get(\n `readme/${encodeURIComponent(opts.project)}/${encodeURIComponent(\n opts.repo,\n )}?${queryString}`,\n );\n }\n\n public async getBuildRunLog(\n projectName: string,\n entityRef: string,\n buildId: number,\n host?: string,\n org?: string,\n ): Promise<{ log: string[] }> {\n const queryString = new URLSearchParams();\n queryString.append('entityRef', entityRef);\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}/build/${buildId}/log?${queryString}`;\n return await this.get<{ log: string[] }>(urlSegment);\n }\n\n private async get<T>(path: string): Promise<T> {\n const baseUrl = `${await this.discoveryApi.getBaseUrl('azure-devops')}/`;\n const url = new URL(path, baseUrl);\n\n const response = await this.fetchApi.fetch(url.toString());\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<T>;\n }\n}\n"],"names":["urlSegment","items"],"mappings":";;AAkCO,MAAM,iBAA4C,CAAA;AAAA,EACtC,YAAA;AAAA,EACA,QAAA;AAAA,EAEV,YAAY,OAGhB,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B,EAEA,MAAa,aACX,CAAA,W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AA;AAC7C,IAAA,MAAM,UAAU,CAAG,EAAA,MAAM,KAAK,YAAa,CAAA,UAAA,CAAW,cAAc,CAAC,CAAA,CAAA,CAAA;AACrE,IAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAA,IAAA,EAAM,OAAO,CAAA;AAEjC,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,SAAS,KAAM,CAAA,GAAA,CAAI,UAAU,CAAA;AAEzD,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,QAAQ,CAAA;AAAA;AAGjD,IAAA,OAAO,SAAS,IAAK,EAAA;AAAA;AAEzB;;;;"}
|
|
1
|
+
{"version":3,"file":"AzureDevOpsClient.esm.js","sources":["../../src/api/AzureDevOpsClient.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 BuildRun,\n BuildRunOptions,\n DashboardPullRequest,\n GitTag,\n PullRequest,\n PullRequestOptions,\n Readme,\n ReadmeConfig,\n RepoBuild,\n RepoBuildOptions,\n Team,\n} from '@backstage-community/plugin-azure-devops-common';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { AzureDevOpsApi } from './AzureDevOpsApi';\n\n/** @public */\nexport class AzureDevOpsClient implements AzureDevOpsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n public constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n /**\n * @deprecated This method has no usages and will be removed in a future release\n */\n public async getRepoBuilds(\n projectName: string,\n repoName: string,\n host?: string,\n org?: string,\n options?: RepoBuildOptions,\n ): Promise<{ items: RepoBuild[] }> {\n const queryString = new URLSearchParams();\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n const urlSegment = `repo-builds/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<RepoBuild[]>(urlSegment);\n return { items };\n }\n\n public async getGitTags(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n ): Promise<{ items: GitTag[] }> {\n const queryString = new URLSearchParams();\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n queryString.append('entityRef', entityRef);\n const urlSegment = `git-tags/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<GitTag[]>(urlSegment);\n return { items };\n }\n\n public async getPullRequests(\n projectName: string,\n repoName: string,\n entityRef: string,\n host?: string,\n org?: string,\n options?: PullRequestOptions,\n ): Promise<{ items: PullRequest[] }> {\n const queryString = new URLSearchParams();\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n if (options?.status) {\n queryString.append('status', options.status.toString());\n }\n if (options?.teamsLimit) {\n queryString.append('teamsLimit', options.teamsLimit.toString());\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n queryString.append('entityRef', entityRef);\n const urlSegment = `pull-requests/${encodeURIComponent(\n projectName,\n )}/${encodeURIComponent(repoName)}?${queryString}`;\n\n const items = await this.get<PullRequest[]>(urlSegment);\n return { items };\n }\n\n public getDashboardPullRequests(\n projectName: string,\n teamsLimit?: number,\n ): Promise<DashboardPullRequest[]> {\n const queryString = new URLSearchParams();\n queryString.append('top', '100');\n if (teamsLimit) {\n queryString.append('teamsLimit', teamsLimit.toString());\n }\n const urlSegment = `dashboard-pull-requests/${projectName}?${queryString}`;\n return this.get<DashboardPullRequest[]>(urlSegment);\n }\n\n public getAllTeams(limit?: number): Promise<Team[]> {\n const queryString = new URLSearchParams();\n if (limit) {\n queryString.append('limit', limit.toString());\n }\n let urlSegment = 'all-teams';\n if (queryString.toString()) {\n urlSegment += `?${queryString}`;\n }\n return this.get<Team[]>(urlSegment);\n }\n\n public getUserTeamIds(userId: string): Promise<string[]> {\n return this.get<string[]>(`users/${userId}/team-ids`);\n }\n\n public async getBuildRuns(\n projectName: string,\n entityRef: string,\n repoName?: string,\n definitionName?: string,\n host?: string,\n org?: string,\n options?: BuildRunOptions,\n ): Promise<{ items: BuildRun[] }> {\n const queryString = new URLSearchParams();\n queryString.append('entityRef', entityRef);\n if (repoName) {\n queryString.append('repoName', repoName);\n }\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n if (definitionName) {\n const definitionNames = definitionName.split(',');\n if (definitionNames.length > 1) {\n const buildRuns: BuildRun[] = [];\n for (const name of definitionNames) {\n queryString.set('definitionName', name.trim());\n if (options?.top) {\n queryString.set('top', options.top.toString());\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}?${queryString}`;\n const items = await this.get<BuildRun[]>(urlSegment);\n buildRuns.push(...items);\n }\n return { items: buildRuns };\n }\n queryString.append('definitionName', definitionName.trim());\n }\n if (options?.top) {\n queryString.append('top', options.top.toString());\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}?${queryString}`;\n const items = await this.get<BuildRun[]>(urlSegment);\n return { items };\n }\n\n public async getReadme(opts: ReadmeConfig): Promise<Readme> {\n const queryString = new URLSearchParams();\n if (opts.host) {\n queryString.append('host', opts.host);\n }\n if (opts.org) {\n queryString.append('org', opts.org);\n }\n if (opts.path) {\n queryString.append('path', opts.path);\n }\n queryString.append('entityRef', opts.entityRef);\n\n return await this.get(\n `readme/${encodeURIComponent(opts.project)}/${encodeURIComponent(\n opts.repo,\n )}?${queryString}`,\n );\n }\n\n public async getBuildRunLog(\n projectName: string,\n entityRef: string,\n buildId: number,\n host?: string,\n org?: string,\n ): Promise<{ log: string[] }> {\n const queryString = new URLSearchParams();\n queryString.append('entityRef', entityRef);\n if (host) {\n queryString.append('host', host);\n }\n if (org) {\n queryString.append('org', org);\n }\n const urlSegment = `builds/${encodeURIComponent(\n projectName,\n )}/build/${buildId}/log?${queryString}`;\n return await this.get<{ log: string[] }>(urlSegment);\n }\n\n private async get<T>(path: string): Promise<T> {\n const baseUrl = `${await this.discoveryApi.getBaseUrl('azure-devops')}/`;\n const url = new URL(path, baseUrl);\n\n const response = await this.fetchApi.fetch(url.toString());\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<T>;\n }\n}\n"],"names":["urlSegment","items"],"mappings":";;AAkCO,MAAM,iBAA4C,CAAA;AAAA,EACtC,YAAA;AAAA,EACA,QAAA;AAAA,EAEV,YAAY,OAGhB,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B;AAAA;AAAA;AAAA,EAIA,MAAa,aACX,CAAA,WAAA,EACA,QACA,EAAA,IAAA,EACA,KACA,OACiC,EAAA;AACjC,IAAM,MAAA,WAAA,GAAc,IAAI,eAAgB,EAAA;AACxC,IAAA,IAAI,SAAS,GAAK,EAAA;AAChB,MAAA,WAAA,CAAY,MAAO,CAAA,KAAA,EAAO,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA;AAAA;AAElD,IAAA,IAAI,IAAM,EAAA;AACR,MAAY,WAAA,CAAA,MAAA,CAAO,QAAQ,IAAI,CAAA;AAAA;AAEjC,IAAA,IAAI,GAAK,EAAA;AACP,MAAY,WAAA,CAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA;AAE/B,IAAA,MAA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zB;;;;"}
|
|
@@ -10,9 +10,7 @@ import CloseIcon from '@material-ui/icons/Close';
|
|
|
10
10
|
import { useApi } from '@backstage/core-plugin-api';
|
|
11
11
|
import { azureDevOpsApiRef } from '../../../../api/AzureDevOpsApi.esm.js';
|
|
12
12
|
import '@backstage/errors';
|
|
13
|
-
import '
|
|
14
|
-
import 'humanize-duration';
|
|
15
|
-
import { getAnnotationValuesFromEntity } from '../../../../utils/getAnnotationValuesFromEntity.esm.js';
|
|
13
|
+
import { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';
|
|
16
14
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
17
15
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
18
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildLogDrawer.esm.js","sources":["../../../../../src/components/BuildTable/lib/BuildLogDrawer/BuildLogDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { useState, useEffect, useCallback } from 'react';\nimport Drawer from '@material-ui/core/Drawer';\nimport Typography from '@material-ui/core/Typography';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { azureDevOpsApiRef } from '../../../../api';\nimport { getAnnotationValuesFromEntity } from '
|
|
1
|
+
{"version":3,"file":"BuildLogDrawer.esm.js","sources":["../../../../../src/components/BuildTable/lib/BuildLogDrawer/BuildLogDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { useState, useEffect, useCallback } from 'react';\nimport Drawer from '@material-ui/core/Drawer';\nimport Typography from '@material-ui/core/Typography';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { azureDevOpsApiRef } from '../../../../api';\nimport { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nconst useDrawerStyles = makeStyles(theme => ({\n logDrawer: {\n width: '40%',\n minWidth: '500px',\n padding: theme.spacing(2),\n },\n header: {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: theme.spacing(2),\n borderBottom: `1px solid ${theme.palette.divider}`,\n paddingBottom: theme.spacing(1),\n },\n content: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n },\n logContainer: {\n flexGrow: 1,\n overflow: 'auto',\n backgroundColor: theme.palette.background.default,\n padding: theme.spacing(2),\n borderRadius: theme.shape.borderRadius,\n marginTop: theme.spacing(2),\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n },\n}));\n\ntype BuildLogDrawerProps = {\n buildId?: number;\n open: boolean;\n onClose: () => void;\n logsCache: Record<number, string[]>;\n updateCache: (buildId: number, logs: string[]) => void;\n};\n\nexport const BuildLogDrawer = ({\n buildId,\n open,\n onClose,\n logsCache,\n updateCache,\n}: BuildLogDrawerProps) => {\n const [loading, setLoading] = useState(false);\n const [logs, setLogs] = useState<string[]>([]);\n const [error, setError] = useState<Error | undefined>();\n const { entity } = useEntity();\n const azureApi = useApi(azureDevOpsApiRef);\n const classes = useDrawerStyles();\n\n const fetchLogs = useCallback(async () => {\n if (!buildId) {\n setError(new Error('Missing ID for build'));\n return;\n }\n\n setLoading(true);\n setError(undefined);\n setLogs([]);\n\n try {\n const { project, host, org } = getAnnotationValuesFromEntity(entity);\n const response = await azureApi.getBuildRunLog(\n project,\n stringifyEntityRef(entity),\n buildId,\n host,\n org,\n );\n\n setLogs(response.log);\n updateCache(buildId, response.log);\n } catch (err) {\n setError(err as Error);\n } finally {\n setLoading(false);\n }\n }, [buildId, entity, azureApi, updateCache]);\n\n // Reset logs when a different build is selected\n useEffect(() => {\n if (buildId && open) {\n // Check logs in cache first\n if (logsCache[buildId]) {\n setLogs(logsCache[buildId]);\n } else {\n fetchLogs();\n }\n }\n }, [buildId, open, fetchLogs, logsCache]);\n\n return (\n <Drawer\n anchor=\"right\"\n open={open}\n onClose={onClose}\n classes={{\n paper: classes.logDrawer,\n }}\n >\n <div className={classes.content}>\n <div className={classes.header}>\n <Typography variant=\"h6\">\n Build Logs {buildId ? `(Build #${buildId})` : ''}\n </Typography>\n <IconButton onClick={onClose} aria-label=\"close\">\n <CloseIcon />\n </IconButton>\n </div>\n\n {loading && <LinearProgress />}\n\n {error && (\n <Typography color=\"error\">\n Error loading logs: {error.message}\n </Typography>\n )}\n\n {!loading && !error && logs.length === 0 && (\n <Typography>No logs available</Typography>\n )}\n\n {!loading && !error && logs.length > 0 && (\n <Box component=\"pre\" className={classes.logContainer}>\n {logs.join('\\n')}\n </Box>\n )}\n </div>\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAM,e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,EAAA,EAAW,QAAiB,EAAA,mBAAA,EAAA,CAAA;AAAA,QAG9B,CAAC,OAAW,IAAA,CAAC,KAAS,IAAA,IAAA,CAAK,SAAS,CACnC,oBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EAAU,OAAM,SAAW,EAAA,OAAA,CAAQ,cACrC,QAAK,EAAA,IAAA,CAAA,IAAA,CAAK,IAAI,CACjB,EAAA;AAAA,OAEJ,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Box from '@material-ui/core/Box';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
|
-
import '
|
|
5
|
-
import 'humanize-duration';
|
|
6
|
-
import { getAnnotationValuesFromEntity } from '../../../../utils/getAnnotationValuesFromEntity.esm.js';
|
|
4
|
+
import { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';
|
|
7
5
|
|
|
8
6
|
const EmptyBuildResults = ({ entity }) => {
|
|
9
7
|
const annotations = entity ? getAnnotationValuesFromEntity(entity) : void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyBuildResults.esm.js","sources":["../../../../../src/components/BuildTable/lib/EmptyBuildResults/EmptyBuildResults.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { Entity } from '@backstage/catalog-model';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { getAnnotationValuesFromEntity } from '
|
|
1
|
+
{"version":3,"file":"EmptyBuildResults.esm.js","sources":["../../../../../src/components/BuildTable/lib/EmptyBuildResults/EmptyBuildResults.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { Entity } from '@backstage/catalog-model';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';\n\nexport const EmptyBuildResults = ({ entity }: { entity?: Entity }) => {\n const annotations = entity\n ? getAnnotationValuesFromEntity(entity)\n : undefined;\n const repoName = annotations?.repo;\n const buildDefinition = annotations?.definition;\n\n return (\n <Box padding={2}>\n <Typography component=\"p\" align=\"center\" variant=\"body1\">\n No records to display\n </Typography>\n <Typography component=\"p\" align=\"center\" variant=\"body2\">\n No builds could be found with repository name{' '}\n {repoName ?? '(no value provided)'} or build definition{' '}\n {buildDefinition ?? '(no value provided)'}.\n </Typography>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,iBAAoB,GAAA,CAAC,EAAE,MAAA,EAAkC,KAAA;AACpE,EAAA,MAAM,WAAc,GAAA,MAAA,GAChB,6BAA8B,CAAA,MAAM,CACpC,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,WAAW,WAAa,EAAA,IAAA;AAC9B,EAAA,MAAM,kBAAkB,WAAa,EAAA,UAAA;AAErC,EACE,uBAAA,IAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAS,CACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAW,SAAU,EAAA,GAAA,EAAI,OAAM,QAAS,EAAA,OAAA,EAAQ,SAAQ,QAEzD,EAAA,uBAAA,EAAA,CAAA;AAAA,yBACC,UAAW,EAAA,EAAA,SAAA,EAAU,KAAI,KAAM,EAAA,QAAA,EAAS,SAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,MAAA,+CAAA;AAAA,MACT,GAAA;AAAA,MAC7C,QAAY,IAAA,qBAAA;AAAA,MAAsB,sBAAA;AAAA,MAAqB,GAAA;AAAA,MACvD,eAAmB,IAAA,qBAAA;AAAA,MAAsB;AAAA,KAC5C,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -9,8 +9,6 @@ import 'react-use/esm/useInterval';
|
|
|
9
9
|
import 'react';
|
|
10
10
|
import { azureDevOpsPipelineReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
11
11
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
12
|
-
import 'luxon';
|
|
13
|
-
import 'humanize-duration';
|
|
14
12
|
import { useBuildRuns } from '../../hooks/useBuildRuns.esm.js';
|
|
15
13
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
16
14
|
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPageAzurePipelines.esm.js","sources":["../../../src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BuildTable } from '../BuildTable/BuildTable';\nimport { 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\n items={items}\n loading={loading}\n error={error}\n entity={entity}\n />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityPageAzurePipelines.esm.js","sources":["../../../src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BuildTable } from '../BuildTable/BuildTable';\nimport { 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\n items={items}\n loading={loading}\n error={error}\n entity={entity}\n />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBa,MAAA,wBAAA,GAA2B,CAAC,KAAqC,KAAA;AAC5E,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAM,MAAA,EAAE,OAAO,OAAS,EAAA,KAAA,KAAU,YAAa,CAAA,MAAA,EAAQ,MAAM,YAAY,CAAA;AAEzE,EACE,uBAAA,GAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,iCAAA;AAAA,MACZ,WAAA,EAAa,mBAAmB,MAAM,CAAA;AAAA,MACtC,SAAW,EAAA,IAAA;AAAA,MAEX,QAAA,kBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,OAAA;AAAA,UACA,KAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -5,13 +5,13 @@ import { getPullRequestGroupConfigs, getPullRequestGroups } from './lib/utils.es
|
|
|
5
5
|
import { FilterType } from './lib/filters/types.esm.js';
|
|
6
6
|
import 'luxon';
|
|
7
7
|
import 'humanize-duration';
|
|
8
|
-
import { azureDevOpsPullRequestDashboardReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
9
8
|
import { PullRequestGrid } from './lib/PullRequestGrid/PullRequestGrid.esm.js';
|
|
10
9
|
import '../../api/AzureDevOpsApi.esm.js';
|
|
11
10
|
import '@backstage/errors';
|
|
12
11
|
import '@backstage/core-plugin-api';
|
|
13
12
|
import 'react-use/esm/useAsync';
|
|
14
13
|
import { useDashboardPullRequests } from '../../hooks/useDashboardPullRequests.esm.js';
|
|
14
|
+
import { azureDevOpsPullRequestDashboardReadPermission } from '@backstage-community/plugin-azure-devops-common';
|
|
15
15
|
import '@backstage/catalog-model';
|
|
16
16
|
import { useFilterProcessor } from './lib/hooks/useFilterProcessor.esm.js';
|
|
17
17
|
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignedToTeamFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/assignedToTeamFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type AssignedToTeamFilter = BaseFilter & {\n type: FilterType.AssignedToTeam;\n teamId: string;\n};\n\nexport function createAssignedToTeamFilter(\n filter: AssignedToTeamFilter,\n): PullRequestFilter {\n return (pullRequest: DashboardPullRequest): boolean => {\n const reviewerIds = pullRequest.reviewers?.map(reviewer => reviewer.id);\n\n if (!reviewerIds) {\n return false;\n }\n\n return stringArrayHas(reviewerIds, filter.teamId, true);\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assignedToTeamFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/assignedToTeamFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type AssignedToTeamFilter = BaseFilter & {\n type: FilterType.AssignedToTeam;\n teamId: string;\n};\n\nexport function createAssignedToTeamFilter(\n filter: AssignedToTeamFilter,\n): PullRequestFilter {\n return (pullRequest: DashboardPullRequest): boolean => {\n const reviewerIds = pullRequest.reviewers?.map(reviewer => reviewer.id);\n\n if (!reviewerIds) {\n return false;\n }\n\n return stringArrayHas(reviewerIds, filter.teamId, true);\n };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,2BACd,MACmB,EAAA;AACnB,EAAA,OAAO,CAAC,WAA+C,KAAA;AACrD,IAAA,MAAM,cAAc,WAAY,CAAA,SAAA,EAAW,GAAI,CAAA,CAAA,QAAA,KAAY,SAAS,EAAE,CAAA;AAEtE,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,OAAO,cAAe,CAAA,WAAA,EAAa,MAAO,CAAA,MAAA,EAAQ,IAAI,CAAA;AAAA,GACxD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignedToUserFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/assignedToUserFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type AssignedToUserFilter = BaseFilter &\n (\n | {\n type: FilterType.AssignedToUser;\n email: string;\n }\n | {\n type: FilterType.AssignedToCurrentUser;\n email?: string;\n }\n );\n\nexport function createAssignedToUserFilter(\n filter: AssignedToUserFilter,\n): PullRequestFilter {\n const email = filter.email;\n\n return (pullRequest: DashboardPullRequest): boolean => {\n const uniqueNames = pullRequest.reviewers?.map(\n reviewer => reviewer.uniqueName,\n );\n\n if (!email || !uniqueNames) {\n return false;\n }\n\n return stringArrayHas(uniqueNames, email, true);\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assignedToUserFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/assignedToUserFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type AssignedToUserFilter = BaseFilter &\n (\n | {\n type: FilterType.AssignedToUser;\n email: string;\n }\n | {\n type: FilterType.AssignedToCurrentUser;\n email?: string;\n }\n );\n\nexport function createAssignedToUserFilter(\n filter: AssignedToUserFilter,\n): PullRequestFilter {\n const email = filter.email;\n\n return (pullRequest: DashboardPullRequest): boolean => {\n const uniqueNames = pullRequest.reviewers?.map(\n reviewer => reviewer.uniqueName,\n );\n\n if (!email || !uniqueNames) {\n return false;\n }\n\n return stringArrayHas(uniqueNames, email, true);\n };\n}\n"],"names":[],"mappings":";;;;AAiCO,SAAS,2BACd,MACmB,EAAA;AACnB,EAAA,MAAM,QAAQ,MAAO,CAAA,KAAA;AAErB,EAAA,OAAO,CAAC,WAA+C,KAAA;AACrD,IAAM,MAAA,WAAA,GAAc,YAAY,SAAW,EAAA,GAAA;AAAA,MACzC,cAAY,QAAS,CAAA;AAAA,KACvB;AAEA,IAAI,IAAA,CAAC,KAAS,IAAA,CAAC,WAAa,EAAA;AAC1B,MAAO,OAAA,KAAA;AAAA;AAGT,IAAO,OAAA,cAAA,CAAe,WAAa,EAAA,KAAA,EAAO,IAAI,CAAA;AAAA,GAChD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createdByTeamFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/createdByTeamFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type CreatedByTeamFilter = BaseFilter &\n ({\n type: FilterType.CreatedByTeam;\n } & ({ teamId: string } | { teamName: string }));\n\nexport function createCreatedByTeamFilter(\n filter: CreatedByTeamFilter,\n): PullRequestFilter {\n return (pullRequest: DashboardPullRequest): boolean => {\n const [createdByTeams, team] =\n 'teamId' in filter\n ? [pullRequest.createdBy?.teamIds, filter.teamId]\n : [pullRequest.createdBy?.teamNames, filter.teamName];\n\n if (!createdByTeams) {\n return false;\n }\n\n return stringArrayHas(createdByTeams, team, true);\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createdByTeamFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/createdByTeamFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { stringArrayHas } from '../../../../utils';\n\n/** @public */\nexport type CreatedByTeamFilter = BaseFilter &\n ({\n type: FilterType.CreatedByTeam;\n } & ({ teamId: string } | { teamName: string }));\n\nexport function createCreatedByTeamFilter(\n filter: CreatedByTeamFilter,\n): PullRequestFilter {\n return (pullRequest: DashboardPullRequest): boolean => {\n const [createdByTeams, team] =\n 'teamId' in filter\n ? [pullRequest.createdBy?.teamIds, filter.teamId]\n : [pullRequest.createdBy?.teamNames, filter.teamName];\n\n if (!createdByTeams) {\n return false;\n }\n\n return stringArrayHas(createdByTeams, team, true);\n };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,0BACd,MACmB,EAAA;AACnB,EAAA,OAAO,CAAC,WAA+C,KAAA;AACrD,IAAA,MAAM,CAAC,cAAgB,EAAA,IAAI,IACzB,QAAY,IAAA,MAAA,GACR,CAAC,WAAY,CAAA,SAAA,EAAW,OAAS,EAAA,MAAA,CAAO,MAAM,CAC9C,GAAA,CAAC,YAAY,SAAW,EAAA,SAAA,EAAW,OAAO,QAAQ,CAAA;AAExD,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAO,OAAA,cAAA,CAAe,cAAgB,EAAA,IAAA,EAAM,IAAI,CAAA;AAAA,GAClD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createdByUserFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/createdByUserFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { equalsIgnoreCase } from '../../../../utils';\n\n/** @public */\nexport type CreatedByUserFilter = BaseFilter &\n (\n | {\n type: FilterType.CreatedByUser;\n email: string;\n }\n | {\n type: FilterType.CreatedByCurrentUser;\n email?: string;\n }\n );\n\nexport function createCreatedByUserFilter(\n filter: CreatedByUserFilter,\n): PullRequestFilter {\n const email = filter.email;\n\n return (pullRequest: DashboardPullRequest): boolean => {\n const uniqueName = pullRequest.createdBy?.uniqueName;\n\n if (!email || !uniqueName) {\n return false;\n }\n\n return equalsIgnoreCase(email, uniqueName);\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createdByUserFilter.esm.js","sources":["../../../../../src/components/PullRequestsPage/lib/filters/createdByUserFilter.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 { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';\nimport { BaseFilter, FilterType, PullRequestFilter } from './types';\nimport { equalsIgnoreCase } from '../../../../utils';\n\n/** @public */\nexport type CreatedByUserFilter = BaseFilter &\n (\n | {\n type: FilterType.CreatedByUser;\n email: string;\n }\n | {\n type: FilterType.CreatedByCurrentUser;\n email?: string;\n }\n );\n\nexport function createCreatedByUserFilter(\n filter: CreatedByUserFilter,\n): PullRequestFilter {\n const email = filter.email;\n\n return (pullRequest: DashboardPullRequest): boolean => {\n const uniqueName = pullRequest.createdBy?.uniqueName;\n\n if (!email || !uniqueName) {\n return false;\n }\n\n return equalsIgnoreCase(email, uniqueName);\n };\n}\n"],"names":[],"mappings":";;;;AAiCO,SAAS,0BACd,MACmB,EAAA;AACnB,EAAA,MAAM,QAAQ,MAAO,CAAA,KAAA;AAErB,EAAA,OAAO,CAAC,WAA+C,KAAA;AACrD,IAAM,MAAA,UAAA,GAAa,YAAY,SAAW,EAAA,UAAA;AAE1C,IAAI,IAAA,CAAC,KAAS,IAAA,CAAC,UAAY,EAAA;AACzB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAO,OAAA,gBAAA,CAAiB,OAAO,UAAU,CAAA;AAAA,GAC3C;AACF;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FilterType } from '../filters/types.esm.js';
|
|
2
2
|
import 'luxon';
|
|
3
3
|
import 'humanize-duration';
|
|
4
|
-
import '@backstage-community/plugin-azure-devops-common';
|
|
5
4
|
import '../../../../api/AzureDevOpsApi.esm.js';
|
|
6
5
|
import '@backstage/errors';
|
|
7
6
|
import '@backstage/core-plugin-api';
|
|
@@ -9,6 +8,7 @@ import 'react-use/esm/useAsync';
|
|
|
9
8
|
import 'react-use/esm/useAsyncRetry';
|
|
10
9
|
import 'react-use/esm/useInterval';
|
|
11
10
|
import 'react';
|
|
11
|
+
import '@backstage-community/plugin-azure-devops-common';
|
|
12
12
|
import '@backstage/catalog-model';
|
|
13
13
|
import { useUserEmail } from '../../../../hooks/useUserEmail.esm.js';
|
|
14
14
|
import { useUserTeamIds } from '../../../../hooks/useUserTeamIds.esm.js';
|
|
@@ -13,8 +13,6 @@ import 'react-use/esm/useInterval';
|
|
|
13
13
|
import 'react';
|
|
14
14
|
import '@backstage-community/plugin-azure-devops-common';
|
|
15
15
|
import '@backstage/catalog-model';
|
|
16
|
-
import 'luxon';
|
|
17
|
-
import 'humanize-duration';
|
|
18
16
|
import { useReadme } from '../../hooks/useReadme.esm.js';
|
|
19
17
|
|
|
20
18
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n InfoCard,\n Progress,\n MarkdownContent,\n EmptyState,\n ErrorPanel,\n} from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { useReadme } from '../../hooks';\n\nconst useStyles = makeStyles(theme => ({\n readMe: {\n overflowY: 'auto',\n paddingRight: theme.spacing(1),\n '&::-webkit-scrollbar-track': {\n backgroundColor: '#F5F5F5',\n borderRadius: '5px',\n },\n '&::-webkit-scrollbar': {\n width: '5px',\n backgroundColor: '#F5F5F5',\n borderRadius: '5px',\n },\n '&::-webkit-scrollbar-thumb': {\n border: '1px solid #555555',\n backgroundColor: '#555',\n borderRadius: '4px',\n },\n },\n}));\n\ntype Props = {\n maxHeight?: number;\n};\n\ntype ErrorProps = {\n error: Error;\n};\n\nfunction isNotFoundError(error: any): boolean {\n return error?.response?.status === 404;\n}\n\nconst ReadmeCardError = ({ error }: ErrorProps) => {\n if (isNotFoundError(error)) {\n return (\n <EmptyState\n title=\"No README available for this entity\"\n missing=\"field\"\n description=\"You can add a README to your entity by following the Azure DevOps documentation.\"\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops\"\n >\n Read more\n </Button>\n }\n />\n );\n }\n return <ErrorPanel title={error.message} error={error} />;\n};\n\nexport const ReadmeCard = (props: Props) => {\n const classes = useStyles();\n const { entity } = useEntity();\n const { loading, error, item: value } = useReadme(entity);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ReadmeCardError error={error} />;\n }\n\n return (\n <InfoCard\n title=\"Readme\"\n deepLink={{\n link: value!.url,\n title: 'Readme',\n }}\n >\n <Box className={classes.readMe} sx={{ maxHeight: props.maxHeight }}>\n <MarkdownContent content={value?.content ?? ''} />\n </Box>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n InfoCard,\n Progress,\n MarkdownContent,\n EmptyState,\n ErrorPanel,\n} from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { useReadme } from '../../hooks';\n\nconst useStyles = makeStyles(theme => ({\n readMe: {\n overflowY: 'auto',\n paddingRight: theme.spacing(1),\n '&::-webkit-scrollbar-track': {\n backgroundColor: '#F5F5F5',\n borderRadius: '5px',\n },\n '&::-webkit-scrollbar': {\n width: '5px',\n backgroundColor: '#F5F5F5',\n borderRadius: '5px',\n },\n '&::-webkit-scrollbar-thumb': {\n border: '1px solid #555555',\n backgroundColor: '#555',\n borderRadius: '4px',\n },\n },\n}));\n\ntype Props = {\n maxHeight?: number;\n};\n\ntype ErrorProps = {\n error: Error;\n};\n\nfunction isNotFoundError(error: any): boolean {\n return error?.response?.status === 404;\n}\n\nconst ReadmeCardError = ({ error }: ErrorProps) => {\n if (isNotFoundError(error)) {\n return (\n <EmptyState\n title=\"No README available for this entity\"\n missing=\"field\"\n description=\"You can add a README to your entity by following the Azure DevOps documentation.\"\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops\"\n >\n Read more\n </Button>\n }\n />\n );\n }\n return <ErrorPanel title={error.message} error={error} />;\n};\n\nexport const ReadmeCard = (props: Props) => {\n const classes = useStyles();\n const { entity } = useEntity();\n const { loading, error, item: value } = useReadme(entity);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ReadmeCardError error={error} />;\n }\n\n return (\n <InfoCard\n title=\"Readme\"\n deepLink={{\n link: value!.url,\n title: 'Readme',\n }}\n >\n <Box className={classes.readMe} sx={{ maxHeight: props.maxHeight }}>\n <MarkdownContent content={value?.content ?? ''} />\n </Box>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,SAAW,EAAA,MAAA;AAAA,IACX,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC7B,4BAA8B,EAAA;AAAA,MAC5B,eAAiB,EAAA,SAAA;AAAA,MACjB,YAAc,EAAA;AAAA,KAChB;AAAA,IACA,sBAAwB,EAAA;AAAA,MACtB,KAAO,EAAA,KAAA;AAAA,MACP,eAAiB,EAAA,SAAA;AAAA,MACjB,YAAc,EAAA;AAAA,KAChB;AAAA,IACA,4BAA8B,EAAA;AAAA,MAC5B,MAAQ,EAAA,mBAAA;AAAA,MACR,eAAiB,EAAA,MAAA;AAAA,MACjB,YAAc,EAAA;AAAA;AAChB;AAEJ,CAAE,CAAA,CAAA;AAUF,SAAS,gBAAgB,KAAqB,EAAA;AAC5C,EAAO,OAAA,KAAA,EAAO,UAAU,MAAW,KAAA,GAAA;AACrC;AAEA,MAAM,eAAkB,GAAA,CAAC,EAAE,KAAA,EAAwB,KAAA;AACjD,EAAI,IAAA,eAAA,CAAgB,KAAK,CAAG,EAAA;AAC1B,IACE,uBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,qCAAA;AAAA,QACN,OAAQ,EAAA,OAAA;AAAA,QACR,WAAY,EAAA,kFAAA;AAAA,QACZ,MACE,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,WAAA;AAAA,YACR,KAAM,EAAA,SAAA;AAAA,YACN,IAAK,EAAA,2FAAA;AAAA,YACN,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,KAEJ;AAAA;AAGJ,EAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,KAAO,EAAA,KAAA,CAAM,SAAS,KAAc,EAAA,CAAA;AACzD,CAAA;AAEa,MAAA,UAAA,GAAa,CAAC,KAAiB,KAAA;AAC1C,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,MAAM,KAAM,EAAA,GAAI,UAAU,MAAM,CAAA;AAExD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,GAAA,CAAC,mBAAgB,KAAc,EAAA,CAAA;AAAA;AAGxC,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,QAAA;AAAA,MACN,QAAU,EAAA;AAAA,QACR,MAAM,KAAO,CAAA,GAAA;AAAA,QACb,KAAO,EAAA;AAAA,OACT;AAAA,MAEA,8BAAC,GAAI,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,MAAA,EAAQ,IAAI,EAAE,SAAA,EAAW,KAAM,CAAA,SAAA,IACrD,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,SAAS,KAAO,EAAA,OAAA,IAAW,IAAI,CAClD,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getAnnotationValuesFromEntity as getAnnotationValuesFromEntity$1 } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
|
|
3
|
+
const getAnnotationValuesFromEntity = getAnnotationValuesFromEntity$1;
|
|
4
|
+
|
|
5
|
+
export { getAnnotationValuesFromEntity };
|
|
6
|
+
//# sourceMappingURL=deprecated.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { getAnnotationValuesFromEntity as getAnnotationValuesFromEntityCommon } from '@backstage-community/plugin-azure-devops-common';\n\n/**\n * @public\n * @deprecated Import this from `@backstage-community/plugin-azure-devops-common` instead\n */\nexport const getAnnotationValuesFromEntity =\n getAnnotationValuesFromEntityCommon;\n"],"names":["getAnnotationValuesFromEntityCommon"],"mappings":";;AAsBO,MAAM,6BACX,GAAAA;;;;"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { AZURE_DEVOPS_DEFAULT_TOP } from '@backstage-community/plugin-azure-devops-common';
|
|
1
|
+
import { getAnnotationValuesFromEntity, AZURE_DEVOPS_DEFAULT_TOP } from '@backstage-community/plugin-azure-devops-common';
|
|
2
2
|
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import useAsync from 'react-use/esm/useAsync';
|
|
6
|
-
import 'luxon';
|
|
7
|
-
import 'humanize-duration';
|
|
8
|
-
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
9
6
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
10
7
|
|
|
11
8
|
function useBuildRuns(entity, defaultLimit) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuildRuns.esm.js","sources":["../../src/hooks/useBuildRuns.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 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 '
|
|
1
|
+
{"version":3,"file":"useBuildRuns.esm.js","sources":["../../src/hooks/useBuildRuns.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 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 '@backstage-community/plugin-azure-devops-common';\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"],"names":[],"mappings":";;;;;;;AA4BgB,SAAA,YAAA,CACd,QACA,YAKA,EAAA;AACA,EAAA,MAAM,MAAM,YAAgB,IAAA,wBAAA;AAC5B,EAAA,MAAM,OAA2B,GAAA;AAAA,IAC/B;AAAA,GACF;AAEA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,CAAA;AAEpC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,MAAM;AAC/C,IAAM,MAAA,EAAE,SAAS,IAAM,EAAA,UAAA,EAAY,MAAM,GAAI,EAAA,GAC3C,8BAA8B,MAAM,CAAA;AACtC,IAAA,OAAO,GAAI,CAAA,YAAA;AAAA,MACT,OAAA;AAAA,MACA,mBAAmB,MAAM,CAAA;AAAA,MACzB,IAAA;AAAA,MACA,UAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA;AAAA,KACF;AAAA,GACF,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAO,OAAA;AAAA,IACL,OAAO,KAAO,EAAA,KAAA;AAAA,IACd,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -3,9 +3,7 @@ import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import useAsync from 'react-use/esm/useAsync';
|
|
6
|
-
import '
|
|
7
|
-
import 'humanize-duration';
|
|
8
|
-
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
6
|
+
import { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';
|
|
9
7
|
|
|
10
8
|
function useGitTags(entity) {
|
|
11
9
|
const api = useApi(azureDevOpsApiRef);
|
|
@@ -1 +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 '
|
|
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 '@backstage-community/plugin-azure-devops-common';\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;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;AACzE,IAAA,OAAO,GAAI,CAAA,UAAA;AAAA,MACT,OAAA;AAAA,MACA,IAAA;AAAA,MACA,mBAAmB,MAAM,CAAA;AAAA,MACzB,IAAA;AAAA,MACA;AAAA,KACF;AAAA,GACF,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAO,OAAA;AAAA,IACL,OAAO,KAAO,EAAA,KAAA;AAAA,IACd,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { PullRequestStatus, AZURE_DEVOPS_DEFAULT_TOP } from '@backstage-community/plugin-azure-devops-common';
|
|
1
|
+
import { PullRequestStatus, getAnnotationValuesFromEntity, AZURE_DEVOPS_DEFAULT_TOP } from '@backstage-community/plugin-azure-devops-common';
|
|
2
2
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
3
3
|
import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
4
4
|
import '@backstage/errors';
|
|
5
5
|
import { useApi } from '@backstage/core-plugin-api';
|
|
6
6
|
import useAsync from 'react-use/esm/useAsync';
|
|
7
|
-
import 'luxon';
|
|
8
|
-
import 'humanize-duration';
|
|
9
|
-
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
10
7
|
|
|
11
8
|
function usePullRequests(entity, defaultLimit, requestedStatus, defaultTeamsLimit) {
|
|
12
9
|
const top = defaultLimit ?? AZURE_DEVOPS_DEFAULT_TOP;
|
|
@@ -1 +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 '
|
|
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 '@backstage-community/plugin-azure-devops-common';\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,wBAAA;AAC5B,EAAA,MAAM,aAAkC,KAAA,CAAA;AACxC,EAAM,MAAA,MAAA,GAAS,mBAAmB,iBAAkB,CAAA,MAAA;AACpD,EAAA,MAAM,OAA8B,GAAA;AAAA,IAClC,GAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,GAAA,GAAM,OAAO,iBAAiB,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;AACzE,IAAM,MAAA,SAAA,GAAY,mBAAmB,MAAM,CAAA;AAC3C,IAAA,OAAO,GAAI,CAAA,eAAA;AAAA,MACT,OAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA;AAAA,KACF;AAAA,GACC,EAAA,CAAC,GAAK,EAAA,GAAA,EAAK,MAAM,CAAC,CAAA;AAErB,EAAO,OAAA;AAAA,IACL,OAAO,KAAO,EAAA,KAAA;AAAA,IACd,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -3,14 +3,17 @@ import { azureDevOpsApiRef } from '../api/AzureDevOpsApi.esm.js';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import useAsync from 'react-use/esm/useAsync';
|
|
6
|
-
import '
|
|
7
|
-
import 'humanize-duration';
|
|
8
|
-
import { getAnnotationValuesFromEntity } from '../utils/getAnnotationValuesFromEntity.esm.js';
|
|
6
|
+
import { getAnnotationValuesFromEntity } from '@backstage-community/plugin-azure-devops-common';
|
|
9
7
|
|
|
10
8
|
function useReadme(entity) {
|
|
11
9
|
const api = useApi(azureDevOpsApiRef);
|
|
12
10
|
const { value, loading, error } = useAsync(() => {
|
|
13
11
|
const { project, repo, host, org, readmePath } = getAnnotationValuesFromEntity(entity);
|
|
12
|
+
if (readmePath?.startsWith(".")) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`The "dev.azure.com/readme-path" annotation does not support relative paths, please correct this annotation. The value provided was: "${readmePath}"`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
14
17
|
const entityRef = stringifyEntityRef(entity);
|
|
15
18
|
return api.getReadme({
|
|
16
19
|
project,
|
|
@@ -1 +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 '
|
|
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 '@backstage-community/plugin-azure-devops-common';\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\n if (readmePath?.startsWith('.')) {\n throw new Error(\n `The \"dev.azure.com/readme-path\" annotation does not support relative paths, please correct this annotation. The value provided was: \"${readmePath}\"`,\n );\n }\n\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;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;AAEtC,IAAI,IAAA,UAAA,EAAY,UAAW,CAAA,GAAG,CAAG,EAAA;AAC/B,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,wIAAwI,UAAU,CAAA,CAAA;AAAA,OACpJ;AAAA;AAGF,IAAM,MAAA,SAAA,GAAY,mBAAmB,MAAM,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;AAAA,KACP,CAAA;AAAA,GACH,EAAG,CAAC,GAAG,CAAC,CAAA;AAER,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,KAAA;AAAA,IACN,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DashboardPullRequest, RepoBuildOptions, RepoBuild, GitTag, PullRequestOptions, PullRequest, Team, BuildRunOptions, BuildRun, ReadmeConfig, Readme } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
+
import { DashboardPullRequest, RepoBuildOptions, RepoBuild, GitTag, PullRequestOptions, PullRequest, Team, BuildRunOptions, BuildRun, ReadmeConfig, Readme, getAnnotationValuesFromEntity as getAnnotationValuesFromEntity$1 } from '@backstage-community/plugin-azure-devops-common';
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
4
|
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { Entity } from '@backstage/catalog-model';
|
|
@@ -130,6 +130,9 @@ declare const AzurePullRequestsIcon: (props: SvgIconProps) => react_jsx_runtime.
|
|
|
130
130
|
declare const azureDevOpsApiRef: _backstage_core_plugin_api.ApiRef<AzureDevOpsApi>;
|
|
131
131
|
/** @public */
|
|
132
132
|
interface AzureDevOpsApi {
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated This method has no usages and will be removed in a future release
|
|
135
|
+
*/
|
|
133
136
|
getRepoBuilds(projectName: string, repoName: string, host?: string, org?: string, options?: RepoBuildOptions): Promise<{
|
|
134
137
|
items: RepoBuild[];
|
|
135
138
|
}>;
|
|
@@ -159,6 +162,9 @@ declare class AzureDevOpsClient implements AzureDevOpsApi {
|
|
|
159
162
|
discoveryApi: DiscoveryApi;
|
|
160
163
|
fetchApi: FetchApi;
|
|
161
164
|
});
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated This method has no usages and will be removed in a future release
|
|
167
|
+
*/
|
|
162
168
|
getRepoBuilds(projectName: string, repoName: string, host?: string, org?: string, options?: RepoBuildOptions): Promise<{
|
|
163
169
|
items: RepoBuild[];
|
|
164
170
|
}>;
|
|
@@ -181,14 +187,10 @@ declare class AzureDevOpsClient implements AzureDevOpsApi {
|
|
|
181
187
|
private get;
|
|
182
188
|
}
|
|
183
189
|
|
|
184
|
-
/**
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
host?: string;
|
|
190
|
-
org?: string;
|
|
191
|
-
readmePath?: string;
|
|
192
|
-
};
|
|
190
|
+
/**
|
|
191
|
+
* @public
|
|
192
|
+
* @deprecated Import this from `@backstage-community/plugin-azure-devops-common` instead
|
|
193
|
+
*/
|
|
194
|
+
declare const getAnnotationValuesFromEntity: typeof getAnnotationValuesFromEntity$1;
|
|
193
195
|
|
|
194
196
|
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, getAnnotationValuesFromEntity, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
|
package/dist/index.esm.js
CHANGED
|
@@ -2,9 +2,9 @@ export { AzurePullRequestsPage, EntityAzureGitTagsContent, EntityAzurePipelinesC
|
|
|
2
2
|
export { AzurePullRequestsIcon } from './components/AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js';
|
|
3
3
|
export { azureDevOpsApiRef } from './api/AzureDevOpsApi.esm.js';
|
|
4
4
|
export { AzureDevOpsClient } from './api/AzureDevOpsClient.esm.js';
|
|
5
|
-
import 'luxon';
|
|
6
|
-
import 'humanize-duration';
|
|
7
|
-
export { getAnnotationValuesFromEntity } from './utils/getAnnotationValuesFromEntity.esm.js';
|
|
8
5
|
import './components/PullRequestsPage/PullRequestsPage.esm.js';
|
|
9
6
|
export { FilterType } from './components/PullRequestsPage/lib/filters/types.esm.js';
|
|
7
|
+
import 'luxon';
|
|
8
|
+
import 'humanize-duration';
|
|
9
|
+
export { getAnnotationValuesFromEntity } from './deprecated.esm.js';
|
|
10
10
|
//# sourceMappingURL=index.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-azure-devops",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "azure-devops",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"test": "backstage-cli package test"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@backstage-community/plugin-azure-devops-common": "^0.
|
|
67
|
-
"@backstage/catalog-model": "^1.7.
|
|
68
|
-
"@backstage/core-compat-api": "^0.4.
|
|
69
|
-
"@backstage/core-components": "^0.17.
|
|
70
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
66
|
+
"@backstage-community/plugin-azure-devops-common": "^0.11.1",
|
|
67
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
68
|
+
"@backstage/core-compat-api": "^0.4.2",
|
|
69
|
+
"@backstage/core-components": "^0.17.2",
|
|
70
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
71
71
|
"@backstage/errors": "^1.2.7",
|
|
72
|
-
"@backstage/frontend-plugin-api": "^0.10.
|
|
73
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
74
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
72
|
+
"@backstage/frontend-plugin-api": "^0.10.2",
|
|
73
|
+
"@backstage/plugin-catalog-react": "^1.18.0",
|
|
74
|
+
"@backstage/plugin-permission-react": "^0.4.34",
|
|
75
75
|
"@material-ui/core": "^4.12.2",
|
|
76
76
|
"@material-ui/icons": "^4.9.1",
|
|
77
77
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"react-use": "^17.2.4"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@backstage/cli": "^0.32.
|
|
84
|
-
"@backstage/dev-utils": "^1.1.
|
|
85
|
-
"@backstage/test-utils": "^1.7.
|
|
83
|
+
"@backstage/cli": "^0.32.1",
|
|
84
|
+
"@backstage/dev-utils": "^1.1.10",
|
|
85
|
+
"@backstage/test-utils": "^1.7.8",
|
|
86
86
|
"@testing-library/dom": "^10.0.0",
|
|
87
87
|
"@testing-library/jest-dom": "^6.0.0",
|
|
88
88
|
"@testing-library/react": "^15.0.0",
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { AZURE_DEVOPS_PROJECT_ANNOTATION, AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION, AZURE_DEVOPS_README_ANNOTATION, AZURE_DEVOPS_REPO_ANNOTATION, AZURE_DEVOPS_HOST_ORG_ANNOTATION } from '@backstage-community/plugin-azure-devops-common';
|
|
2
|
-
|
|
3
|
-
function getAnnotationValuesFromEntity(entity) {
|
|
4
|
-
const hostOrg = getHostOrg(entity.metadata.annotations);
|
|
5
|
-
const projectRepo = getProjectRepo(entity.metadata.annotations);
|
|
6
|
-
const project = entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION];
|
|
7
|
-
const definition = entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION];
|
|
8
|
-
const readmePath = entity.metadata.annotations?.[AZURE_DEVOPS_README_ANNOTATION];
|
|
9
|
-
if (definition) {
|
|
10
|
-
if (project) {
|
|
11
|
-
return {
|
|
12
|
-
project,
|
|
13
|
-
definition,
|
|
14
|
-
readmePath,
|
|
15
|
-
...hostOrg
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
if (projectRepo.project) {
|
|
19
|
-
return {
|
|
20
|
-
project: projectRepo.project,
|
|
21
|
-
repo: projectRepo.repo,
|
|
22
|
-
definition,
|
|
23
|
-
readmePath,
|
|
24
|
-
...hostOrg
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Value for annotation "${AZURE_DEVOPS_PROJECT_ANNOTATION}" was not found`
|
|
29
|
-
);
|
|
30
|
-
} else {
|
|
31
|
-
if (projectRepo.project) {
|
|
32
|
-
return {
|
|
33
|
-
project: projectRepo.project,
|
|
34
|
-
repo: projectRepo.repo,
|
|
35
|
-
readmePath,
|
|
36
|
-
...hostOrg
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (project) {
|
|
40
|
-
throw new Error(
|
|
41
|
-
`Value for annotation "${AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION}" was not found`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
throw new Error('Expected "dev.azure.com" annotations were not found');
|
|
46
|
-
}
|
|
47
|
-
function getProjectRepo(annotations) {
|
|
48
|
-
const annotation = annotations?.[AZURE_DEVOPS_REPO_ANNOTATION];
|
|
49
|
-
if (!annotation) {
|
|
50
|
-
return { project: void 0, repo: void 0 };
|
|
51
|
-
}
|
|
52
|
-
if (annotation.split("/").length === 2) {
|
|
53
|
-
const [project, repo] = annotation.split("/");
|
|
54
|
-
if (project && repo) {
|
|
55
|
-
return { project, repo };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Invalid value for annotation "${AZURE_DEVOPS_REPO_ANNOTATION}"; expected format is: <project-name>/<repo-name>, found: "${annotation}"`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
function getHostOrg(annotations) {
|
|
63
|
-
const annotation = annotations?.[AZURE_DEVOPS_HOST_ORG_ANNOTATION];
|
|
64
|
-
if (!annotation) {
|
|
65
|
-
return { host: void 0, org: void 0 };
|
|
66
|
-
}
|
|
67
|
-
const segments = annotation.split("/");
|
|
68
|
-
if (segments.length === 2) {
|
|
69
|
-
const [host, org] = segments;
|
|
70
|
-
if (host && org) {
|
|
71
|
-
return { host, org };
|
|
72
|
-
}
|
|
73
|
-
} else if (segments.length === 3) {
|
|
74
|
-
const [host, subpath, org] = segments;
|
|
75
|
-
return { host: `${host}/${subpath}`, org };
|
|
76
|
-
}
|
|
77
|
-
throw new Error(
|
|
78
|
-
`Invalid value for annotation "${AZURE_DEVOPS_HOST_ORG_ANNOTATION}"; expected format is: <host-name>/<organization-name>, found: "${annotation}"`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { getAnnotationValuesFromEntity };
|
|
83
|
-
//# sourceMappingURL=getAnnotationValuesFromEntity.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n/** @public **/\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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