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'),
{ 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*/
}
});

View 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'
},

View 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',

View 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',

View 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();

View File

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

View 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));
}
}

View 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: [

View 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';

View 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,

View 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);

View 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'

View 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',

View 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);

View 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;

View 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',

View 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;

View 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 });

View 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();
}
}
}

View 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);

View 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");

View 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',

View File

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

View 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;
},