From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BB6BB6D5F8 for ; Tue, 28 Sep 2021 12:05:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AE026C2B9 for ; Tue, 28 Sep 2021 12:05:57 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6180BC2A3 for ; Tue, 28 Sep 2021 12:05:56 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3D2384247C for ; Tue, 28 Sep 2021 12:05:56 +0200 (CEST) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Tue, 28 Sep 2021 12:05:48 +0200 Message-Id: <20210928100548.4873-6-h.laimer@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210928100548.4873-1-h.laimer@proxmox.com> References: <20210928100548.4873-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.090 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: [pbs-devel] [PATCH proxmox-backup 5/5] ui: add maintenance to datastore options X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 10:05:57 -0000 --- www/Makefile | 1 + www/datastore/OptionView.js | 10 +++++ www/window/MaintenanceOptions.js | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 www/window/MaintenanceOptions.js diff --git a/www/Makefile b/www/Makefile index 4aec6e2c..8f6b17ed 100644 --- a/www/Makefile +++ b/www/Makefile @@ -63,6 +63,7 @@ JSSRC= \ window/BackupGroupChangeOwner.js \ window/CreateDirectory.js \ window/DataStoreEdit.js \ + window/MaintenanceOptions.js \ window/NotesEdit.js \ window/RemoteEdit.js \ window/NotifyOptions.js \ diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js index 5a5e85be..1e0c3357 100644 --- a/www/datastore/OptionView.js +++ b/www/datastore/OptionView.js @@ -1,3 +1,4 @@ + Ext.define('PBS.Datastore.Options', { extend: 'Proxmox.grid.ObjectGrid', xtype: 'pbsDatastoreOptionView', @@ -111,5 +112,14 @@ Ext.define('PBS.Datastore.Options', { }, }, }, + "maintenance-type": { + required: true, + header: gettext('Maintenance mode'), + defaultValue: 'Off', + renderer: (value) => Ext.String.capitalize(value) || 'Off', + editor: { + xtype: 'pbsMaintenanceOptionEdit', + }, + }, }, }); diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js new file mode 100644 index 00000000..8ff5ccf9 --- /dev/null +++ b/www/window/MaintenanceOptions.js @@ -0,0 +1,63 @@ +Ext.define('PBS.form.MaintenanceType', { + extend: 'Proxmox.form.KVComboBox', + alias: 'widget.pbsMaintenanceType', + + comboItems: [ + ['__default__', gettext('Off')], + ['readonly', gettext('Read Only')], + ['offline', gettext('Offline')], + ], +}); + +Ext.define('PBS.window.MaintenanceOptions', { + extend: 'Proxmox.window.Edit', + xtype: 'pbsMaintenanceOptionEdit', + mixins: ['Proxmox.Mixin.CBind'], + + subject: gettext('Maintenance mode'), + + width: 450, + fieldDefaults: { + labelWidth: 120, + }, + + items: { + xtype: 'inputpanel', + onGetValues: function(values) { + PBS.Utils.delete_if_default(values, 'maintenance-type', ''); + PBS.Utils.delete_if_default(values, 'maintenance-msg', ''); + if (values.delete) { + values.delete = values.delete.split(','); + } + + return values; + }, + items: [ + { + xtype: 'pbsMaintenanceType', + name: 'maintenance-type', + fieldLabel: gettext('Maintenance Type'), + value: '__default__', + deleteEmpty: true, + }, + { + xtype: 'textfield', + emptyText: 'none', + name: 'maintenance-msg', + fieldLabel: gettext('Description'), + value: '__default__', + deleteEmpty: true, + }, + ], + }, + setValues: function(values) { + let me = this; + + const options = { + 'maintenance-type': values['maintenance-type'] || '__default__', + 'maintenance-msg': values['maintenance-msg'], + }; + + me.callParent([options]); + }, +}); -- 2.30.2