public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] ui: add maintenance mask to DataStoreListSummary
Date: Fri,  6 May 2022 09:58:58 +0000	[thread overview]
Message-ID: <20220506095858.2775-1-h.laimer@proxmox.com> (raw)

Signed-off-by: Hannes Laimer <h.laimer@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





             reply	other threads:[~2022-05-06  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  9:58 Hannes Laimer [this message]
2022-05-16 16:13 ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506095858.2775-1-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal