[pbs-devel] [PATCH proxmox-backup v4 19/22] ui: utils: render unplugged datastores correctly

Hannes Laimer h.laimer at proxmox.com
Tue Apr 16 17:24:13 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 www/NavigationTree.js | 13 +++++++++----
 www/Utils.js          |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 9ce93799..dc4a3dc7 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -264,13 +264,18 @@ Ext.define('PBS.view.main.NavigationTree', {
 		let mainIcon = `fa fa-${records[i].data.removable ? 'plug' : 'database'}`;
 		let [qtip, iconCls] = ['', mainIcon];
 		const maintenance = records[i].data.maintenance;
+		const removable_not_available = records[i].data.removable && !records[i].data.available;
+		if (removable_not_available) {
+		    iconCls = `${mainIcon} pmx-tree-icon-custom unplugged`;
+		    qtip = gettext('Removable datastore not mounted');
+		}
 		if (maintenance) {
 		    const [type, message] = PBS.Utils.parseMaintenanceMode(maintenance);
 		    qtip = `${type}${message ? ': ' + message : ''}`;
-		    const maintenanceTypeCls = {
-			'delete': 'destroying',
-			'unplugged': 'unplugged',
-		    }[type] ?? 'maintenance';
+		    let maintenanceTypeCls = 'maintenance';
+		    if (type === 'delete') {
+			maintenanceTypeCls = 'destroying';
+		    }
 		    iconCls = `${mainIcon} pmx-tree-icon-custom ${maintenanceTypeCls}`;
 		}
 
diff --git a/www/Utils.js b/www/Utils.js
index 5357949b..0ee6609c 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -703,6 +703,8 @@ Ext.define('PBS.Utils', {
 		break;
 	    case 'offline': modeText = gettext("Offline");
 		break;
+	    case 'unplugged': modeText = gettext("Unplugged");
+		break;
 	}
 	return `${modeText} ${extra}`;
     },
-- 
2.39.2





More information about the pbs-devel mailing list