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

Hannes Laimer h.laimer at proxmox.com
Tue Apr 9 13:00:12 CEST 2024


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..401fab93 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 ?? '',
 	    };
 	}
+	let unplugged = options['maintenance-type'] === 'unplugged';
+	let 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