mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-11 17:36:24 +00:00
ui: vm/usbedit: code & indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
7c72eb5112
commit
2e8f031f99
@ -42,11 +42,11 @@ Ext.define('PVE.qemu.USBInputPanel', {
|
|||||||
|
|
||||||
onGetValues: function(values) {
|
onGetValues: function(values) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(!me.confid) {
|
if (!me.confid) {
|
||||||
var i;
|
for (let i = 0; i < 6; i++) {
|
||||||
for (i = 0; i < 6; i++) {
|
let id = 'usb' + i.toString();
|
||||||
if (!me.vmconfig['usb' + i.toString()]) {
|
if (!me.vmconfig[id]) {
|
||||||
me.confid = 'usb' + i.toString();
|
me.confid = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,10 +142,8 @@ Ext.define('PVE.qemu.USBEdit', {
|
|||||||
vmconfig: undefined,
|
vmconfig: undefined,
|
||||||
|
|
||||||
isAdd: true,
|
isAdd: true,
|
||||||
|
|
||||||
subject: gettext('USB Device'),
|
subject: gettext('USB Device'),
|
||||||
|
|
||||||
|
|
||||||
initComponent : function() {
|
initComponent : function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -165,35 +163,37 @@ Ext.define('PVE.qemu.USBEdit', {
|
|||||||
me.load({
|
me.load({
|
||||||
success: function(response, options) {
|
success: function(response, options) {
|
||||||
ipanel.setVMConfig(response.result.data);
|
ipanel.setVMConfig(response.result.data);
|
||||||
if (me.confid) {
|
if (me.isCreate) {
|
||||||
var data = response.result.data[me.confid].split(',');
|
return;
|
||||||
var port, hostdevice, usb3 = false;
|
|
||||||
var type = 'spice';
|
|
||||||
var i;
|
|
||||||
for (i = 0; i < data.length; i++) {
|
|
||||||
if (/^(host=)?(0x)?[a-zA-Z0-9]{4}\:(0x)?[a-zA-Z0-9]{4}$/.test(data[i])) {
|
|
||||||
hostdevice = data[i];
|
|
||||||
hostdevice = hostdevice.replace('host=', '').replace('0x','');
|
|
||||||
type = 'hostdevice';
|
|
||||||
} else if (/^(host=)?(\d+)\-(\d+(\.\d+)*)$/.test(data[i])) {
|
|
||||||
port = data[i];
|
|
||||||
port = port.replace('host=','');
|
|
||||||
type = 'port';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/^usb3=(1|on|true)$/.test(data[i])) {
|
|
||||||
usb3 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var values = {
|
|
||||||
usb : type,
|
|
||||||
hostdevice: hostdevice,
|
|
||||||
port: port,
|
|
||||||
usb3: usb3
|
|
||||||
};
|
|
||||||
|
|
||||||
ipanel.setValues(values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = response.result.data[me.confid].split(',');
|
||||||
|
var port, hostdevice, usb3 = false;
|
||||||
|
var type = 'spice';
|
||||||
|
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
if (/^(host=)?(0x)?[a-zA-Z0-9]{4}\:(0x)?[a-zA-Z0-9]{4}$/.test(data[i])) {
|
||||||
|
hostdevice = data[i];
|
||||||
|
hostdevice = hostdevice.replace('host=', '').replace('0x','');
|
||||||
|
type = 'hostdevice';
|
||||||
|
} else if (/^(host=)?(\d+)\-(\d+(\.\d+)*)$/.test(data[i])) {
|
||||||
|
port = data[i];
|
||||||
|
port = port.replace('host=', '');
|
||||||
|
type = 'port';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^usb3=(1|on|true)$/.test(data[i])) {
|
||||||
|
usb3 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var values = {
|
||||||
|
usb : type,
|
||||||
|
hostdevice: hostdevice,
|
||||||
|
port: port,
|
||||||
|
usb3: usb3
|
||||||
|
};
|
||||||
|
|
||||||
|
ipanel.setValues(values);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user