From 9e0f6ceb57f413128cd2688597e5ecee4b3a6435 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Mon, 26 Jun 2023 13:19:33 +0200 Subject: [PATCH] Alerting: small typescript fix for Policy (#70655) --- .../notification-policies/Policy.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx index dcb21534895..bb9339d2dad 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx @@ -345,18 +345,13 @@ const InheritedProperties: FC<{ properties: InhertitableProperties }> = ({ prope placement="top" content={ - {Object.entries(properties).map(([key, value]) => { - // no idea how to do this with TypeScript without type casting... - return ( - } > @@ -524,7 +519,7 @@ function getContactPointErrors(contactPoint: string, contactPointsState: Receive return contactPointErrors; } -const routePropertyToLabel = (key: keyof InhertitableProperties): string => { +const routePropertyToLabel = (key: keyof InhertitableProperties | string): string => { switch (key) { case 'receiver': return 'Contact Point'; @@ -538,10 +533,15 @@ const routePropertyToLabel = (key: keyof InhertitableProperties): string => { return 'Mute timings'; case 'repeat_interval': return 'Repeat interval'; + default: + return key; } }; -const routePropertyToValue = (key: keyof InhertitableProperties, value: string | string[]): React.ReactNode => { +const routePropertyToValue = ( + key: keyof InhertitableProperties | string, + value: string | string[] +): React.ReactNode => { const isNotGrouping = key === 'group_by' && Array.isArray(value) && value[0] === '...'; const isSingleGroup = key === 'group_by' && Array.isArray(value) && value.length === 0;