From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id CB4651FF137 for ; Tue, 03 Mar 2026 16:23:03 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 92C631AE48; Tue, 3 Mar 2026 16:23:47 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v4 18/22] ui: add notification thresholds edit window Date: Tue, 3 Mar 2026 16:23:13 +0100 Message-ID: <20260303152317.934256-32-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260303152317.934256-1-c.ebner@proxmox.com> References: <20260303152317.934256-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1772551388190 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.051 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: UG3LCJ53MFYPATLTXI4LFVFU6SCQ7QRT X-Message-ID-Hash: UG3LCJ53MFYPATLTXI4LFVFU6SCQ7QRT X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allows setting the notification thresholds via the datastore options. Signed-off-by: Christian Ebner --- www/Makefile | 1 + www/datastore/OptionView.js | 9 +++ www/window/NotificationThresholds.js | 113 +++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 www/window/NotificationThresholds.js diff --git a/www/Makefile b/www/Makefile index 9ebf0445f..5002bae90 100644 --- a/www/Makefile +++ b/www/Makefile @@ -81,6 +81,7 @@ JSSRC= \ window/NamespaceEdit.js \ window/MaintenanceOptions.js \ window/NotesEdit.js \ + window/NotificationThresholds.js \ window/RemoteEdit.js \ window/TrafficControlEdit.js \ window/NotifyOptions.js \ diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js index 7854e64d7..f800c167f 100644 --- a/www/datastore/OptionView.js +++ b/www/datastore/OptionView.js @@ -334,5 +334,14 @@ Ext.define('PBS.Datastore.Options', { }, }, }, + 'notification-thresholds': { + required: true, + header: gettext('Notification Thresholds'), + renderer: (v) => + PBS.Utils.render_notification_thresholds(PBS.Utils.parsePropertyString(v)), + editor: { + xtype: 'pbsNotificationThresholdsEdit', + }, + }, }, }); diff --git a/www/window/NotificationThresholds.js b/www/window/NotificationThresholds.js new file mode 100644 index 000000000..19b3598e6 --- /dev/null +++ b/www/window/NotificationThresholds.js @@ -0,0 +1,113 @@ +Ext.define('PBS.window.NotificationThresholds', { + extend: 'Proxmox.window.Edit', + xtype: 'pbsNotificationThresholdsEdit', + mixins: ['Proxmox.Mixin.CBind'], + + subject: gettext('Notification Thresholds'), + + width: 500, + fieldDefaults: { + labelWidth: 120, + }, + + items: { + xtype: 'inputpanel', + onGetValues: function (values) { + if (!Ext.isArray(values.delete ?? [])) { + values.delete = [values.delete]; + } + for (const k of values.delete ?? []) { + delete values[k]; + } + delete values.delete; + let notificationThresholds = PBS.Utils.printPropertyString(values); + if (!notificationThresholds) { + return { delete: 'notification-thresholds' }; + } + return { 'notification-thresholds': notificationThresholds }; + }, + onSetValues: function (values) { + if (values['notification-thresholds']) { + return PBS.Utils.parsePropertyString(values['notification-thresholds']); + } + }, + items: [ + { + xtype: 'box', + html: `${gettext('S3 requests count:')}`, + padding: '10 0 5 0', + }, + { + xtype: 'proxmoxintegerfield', + name: 's3-get', + fieldLabel: gettext('GET'), + emptyText: gettext('none'), + fieldStyle: 'text-align: right', + minValue: 0, + deleteEmpty: true, + }, + { + xtype: 'proxmoxintegerfield', + name: 's3-put', + fieldLabel: gettext('PUT'), + emptyText: gettext('none'), + fieldStyle: 'text-align: right', + minValue: 0, + deleteEmpty: true, + }, + { + xtype: 'proxmoxintegerfield', + name: 's3-post', + fieldLabel: gettext('POST'), + emptyText: gettext('none'), + fieldStyle: 'text-align: right', + minValue: 0, + deleteEmpty: true, + }, + { + xtype: 'proxmoxintegerfield', + name: 's3-head', + fieldLabel: gettext('HEAD'), + emptyText: gettext('none'), + fieldStyle: 'text-align: right', + minValue: 0, + deleteEmpty: true, + }, + { + xtype: 'proxmoxintegerfield', + name: 's3-delete', + fieldLabel: gettext('DELETE'), + emptyText: gettext('none'), + fieldStyle: 'text-align: right', + minValue: 0, + deleteEmpty: true, + }, + { + xtype: 'menuseparator', + }, + { + xtype: 'box', + html: `${gettext('S3 traffic volume:')}`, + padding: '10 0 5 0', + }, + { + xtype: 'pmxSizeField', + name: 's3-upload', + fieldLabel: gettext('Upload'), + unit: 'GiB', + submitAutoScaledSizeUnit: true, + allowZero: false, + emptyText: gettext('none'), + }, + { + xtype: 'pmxSizeField', + name: 's3-download', + fieldLabel: gettext('Download'), + unit: 'GiB', + submitAutoScaledSizeUnit: true, + allowZero: false, + emptyText: gettext('none'), + }, + ], + }, +}); -- 2.47.3