[pbs-devel] [PATCH proxmox-backup] ui: add maintenance mask to DataStoreListSummary

Hannes Laimer h.laimer at proxmox.com
Fri May 6 11:58:58 CEST 2022


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 www/datastore/DataStoreListSummary.js | 33 ++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/www/datastore/DataStoreListSummary.js b/www/datastore/DataStoreListSummary.js
index eb9e04e1..b135326c 100644
--- a/www/datastore/DataStoreListSummary.js
+++ b/www/datastore/DataStoreListSummary.js
@@ -22,6 +22,7 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
 	    stillbad: 0,
 	    deduplication: 1.0,
 	    error: "",
+	    maintenance: '',
 	},
     },
     setTasks: function(taskdata, since) {
@@ -34,10 +35,21 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
 	let vm = me.getViewModel();
 
 	if (statusData.error !== undefined) {
+	    Proxmox.Utils.API2Request({
+		url: `/config/datastore/${statusData.store}`,
+		success: (response) => {
+		    const config = response.result.data;
+		    if (config['maintenance-mode']) {
+			const [_type, msg] = PBS.Utils.parseMaintenanceMode(config['maintenance-mode']);
+			vm.set('maintenance', `${gettext('Datastore is in maintenance mode')}${msg ? ': ' + msg : ''}`);
+		    }
+		},
+	    });
 	    vm.set('error', statusData.error);
 	    return;
 	} else {
 	    vm.set('error', "");
+	    vm.set('maintenance', '');
 	}
 
 	let usage = statusData.used/statusData.total;
@@ -104,12 +116,31 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
 			'</center>',
 		    ],
 		    bind: {
-			visible: '{error}',
+			visible: '{error && !maintenance}',
 			data: {
 			    text: '{error}',
 			},
 		    },
 		},
+		{
+		    xtype: 'box',
+		    reference: 'errorBox',
+		    hidden: true,
+		    tpl: [
+			'<center>',
+			`<h3>${gettext("Maintenance mode")}</h3>`,
+			'<i class="fa fa-5x fa-wrench"></i>',
+			'<br /><br/>',
+			'{text}',
+			'</center>',
+		    ],
+		    bind: {
+			visible: '{maintenance}',
+			data: {
+			    text: '{maintenance}',
+			},
+		    },
+		},
 		{
 		    xtype: 'proxmoxGauge',
 		    warningThreshold: 0.8,
-- 
2.30.2






More information about the pbs-devel mailing list