fix #7684: ui: backup job detail: allow sorting guests by inclusion status
The 'Backup Job' column of the job detail tree only has a value for the volumes, not for the guests. So sorting by it only sorted the volumes within each guest, while the guests themselves stayed in their order, which made it look like sorting by that column did nothing. Set the share of included volumes on the guests too, and show it as 'Yes' if all, 'No' if none and 'Mixed' if only some of the volumes of a guest are included. This way, guests with excluded volumes end up at the top or bottom of the list when sorting by that column. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
cf2351ccf5
commit
eb9893f378
1 file changed
+16
-2
@@ -50,7 +50,13 @@ Ext.define('PVE.dc.BackupDiskTree', {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: gettext('Backup Job'),
|
text: gettext('Backup Job'),
|
||||||
renderer: PVE.Utils.render_backup_status,
|
renderer: function (value, meta, record) {
|
||||||
|
if (value > 0 && value < 1) {
|
||||||
|
// guest level with only some of its volumes included
|
||||||
|
return `<i class="fa fa-adjust warning"></i> ${gettext('Mixed')}`;
|
||||||
|
}
|
||||||
|
return PVE.Utils.render_backup_status(value, meta, record);
|
||||||
|
},
|
||||||
dataIndex: 'included',
|
dataIndex: 'included',
|
||||||
flex: 3,
|
flex: 3,
|
||||||
},
|
},
|
||||||
@@ -68,8 +74,16 @@ Ext.define('PVE.dc.BackupDiskTree', {
|
|||||||
Proxmox.Utils.setErrorMask(me, response.htmlStatus);
|
Proxmox.Utils.setErrorMask(me, response.htmlStatus);
|
||||||
},
|
},
|
||||||
success: function (response, opts) {
|
success: function (response, opts) {
|
||||||
|
let root = response.result.data;
|
||||||
|
// set the share of included volumes on the guests too, so they can be sorted by it
|
||||||
|
for (const guest of root.children) {
|
||||||
|
if (guest.children?.length) {
|
||||||
|
let included = guest.children.filter((volume) => volume.included).length;
|
||||||
|
guest.included = included / guest.children.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
sm.deselectAll();
|
sm.deselectAll();
|
||||||
me.setRootNode(response.result.data);
|
me.setRootNode(root);
|
||||||
me.expandAll();
|
me.expandAll();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user