Rename annotation

Signed-off-by: Julio Zynger <julio.zynger@soundcloud.com>
This commit is contained in:
Julio Zynger
2022-01-03 15:20:25 +01:00
parent 0781c324d5
commit 2d44ec02c2
3 changed files with 15 additions and 6 deletions
@@ -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 <MissingAnnotationEmptyState annotation={GOCD_APP_ANNOTATION} />;
return (
<MissingAnnotationEmptyState annotation={GOCD_PIPELINES_ANNOTATION} />
);
}
if (isError(pipelineHistory)) {
@@ -16,5 +16,5 @@
export {
GoCdBuildsComponent,
isGoCdAvailable,
GOCD_APP_ANNOTATION,
GOCD_PIPELINES_ANNOTATION,
} from './GoCdBuildsComponent';
+1 -1
View File
@@ -16,6 +16,6 @@
export { gocdPlugin } from './plugin';
export { EntityGoCdContent } from './extensions';
export {
GOCD_APP_ANNOTATION,
GOCD_PIPELINES_ANNOTATION,
isGoCdAvailable,
} from './components/GoCdBuildsComponent';