circleci,cloudbuild,github-actions,jenkins: rename internal entity conditional

This commit is contained in:
Patrik Oldsberg
2021-02-07 23:48:31 +01:00
parent 3eb1b1bacc
commit 8e1789e0c3
8 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ import { Entity } from '@backstage/catalog-model';
import { useEntity } from '@backstage/plugin-catalog-react';
import { MissingAnnotationEmptyState } from '@backstage/core';
export const isPluginApplicableToEntity = (entity: Entity) =>
export const isCircleCIAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]);
type Props = {
@@ -35,7 +35,7 @@ type Props = {
export const Router = (_props: Props) => {
const { entity } = useEntity();
if (!isPluginApplicableToEntity(entity)) {
if (!isCircleCIAvailable(entity)) {
return <MissingAnnotationEmptyState annotation={CIRCLECI_ANNOTATION} />;
}
+2 -2
View File
@@ -23,7 +23,7 @@ export * from './api';
export * from './route-refs';
export {
Router,
isPluginApplicableToEntity,
isPluginApplicableToEntity as isCircleCIAvailable,
isCircleCIAvailable,
isCircleCIAvailable as isPluginApplicableToEntity,
} from './components/Router';
export { CIRCLECI_ANNOTATION } from './constants';
+2 -2
View File
@@ -23,7 +23,7 @@ import { WorkflowRunsTable } from './WorkflowRunsTable';
import { CLOUDBUILD_ANNOTATION } from './useProjectName';
import { MissingAnnotationEmptyState } from '@backstage/core';
export const isPluginApplicableToEntity = (entity: Entity) =>
export const isCloudbuildAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[CLOUDBUILD_ANNOTATION]);
type Props = {
@@ -34,7 +34,7 @@ type Props = {
export const Router = (_props: Props) => {
const { entity } = useEntity();
if (!isPluginApplicableToEntity(entity)) {
if (!isCloudbuildAvailable(entity)) {
// TODO(shmidt-i): move warning to a separate standardized component
return <MissingAnnotationEmptyState annotation={CLOUDBUILD_ANNOTATION} />;
}
+2 -2
View File
@@ -23,8 +23,8 @@ export {
export * from './api';
export {
Router,
isPluginApplicableToEntity,
isPluginApplicableToEntity as isCloudbuildAvailable,
isCloudbuildAvailable,
isCloudbuildAvailable as isPluginApplicableToEntity,
} from './components/Router';
export * from './components/Cards';
export { CLOUDBUILD_ANNOTATION } from './components/useProjectName';
@@ -23,7 +23,7 @@ import { WorkflowRunsTable } from './WorkflowRunsTable';
import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName';
import { MissingAnnotationEmptyState } from '@backstage/core';
export const isPluginApplicableToEntity = (entity: Entity) =>
export const isGithubActionsAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]);
type Props = {
@@ -34,7 +34,7 @@ type Props = {
export const Router = (_props: Props) => {
const { entity } = useEntity();
if (!isPluginApplicableToEntity(entity)) {
if (!isGithubActionsAvailable(entity)) {
return (
<MissingAnnotationEmptyState annotation={GITHUB_ACTIONS_ANNOTATION} />
);
+2 -2
View File
@@ -25,8 +25,8 @@ export {
export * from './api';
export {
Router,
isPluginApplicableToEntity,
isPluginApplicableToEntity as isGithubActionsAvailable,
isGithubActionsAvailable,
isGithubActionsAvailable as isPluginApplicableToEntity,
} from './components/Router';
export * from './components/Cards';
export { GITHUB_ACTIONS_ANNOTATION } from './components/useProjectName';
+2 -2
View File
@@ -23,7 +23,7 @@ import { Entity } from '@backstage/catalog-model';
import { MissingAnnotationEmptyState } from '@backstage/core';
import { CITable } from './BuildsPage/lib/CITable';
export const isPluginApplicableToEntity = (entity: Entity) =>
export const isJenkinsAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]);
type Props = {
@@ -34,7 +34,7 @@ type Props = {
export const Router = (_props: Props) => {
const { entity } = useEntity();
if (!isPluginApplicableToEntity(entity)) {
if (!isJenkinsAvailable(entity)) {
return <MissingAnnotationEmptyState annotation={JENKINS_ANNOTATION} />;
}
+2 -2
View File
@@ -23,8 +23,8 @@ export {
export { LatestRunCard } from './components/Cards';
export {
Router,
isPluginApplicableToEntity,
isPluginApplicableToEntity as isJenkinsAvailable,
isJenkinsAvailable,
isJenkinsAvailable as isPluginApplicableToEntity,
} from './components/Router';
export { JENKINS_ANNOTATION } from './constants';
export * from './api';