From ff49fd4623215f40b53ab85046aa89b49fb7bb6c Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 26 Sep 2019 18:00:54 +0200 Subject: [PATCH] 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 --- www/manager6/form/USBSelector.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/www/manager6/form/USBSelector.js b/www/manager6/form/USBSelector.js index 891e7143..7d7caa00 100644 --- a/www/manager6/form/USBSelector.js +++ b/www/manager6/form/USBSelector.js @@ -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();