mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-07 06:13:28 +00:00
ui: boot order: eslint fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
2dddf3ba59
commit
eb4b9246a8
@ -1,10 +1,10 @@
|
|||||||
Ext.define('pve-boot-order-entry', {
|
Ext.define('pve-boot-order-entry', {
|
||||||
extend: 'Ext.data.Model',
|
extend: 'Ext.data.Model',
|
||||||
fields: [
|
fields: [
|
||||||
{name: 'name', type: 'string'},
|
{ name: 'name', type: 'string' },
|
||||||
{name: 'enabled', type: 'bool'},
|
{ name: 'enabled', type: 'bool' },
|
||||||
{name: 'desc', type: 'string'},
|
{ name: 'desc', type: 'string' },
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.define('PVE.qemu.BootOrderPanel', {
|
Ext.define('PVE.qemu.BootOrderPanel', {
|
||||||
@ -40,7 +40,7 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
|
|
||||||
let bootorder = [];
|
let bootorder = [];
|
||||||
if (boot.order) {
|
if (boot.order) {
|
||||||
bootorder = boot.order.split(';').map(dev => ({name: dev, enabled: true}));
|
bootorder = boot.order.split(';').map(dev => ({ name: dev, enabled: true }));
|
||||||
} else if (!(/^\s*$/).test(me.vmconfig.boot)) {
|
} else if (!(/^\s*$/).test(me.vmconfig.boot)) {
|
||||||
// legacy style, transform to new bootorder
|
// legacy style, transform to new bootorder
|
||||||
let order = boot.legacy || 'cdn';
|
let order = boot.legacy || 'cdn';
|
||||||
@ -48,7 +48,7 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
|
|
||||||
// get the first 4 characters (acdn)
|
// get the first 4 characters (acdn)
|
||||||
// ignore the rest (there should never be more than 4)
|
// ignore the rest (there should never be more than 4)
|
||||||
let orderList = order.split('').slice(0,4);
|
let orderList = order.split('').slice(0, 4);
|
||||||
|
|
||||||
// build bootdev list
|
// build bootdev list
|
||||||
for (let i = 0; i < orderList.length; i++) {
|
for (let i = 0; i < orderList.length; i++) {
|
||||||
@ -73,7 +73,7 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
|
|
||||||
// Object.each iterates in random order, sort alphabetically
|
// Object.each iterates in random order, sort alphabetically
|
||||||
list.sort();
|
list.sort();
|
||||||
list.forEach(dev => bootorder.push({name: dev, enabled: true}));
|
list.forEach(dev => bootorder.push({ name: dev, enabled: true }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,13 +81,12 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
let disabled = [];
|
let disabled = [];
|
||||||
Ext.Object.each(me.vmconfig, function(key, value) {
|
Ext.Object.each(me.vmconfig, function(key, value) {
|
||||||
if (me.isBootdev(key, value) &&
|
if (me.isBootdev(key, value) &&
|
||||||
!Ext.Array.some(bootorder, x => x.name === key))
|
!Ext.Array.some(bootorder, x => x.name === key)) {
|
||||||
{
|
|
||||||
disabled.push(key);
|
disabled.push(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
disabled.sort();
|
disabled.sort();
|
||||||
disabled.forEach(dev => bootorder.push({name: dev, enabled: false}));
|
disabled.forEach(dev => bootorder.push({ name: dev, enabled: false }));
|
||||||
|
|
||||||
// add descriptions
|
// add descriptions
|
||||||
bootorder.forEach(entry => {
|
bootorder.forEach(entry => {
|
||||||
@ -178,13 +177,13 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
plugins: {
|
plugins: {
|
||||||
ptype: 'gridviewdragdrop',
|
ptype: 'gridviewdragdrop',
|
||||||
dragText: gettext('Drag and drop to reorder'),
|
dragText: gettext('Drag and drop to reorder'),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
listeners: {
|
listeners: {
|
||||||
drop: function() {
|
drop: function() {
|
||||||
// doesn't fire automatically on reorder
|
// doesn't fire automatically on reorder
|
||||||
this.getStore().fireEvent("update");
|
this.getStore().fireEvent("update");
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -214,7 +213,7 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
// not a subclass, so no callParent; just do it manually
|
// not a subclass, so no callParent; just do it manually
|
||||||
me.setRawValue(me.valueToRaw(val));
|
me.setRawValue(me.valueToRaw(val));
|
||||||
return me.mixins.field.setValue.call(me, val);
|
return me.mixins.field.setValue.call(me, val);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -246,11 +245,11 @@ Ext.define('PVE.qemu.BootOrderPanel', {
|
|||||||
marker.checkDirty();
|
marker.checkDirty();
|
||||||
emptyWarning.setHidden(val !== '');
|
emptyWarning.setHidden(val !== '');
|
||||||
grid.getView().refresh();
|
grid.getView().refresh();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
grid.setStore(me.store);
|
grid.setStore(me.store);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.define('PVE.qemu.BootOrderEdit', {
|
Ext.define('PVE.qemu.BootOrderEdit', {
|
||||||
@ -258,19 +257,19 @@ Ext.define('PVE.qemu.BootOrderEdit', {
|
|||||||
|
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'pveQemuBootOrderPanel',
|
xtype: 'pveQemuBootOrderPanel',
|
||||||
itemId: 'inputpanel'
|
itemId: 'inputpanel',
|
||||||
}],
|
}],
|
||||||
|
|
||||||
subject: gettext('Boot Order'),
|
subject: gettext('Boot Order'),
|
||||||
width: 640,
|
width: 640,
|
||||||
|
|
||||||
initComponent : function() {
|
initComponent: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
me.callParent();
|
me.callParent();
|
||||||
me.load({
|
me.load({
|
||||||
success: function(response, options) {
|
success: function(response, options) {
|
||||||
me.down('#inputpanel').setVMConfig(response.result.data);
|
me.down('#inputpanel').setVMConfig(response.result.data);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user