[pbs-devel] [PATCH proxmox-backup v8 20/23] ui: render 'unmount' maintenance mode correctly

Hannes Laimer h.laimer at proxmox.com
Fri Apr 19 17:56:03 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 www/Utils.js                     |  4 +++-
 www/window/MaintenanceOptions.js | 10 ++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/www/Utils.js b/www/Utils.js
index ad2b2777..5af2baca 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -698,7 +698,7 @@ Ext.define('PBS.Utils', {
 	let extra = '';
 
 	if (activeTasks !== undefined) {
-	    const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0);
+	    const conflictingTasks = activeTasks.write + (type === 'offline' || type === 'unmount' ? activeTasks.read : 0);
 
 	    if (conflictingTasks > 0) {
 		extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
@@ -718,6 +718,8 @@ Ext.define('PBS.Utils', {
 		break;
 	    case 'offline': modeText = gettext("Offline");
 		break;
+	    case 'unmount': modeText = gettext("Unmounting");
+		break;
 	}
 	return `${modeText} ${extra}`;
     },
diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js
index 527c3698..d7348cb4 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__',
@@ -85,6 +86,15 @@ Ext.define('PBS.window.MaintenanceOptions', {
 	    };
 	}
 
+        let unmounting = options['maintenance-type'] === 'unmount';
+        let defaultType = options['maintenance-type'] === '__default__';
+        if (unmounting) {
+            options['maintenance-type'] = '';
+        }
+
 	me.callParent([options]);
+
+        Ext.ComponentManager.get('type-field').setDisabled(unmounting);
+        Ext.ComponentManager.get('message-field').setDisabled(unmounting || defaultType);
     },
 });
-- 
2.39.2





More information about the pbs-devel mailing list