diff --git a/.changeset/wild-emus-film.md b/.changeset/wild-emus-film.md new file mode 100644 index 0000000000..abb77c5ddc --- /dev/null +++ b/.changeset/wild-emus-film.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-insights': minor +--- + +Add checksId option to EntityTechInsightsScorecardContent component diff --git a/plugins/tech-insights/api-report.md b/plugins/tech-insights/api-report.md index deadd06010..9574efca28 100644 --- a/plugins/tech-insights/api-report.md +++ b/plugins/tech-insights/api-report.md @@ -34,9 +34,11 @@ export type CheckResultRenderer = { export const EntityTechInsightsScorecardContent: ({ title, description, + checksId, }: { title?: string | undefined; description?: string | undefined; + checksId?: string[] | undefined; }) => JSX.Element; // @public @@ -58,7 +60,7 @@ export interface TechInsightsApi { // (undocumented) runChecks( entityParams: CompoundEntityRef, - checks?: Check[], + checks?: string[], ): Promise; } diff --git a/plugins/tech-insights/src/api/TechInsightsApi.ts b/plugins/tech-insights/src/api/TechInsightsApi.ts index 0a6bb937a6..a24bf74a01 100644 --- a/plugins/tech-insights/src/api/TechInsightsApi.ts +++ b/plugins/tech-insights/src/api/TechInsightsApi.ts @@ -47,7 +47,7 @@ export interface TechInsightsApi { getAllChecks(): Promise; runChecks( entityParams: CompoundEntityRef, - checks?: Check[], + checks?: string[], ): Promise; runBulkChecks( entities: CompoundEntityRef[], diff --git a/plugins/tech-insights/src/api/TechInsightsClient.ts b/plugins/tech-insights/src/api/TechInsightsClient.ts index 5b9af9557f..04de46dba9 100644 --- a/plugins/tech-insights/src/api/TechInsightsClient.ts +++ b/plugins/tech-insights/src/api/TechInsightsClient.ts @@ -75,13 +75,12 @@ export class TechInsightsClient implements TechInsightsApi { async runChecks( entityParams: CompoundEntityRef, - checks?: Check[], + checks?: string[], ): Promise { const url = await this.discoveryApi.getBaseUrl('tech-insights'); const { token } = await this.identityApi.getCredentials(); const { namespace, kind, name } = entityParams; - const checkIds = checks ? checks.map(check => check.id) : []; - const requestBody = { checks: checkIds.length > 0 ? checkIds : undefined }; + const requestBody = { checks }; const response = await fetch( `${url}/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent( kind, diff --git a/plugins/tech-insights/src/components/ScorecardsOverview/ScorecardsOverview.tsx b/plugins/tech-insights/src/components/ScorecardsOverview/ScorecardsOverview.tsx index 73143a7ea8..53cf826e78 100644 --- a/plugins/tech-insights/src/components/ScorecardsOverview/ScorecardsOverview.tsx +++ b/plugins/tech-insights/src/components/ScorecardsOverview/ScorecardsOverview.tsx @@ -26,14 +26,16 @@ import { techInsightsApiRef } from '../../api/TechInsightsApi'; export const ScorecardsOverview = ({ title, description, + checksId, }: { title?: string; description?: string; + checksId?: string[]; }) => { const api = useApi(techInsightsApiRef); const { namespace, kind, name } = useParams(); const { value, loading, error } = useAsync( - async () => await api.runChecks({ namespace, kind, name }), + async () => await api.runChecks({ namespace, kind, name }, checksId), ); if (loading) {