[pbs-devel] [PATCH proxmox-backup 19/23] ui: maintenance: disable edit if unplugged

Hannes Laimer h.laimer at proxmox.com
Fri Sep 15 08:54:53 CEST 2023


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 www/window/MaintenanceOptions.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js
index 527c3698..e50e0f2f 100644
--- a/www/window/MaintenanceOptions.js
+++ b/www/window/MaintenanceOptions.js
@@ -52,6 +52,7 @@ Ext.define('PBS.window.MaintenanceOptions', {
 	items: [
 	    {
 		xtype: 'pbsMaintenanceType',
+		id: 'type-field',
 		name: 'maintenance-type',
 		fieldLabel: gettext('Maintenance Type'),
 		value: '__default__',
@@ -84,7 +85,15 @@ Ext.define('PBS.window.MaintenanceOptions', {
 		'maintenance-msg': message ?? '',
 	    };
 	}
+	const unplugged = options['maintenance-type'] === 'unplugged';
+	const defaultType = options['maintenance-type'] === '__default__';
+	if (unplugged) {
+	    options['maintenance-type'] = '';
+	}
 
 	me.callParent([options]);
+
+	Ext.ComponentManager.get('type-field').setDisabled(unplugged);
+	Ext.ComponentManager.get('message-field').setDisabled(unplugged || defaultType);
     },
 });
-- 
2.39.2






More information about the pbs-devel mailing list