From 2d44ec02c278a8080e3a5c36b61e1a2c3ef84f8a Mon Sep 17 00:00:00 2001 From: Julio Zynger Date: Mon, 3 Jan 2022 15:20:25 +0100 Subject: [PATCH] Rename annotation Signed-off-by: Julio Zynger --- .../GoCdBuildsComponent/GoCdBuildsComponent.tsx | 17 +++++++++++++---- .../src/components/GoCdBuildsComponent/index.ts | 2 +- plugins/gocd/src/index.ts | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/plugins/gocd/src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx b/plugins/gocd/src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx index a12af86bfd..b7938a30b1 100644 --- a/plugins/gocd/src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx +++ b/plugins/gocd/src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx @@ -30,16 +30,23 @@ import { GoCdBuildsTable } from '../GoCdBuildsTable/GoCdBuildsTable'; import { GoCdApiError, PipelineHistory } from '../../api/gocdApi.model'; import { Item, Select } from '../Select'; -export const GOCD_APP_ANNOTATION = 'gocd.org/pipelines'; +/** + * Constant storing GoCD pipelines annotation. + * + * @public + */ +export const GOCD_PIPELINES_ANNOTATION = 'gocd.org/pipelines'; export const isGoCdAvailable = (entity: Entity): boolean => - Boolean(entity.metadata.annotations?.[GOCD_APP_ANNOTATION]); + Boolean(entity.metadata.annotations?.[GOCD_PIPELINES_ANNOTATION]); export const GoCdBuildsComponent = (): JSX.Element => { const { entity } = useEntity(); const config = useApi(configApiRef); const rawPipelines: string[] | undefined = ( - entity.metadata.annotations?.[GOCD_APP_ANNOTATION] as string | undefined + entity.metadata.annotations?.[GOCD_PIPELINES_ANNOTATION] as + | string + | undefined ) ?.split(',') .map(p => p.trim()); @@ -72,7 +79,9 @@ export const GoCdBuildsComponent = (): JSX.Element => { } if (!rawPipelines) { - return ; + return ( + + ); } if (isError(pipelineHistory)) { diff --git a/plugins/gocd/src/components/GoCdBuildsComponent/index.ts b/plugins/gocd/src/components/GoCdBuildsComponent/index.ts index 9085ca62ba..662d2b4038 100644 --- a/plugins/gocd/src/components/GoCdBuildsComponent/index.ts +++ b/plugins/gocd/src/components/GoCdBuildsComponent/index.ts @@ -16,5 +16,5 @@ export { GoCdBuildsComponent, isGoCdAvailable, - GOCD_APP_ANNOTATION, + GOCD_PIPELINES_ANNOTATION, } from './GoCdBuildsComponent'; diff --git a/plugins/gocd/src/index.ts b/plugins/gocd/src/index.ts index 97b0fb6e80..c92e899546 100644 --- a/plugins/gocd/src/index.ts +++ b/plugins/gocd/src/index.ts @@ -16,6 +16,6 @@ export { gocdPlugin } from './plugin'; export { EntityGoCdContent } from './extensions'; export { - GOCD_APP_ANNOTATION, + GOCD_PIPELINES_ANNOTATION, isGoCdAvailable, } from './components/GoCdBuildsComponent';