diff --git a/app-config.yaml b/app-config.yaml
index 645221538b..c24ac1701b 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -436,5 +436,3 @@ azureDevOps:
host: dev.azure.com
token: my-token
organization: my-company
- azurePipelines:
- top: 25
diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx
index 4147874e65..3fe027ddad 100644
--- a/packages/app/src/components/catalog/EntityPage.tsx
+++ b/packages/app/src/components/catalog/EntityPage.tsx
@@ -188,7 +188,7 @@ export const cicdContent = (
-
+
diff --git a/plugins/azure-devops/README.md b/plugins/azure-devops/README.md
index 03be6dfba2..edf26ecfb3 100644
--- a/plugins/azure-devops/README.md
+++ b/plugins/azure-devops/README.md
@@ -17,8 +17,6 @@ azureDevOps:
host: dev.azure.com
token: ${AZURE_TOKEN}
organization: my-company
- azurePipelines:
- top: 50
```
Configuration Details:
@@ -26,7 +24,6 @@ Configuration Details:
- `host` and `token` can be the same as the ones used for the `integration` section
- `AZURE_TOKEN` environment variable must be set to a [Personal Access Token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page) with read access to both Code and Build
- `organization` is your Azure DevOps Organization name or for Azure DevOps Server (on-premise) this will be your Collection name
-- `top` is strictly used by the frontend to limit the number of items returned, if not provided it defaults to 10. Currently only used for Builds
### Backend
@@ -96,7 +93,9 @@ To get the frontend working you'll need to do the following two steps:
// ...
-
+ // Set defaultLimit to the max number of builds you would like to be able to see
+ // the default if not set is 10
+
// ...
diff --git a/plugins/azure-devops/config.d.ts b/plugins/azure-devops/config.d.ts
deleted file mode 100644
index bbd42c55a1..0000000000
--- a/plugins/azure-devops/config.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2021 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export interface Config {
- /** Configuration options for the azure-devops-backend plugin */
- azureDevOps: {
- azurePipelines: {
- /**
- * The max number of items to return - applies to builds
- * @visibility frontend
- */
- top: number;
- };
- };
-}
diff --git a/plugins/azure-devops/package.json b/plugins/azure-devops/package.json
index b6f7801766..3aa545cc27 100644
--- a/plugins/azure-devops/package.json
+++ b/plugins/azure-devops/package.json
@@ -57,8 +57,6 @@
"msw": "^0.29.0"
},
"files": [
- "dist",
- "config.d.ts"
- ],
- "configSchema": "config.d.ts"
+ "dist"
+ ]
}
diff --git a/plugins/azure-devops/src/api/AzureDevOpsClient.ts b/plugins/azure-devops/src/api/AzureDevOpsClient.ts
index f0ed2d9951..e03428e511 100644
--- a/plugins/azure-devops/src/api/AzureDevOpsClient.ts
+++ b/plugins/azure-devops/src/api/AzureDevOpsClient.ts
@@ -31,17 +31,18 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
this.identityApi = options.identityApi;
}
- getRepoBuilds(
+ async getRepoBuilds(
projectName: string,
repoName: string,
options?: RepoBuildOptions,
): Promise<{ items: RepoBuild[] }> {
- return this.get(
+ const items = await this.get(
`repo-builds/${projectName}/${repoName}?top=${options?.top}`,
);
+ return { items };
}
- private async get(path: string): Promise<{ items: any }> {
+ private async get(path: string): Promise {
const baseUrl = `${await this.discoveryApi.getBaseUrl('azure-devops')}/`;
const url = new URL(path, baseUrl);
@@ -54,6 +55,6 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
throw await ResponseError.fromResponse(response);
}
- return response.json() as Promise<{ items: any }>;
+ return response.json() as Promise;
}
}
diff --git a/plugins/azure-devops/src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx b/plugins/azure-devops/src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx
index 34c8bc4fd1..c993922105 100644
--- a/plugins/azure-devops/src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx
+++ b/plugins/azure-devops/src/components/EntityPageAzurePipelines/EntityPageAzurePipelines.tsx
@@ -19,9 +19,13 @@ import React from 'react';
import { useRepoBuilds } from '../../hooks/useRepoBuilds';
import { BuildTable } from '../BuildTable/BuildTable';
-export const EntityPageAzurePipelines = () => {
+export const EntityPageAzurePipelines = ({
+ defaultLimit,
+}: {
+ defaultLimit?: number;
+}) => {
const { entity } = useEntity();
- const { items, loading, error } = useRepoBuilds(entity);
+ const { items, loading, error } = useRepoBuilds(entity, defaultLimit);
return ;
};
diff --git a/plugins/azure-devops/src/components/Router.tsx b/plugins/azure-devops/src/components/Router.tsx
index ce8dd3b51d..3000deb5cc 100644
--- a/plugins/azure-devops/src/components/Router.tsx
+++ b/plugins/azure-devops/src/components/Router.tsx
@@ -25,7 +25,7 @@ import { MissingAnnotationEmptyState } from '@backstage/core-components';
export const isAzureDevOpsAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_ANNOTATION]);
-export const Router = () => {
+export const Router = ({ defaultLimit }: { defaultLimit?: number }) => {
const { entity } = useEntity();
if (!isAzureDevOpsAvailable(entity)) {
@@ -36,7 +36,7 @@ export const Router = () => {
}
+ element={}
/>
);
diff --git a/plugins/azure-devops/src/hooks/useRepoBuilds.ts b/plugins/azure-devops/src/hooks/useRepoBuilds.ts
index 8dafccb4a2..5207838f04 100644
--- a/plugins/azure-devops/src/hooks/useRepoBuilds.ts
+++ b/plugins/azure-devops/src/hooks/useRepoBuilds.ts
@@ -16,21 +16,21 @@
import { useAsync } from 'react-use';
import { Entity } from '@backstage/catalog-model';
-import { useApi, configApiRef } from '@backstage/core-plugin-api';
+import { useApi } from '@backstage/core-plugin-api';
import { azureDevOpsApiRef } from '../api';
import { RepoBuild, RepoBuildOptions } from '../api/types';
import { useProjectRepoFromEntity } from './useProjectRepoFromEntity';
import { AZURE_DEVOPS_DEFAULT_TOP } from '../constants';
-export function useRepoBuilds(entity: Entity): {
+export function useRepoBuilds(
+ entity: Entity,
+ defaultLimit?: number,
+): {
items: RepoBuild[];
loading: boolean;
error: any;
} {
- const config = useApi(configApiRef);
- const top =
- config.getOptionalNumber('azureDevOps.azurePipelines.top') ??
- AZURE_DEVOPS_DEFAULT_TOP;
+ const top = defaultLimit ?? AZURE_DEVOPS_DEFAULT_TOP;
const options: RepoBuildOptions = {
top: top,
};