jslint: type confusion

resolve/mark several type confusions

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-10-23 15:01:10 +02:00 committed by Dietmar Maurer
parent 771bd0b94b
commit de0ebd99a1
24 changed files with 97 additions and 21 deletions

View File

@ -11,8 +11,11 @@ Ext.define('PMG.ClamAVDatabaseConfig', {
me.add_text_row('dbmirror', gettext('Database Mirror'), me.add_text_row('dbmirror', gettext('Database Mirror'),
{ deleteEmpty: true, defaultValue: 'database.clamav.net' }); { deleteEmpty: true, defaultValue: 'database.clamav.net' });
/*jslint confusion: true*/
/*defaultValue is a string above*/
me.add_boolean_row('safebrowsing', gettext('Google Safe Browsing'), me.add_boolean_row('safebrowsing', gettext('Google Safe Browsing'),
{ defaultValue: 1 }); { defaultValue: 1 });
/*jslint confusion: false*/
var baseurl = '/config/clamav'; var baseurl = '/config/clamav';
@ -107,7 +110,10 @@ Ext.define('PMG.ClamAVDatabaseStatus', {
me.callParent(); me.callParent();
/*jslint confusion: true*/
/*monStoreErrors is a bool above*/
Proxmox.Utils.monStoreErrors(me.getView(), me.store, true); Proxmox.Utils.monStoreErrors(me.getView(), me.store, true);
/*jslint confusion: false*/
} }
}); });

View File

