]> git.proxmox.com Git - pmg-gui.git/commitdiff
jslint: type confusion
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 23 Oct 2017 13:01:10 +0000 (15:01 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 23 Oct 2017 15:30:26 +0000 (17:30 +0200)
resolve/mark several type confusions

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
24 files changed:
js/ClamAVDatabase.js
js/ClusterAdministration.js
js/ContactStatistics.js
js/Dashboard.js
js/DomainStatistics.js
js/FetchmailEdit.js
js/HourlyMailDistribution.js
js/LDAPConfig.js
js/MailProxyOptions.js
js/MailTracker.js
js/MyNetworks.js
js/QuarantineView.js
js/ReceiverStatistics.js
js/RelayDomains.js
js/RuleConfiguration.js
js/SenderStatistics.js
js/SpamDetectorLanguages.js
js/SpamQuarantineOptions.js
js/SpamScoreDistribution.js
js/Transport.js
js/UserBlackWhiteList.js
js/UserEdit.js
js/UserView.js
js/Utils.js

index 80a85823e514bbaeaeb8afbab18782c8d8611e84..b6a3f3012800d02bf56db2cd3038f91907672218 100644 (file)
@@ -11,8 +11,11 @@ Ext.define('PMG.ClamAVDatabaseConfig', {
        me.add_text_row('dbmirror', gettext('Database Mirror'),
                        { deleteEmpty: true, defaultValue: 'database.clamav.net' });
 
+       /*jslint confusion: true*/
+       /*defaultValue is a string above*/
        me.add_boolean_row('safebrowsing', gettext('Google Safe Browsing'),
                           { defaultValue: 1 });
+       /*jslint confusion: false*/
 
        var baseurl = '/config/clamav';
 
@@ -107,7 +110,10 @@ Ext.define('PMG.ClamAVDatabaseStatus', {
 
        me.callParent();
 
+       /*jslint confusion: true*/
+       /*monStoreErrors is a bool above*/
        Proxmox.Utils.monStoreErrors(me.getView(), me.store, true);
+       /*jslint confusion: false*/
     }
 });
 
index 3a95ef97cd6b1d294b4f06528cc3ce1746c5a5a2..d1a2ff38b4be5e82f3a7462fbd739cfd5a787c68 100644 (file)
@@ -77,7 +77,7 @@ Ext.define('PMG.ClusterAddNodeWindow', {
        {
            xtype: 'component',
            border: false,
-           padding: 10,
+           padding: '10 10 10 10',
            html: gettext("Please use the 'Join' button on the node you want to add, using the following IP address and fingerprint.")
        },
        {
@@ -103,6 +103,8 @@ Ext.define('PMG.ClusterAddNodeWindow', {
     ]
 });
 
+/*jslint confusion: true*/
+/* bind is a function and object */
 Ext.define('PMG.ClusterAdministration', {
     extend: 'Ext.tab.Panel',
     xtype: 'pmgClusterAdministration',
@@ -276,7 +278,7 @@ Ext.define('PMG.ClusterAdministration', {
                        if (Ext.isArray(value)) {
                            return value[0];
                        }
-                       return value;
+                       return value.toString();
                    },
                    dataIndex: 'loadavg'
                },
index f50b42f587bff37954042d60db0fd074cfd5c0f7..948f6d064a19ab655527cf7d3f7d5f056962789c 100644 (file)
@@ -1,4 +1,6 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* filter is a function and object */
 Ext.define('PMG.ContactDetails', {
     extend: 'Ext.grid.GridPanel',
     xtype: 'pmgContactDetails',
index 4fc35fd0db8f0796cde3444f1c267cba0de7366d..7dcc83183ded9a586ef2e030674514b1be020ed3 100644 (file)
@@ -1,4 +1,11 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* load is a function and string
+ * hours is a number and string
+ * timespan is a number and string
+ * bind is a function and object
+ * handler is a function and string
+ */
 Ext.define('PMG.Dashboard', {
     extend: 'Ext.panel.Panel',
     xtype: 'pmgDashboard',
@@ -18,7 +25,7 @@ Ext.define('PMG.Dashboard', {
                },
                items: [{
                    xtype: 'form',
-                   bodyPadding: 10,
+                   bodyPadding: '10 10 10 10',
                    defaultButton: 'savebutton',
                    items: [{
                        xtype: 'proxmoxintegerfield',
@@ -73,7 +80,7 @@ Ext.define('PMG.Dashboard', {
            var bytes_in = 0;
            var bytes_out = 0;
            var ptime = 0;
-           var avg_ptime = 0;
+           var avg_ptime;
 
            records.forEach(function(item) {
                bytes_in += item.data.bytes_in;
@@ -260,7 +267,9 @@ Ext.define('PMG.Dashboard', {
            Ext.String.format(gettext('{0} hours'), '{hours}') + ')'
     },
 
-    layout: 'column',
+    layout: {
+       type: 'column'
+    },
     border: false,
 
     bodyPadding: '20 0 0 20',
@@ -394,7 +403,7 @@ Ext.define('PMG.Dashboard', {
            iconCls: 'fa fa-list',
            title: gettext('Top Receivers'),
 
-           bodyPadding: 20,
+           bodyPadding: '20 20 20 20',
            layout: {
                type: 'vbox',
                pack: 'center',
index 7762bb731ddb41f8dde871d1187e270670dce6ed..72784d449ae329c387fca3973122043699f977ba 100644 (file)
@@ -54,7 +54,7 @@ Ext.define('PMG.DomainStatistics', {
            return v === '' ? '--- EMPTY ADDRESS ---' : Ext.htmlEncode(v);
        };
 
-       me.items = {
+       me.items = [{
            xtype: 'tabpanel',
            border: false,
            items: [
@@ -143,7 +143,7 @@ Ext.define('PMG.DomainStatistics', {
                    ]
                }
            ]
-       };
+       }];
 
        me.callParent();
 
index f019d14ea8928191759c663888572db9259ecfcc..a268dfaeab3c8d988ebebf29f3d76c020eb30ae1 100644 (file)
@@ -1,3 +1,5 @@
+/*jslint confusion: true*/
+/*value is string and number*/
 Ext.define('PMG.FetchmailEdit', {
     extend: 'Proxmox.window.Edit',
     xtype: 'pmgFetchmailEdit',
index bb96cc95caa453f039701c3ead9424acbb654608..7f223d26177d40c365ee88ac419f8499093b6dc0 100644 (file)
@@ -41,7 +41,8 @@ Ext.define('PMG.MailDistChart', {
                renderer: function(tooltip, record, item) {
                    var start = record.get('index');
                    var end = start+1;
-                   tooltip.setHtml('Time: ' + start + ' - ' + end + '<br>' +
+                   tooltip.setHtml('Time: ' + start.toString() +
+                                   ' - ' + end.toString() + '<br>' +
                                    'Count: ' + record.get(item.field));
                }
            }
index 27a94429d266c60d1067ba6f19641e23e07fcc98..8294822998046b37a7ab24470fa393c500a67b53 100644 (file)
@@ -1,4 +1,12 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/*create is function and bool,
+ * reload is function and string,
+ * height is number and string,
+ * hidden is bool and string,
+ * bind is function and object,
+ * callback is function and string
+ */
 Ext.define('pmg-ldap-config', {
     extend: 'Ext.data.Model',
     fields: [ 'profile', 'server1', 'server2', 'comment',
@@ -364,9 +372,7 @@ Ext.define('PMG.LDAPConfig', {
        }
     },
 
-    layout: {
-       type: 'border',
-    },
+    layout: 'border',
 
     items: [
        {
@@ -496,10 +502,10 @@ Ext.define('PMG.LDAPConfigGrid', {
 
     store: {
        model: 'pmg-ldap-config',
-       sorters: {
+       sorters: [{
            property: 'profile',
            order: 'DESC'
-       }
+       }]
     },
 
     tbar: [
index c3ede9aa597f95e8ae8702ef66b278f46afe1f93..7312b5fffb5888b62c9ba2d75cd73f0a868b68d3 100644 (file)
@@ -28,6 +28,8 @@ Ext.define('PMG.MailProxyOptions', {
            return Proxmox.Utils.yesText + ' (' + value + ')';
        };
 
+       /*jslint confusion: true*/
+       /*defaultValue is string and number*/
        me.add_combobox_row('verifyreceivers', gettext('Verify Receivers'), {
            renderer: render_verifyreceivers,
            defaultValue: '__default__',
@@ -37,6 +39,7 @@ Ext.define('PMG.MailProxyOptions', {
                ['450', render_verifyreceivers('450') ],
                ['550', render_verifyreceivers('550') ]]
        });
+       /*jslint confusion: false*/
 
        me.add_boolean_row('greylist', gettext('Use Greylisting'),
                           { defaultValue: 1 });
@@ -57,8 +60,11 @@ Ext.define('PMG.MailProxyOptions', {
        me.add_integer_row('message_rate_limit', gettext('Client Message Rate Limit'),
                           { defaultValue: 0, minValue: 0 });
 
+       /*jslint confusion: true*/
+       /*defaultValue is string and number*/
        me.add_text_row('banner', gettext('SMTPD Banner'),
                        { deleteEmpty: true, defaultValue: 'ESMTP Proxmox' });
+       /*jslint confusion: false*/
 
        var baseurl = '/config/mail';
 
index a992c6aa82a39d9cbddfeb77b4b49fb1ec595aa7..991eecd180d4ff015d28a7e09a3b63f037943dab 100644 (file)
@@ -106,7 +106,9 @@ Ext.define('PMG.MailTrackerFilter', {
                    xtype: 'promxoxDateTimeField'
                },
                {
-                   layout: 'hbox',
+                   layout: {
+                       type: 'hbox'
+                   },
                    border: false,
                    items: [
                        {
@@ -145,7 +147,9 @@ Ext.define('PMG.MaiLogWindow', {
     height: 400,
     scrollable: true,
 
-    layout: 'auto',
+    layout: {
+       type: 'auto'
+    },
     modal: true,
     bodyPadding: 5,
 
index f5a6c6f77df074cf61847f5b3b51499e9e13b603..977af50d7032902fd0e6b3a3330ed94482aa8b56 100644 (file)
@@ -79,6 +79,8 @@ Ext.define('PMG.MyNetworks', {
             {
                text: gettext('Create'),
                handler: function() {
+                   /*jslint confusion: true*/
+                   /* create is function and bool */
                    var config = {
                        method: 'POST',
                        url: "/api2/extjs/config/mynetworks",
@@ -97,6 +99,7 @@ Ext.define('PMG.MyNetworks', {
                            }
                        ]
                    };
+                   /*jslint confusion: false*/
 
                    var win = Ext.createWidget('proxmoxWindowEdit', config);
 
index 2721d2280d7c893fe0eb4cea5d55f7e02fafce47..3d69d1274758ffc3c68131d0ebbf3c8741f88ef0 100644 (file)
@@ -183,7 +183,9 @@ Ext.define('PMG.QuarantineView', {
 
     plugins: 'viewport',
 
-    layout: 'border',
+    layout: {
+       type: 'border'
+    },
 
     items: [
        {
@@ -234,7 +236,9 @@ Ext.define('PMG.QuarantineView', {
        },
        {
            xtype: 'panel',
-           layout: 'card',
+           layout: {
+               type: 'card'
+           },
            region: 'center',
            border: false,
            reference: 'contentpanel'
index bccd483f5df7a508156f9b7a0414bd915f955c77..438db774e94fec8d165a81c504dcf5505b52c0c5 100644 (file)
@@ -1,4 +1,6 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* filter is a function and object */
 Ext.define('PMG.ReceiverDetails', {
     extend: 'Ext.grid.GridPanel',
     xtype: 'pmgReceiverDetails',
index 3b8e0ac53becfdb48a6bab24b66a80dd035b2535..387355a857be5081bde43b5bbf186a7aba97f2d1 100644 (file)
@@ -79,6 +79,8 @@ Ext.define('PMG.RelayDomains', {
             {
                text: gettext('Create'),
                handler: function() {
+                   /*jslint confusion: true*/
+                   /* create is a function and boolean */
                    var config = {
                        method: 'POST',
                        url: "/api2/extjs/config/domains",
@@ -97,6 +99,7 @@ Ext.define('PMG.RelayDomains', {
                            }
                        ]
                    };
+                   /*jslint confusion: false*/
 
                    var win = Ext.createWidget('proxmoxWindowEdit', config);
 
index 9f28472f9aa2f97c6d22145dcb1e6b15bbf5b633..a28fa875b73c3197966d555ff10261a8c8c7f333 100644 (file)
@@ -1,4 +1,9 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* create is a function and boolean,
+ * bind is a function and object,
+ * callback is a function and string
+ */
 Ext.define('pmg-rule-list', {
     extend: 'Ext.data.Model',
     fields: [
@@ -26,7 +31,7 @@ Ext.define('PMG.RulesConfiguration', {
        selectedRuleChange: function(grid, selected, eOpts) {
            var me = this;
            var infoPanel = me.lookupReference('infopanel');
-           var baseurl = undefined;
+           var baseurl;
 
            if (selected.length > 0) {
                baseurl = '/config/ruledb/rules/' + selected[0].data.id;
index 89ad40818725b0060872b84a8590c428662def2c..863700d90bd6262af3354b1d1faa55eabcbb29e3 100644 (file)
@@ -1,4 +1,6 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* filter is a function and object */
 Ext.define('PMG.SenderDetails', {
     extend: 'Ext.grid.GridPanel',
     xtype: 'pmgSenderDetails',
index b30e3ab8f67c76dd9abab1ad33567961de7b60c3..b63c6278163e9b8d179df40aef2f8b1761274e6b 100644 (file)
@@ -73,7 +73,10 @@ Ext.define('PMG.SpamDetectorLanguagesInputPanel', {
        if (!values.languages) {
            values['delete'] = 'languages';
        } else if (Ext.isArray(values.languages)) {
-           values.languages = values.languages.join(' ')
+           /*jslint confusion: true*/
+           /*languages is an array and string here*/
+           values.languages = values.languages.join(' ');
+           /*jslint confusion: false*/
        }
 
        return values;
index 9eea97f57100b916da3f1095cd0bbe41e8f09a45..ca4c7b9d39c5f138005d51cdfbbab833851c056a 100644 (file)
@@ -30,6 +30,8 @@ Ext.define('PMG.SpamQuarantineOptions', {
            return me.authmodeTextHash[value] || value;
        };
 
+       /*jslint confusion: true*/
+       /* defaultValue is a string and a number*/
        me.add_combobox_row('authmode', gettext('Authentication mode'), {
            defaultValue: 'ticket',
            renderer: render_authmode,
@@ -53,6 +55,7 @@ Ext.define('PMG.SpamQuarantineOptions', {
                ['outlook', render_reportstyle('outlook') ],
                ['custom', render_reportstyle('custom') ]]
        });
+       /*jslint confusion: false*/
 
        me.add_text_row('hostname', gettext('Quarantine Host'),
                        { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText });
index 6bd117026255f012ffefb869b5a8df786ca1ef40..866849b86d3ba3be37f07508552754b937bb4624 100644 (file)
@@ -21,7 +21,7 @@ Ext.define('PMG.SpamScoreDistribution', {
                    if (rec.data.level >= 10) {
                        return PMG.Utils.scoreText + ' >= 10';
                    } else {
-                       return PMG.Utils.scoreText + ' ' + rec.data.level;
+                       return PMG.Utils.scoreText + ' ' + rec.data.level.toString();
                    }
                }
            }
index 7d1ca6e6b40bd57a3e53c6704130470eee6554fc..ab37f677d8e989bfa8eaac2918fcf97b47b4a055 100644 (file)
@@ -100,6 +100,8 @@ Ext.define('PMG.Transport', {
            win.show();
        };
 
+       /*jslint confusion: true*/
+       /*create is a function and boolean */
        var tbar = [
             {
                xtype: 'proxmoxButton',
@@ -127,6 +129,7 @@ Ext.define('PMG.Transport', {
             },
            remove_btn
         ];
+       /*jslint confusion: false*/
 
        Proxmox.Utils.monStoreErrors(me, store, true);
 
index 477e1881f66a7b01202247f5191fb030eaa40bfc..2f20b92d5d98757fc2a50429231cf929266fed14 100644 (file)
@@ -38,6 +38,8 @@ Ext.define('PMG.UserBlackWhiteList', {
                });
            });
 
+           /*jslint confusion: true*/
+           /* create is an function */
            var config = {
                method: 'POST',
                url: url,
@@ -45,6 +47,7 @@ Ext.define('PMG.UserBlackWhiteList', {
                isAdd: true,
                items: items
            };
+           /*jslint confusion: false*/
 
            if (me.listname === 'blacklist') {
                config.subject = gettext("Blacklist");
index 5811c242e263f12679a4368f3ed2e85a16c3d2b0..bf66dcfe26680896889f480cf5c030580b427fc6 100644 (file)
@@ -1,4 +1,6 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/* submitvalue is string and bool */
 Ext.define('PMG.UserEdit', {
     extend: 'Proxmox.window.Edit',
     alias: 'widget.pmgUserEdit',
index e1cb972c830e68426bd52c82e13aaa9a656616e1..0a7fd7054ae8fd89d699d19c1b15aef4a8d38424 100644 (file)
@@ -1,4 +1,6 @@
 /*global Proxmox*/
+/*jslint confusion: true*/
+/*renderer is string and function*/
 Ext.define('pmg-users', {
     extend: 'Ext.data.Model',
     fields: [
index 7a8e6115de59947b370fcbb8f436ac555f8cf61d..ce806f0f70bfb76fcbae399a738cc2cc6ae4cda7 100644 (file)
@@ -736,8 +736,11 @@ Ext.define('PMG.Utils', {
        var from = Ext.htmlEncode(rec.data.from);
        var sender = Ext.htmlEncode(rec.data.sender);
        if (sender) {
+           /*jslint confusion: true*/
+           /*format is a string above*/
            from = Ext.String.format(gettext("{0} on behalf of {1}"),
                                     sender, from);
+           /*jslint confusion: false*/
        }
        return '<small>' + from + '</small><br>' + subject;
     },