ui: form/DataStoreSelector: show maintenance mode in selector

to not having to query the activeTasks everywhere, change the renderer
to omit the check/spinner when no activeTasks are given

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-05-17 08:52:13 +02:00 committed by Thomas Lamprecht
parent 8af1fa5477
commit c15b058db7
2 changed files with 19 additions and 7 deletions

View File

@ -663,15 +663,18 @@ Ext.define('PBS.Utils', {
let [type, message] = PBS.Utils.parseMaintenanceMode(mode); let [type, message] = PBS.Utils.parseMaintenanceMode(mode);
let extra = '';
if (activeTasks !== undefined) {
const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0); const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0);
let extra = '';
if (conflictingTasks > 0) { if (conflictingTasks > 0) {
extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> '; extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
extra += Ext.String.format(gettext('{0} conflicting tasks still active.'), conflictingTasks); extra += Ext.String.format(gettext('{0} conflicting tasks still active.'), conflictingTasks);
} else { } else {
extra += '<i class="fa fa-check"></i>'; extra += '<i class="fa fa-check"></i>';
} }
}
if (message) { if (message) {
extra += ` ("${message}")`; extra += ` ("${message}")`;

View File

@ -29,6 +29,15 @@ Ext.define('PBS.form.DataStoreSelector', {
renderer: Ext.String.htmlEncode, renderer: Ext.String.htmlEncode,
flex: 1, flex: 1,
}, },
{
header: gettext('Maintenance'),
sortable: true,
dataIndex: 'maintenance',
renderer: (value) => {
return PBS.Utils.renderMaintenance(value);
},
flex: 1,
}
], ],
}, },
}); });