]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/qemu/HardwareView.js
ui: eslint: fix various spacing related issues
[pve-manager.git] / www / manager6 / qemu / HardwareView.js
index 20983b9b85217e8f67861d0224e02ba5ee17bfcb..5f60da1c31c78f021c4e0f1fecfe05e794372763 100644 (file)
@@ -43,12 +43,12 @@ Ext.define('PVE.qemu.HardwareView', {
        }
     },
 
-    initComponent : function() {
+    initComponent: function() {
        var me = this;
        var i, confid;
 
        var nodename = me.pveSelNode.data.node;
-       if (!nodename) { 
+       if (!nodename) {
            throw "no node name specified";
        }
 
@@ -60,7 +60,6 @@ Ext.define('PVE.qemu.HardwareView', {
        var caps = Ext.state.Manager.get('GuiCap');
        var diskCap = caps.vms['VM.Config.Disk'];
 
-       /*jslint confusion: true */
        var rows = {
            memory: {
                header: gettext('Memory'),
@@ -74,10 +73,10 @@ Ext.define('PVE.qemu.HardwareView', {
                    var res = '';
 
                    var max = me.getObjectValue('memory', 512, pending);
-                   var balloon =  me.getObjectValue('balloon', undefined, pending);
+                   var balloon = me.getObjectValue('balloon', undefined, pending);
                    var shares = me.getObjectValue('shares', undefined, pending);
 
-                   res  = Proxmox.Utils.format_size(max*1024*1024);
+                   res = Proxmox.Utils.format_size(max*1024*1024);
 
                    if (balloon !== undefined && balloon > 0) {
                        res = Proxmox.Utils.format_size(balloon*1024*1024) + "/" + res;
@@ -89,19 +88,18 @@ Ext.define('PVE.qemu.HardwareView', {
                        res += ' [balloon=0]';
                    }
                    return res;
-               }
+               },
            },
            sockets: {
                header: gettext('Processors'),
                never_delete: true,
-               editor: (caps.vms['VM.Config.CPU'] || caps.vms['VM.Config.HWType']) ? 
-                   'PVE.qemu.ProcessorEdit' : undefined,
+               editor: (caps.vms['VM.Config.CPU'] || caps.vms['VM.Config.HWType'])
+                   'PVE.qemu.ProcessorEdit' : undefined,
                tdCls: 'pve-itype-icon-processor',
                group: 3,
                defaultValue: '1',
                multiKey: ['sockets', 'cpu', 'cores', 'numa', 'vcpus', 'cpulimit', 'cpuunits'],
                renderer: function(value, metaData, record, rowIndex, colIndex, store, pending) {
-
                    var sockets = me.getObjectValue('sockets', 1, pending);
                    var model = me.getObjectValue('cpu', undefined, pending);
                    var cores = me.getObjectValue('cores', 1, pending);
@@ -134,7 +132,7 @@ Ext.define('PVE.qemu.HardwareView', {
                    }
 
                    return res;
-               }
+               },
            },
            bios: {
                header: 'BIOS',
@@ -143,20 +141,20 @@ Ext.define('PVE.qemu.HardwareView', {
                editor: caps.vms['VM.Config.Options'] ? 'PVE.qemu.BiosEdit' : undefined,
                defaultValue: '',
                iconCls: 'microchip',
-               renderer: PVE.Utils.render_qemu_bios
+               renderer: PVE.Utils.render_qemu_bios,
            },
            vga: {
                header: gettext('Display'),
                editor: caps.vms['VM.Config.HWType'] ? 'PVE.qemu.DisplayEdit' : undefined,
                never_delete: true,
                iconCls: 'desktop',
-               group:5,
+               group: 5,
                defaultValue: '',
-               renderer: PVE.Utils.render_kvm_vga_driver               
+               renderer: PVE.Utils.render_kvm_vga_driver,
            },
            machine: {
                header: gettext('Machine'),
-               editor: caps.vms['VM.Config.HWType'] ?  {
+               editor: caps.vms['VM.Config.HWType'] ? {
                    xtype: 'proxmoxWindowEdit',
                    subject: gettext('Machine'),
                    width: 350,
@@ -167,14 +165,15 @@ Ext.define('PVE.qemu.HardwareView', {
                        fieldLabel: gettext('Machine'),
                        comboItems: [
                            ['__default__', PVE.Utils.render_qemu_machine('')],
-                           ['q35', 'q35']
-                       ]
-                   }]} : undefined,
+                           ['q35', 'q35'],
+                       ],
+                   }]
+} : undefined,
                iconCls: 'cogs',
                never_delete: true,
                group: 6,
                defaultValue: '',
-               renderer: PVE.Utils.render_qemu_machine
+               renderer: PVE.Utils.render_qemu_machine,
            },
            scsihw: {
                header: gettext('SCSI Controller'),
@@ -183,7 +182,7 @@ Ext.define('PVE.qemu.HardwareView', {
                renderer: PVE.Utils.render_scsihw,
                group: 7,
                never_delete: true,
-               defaultValue: ''
+               defaultValue: '',
            },
            vmstate: {
                header: gettext('Hibernation VM State'),
@@ -192,34 +191,33 @@ Ext.define('PVE.qemu.HardwareView', {
                group: 100,
            },
            cores: {
-               visible: false
+               visible: false,
            },
            cpu: {
-               visible: false
+               visible: false,
            },
            numa: {
-               visible: false
+               visible: false,
            },
            balloon: {
-               visible: false
+               visible: false,
            },
            hotplug: {
-               visible: false
+               visible: false,
            },
            vcpus: {
-               visible: false
+               visible: false,
            },
            cpuunits: {
-               visible: false
+               visible: false,
            },
            cpulimit: {
-               visible: false
+               visible: false,
            },
            shares: {
-               visible: false
-           }
+               visible: false,
+           },
        };
-       /*jslint confusion: false */
 
        PVE.Utils.forEachBus(undefined, function(type, id) {
            var confid = type + id;
@@ -231,7 +229,7 @@ Ext.define('PVE.qemu.HardwareView', {
                isOnStorageBus: true,
                header: gettext('Hard Disk') + ' (' + confid +')',
                cdheader: gettext('CD/DVD Drive') + ' (' + confid +')',
-               cloudheader: gettext('CloudInit Drive') + ' (' + confid + ')'
+               cloudheader: gettext('CloudInit Drive') + ' (' + confid + ')',
            };
        });
        for (i = 0; i < PVE.Utils.hardware_counts.net; i++) {
@@ -242,7 +240,7 @@ Ext.define('PVE.qemu.HardwareView', {
                iconCls: 'exchange',
                editor: caps.vms['VM.Config.Network'] ? 'PVE.qemu.NetworkEdit' : undefined,
                never_delete: caps.vms['VM.Config.Network'] ? false : true,
-               header: gettext('Network Device') + ' (' + confid +')'
+               header: gettext('Network Device') + ' (' + confid +')',
            };
        }
        rows.efidisk0 = {
@@ -250,7 +248,7 @@ Ext.define('PVE.qemu.HardwareView', {
            iconCls: 'hdd-o',
            editor: null,
            never_delete: caps.vms['VM.Config.Disk'] ? false : true,
-           header: gettext('EFI Disk')
+           header: gettext('EFI Disk'),
        };
        for (i = 0; i < PVE.Utils.hardware_counts.usb; i++) {
            confid = "usb" + i.toString();
@@ -260,7 +258,7 @@ Ext.define('PVE.qemu.HardwareView', {
                iconCls: 'usb',
                editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.USBEdit' : undefined,
                never_delete: caps.nodes['Sys.Console'] ? false : true,
-               header: gettext('USB Device') + ' (' + confid + ')'
+               header: gettext('USB Device') + ' (' + confid + ')',
            };
        }
        for (i = 0; i < PVE.Utils.hardware_counts.hostpci; i++) {
@@ -271,7 +269,7 @@ Ext.define('PVE.qemu.HardwareView', {
                tdCls: 'pve-itype-icon-pci',
                never_delete: caps.nodes['Sys.Console'] ? false : true,
                editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.PCIEdit' : undefined,
-               header: gettext('PCI Device') + ' (' + confid + ')'
+               header: gettext('PCI Device') + ' (' + confid + ')',
            };
        }
        for (i = 0; i < PVE.Utils.hardware_counts.serial; i++) {
@@ -281,7 +279,7 @@ Ext.define('PVE.qemu.HardwareView', {
                order: i,
                tdCls: 'pve-itype-icon-serial',
                never_delete: caps.nodes['Sys.Console'] ? false : true,
-               header: gettext('Serial Port') + ' (' + confid + ')'
+               header: gettext('Serial Port') + ' (' + confid + ')',
            };
        }
        rows.audio0 = {
@@ -289,7 +287,7 @@ Ext.define('PVE.qemu.HardwareView', {
            iconCls: 'volume-up',
            editor: caps.vms['VM.Config.HWType'] ? 'PVE.qemu.AudioEdit' : undefined,
            never_delete: caps.vms['VM.Config.HWType'] ? false : true,
-           header: gettext('Audio Device')
+           header: gettext('Audio Device'),
        };
        for (i = 0; i < 256; i++) {
            rows["unused" + i.toString()] = {
@@ -298,7 +296,7 @@ Ext.define('PVE.qemu.HardwareView', {
                iconCls: 'hdd-o',
                del_extra_msg: gettext('This will permanently erase all data.'),
                editor: caps.vms['VM.Config.Disk'] ? 'PVE.qemu.HDEdit' : undefined,
-               header: gettext('Unused Disk') + ' ' + i.toString()
+               header: gettext('Unused Disk') + ' ' + i.toString(),
            };
        }
        rows.rng0 = {
@@ -306,7 +304,7 @@ Ext.define('PVE.qemu.HardwareView', {
            tdCls: 'pve-itype-icon-die',
            editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.RNGEdit' : undefined,
            never_delete: caps.nodes['Sys.Console'] ? false : true,
-           header: gettext("VirtIO RNG")
+           header: gettext("VirtIO RNG"),
        };
 
        var sorterFn = function(rec1, rec2) {
@@ -320,7 +318,7 @@ Ext.define('PVE.qemu.HardwareView', {
            if ((g1 - g2) !== 0) {
                return g1 - g2;
            }
-           
+
            if ((order1 - order2) !== 0) {
                return order1 - order2;
            }
@@ -367,13 +365,13 @@ Ext.define('PVE.qemu.HardwareView', {
                win = Ext.create(editor, {
                    pveSelNode: me.pveSelNode,
                    confid: rec.data.key,
-                   url: '/api2/extjs/' + baseurl
+                   url: '/api2/extjs/' + baseurl,
                });
            } else {
                var config = Ext.apply({
                    pveSelNode: me.pveSelNode,
                    confid: rec.data.key,
-                   url: '/api2/extjs/' + baseurl
+                   url: '/api2/extjs/' + baseurl,
                }, rowdef.editor);
                win = Ext.createWidget(rowdef.editor.xtype, config);
                win.load();
@@ -392,7 +390,7 @@ Ext.define('PVE.qemu.HardwareView', {
            var win = Ext.create('PVE.window.HDResize', {
                disk: rec.data.key,
                nodename: nodename,
-               vmid: vmid
+               vmid: vmid,
            });
 
            win.show();
@@ -409,7 +407,7 @@ Ext.define('PVE.qemu.HardwareView', {
            var win = Ext.create('PVE.window.HDMove', {
                disk: rec.data.key,
                nodename: nodename,
-               vmid: vmid
+               vmid: vmid,
            });
 
            win.show();
@@ -421,21 +419,21 @@ Ext.define('PVE.qemu.HardwareView', {
            text: gettext('Edit'),
            selModel: sm,
            disabled: true,
-           handler: run_editor
+           handler: run_editor,
         });
 
        var resize_btn = new Proxmox.button.Button({
            text: gettext('Resize disk'),
            selModel: sm,
            disabled: true,
-           handler: run_resize
+           handler: run_resize,
        });
 
        var move_btn = new Proxmox.button.Button({
            text: gettext('Move disk'),
            selModel: sm,
            disabled: true,
-           handler: run_move
+           handler: run_move,
        });
 
        var remove_btn = new Proxmox.button.Button({
@@ -469,10 +467,10 @@ Ext.define('PVE.qemu.HardwareView', {
                    waitMsgTarget: me,
                    method: b.RESTMethod,
                    params: {
-                       'delete': rec.data.key
+                       'delete': rec.data.key,
                    },
                    callback: () => me.reload(),
-                   failure: function (response, opts) {
+                   failure: function(response, opts) {
                        Ext.Msg.alert('Error', response.htmlStatus);
                    },
                    success: function(response, options) {
@@ -482,11 +480,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                upid: upid,
                                listeners: {
                                    destroy: () => me.reload(),
-                               }
+                               },
                            });
                            win.show();
                        }
-                   }
+                   },
                });
            },
            listeners: {
@@ -503,15 +501,15 @@ Ext.define('PVE.qemu.HardwareView', {
 
                    var optimal = alt > def ? alt : def;
                    btn.setSize({ width: optimal });
-               }
-           }
+               },
+           },
        });
 
        var revert_btn = new PVE.button.PendingRevert({
            apiurl: '/api2/extjs/' + baseurl,
        });
 
-       var efidisk_menuitem = Ext.create('Ext.menu.Item',{
+       var efidisk_menuitem = Ext.create('Ext.menu.Item', {
            text: gettext('EFI Disk'),
            iconCls: 'fa fa-fw fa-hdd-o black',
            disabled: !caps.vms['VM.Config.Disk'],
@@ -526,7 +524,7 @@ Ext.define('PVE.qemu.HardwareView', {
                });
                win.on('destroy', me.reload, me);
                win.show();
-           }
+           },
        });
 
        let counts = {};
@@ -539,7 +537,7 @@ Ext.define('PVE.qemu.HardwareView', {
            // en/disable hardwarebuttons
            counts = {};
            var hasCloudInit = false;
-           me.rstore.getData().items.forEach(function(item){
+           me.rstore.getData().items.forEach(function(item) {
                if (!hasCloudInit && (
                    /vm-.*-cloudinit/.test(item.data.value) ||
                    /vm-.*-cloudinit/.test(item.data.pending)
@@ -606,7 +604,6 @@ Ext.define('PVE.qemu.HardwareView', {
            move_btn.setDisabled(pending || !(isUsedDisk || isEfi) || !diskCap);
 
            revert_btn.setDisabled(!pending);
-
        };
 
        Ext.apply(me, {
@@ -614,7 +611,7 @@ Ext.define('PVE.qemu.HardwareView', {
            interval: 5000,
            selModel: sm,
            run_editor: run_editor,
-           tbar: [ 
+           tbar: [
                {
                    text: gettext('Add'),
                    menu: new Ext.menu.Menu({
@@ -627,11 +624,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.HDEdit', {
                                        url: '/api2/extjs/' + baseurl,
-                                       pveSelNode: me.pveSelNode
+                                       pveSelNode: me.pveSelNode,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('CD/DVD Drive'),
@@ -640,11 +637,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.CDEdit', {
                                        url: '/api2/extjs/' + baseurl,
-                                       pveSelNode: me.pveSelNode
+                                       pveSelNode: me.pveSelNode,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('Network Device'),
@@ -655,11 +652,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                    var win = Ext.create('PVE.qemu.NetworkEdit', {
                                        url: '/api2/extjs/' + baseurl,
                                        pveSelNode: me.pveSelNode,
-                                       isCreate: true
+                                       isCreate: true,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            efidisk_menuitem,
                            {
@@ -670,11 +667,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.USBEdit', {
                                        url: '/api2/extjs/' + baseurl,
-                                       pveSelNode: me.pveSelNode
+                                       pveSelNode: me.pveSelNode,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('PCI Device'),
@@ -684,11 +681,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.PCIEdit', {
                                        url: '/api2/extjs/' + baseurl,
-                                       pveSelNode: me.pveSelNode
+                                       pveSelNode: me.pveSelNode,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('Serial Port'),
@@ -697,11 +694,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                disabled: !caps.vms['VM.Config.Options'],
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.SerialEdit', {
-                                       url: '/api2/extjs/' + baseurl
+                                       url: '/api2/extjs/' + baseurl,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('CloudInit Drive'),
@@ -711,11 +708,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                handler: function() {
                                    var win = Ext.create('PVE.qemu.CIDriveEdit', {
                                        url: '/api2/extjs/' + baseurl,
-                                       pveSelNode: me.pveSelNode
+                                       pveSelNode: me.pveSelNode,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext('Audio Device'),
@@ -726,11 +723,11 @@ Ext.define('PVE.qemu.HardwareView', {
                                    var win = Ext.create('PVE.qemu.AudioEdit', {
                                        url: '/api2/extjs/' + baseurl,
                                        isCreate: true,
-                                       isAdd: true
+                                       isAdd: true,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
+                               },
                            },
                            {
                                text: gettext("VirtIO RNG"),
@@ -741,36 +738,34 @@ Ext.define('PVE.qemu.HardwareView', {
                                    var win = Ext.create('PVE.qemu.RNGEdit', {
                                        url: '/api2/extjs/' + baseurl,
                                        isCreate: true,
-                                       isAdd: true
+                                       isAdd: true,
                                    });
                                    win.on('destroy', me.reload, me);
                                    win.show();
-                               }
-                           }
-                       ]
-                   })
+                               },
+                           },
+                       ],
+                   }),
                },
                remove_btn,
                edit_btn,
                resize_btn,
                move_btn,
-               revert_btn
+               revert_btn,
            ],
            rows: rows,
            sorterFn: sorterFn,
            listeners: {
                itemdblclick: run_editor,
-               selectionchange: set_button_status
-           }
+               selectionchange: set_button_status,
+           },
        });
 
        me.callParent();
 
-       me.on('activate', me.rstore.startUpdate);
-       me.on('destroy', me.rstore.stopUpdate);
+       me.on('activate', me.rstore.startUpdate, me.rstore);
+       me.on('destroy', me.rstore.stopUpdate, me.rstore);
 
-       me.mon(me.getStore(), 'datachanged', function() {
-           set_button_status();
-       });
-    }
+       me.mon(me.getStore(), 'datachanged', set_button_status, me);
+    },
 });