@ -77,7 +77,7 @@ Ext.define('PMG.ClusterAddNodeWindow', {
{ {
xtype: 'component', xtype: 'component',
border: false, 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.") 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', { Ext.define('PMG.ClusterAdministration', {
extend: 'Ext.tab.Panel', extend: 'Ext.tab.Panel',
xtype: 'pmgClusterAdministration', xtype: 'pmgClusterAdministration',
@ -276,7 +278,7 @@ Ext.define('PMG.ClusterAdministration', {
if (Ext.isArray(value)) { if (Ext.isArray(value)) {
return value[0]; return value[0];
} }
return value; return value.toString();
}, },
dataIndex: 'loadavg' dataIndex: 'loadavg'
}, },

View File

@ -1,4 +1,6 @@
/*global Proxmox*/ /*global Proxmox*/
/*jslint confusion: true*/
/* filter is a function and object */
Ext.define('PMG.ContactDetails', { Ext.define('PMG.ContactDetails', {
extend: 'Ext.grid.GridPanel', extend: 'Ext.grid.GridPanel',
xtype: 'pmgContactDetails', xtype: 'pmgContactDetails',

View File

@ -1,4 +1,11 @@
/*global Proxmox*/ /*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', { Ext.define('PMG.Dashboard', {
extend: 'Ext.panel.Panel', extend: 'Ext.panel.Panel',
xtype: 'pmgDashboard', xtype: 'pmgDashboard',
@ -18,7 +25,7 @@ Ext.define('PMG.Dashboard', {
}, },
items: [{ items: [{
xtype: 'form', xtype: 'form',
bodyPadding: 10, bodyPadding: '10 10 10 10',
defaultButton: 'savebutton', defaultButton: 'savebutton',
items: [{ items: [{
xtype: 'proxmoxintegerfield', xtype: 'proxmoxintegerfield',
@ -73,7 +80,7 @@ Ext.define('PMG.Dashboard', {
var bytes_in = 0; var bytes_in = 0;
var bytes_out = 0; var bytes_out = 0;
var ptime = 0; var ptime = 0;
var avg_ptime = 0; var avg_ptime;
records.forEach(function(item) { records.forEach(function(item) {
bytes_in += item.data.bytes_in; bytes_in += item.data.bytes_in;
@ -260,7 +267,9 @@ Ext.define('PMG.Dashboard', {
Ext.String.format(gettext('{0} hours'), '{hours}') + ')' Ext.String.format(gettext('{0} hours'), '{hours}') + ')'
}, },
layout: 'column', layout: {
type: 'column'
},
border: false, border: false,
bodyPadding: '20 0 0 20', bodyPadding: '20 0 0 20',
@ -394,7 +403,7 @@ Ext.define('PMG.Dashboard', {
iconCls: 'fa fa-list', iconCls: 'fa fa-list',
title: gettext('Top Receivers'), title: gettext('Top Receivers'),
bodyPadding: 20, bodyPadding: '20 20 20 20',
layout: { layout: {
type: 'vbox', type: 'vbox',
pack: 'center', pack: 'center',

View File

@ -54,7 +54,7 @@ Ext.define('PMG.DomainStatistics', {
return v === '' ? '--- EMPTY ADDRESS ---' : Ext.htmlEncode(v); return v === '' ? '--- EMPTY ADDRESS ---' : Ext.htmlEncode(v);
}; };
me.items = { me.items = [{
xtype: 'tabpanel', xtype: 'tabpanel',
border: false, border: false,
items: [ items: [
@ -143,7 +143,7 @@ Ext.define('PMG.DomainStatistics', {
] ]
} }
] ]
}; }];
me.callParent(); me.callParent();

View File

@ -1,3 +1,5 @@
/*jslint confusion: true*/
/*value is string and number*/
Ext.define('PMG.FetchmailEdit', { Ext.define('PMG.FetchmailEdit', {
extend: 'Proxmox.window.Edit', extend: 'Proxmox.window.Edit',
xtype: 'pmgFetchmailEdit', xtype: 'pmgFetchmailEdit',

View File

@ -41,7 +41,8 @@ Ext.define('PMG.MailDistChart', {
renderer: function(tooltip, record, item) { renderer: function(tooltip, record, item) {
var start = record.get('index'); var start = record.get('index');
var end = start+1; var end = start+1;
tooltip.setHtml('Time: ' + start + ' - ' + end + '<br>' + tooltip.setHtml('Time: ' + start.toString() +
' - ' + end.toString() + '<br>' +
'Count: ' + record.get(item.field)); 'Count: ' + record.get(item.field));
} }
} }

View File

@ -1,4 +1,12 @@
/*global Proxmox*/ /*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', { Ext.define('pmg-ldap-config', {
extend: 'Ext.data.Model', extend: 'Ext.data.Model',
fields: [ 'profile', 'server1', 'server2', 'comment', fields: [ 'profile', 'server1', 'server2', 'comment',
@ -364,9 +372,7 @@ Ext.define('PMG.LDAPConfig', {
} }
}, },
layout: { layout: 'border',
type: 'border',
},
items: [ items: [
{ {
@ -496,10 +502,10 @@ Ext.define('PMG.LDAPConfigGrid', {
store: { store: {
model: 'pmg-ldap-config', model: 'pmg-ldap-config',
sorters: { sorters: [{
property: 'profile', property: 'profile',
order: 'DESC' order: 'DESC'
} }]
}, },
tbar: [ tbar: [

View File

@ -28,6 +28,8 @@ Ext.define('PMG.MailProxyOptions', {
return Proxmox.Utils.yesText + ' (' + value + ')'; return Proxmox.Utils.yesText + ' (' + value + ')';
}; };
/*jslint confusion: true*/
/*defaultValue is string and number*/
me.add_combobox_row('verifyreceivers', gettext('Verify Receivers'), { me.add_combobox_row('verifyreceivers', gettext('Verify Receivers'), {
renderer: render_verifyreceivers, renderer: render_verifyreceivers,
defaultValue: '__default__', defaultValue: '__default__',
@ -37,6 +39,7 @@ Ext.define('PMG.MailProxyOptions', {
['450', render_verifyreceivers('450') ], ['450', render_verifyreceivers('450') ],
['550', render_verifyreceivers('550') ]] ['550', render_verifyreceivers('550') ]]
}); });
/*jslint confusion: false*/
me.add_boolean_row('greylist', gettext('Use Greylisting'), me.add_boolean_row('greylist', gettext('Use Greylisting'),
{ defaultValue: 1 }); { defaultValue: 1 });
@ -57,8 +60,11 @@ Ext.define('PMG.MailProxyOptions', {
me.add_integer_row('message_rate_limit', gettext('Client Message Rate Limit'), me.add_integer_row('message_rate_limit', gettext('Client Message Rate Limit'),
{ defaultValue: 0, minValue: 0 }); { defaultValue: 0, minValue: 0 });
/*jslint confusion: true*/
/*defaultValue is string and number*/
me.add_text_row('banner', gettext('SMTPD Banner'), me.add_text_row('banner', gettext('SMTPD Banner'),
{ deleteEmpty: true, defaultValue: 'ESMTP Proxmox' }); { deleteEmpty: true, defaultValue: 'ESMTP Proxmox' });
/*jslint confusion: false*/
var baseurl = '/config/mail'; var baseurl = '/config/mail';

View File

@ -106,7 +106,9 @@ Ext.define('PMG.MailTrackerFilter', {
xtype: 'promxoxDateTimeField' xtype: 'promxoxDateTimeField'
}, },
{ {
layout: 'hbox', layout: {
type: 'hbox'
},
border: false, border: false,
items: [ items: [
{ {
@ -145,7 +147,9 @@ Ext.define('PMG.MaiLogWindow', {
height: 400, height: 400,
scrollable: true, scrollable: true,
layout: 'auto', layout: {
type: 'auto'
},
modal: true, modal: true,
bodyPadding: 5, bodyPadding: 5,

View File

@ -79,6 +79,8 @@ Ext.define('PMG.MyNetworks', {
{ {
text: gettext('Create'), text: gettext('Create'),
handler: function() { handler: function() {
/*jslint confusion: true*/
/* create is function and bool */
var config = { var config = {
method: 'POST', method: 'POST',
url: "/api2/extjs/config/mynetworks", url: "/api2/extjs/config/mynetworks",
@ -97,6 +99,7 @@ Ext.define('PMG.MyNetworks', {
} }
] ]
}; };
/*jslint confusion: false*/
var win = Ext.createWidget('proxmoxWindowEdit', config); var win = Ext.createWidget('proxmoxWindowEdit', config);

View File

@ -183,7 +183,9 @@ Ext.define('PMG.QuarantineView', {
plugins: 'viewport', plugins: 'viewport',
layout: 'border', layout: {
type: 'border'
},
items: [ items: [
{ {
@ -234,7 +236,9 @@ Ext.define('PMG.QuarantineView', {
}, },
{ {
xtype: 'panel', xtype: 'panel',
layout: 'card', layout: {
type: 'card'
},
region: 'center', region: 'center',
border: false, border: false,
reference: 'contentpanel' reference: 'contentpanel'

View File

@ -1,4 +1,6 @@
/*global Proxmox*/ /*global Proxmox*/
/*jslint confusion: true*/
/* filter is a function and object */
Ext.define('PMG.ReceiverDetails', { Ext.define('PMG.ReceiverDetails', {
extend: 'Ext.grid.GridPanel', extend: 'Ext.grid.GridPanel',
xtype: 'pmgReceiverDetails', xtype: 'pmgReceiverDetails',

View File

@ -79,6 +79,8 @@ Ext.define('PMG.RelayDomains', {
{ {
text: gettext('Create'), text: gettext('Create'),
handler: function() { handler: function() {
/*jslint confusion: true*/
/* create is a function and boolean */
var config = { var config = {
method: 'POST', method: 'POST',
url: "/api2/extjs/config/domains", url: "/api2/extjs/config/domains",
@ -97,6 +99,7 @@ Ext.define('PMG.RelayDomains', {
} }
] ]
}; };
/*jslint confusion: false*/
var win = Ext.createWidget('proxmoxWindowEdit', config); var win = Ext.createWidget('proxmoxWindowEdit', config);

View File

@ -1,4 +1,9 @@
/*global Proxmox*/ /*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', { Ext.define('pmg-rule-list', {
extend: 'Ext.data.Model', extend: 'Ext.data.Model',
fields: [ fields: [
@ -26,7 +31,7 @@ Ext.define('PMG.RulesConfiguration', {
selectedRuleChange: function(grid, selected, eOpts) { selectedRuleChange: function(grid, selected, eOpts) {
var me = this; var me = this;
var infoPanel = me.lookupReference('infopanel'); var infoPanel = me.lookupReference('infopanel');
var baseurl = undefined; var baseurl;
if (selected.length > 0) { if (selected.length > 0) {
baseurl = '/config/ruledb/rules/' + selected[0].data.id; baseurl = '/config/ruledb/rules/' + selected[0].data.id;

View File

@ -1,4 +1,6 @@
/*global Proxmox*/ /*global Proxmox*/
/*jslint confusion: true*/
/* filter is a function and object */
Ext.define('PMG.SenderDetails', { Ext.define('PMG.SenderDetails', {
extend: 'Ext.grid.GridPanel', extend: 'Ext.grid.GridPanel',
xtype: 'pmgSenderDetails', xtype: 'pmgSenderDetails',

View File

@ -73,7 +73,10 @@ Ext.define('PMG.SpamDetectorLanguagesInputPanel', {
if (!values.languages) { if (!values.languages) {
values['delete'] = 'languages'; values['delete'] = 'languages';
} else if (Ext.isArray(values.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; return values;

View File

@ -30,6 +30,8 @@ Ext.define('PMG.SpamQuarantineOptions', {
return me.authmodeTextHash[value] || value; return me.authmodeTextHash[value] || value;
}; };
/*jslint confusion: true*/
/* defaultValue is a string and a number*/
me.add_combobox_row('authmode', gettext('Authentication mode'), { me.add_combobox_row('authmode', gettext('Authentication mode'), {
defaultValue: 'ticket', defaultValue: 'ticket',
renderer: render_authmode, renderer: render_authmode,
@ -53,6 +55,7 @@ Ext.define('PMG.SpamQuarantineOptions', {
['outlook', render_reportstyle('outlook') ], ['outlook', render_reportstyle('outlook') ],
['custom', render_reportstyle('custom') ]] ['custom', render_reportstyle('custom') ]]
}); });
/*jslint confusion: false*/
me.add_text_row('hostname', gettext('Quarantine Host'), me.add_text_row('hostname', gettext('Quarantine Host'),
{ deleteEmpty: true, defaultValue: Proxmox.Utils.noneText }); { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText });

View File

@ -21,7 +21,7 @@ Ext.define('PMG.SpamScoreDistribution', {
if (rec.data.level >= 10) { if (rec.data.level >= 10) {
return PMG.Utils.scoreText + ' >= 10'; return PMG.Utils.scoreText + ' >= 10';
} else { } else {
return PMG.Utils.scoreText + ' ' + rec.data.level; return PMG.Utils.scoreText + ' ' + rec.data.level.toString();
} }
} }
} }

View File

@ -100,6 +100,8 @@ Ext.define('PMG.Transport', {
win.show(); win.show();
}; };
/*jslint confusion: true*/
/*create is a function and boolean */
var tbar = [ var tbar = [
{ {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
@ -127,6 +129,7 @@ Ext.define('PMG.Transport', {
}, },
remove_btn remove_btn
]; ];
/*jslint confusion: false*/
Proxmox.Utils.monStoreErrors(me, store, true); Proxmox.Utils.monStoreErrors(me, store, true);

View File

@ -38,6 +38,8 @@ Ext.define('PMG.UserBlackWhiteList', {
}); });
}); });
/*jslint confusion: true*/
/* create is an function */
var config = { var config = {
method: 'POST', method: 'POST',
url: url, url: url,
@ -45,6 +47,7 @@ Ext.define('PMG.UserBlackWhiteList', {
isAdd: true, isAdd: true,
items: items items: items
}; };
/*jslint confusion: false*/
if (me.listname === 'blacklist') { if (me.listname === 'blacklist') {
config.subject = gettext("Blacklist"); config.subject = gettext("Blacklist");

View File

@ -1,4 +1,6 @@
/*global Proxmox*/ /*global Proxmox*/
/*jslint confusion: true*/
/* submitvalue is string and bool */
Ext.define('PMG.UserEdit', { Ext.define('PMG.UserEdit', {
extend: 'Proxmox.window.Edit', extend: 'Proxmox.window.Edit',
alias: 'widget.pmgUserEdit', alias: 'widget.pmgUserEdit',

View File

@ -1,4 +1,6 @@
/*global Proxmox*/ /*global Proxmox*/
/*jslint confusion: true*/
/*renderer is string and function*/
Ext.define('pmg-users', { Ext.define('pmg-users', {
extend: 'Ext.data.Model', extend: 'Ext.data.Model',
fields: [ fields: [

View File

@ -736,8 +736,11 @@ Ext.define('PMG.Utils', {
var from = Ext.htmlEncode(rec.data.from); var from = Ext.htmlEncode(rec.data.from);
var sender = Ext.htmlEncode(rec.data.sender); var sender = Ext.htmlEncode(rec.data.sender);
if (sender) { if (sender) {
/*jslint confusion: true*/
/*format is a string above*/
from = Ext.String.format(gettext("{0} on behalf of {1}"), from = Ext.String.format(gettext("{0} on behalf of {1}"),
sender, from); sender, from);
/*jslint confusion: false*/
} }
return '<small>' + from + '</small><br>' + subject; return '<small>' + from + '</small><br>' + subject;
}, },