]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/MachineEdit.js
573a8c0f38e98de18da9f2b14af1536c03e277c8
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 if (!me
.getView().isWindows
) {
20 version
.setValue('latest');
22 store
.isWindows
= true;
27 onGetValues: function(values
) {
28 if (values
.version
&& values
.version
!== 'latest') {
29 values
.machine
= values
.version
;
32 delete values
.version
;
36 setValues: function(values
) {
39 me
.isWindows
= values
.isWindows
;
41 if (values
.machine
!== '__default__' && values
.machine
!== 'q35') {
42 values
.version
= values
.machine
;
43 values
.machine
= values
.version
.match(/q35/) ? 'q35' : '__default__';
45 // avoid hiding a pinned version
46 me
.setAdvancedVisible(true);
49 this.callParent(arguments
);
53 xtype
: 'proxmoxKVComboBox',
56 fieldLabel
: gettext('Machine'),
58 ['__default__', PVE
.Utils
.render_qemu_machine('')],
67 fieldLabel
: gettext('Version'),
68 emptyText
: gettext('Latest'),
72 displayField
: 'version',
76 fields
: ['id', 'type', 'version'],
79 url
: "/api2/json/nodes/localhost/capabilities/qemu/machines",
82 load: function(records
) {
83 if (!this.isWindows
) {
84 this.insert(0, { id
: 'latest', type
: 'any', version
: gettext('Latest') });
92 Ext
.define('PVE.qemu.MachineEdit', {
93 extend
: 'Proxmox.window.Edit',
95 subject
: gettext('Machine'),
98 xtype
: 'pveMachineInputPanel',
101 initComponent: function() {
107 success: function(response
) {
108 let conf
= response
.result
.data
;
110 machine
: conf
.machine
|| '__default__',
112 if (conf
.ostype
&& conf
.ostype
.match(/^(win|wvista|wxp|w2k)/i)) {
113 values
.isWindows
= true;
115 me
.setValues(values
);