]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: vm/machine: avoid showing latest for windows VMs
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 19:03:34 +0000 (20:03 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 20:31:32 +0000 (21:31 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/qemu/MachineEdit.js

index 6e294a93ff2189cab2c18b50700381c378569bf6..2b91450cc54275336190000c34a8b99d88b139f2 100644 (file)
@@ -16,7 +16,11 @@ Ext.define('PVE.qemu.MachineInputPanel', {
            let type = value === 'q35' ? 'q35' : 'i440fx';
            store.clearFilter();
            store.addFilter(val => (val.data.id === 'latest' || val.data.type === type));
-           version.setValue('latest');
+           if (!me.getView().isWindows) {
+               version.setValue('latest');
+           } else {
+               store.isWindows = true;
+           }
        },
     },
 
@@ -32,6 +36,8 @@ Ext.define('PVE.qemu.MachineInputPanel', {
     setValues: function(values) {
        let me = this;
 
+       me.isWindows = values.isWindows;
+
        if (values.machine !== '__default__' && values.machine !== 'q35') {
            values.version = values.machine;
            values.machine = values.version.match(/q35/) ? 'q35' : '__default__';
@@ -74,7 +80,9 @@ Ext.define('PVE.qemu.MachineInputPanel', {
            },
            listeners: {
                load: function(records) {
-                   this.insert(0, { id: 'latest', type: 'any', version: 'latest' });
+                   if (!this.isWindows) {
+                       this.insert(0, { id: 'latest', type: 'any', version: 'latest' });
+                   }
                },
            },
        },
@@ -97,9 +105,14 @@ Ext.define('PVE.qemu.MachineEdit', {
 
        me.load({
            success: function(response) {
-               let vmconfig = response.result.data;
-               let machine = vmconfig.machine || '__default__';
-               me.setValues({ machine: machine });
+               let conf = response.result.data;
+               let values = {
+                   machine: conf.machine || '__default__',
+               };
+               if (conf.ostype && conf.ostype.match(/^(win|wvista|wxp|w2k)/i)) {
+                   values.isWindows = true;
+               }
+               me.setValues(values);
            },
        });
     },