pve-manager/www/manager6/qemu/DisplayEdit.js
Thomas Lamprecht 8a56fe1a87 ui: qemu: make DisplayEdit declarative and drop DisplaySelector
DisplayEdit did not get a cleanup during our ExtJS 4 to ExtJS 6
cleanup, in fact it was really touched in the last 5 years.

So refactor it to a declarative syntax, at least almost, we keep the
me.load in initComponent, just to much hassle to adress this for now.

Also purge DisplaySelector. It was a component inheriting from
KVComboBox with the possible VGA values as items only used here.
So just use a KVComboBox directly and set comboboxItems directly.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-02-09 14:46:14 +01:00

40 lines
854 B
JavaScript

Ext.define('PVE.qemu.DisplayEdit', {
extend: 'Proxmox.window.Edit',
vmconfig: undefined,
subject: gettext('Display'),
width: 350,
items: [{
name: 'vga',
xtype: 'proxmoxKVComboBox',
value: '__default__',
fieldLabel: gettext('Graphic card'),
comboItems: PVE.Utils.kvm_vga_driver_array(),
validator: function() {
var v = this.getValue();
var cfg = this.up('proxmoxWindowEdit').vmconfig || {};
if (v.match(/^serial\d+$/) && (!cfg[v] || cfg[v] !== 'socket')) {
var fmt = gettext("Serial interface '{0}' is not correctly configured.");
return Ext.String.format(fmt, v);
}
return true;
}
}],
initComponent : function() {
var me = this;
me.callParent();
me.load({
success: function(response) {
me.vmconfig = response.result.data;
me.setValues(me.vmconfig);
}
});
}
});