diff --git a/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx b/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx index 5f9db7e415..559f7c551e 100644 --- a/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx +++ b/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx @@ -59,15 +59,36 @@ export const MissingAnnotation = () => ( ); -export const InvalidTeamAnnotation = ({ teamName }: { teamName: string }) => ( - - - -); +export const InvalidAnnotation = ({ + teamName, + routingKey, +}: { + teamName: string | undefined; + routingKey: string | undefined; +}) => { + let titleSuffix = 'provided annotation'; + + if (teamName) { + titleSuffix = `"${teamName}" team name`; + } + + if (routingKey) { + titleSuffix = `"${routingKey}" routing key`; + } + + return ( + + + + + + + ); +}; export const MissingEventsRestEndpoint = () => ( @@ -181,17 +202,9 @@ export const EntitySplunkOnCallCard = () => { usersHashMap, }: { team: Team | undefined; - usersHashMap: any | undefined; + usersHashMap: any; }) => { - if (!team) { - return ( - - ); - } - - const teamName = team.name || ''; + const teamName = team && team.name ? team.name : ''; return ( <> @@ -224,6 +237,15 @@ export const EntitySplunkOnCallCard = () => { const teams = usersAndTeams?.foundTeams || []; + if (!teams.length) { + return ( + + ); + } + return ( <> {teams.map((team, i) => (