ui: multi pci selector: indent functions multifunction devices

when there is more than one function for a device, indent the individual
functions. This sets them visually apart from the 'pass all through as
one' entry

We have to use a html entity here, as extjs trims the normal whitespace.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-06-19 11:13:32 +02:00 committed by Thomas Lamprecht
parent aafc1f3040
commit b736219f89

View File

@ -128,16 +128,17 @@ Ext.define('PVE.form.MultiPCISelector', {
let slots = {}; let slots = {};
records.forEach((rec) => { records.forEach((rec) => {
let slotname = rec.data.id.slice(0, -2); // remove function let slotname = rec.data.id.slice(0, -2); // remove function
rec.set('slot', slotname);
if (slots[slotname] !== undefined) { if (slots[slotname] !== undefined) {
slots[slotname].count++; slots[slotname].count++;
rec.set('slot', slots[slotname]);
return; return;
} }
slots[slotname] = { slots[slotname] = {
count: 1, count: 1,
}; };
rec.set('slot', slots[slotname]);
if (rec.data.id.endsWith('.0')) { if (rec.data.id.endsWith('.0')) {
slots[slotname].device = rec.data; slots[slotname].device = rec.data;
} }
@ -213,6 +214,12 @@ Ext.define('PVE.form.MultiPCISelector', {
{ {
header: 'ID', header: 'ID',
dataIndex: 'id', dataIndex: 'id',
renderer: function(value, _md, rec) {
if (value.match(/\.[0-9a-f]/i) && rec.data.slot?.count > 1) {
return `&emsp;${value}`;
}
return value;
},
width: 150, width: 150,
}, },
{ {