]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: some more eslint auto-fixes
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Sep 2020 16:34:54 +0000 (18:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Sep 2020 16:34:54 +0000 (18:34 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/LoginView.js
www/MainView.js
www/ServerStatus.js
www/VersionInfo.js
www/ZFSList.js

index 98c81d347771d1ffdeec8edf485b104f317d563d..1deba415ee8e9ce7a420b3d08365665110ad4d50 100644 (file)
@@ -7,7 +7,6 @@ Ext.define('PBS.LoginView', {
 
        submitForm: function() {
            var me = this;
-           var view = me.getView();
            var loginForm = me.lookupReference('loginForm');
            var unField = me.lookupReference('usernameField');
            var saveunField = me.lookupReference('saveunField');
@@ -19,7 +18,7 @@ Ext.define('PBS.LoginView', {
            let params = loginForm.getValues();
 
            params.username = params.username + '@' + params.realm;
-           delete(params.realm);
+           delete params.realm;
 
            if (loginForm.isVisible()) {
                loginForm.mask(gettext('Please wait...'), 'x-mask-loading');
@@ -48,9 +47,9 @@ Ext.define('PBS.LoginView', {
                    loginForm.unmask();
                    Ext.MessageBox.alert(
                        gettext('Error'),
-                       gettext('Login failed. Please try again')
+                       gettext('Login failed. Please try again'),
                    );
-               }
+               },
            });
        },
 
@@ -63,7 +62,7 @@ Ext.define('PBS.LoginView', {
                            pf.focus(false);
                        }
                    }
-               }
+               },
            },
            'field[name=lang]': {
                change: function(f, value) {
@@ -71,10 +70,10 @@ Ext.define('PBS.LoginView', {
                    Ext.util.Cookies.set('PBSLangCookie', value, dt);
                    this.getView().mask(gettext('Please wait...'), 'x-mask-loading');
                    window.location.reload();
-               }
+               },
            },
            'button[reference=loginButton]': {
-               click: 'submitForm'
+               click: 'submitForm',
            },
            'window[reference=loginwindow]': {
                show: function() {
@@ -85,21 +84,21 @@ Ext.define('PBS.LoginView', {
                    var checked = sp.get(checkboxField.getStateId());
                    checkboxField.setValue(checked);
 
-                   if(checked === true) {
+                   if (checked === true) {
                        var username = sp.get(unField.getStateId());
                        unField.setValue(username);
                        var pwField = this.lookupReference('passwordField');
                        pwField.focus();
                    }
-               }
-           }
-       }
+               },
+           },
+       },
     },
 
     plugins: 'viewport',
 
     layout: {
-       type: 'border'
+       type: 'border',
     },
 
     items: [
@@ -108,7 +107,7 @@ Ext.define('PBS.LoginView', {
            xtype: 'container',
            layout: {
                type: 'hbox',
-               align: 'middle'
+               align: 'middle',
            },
            margin: '2 5 2 5',
            height: 38,
@@ -119,12 +118,12 @@ Ext.define('PBS.LoginView', {
                },
                {
                    xtype: 'versioninfo',
-                   makeApiCall: false
-               }
-           ]
+                   makeApiCall: false,
+               },
+           ],
        },
        {
-           region: 'center'
+           region: 'center',
        },
        {
            xtype: 'window',
@@ -138,7 +137,7 @@ Ext.define('PBS.LoginView', {
            defaultFocus: 'usernameField',
 
            layout: {
-               type: 'auto'
+               type: 'auto',
            },
 
            title: gettext('Proxmox Backup Server Login'),
@@ -147,7 +146,7 @@ Ext.define('PBS.LoginView', {
                {
                    xtype: 'form',
                    layout: {
-                       type: 'form'
+                       type: 'form',
                    },
                    defaultButton: 'loginButton',
                    url: '/api2/extjs/access/ticket',
@@ -155,7 +154,7 @@ Ext.define('PBS.LoginView', {
 
                    fieldDefaults: {
                        labelAlign: 'right',
-                       allowBlank: false
+                       allowBlank: false,
                    },
 
                    items: [
@@ -165,7 +164,7 @@ Ext.define('PBS.LoginView', {
                            name: 'username',
                            itemId: 'usernameField',
                            reference: 'usernameField',
-                           stateId: 'login-username'
+                           stateId: 'login-username',
                        },
                        {
                            xtype: 'textfield',
@@ -177,7 +176,7 @@ Ext.define('PBS.LoginView', {
                        },
                        {
                            xtype: 'pmxRealmComboBox',
-                           name: 'realm'
+                           name: 'realm',
                        },
                        {
                            xtype: 'proxmoxLanguageSelector',
@@ -185,8 +184,8 @@ Ext.define('PBS.LoginView', {
                            value: Ext.util.Cookies.get('PBSLangCookie') || Proxmox.defaultLang || 'en',
                            name: 'lang',
                            reference: 'langField',
-                           submitValue: false
-                       }
+                           submitValue: false,
+                       },
                    ],
                    buttons: [
                        {
@@ -197,16 +196,16 @@ Ext.define('PBS.LoginView', {
                            stateId: 'login-saveusername',
                            labelWidth: 250,
                            labelAlign: 'right',
-                           submitValue: false
+                           submitValue: false,
                        },
                        {
                            text: gettext('Login'),
                            reference: 'loginButton',
-                           formBind: true
-                       }
-                   ]
-               }
-           ]
-       }
-    ]
+                           formBind: true,
+                       },
+                   ],
+               },
+           ],
+       },
+    ],
 });
index c5764b1febf7d3eb969f0afb22a07e004dc0ad18..cfd190585115af542a29c9e11dca700a0e743571 100644 (file)
@@ -10,11 +10,11 @@ Ext.define('PBS.MainView', {
            ':path:subpath': {
                action: 'changePath',
                before: 'beforeChangePath',
-                conditions : {
-                   ':path'    : '(?:([%a-zA-Z0-9\\-\\_\\s,\.]+))',
-                   ':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
-               }
-           }
+                conditions: {
+                   ':path': '(?:([%a-zA-Z0-9\\-\\_\\s,.]+))',
+                   ':subpath': '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?',
+               },
+           },
        },
 
        beforeChangePath: function(path, subpath, action) {
@@ -79,7 +79,7 @@ Ext.define('PBS.MainView', {
                obj = contentpanel.add({
                    xtype: path,
                    nodename: 'localhost',
-                   border: false
+                   border: false,
                });
            }
 
@@ -113,7 +113,6 @@ Ext.define('PBS.MainView', {
            if (lastpanel) {
                contentpanel.remove(lastpanel, { destroy: true });
            }
-
        },
 
        logout: function() {
@@ -126,8 +125,8 @@ Ext.define('PBS.MainView', {
 
        control: {
            '[reference=logoutButton]': {
-               click: 'logout'
-           }
+               click: 'logout',
+           },
        },
 
        init: function(view) {
@@ -139,7 +138,7 @@ Ext.define('PBS.MainView', {
            // show login on requestexception
            // fixme: what about other errors
            Ext.Ajax.on('requestexception', function(conn, response, options) {
-               if (response.status == 401) { // auth failure
+               if (response.status === 401 || response.status === '401') { // auth failure
                    me.logout();
                }
            });
@@ -155,7 +154,7 @@ Ext.define('PBS.MainView', {
                    Ext.Ajax.request({
                        params: {
                            username: Proxmox.UserName,
-                           password: ticket
+                           password: ticket,
                        },
                        url: '/api2/json/access/ticket',
                        method: 'POST',
@@ -165,17 +164,17 @@ Ext.define('PBS.MainView', {
                        success: function(response, opts) {
                            var obj = Ext.decode(response.responseText);
                            PBS.Utils.updateLoginData(obj.data);
-                       }
+                       },
                    });
                },
-               interval: 15*60*1000
+               interval: 15*60*1000,
            });
 
 
            // select treeitem and load page from url fragment, if set
            let token = Ext.util.History.getToken() || 'pbsDashboard';
            this.redirectTo(token, true);
-       }
+       },
     },
 
     plugins: 'viewport',
@@ -188,7 +187,7 @@ Ext.define('PBS.MainView', {
            xtype: 'container',
            layout: {
                type: 'hbox',
-               align: 'middle'
+               align: 'middle',
            },
            margin: '2 0 2 5',
            height: 38,
@@ -229,7 +228,7 @@ Ext.define('PBS.MainView', {
                    style: {
                        // proxmox dark grey p light grey as border
                        backgroundColor: '#464d4d',
-                       borderColor: '#ABBABA'
+                       borderColor: '#ABBABA',
                    },
                    margin: '0 5 0 0',
                    iconCls: 'fa fa-user',
@@ -241,7 +240,7 @@ Ext.define('PBS.MainView', {
                        },
                    ],
                },
-           ]
+           ],
        },
        {
            xtype: 'panel',
@@ -250,7 +249,7 @@ Ext.define('PBS.MainView', {
            region: 'west',
            layout: {
                type: 'vbox',
-               align: 'stretch'
+               align: 'stretch',
            },
            items: [{
                xtype: 'navigationtree',
@@ -260,20 +259,20 @@ Ext.define('PBS.MainView', {
                // because of a bug where a viewcontroller does not detect
                // the selectionchange event of a treelist
                listeners: {
-                   selectionchange: 'navigate'
-               }
+                   selectionchange: 'navigate',
+               },
            }, {
                xtype: 'box',
                cls: 'x-treelist-nav',
-               flex: 1
-           }]
+               flex: 1,
+           }],
        },
        {
            xtype: 'panel',
            layout: { type: 'card' },
            region: 'center',
            border: false,
-           reference: 'contentpanel'
-       }
-    ]
+           reference: 'contentpanel',
+       },
+    ],
 });
index 3752820b3c85ce9d2509f714a610233687455669..9e2501b837b25ba1e8aef83df1042d27d28fd10d 100644 (file)
@@ -6,14 +6,14 @@ Ext.define('pve-rrd-node', {
            // percentage
            convert: function(value) {
                return value*100;
-           }
+           },
        },
        {
            name: 'iowait',
            // percentage
            convert: function(value) {
                return value*100;
-           }
+           },
        },
        'netin',
        'netout',
@@ -33,15 +33,15 @@ Ext.define('pve-rrd-node', {
                let ios = 0;
                if (data.read_ios !== undefined) { ios += data.read_ios; }
                if (data.write_ios !== undefined) { ios += data.write_ios; }
-               if (ios == 0 || data.io_ticks === undefined) {
+               if (ios === 0 || data.io_ticks === undefined) {
                    return undefined;
                }
                return (data.io_ticks*1000.0)/ios;
-           }
+           },
        },
        'loadavg',
-       { type: 'date', dateFormat: 'timestamp', name: 'time' }
-    ]
+       { type: 'date', dateFormat: 'timestamp', name: 'time' },
+    ],
 });
 Ext.define('PBS.ServerStatus', {
     extend: 'Ext.panel.Panel',
@@ -62,7 +62,7 @@ Ext.define('PBS.ServerStatus', {
                waitMsgTarget: me,
                failure: function(response, opts) {
                    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
-               }
+               },
            });
        };
 
