From f49faa2aa234d1cb0997ca82971e8a4613d1b37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 22 Sep 2020 11:49:45 +0200 Subject: [PATCH] chore: trust the Boolean :) --- plugins/circleci/src/components/Router.tsx | 3 +-- plugins/github-actions/src/components/Router.tsx | 5 ++--- plugins/jenkins/src/components/Router.tsx | 3 +-- plugins/rollbar/src/components/Router.tsx | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/circleci/src/components/Router.tsx b/plugins/circleci/src/components/Router.tsx index 282eac9111..41764b3d7d 100644 --- a/plugins/circleci/src/components/Router.tsx +++ b/plugins/circleci/src/components/Router.tsx @@ -24,8 +24,7 @@ import { Entity } from '@backstage/catalog-model'; import { WarningPanel } from '@backstage/core'; export const isPluginApplicableToEntity = (entity: Entity) => - Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]) && - entity.metadata.annotations?.[CIRCLECI_ANNOTATION] !== ''; + Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]); export const Router = ({ entity }: { entity: Entity }) => !isPluginApplicableToEntity(entity) ? ( diff --git a/plugins/github-actions/src/components/Router.tsx b/plugins/github-actions/src/components/Router.tsx index 7d340fb8b8..fae56a0480 100644 --- a/plugins/github-actions/src/components/Router.tsx +++ b/plugins/github-actions/src/components/Router.tsx @@ -23,13 +23,12 @@ import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName'; import { WarningPanel } from '@backstage/core'; export const isPluginApplicableToEntity = (entity: Entity) => - Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]) && - entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] !== ''; + Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]); export const Router = ({ entity }: { entity: Entity }) => // TODO(shmidt-i): move warning to a separate standardized component !isPluginApplicableToEntity(entity) ? ( - +
{GITHUB_ACTIONS_ANNOTATION}
annotation is missing on the entity.
diff --git a/plugins/jenkins/src/components/Router.tsx b/plugins/jenkins/src/components/Router.tsx index 56df5456bc..a4c7314691 100644 --- a/plugins/jenkins/src/components/Router.tsx +++ b/plugins/jenkins/src/components/Router.tsx @@ -23,8 +23,7 @@ import { WarningPanel } from '@backstage/core'; import { CITable } from './BuildsPage/lib/CITable'; export const isPluginApplicableToEntity = (entity: Entity) => - Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]) && - entity.metadata.annotations?.[JENKINS_ANNOTATION] !== ''; + Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]); export const Router = ({ entity }: { entity: Entity }) => { return !isPluginApplicableToEntity(entity) ? ( diff --git a/plugins/rollbar/src/components/Router.tsx b/plugins/rollbar/src/components/Router.tsx index bcf325f281..192ef33a61 100644 --- a/plugins/rollbar/src/components/Router.tsx +++ b/plugins/rollbar/src/components/Router.tsx @@ -23,7 +23,7 @@ import { ROLLBAR_ANNOTATION } from '../constants'; import { EntityPageRollbar } from './EntityPageRollbar/EntityPageRollbar'; export const isPluginApplicableToEntity = (entity: Entity) => - entity.metadata.annotations?.[ROLLBAR_ANNOTATION] !== ''; + Boolean(entity.metadata.annotations?.[ROLLBAR_ANNOTATION]); type Props = { entity: Entity;