]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/MachineEdit.js
1 Ext
.define('PVE.qemu.MachineInputPanel', {
2 extend
: 'Proxmox.panel.InputPanel',
3 xtype
: 'pveMachineInputPanel',
6 xclass
: 'Ext.app.ViewController',
8 'combobox[name=machine]': {
9 change
: 'onMachineChange',
12 onMachineChange: function(field
, value
) {
14 let version
= me
.lookup('version');
15 let store
= version
.getStore();
16 let type
= value
=== 'q35' ? 'q35' : 'i440fx';
18 store
.addFilter(val
=> (val
.data
.id
=== 'latest' || val
.data
.type
=== type
));
19 version
.setValue('latest');
23 onGetValues: function(values
) {
24 if (values
.version
&& values
.version
!== 'latest') {
25 values
.machine
= values
.version
;
28 delete values
.version
;
32 setValues: function(values
) {
35 if (values
.machine
!== '__default__' && values
.machine
!== 'q35') {
36 values
.version
= values
.machine
;
37 values
.machine
= values
.version
.match(/q35/) ? 'q35' : '__default__';
39 // avoid hiding a pinned version
40 Ext
.ComponentQuery
.query("#advancedcb")[0].setValue(true);
43 this.callParent(arguments
);
49 xtype
: 'proxmoxKVComboBox',
50 fieldLabel
: gettext('Machine'),
52 ['__default__', PVE
.Utils
.render_qemu_machine('')],
61 fieldLabel
: gettext('Version'),
66 displayField
: 'version',
70 fields
: ['id', 'type', 'version'],
73 url
: "/api2/json/nodes/localhost/capabilities/qemu/machines",
76 load: function(records
) {
77 this.insert(0, { id
: 'latest', type
: 'any', version
: 'latest' });
84 Ext
.define('PVE.qemu.MachineEdit', {
85 extend
: 'Proxmox.window.Edit',
87 subject
: gettext('Machine'),
90 xtype
: 'pveMachineInputPanel',
93 initComponent: function() {
99 success: function(response
) {
100 let vmconfig
= response
.result
.data
;
101 let machine
= vmconfig
.machine
|| '__default__';
102 me
.setValues({ machine
: machine
});