validation added

Signed-off-by: mufaddal motiwala <mufaddalmm.52@gmail.com>
This commit is contained in:
mufaddal motiwala
2021-12-15 19:40:33 +05:30
parent bb46214031
commit 060dd5d518
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ import { useEntity } from '@backstage/plugin-catalog-react';
import { NEWRELIC_GUID } from './constants';
export const isNewRelicDashboardAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[NEWRELIC_GUID]);
Boolean(entity?.metadata?.annotations?.[NEWRELIC_GUID]);
type Props = {
/** @deprecated The entity is now grabbed from context instead */
@@ -20,8 +20,8 @@ import { NEWRELIC_GUID } from '../constants';
export function useNewRelicDashboardEntity() {
const { entity } = useEntity();
const integrationKey: string | undefined =
entity.metadata.annotations?.[NEWRELIC_GUID];
const name: string | undefined = entity.metadata.name;
entity?.metadata?.annotations?.[NEWRELIC_GUID];
const name: string | undefined = entity?.metadata?.name;
return { integrationKey, name };
}