Fixed the warnings/errors reported by eslint for all the static

javascripts.
This commit is contained in:
Ashesh Vashi
2018-01-12 12:59:51 +05:30
parent b78b97d89b
commit c32eb6bd37
102 changed files with 25830 additions and 24548 deletions

View File

@@ -1,19 +1,19 @@
define('pgadmin.node.pga_job', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'sources/pgadmin', 'pgadmin.browser', 'pgadmin.alertifyjs',
'pgadmin.node.pga_jobstep', 'pgadmin.node.pga_schedule'
'pgadmin.node.pga_jobstep', 'pgadmin.node.pga_schedule',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) {
if (!pgBrowser.Nodes['coll-pga_job']) {
var pga_jobs = pgBrowser.Nodes['coll-pga_job'] =
pgBrowser.Nodes['coll-pga_job'] =
pgBrowser.Collection.extend({
node: 'pga_job',
label: gettext('pga_jobs'),
type: 'coll-pga_job',
columns: ['jobid', 'jobname', 'jobenabled', 'jlgstatus', 'jobnextrun', 'joblastrun', 'jobdesc'],
hasStatistics: false
hasStatistics: false,
});
};
}
if (!pgBrowser.Nodes['pga_job']) {
pgBrowser.Nodes['pga_job'] = pgBrowser.Node.extend({
@@ -26,9 +26,7 @@ define('pgadmin.node.pga_job', [
hasCollectiveStatistics: true,
width: '80%',
height: '80%',
canDrop: function(node) {
return true;
},
canDrop: true,
label: gettext('pgAgent Job'),
node_image: function() {
return 'icon-pga_job';
@@ -36,7 +34,7 @@ define('pgadmin.node.pga_job', [
Init: function() {
/* Avoid mulitple registration of menus */
if (this.initialized)
return;
return;
this.initialized = true;
@@ -44,17 +42,17 @@ define('pgadmin.node.pga_job', [
name: 'create_pga_job_on_coll', node: 'coll-pga_job', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: gettext('pgAgent Job...'),
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'},
},{
name: 'create_pga_job', node: 'pga_job', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: gettext('pgAgent Job...'),
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'}
icon: 'wcTabIcon icon-pga_job', data: {action: 'create'},
}, {
name: 'run_now_pga_job', node: 'pga_job', module: this,
applies: ['object', 'context'], callback: 'run_pga_job_now',
priority: 4, label: gettext('Run now'), data: {action: 'create'},
icon: 'fa fa-play-circle'
icon: 'fa fa-play-circle',
}]);
},
model: pgBrowser.Node.Model.extend({
@@ -72,80 +70,80 @@ define('pgadmin.node.pga_job', [
jobrunningat: undefined,
jobdesc: '',
jsteps: [],
jschedules: []
jschedules: [],
},
idAttribute: 'jobid',
parse: function() {
var d = pgBrowser.Node.Model.prototype.parse.apply(this, arguments);
if (d) {
d.jobrunningat = d.jaghostagent || gettext("Not running currently.");
d.jlgstatus = d.jlgstatus || gettext("Unknown");
d.jobrunningat = d.jaghostagent || gettext('Not running currently.');
d.jlgstatus = d.jlgstatus || gettext('Unknown');
}
return d;
},
schema: [{
id: 'jobname', label: gettext('Name'), type: 'text',
cellHeaderClasses: 'width_percent_30'
cellHeaderClasses: 'width_percent_30',
},{
id: 'jobid', label: gettext('ID'), mode: ['properties'],
type: 'int'
type: 'int',
},{
id: 'jobenabled', label: gettext('Enabled?'), type: 'switch',
cellHeaderClasses: 'width_percent_5'
cellHeaderClasses: 'width_percent_5',
},{
id: 'jobclass', label: gettext('Job class'), type: 'text',
mode: ['properties']
mode: ['properties'],
},{
id: 'jobjclid', label: gettext('Job class'), type: 'int',
control: 'node-ajax-options', url: 'classes', url_with_id: false,
cache_node: 'server', mode: ['create', 'edit'],
select2: {allowClear: false},
helpMessage: gettext('Please select a class to categorize the job. This option will not affect the way the job runs.')
helpMessage: gettext('Please select a class to categorize the job. This option will not affect the way the job runs.'),
},{
id: 'jobhostagent', label: gettext('Host agent'), type: 'text',
mode: ['edit', 'create'],
helpMessage: gettext('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.')
helpMessage: gettext('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.'),
},{
id: 'jobhostagent', label: gettext('Host agent'), type: 'text',
mode: ['properties']
mode: ['properties'],
},{
id: 'jobcreated', type: 'text', mode: ['properties'],
label: gettext('Created')
label: gettext('Created'),
},{
id: 'jobchanged', type: 'text', mode: ['properties'],
label: gettext('Changed')
label: gettext('Changed'),
},{
id: 'jobnextrun', type: 'text', mode: ['properties'],
label: gettext('Next run'), cellHeaderClasses: 'width_percent_20'
label: gettext('Next run'), cellHeaderClasses: 'width_percent_20',
},{
id: 'joblastrun', type: 'text', mode: ['properties'],
label: gettext('Last run'), cellHeaderClasses: 'width_percent_20'
label: gettext('Last run'), cellHeaderClasses: 'width_percent_20',
},{
id: 'jlgstatus', type: 'text', label: gettext('Last result'),
cellHeaderClasses: 'width_percent_5', mode: ['properties']
cellHeaderClasses: 'width_percent_5', mode: ['properties'],
},{
id: 'jobrunningat', type: 'text', mode: ['properties'],
label: gettext('Running at')
label: gettext('Running at'),
},{
id: 'jobdesc', label: gettext('Comment'), type: 'multiline',
cellHeaderClasses: 'width_percent_15'
cellHeaderClasses: 'width_percent_15',
},{
id: 'jsteps', label: '', group: gettext('Steps'),
type: 'collection', mode: ['edit', 'create'],
model: pgBrowser.Nodes['pga_jobstep'].model, canEdit: true,
control: 'sub-node-collection', canAdd: true, canDelete: true,
columns: [
'jstname', 'jstenabled', 'jstkind', 'jstconntype', 'jstonerror'
]
'jstname', 'jstenabled', 'jstkind', 'jstconntype', 'jstonerror',
],
},{
id: 'jschedules', label: '', group: gettext('Schedules'),
type: 'collection', mode: ['edit', 'create'],
control: 'sub-node-collection', canAdd: true, canDelete: true,
canEdit: true, model: pgBrowser.Nodes['pga_schedule'].model,
columns: ['jscname', 'jscenabled', 'jscstart', 'jscend']
columns: ['jscname', 'jscenabled', 'jscstart', 'jscend'],
}],
validate: function(keys) {
validate: function() {
var name = this.get('jobname');
if (_.isUndefined(name) || _.isNull(name) ||
String(name).replace(/^\s+|\s+$/g, '') == '') {
@@ -156,7 +154,7 @@ define('pgadmin.node.pga_job', [
this.errorModel.unset('jobname');
}
return null;
}
},
}),
/* Run pgagent job now */
run_pga_job_now: function(args) {
@@ -172,15 +170,15 @@ define('pgadmin.node.pga_job', [
$.ajax({
url: obj.generate_url(i, 'run_now', d, true),
method:'PUT',
success: function(res) {
// 'pgagent.pga_job' table updated with current time
// to run the job now.
t.unload(i);
},
error: function(xhr, status, error) {
var error_msg = "Unable to run pgagent job.";
// 'pgagent.pga_job' table updated with current time to run the job
// now.
success: function() { t.unload(i); },
error: function(xhr) {
var error_msg = gettext('Unable to run pgagent job.');
if (xhr.readyState == 0) {
alertify.error(gettext('Not connected to the server or the connection to the server has been closed.'));
alertify.error(
gettext('Not connected to the server or the connection to the server has been closed.')
);
}
else {
if (_.isUndefined(xhr.responseText)) {
@@ -194,7 +192,7 @@ define('pgadmin.node.pga_job', [
}
}
t.unload(i);
}
},
});
return false;