ui: add maintenance mask to DataStoreListSummary

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2022-05-06 09:58:58 +00:00 committed by Thomas Lamprecht
parent 067c77329b
commit 6da6bafeac
1 changed files with 32 additions and 1 deletions

View File

@ -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,