ui: usbselector: refactor USB Speed rendering, add USB 3.1

Fixes also an issue where unregonized (often faster) devices would
get recognized as "USB 1.x" due to the else fallback.

Now, if we do not recognize the speed value, just print the speed
with the MBps unit (it's not exactly megabit per second, but mega
baud (= symbols) per second - the effective rate is dependent on the
used signal encoding)

adapt widths a bit further

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-09-26 18:00:54 +02:00
parent 04d2d75887
commit f9e4976d4b

View File

@ -52,8 +52,8 @@ Ext.define('PVE.form.USBSelector', {
Ext.apply(me, {
store: store,
emptyText: emptyText,
listConfig: {
width: 500,
listConfig: {
width: 520,
columns: [
{
header: (me.type === 'device')?gettext('Device'):gettext('Port'),
@ -75,21 +75,22 @@ Ext.define('PVE.form.USBSelector', {
},
{
header: gettext('Speed'),
width: 70,
width: 75,
sortable: true,
dataIndex: 'speed',
renderer: function(value) {
if (value === "5000") {
return "USB 3.0";
} else if (value === "480") {
return "USB 2.0";
} else {
return "USB 1.x";
}
let speed_map = {
"10000" : "USB 3.1",
"5000" : "USB 3.0",
"480" : "USB 2.0",
"12" : "USB 1.x",
"1.5": "USB 1.x",
};
return speed_map[value] || value + " Mbps";
}
}
]
}
},
});
me.callParent();