@@ -73,7 +73,7 @@ Ext.define('PBS.ServerStatus', {
            handler: function() {
                node_command('reboot');
            },
-           iconCls: 'fa fa-undo'
+           iconCls: 'fa fa-undo',
        });
 
        var shutdownBtn = Ext.create('Proxmox.button.Button', {
@@ -83,7 +83,7 @@ Ext.define('PBS.ServerStatus', {
            handler: function() {
                node_command('shutdown');
            },
-           iconCls: 'fa fa-power-off'
+           iconCls: 'fa fa-power-off',
        });
 
        var consoleBtn = Ext.create('Proxmox.button.Button', {
@@ -91,14 +91,14 @@ Ext.define('PBS.ServerStatus', {
            iconCls: 'fa fa-terminal',
            handler: function() {
                Proxmox.Utils.openXtermJsViewer('shell', 0, Proxmox.NodeName);
-           }
+           },
        });
 
-       me.tbar = [ consoleBtn, restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' } ];
+       me.tbar = [consoleBtn, restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' }];
 
        var rrdstore = Ext.create('Proxmox.data.RRDStore', {
            rrdurl: "/api2/json/nodes/localhost/rrd",
-           model: 'pve-rrd-node'
+           model: 'pve-rrd-node',
        });
 
        me.items = {
@@ -109,72 +109,72 @@ Ext.define('PBS.ServerStatus', {
            defaults: {
                minHeight: 320,
                padding: 5,
-               columnWidth: 1
+               columnWidth: 1,
            },
            items: [
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('CPU usage'),
-                   fields: ['cpu','iowait'],
+                   fields: ['cpu', 'iowait'],
                    fieldTitles: [gettext('CPU usage'), gettext('IO wait')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Server load'),
                    fields: ['loadavg'],
                    fieldTitles: [gettext('Load average')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Memory usage'),
-                   fields: ['memtotal','memused'],
+                   fields: ['memtotal', 'memused'],
                    fieldTitles: [gettext('Total'), gettext('RAM usage')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Swap usage'),
-                   fields: ['swaptotal','swapused'],
+                   fields: ['swaptotal', 'swapused'],
                    fieldTitles: [gettext('Total'), gettext('Swap usage')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Network traffic'),
-                   fields: ['netin','netout'],
-                   store: rrdstore
+                   fields: ['netin', 'netout'],
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Root Disk usage'),
-                   fields: ['total','used'],
+                   fields: ['total', 'used'],
                    fieldTitles: [gettext('Total'), gettext('Disk usage')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Root Disk Transfer Rate (bytes/second)'),
-                   fields: ['read_bytes','write_bytes'],
+                   fields: ['read_bytes', 'write_bytes'],
                    fieldTitles: [gettext('Read'), gettext('Write')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Root Disk Input/Output Operations per Second (IOPS)'),
-                   fields: ['read_ios','write_ios'],
+                   fields: ['read_ios', 'write_ios'],
                    fieldTitles: [gettext('Read'), gettext('Write')],
-                   store: rrdstore
+                   store: rrdstore,
                },
                {
                    xtype: 'proxmoxRRDChart',
                    title: gettext('Root Disk IO Delay (ms)'),
                    fields: ['io_delay'],
                    fieldTitles: [gettext('IO Delay')],
-                   store: rrdstore
+                   store: rrdstore,
                },
-           ]
+           ],
        };
 
        me.listeners = {
@@ -187,6 +187,6 @@ Ext.define('PBS.ServerStatus', {
        };
 
        me.callParent();
-    }
+    },
 
 });
index 0112825c93ba2e9752fd52de230d17f8ea3fbae8..9929d086229aa3ff12f1def592a98e16f79bb695 100644 (file)
@@ -1,19 +1,18 @@
-/*global Proxmox*/
-Ext.define('PBS.view.main.VersionInfo',{
+Ext.define('PBS.view.main.VersionInfo', {
     extend: 'Ext.Component',
     xtype: 'versioninfo',
 
     makeApiCall: true,
 
     data: {
-       version: false
+       version: false,
     },
 
     tpl: [
        'Backup Server',
        '<tpl if="version">',
        ' {version}-{release}',
-       '</tpl>'
+       '</tpl>',
     ],
 
     initComponent: function() {
@@ -26,8 +25,8 @@ Ext.define('PBS.view.main.VersionInfo',{
                method: 'GET',
                success: function(response) {
                    me.update(response.result.data);
-               }
+               },
            });
        }
-    }
+    },
 });
index 8100b8f6630987aed74b47709e883761a5877745..b58dc222f180e26b6e98fdb60df377e85f90bc5b 100644 (file)
@@ -14,7 +14,7 @@ Ext.define('PBS.admin.ZFSList', {
                nodename: me.nodename,
                listeners: {
                    destroy: function() { me.reload(); },
-               }
+               },
            }).show();
        },
 
@@ -49,7 +49,7 @@ Ext.define('PBS.admin.ZFSList', {
            }
 
            let url = `/api2/json/nodes/${view.nodename}/disks/zfs`;
-           view.getStore().getProxy().setUrl(url)
+           view.getStore().getProxy().setUrl(url);
 
            Proxmox.Utils.monStoreErrors(view, view.getStore(), true);
 
@@ -61,34 +61,34 @@ Ext.define('PBS.admin.ZFSList', {
        {
            text: gettext('Name'),
            dataIndex: 'name',
-           flex: 1
+           flex: 1,
        },
        {
            header: gettext('Size'),
            renderer: Proxmox.Utils.format_size,
-           dataIndex: 'size'
+           dataIndex: 'size',
        },
        {
            header: gettext('Free'),
            renderer: Proxmox.Utils.format_size,
-           dataIndex: 'free'
+           dataIndex: 'free',
        },
        {
            header: gettext('Allocated'),
            renderer: Proxmox.Utils.format_size,
-           dataIndex: 'alloc'
+           dataIndex: 'alloc',
        },
        {
            header: gettext('Fragmentation'),
            renderer: function(value) {
                return value.toString() + '%';
            },
-           dataIndex: 'frag'
+           dataIndex: 'frag',
        },
        {
            header: gettext('Health'),
            renderer: Proxmox.Utils.render_zfs_health,
-           dataIndex: 'health'
+           dataIndex: 'health',
        },
        {
            header: gettext('Deduplication'),
@@ -96,8 +96,8 @@ Ext.define('PBS.admin.ZFSList', {
            renderer: function(value) {
                return value.toFixed(2).toString() + 'x';
            },
-           dataIndex: 'dedup'
-       }
+           dataIndex: 'dedup',
+       },
     ],
 
     rootVisible: false,
@@ -118,7 +118,7 @@ Ext.define('PBS.admin.ZFSList', {
            xtype: 'proxmoxButton',
            disabled: true,
            handler: 'openDetailWindow',
-       }
+       },
     ],
 
     listeners: {
@@ -130,7 +130,7 @@ Ext.define('PBS.admin.ZFSList', {
        proxy: {
            type: 'proxmox',
        },
-       sorters: 'name'
+       sorters: 'name',
     },
 });