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