From cc9b0fc049c2aac1c0d05f5fa944820c151ef874 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 14:38:37 +0300 Subject: [PATCH] [v10.4.x] Alerting: Fix max alerts (#87299) Alerting: Fix max alerts (#87271) (cherry picked from commit 12fa9e56e6a64d1c3a1fb8ab81f999695120e6e1) Co-authored-by: Gilles De Mey --- .../unified/utils/cloud-alertmanager-notifier-types.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts index e8100e9aba9..9c45bac800d 100644 --- a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts +++ b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts @@ -322,8 +322,12 @@ export const cloudNotifierTypes: Array> = [ 'The maximum number of alerts to include in a single webhook message. Alerts above this threshold are truncated. When leaving this at its default value of 0, all alerts are included.', { placeholder: '0', + inputType: 'number', validationRule: '(^\\d+$|^$)', - setValueAs: (value) => (typeof value === 'string' ? parseInt(value, 10) : 0), + setValueAs: (value) => { + const integer = Number(value); + return Number.isFinite(integer) ? integer : 0; + }, } ), httpConfigOption,