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,7 +1,7 @@
define('misc.sql', [
'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser',
'alertify', 'pgadmin.alertifyjs'
], function(gettext, _, S, $, pgBrowser, Alertify) {
'sources/gettext', 'underscore', 'underscore.string', 'jquery',
'sources/pgadmin', 'pgadmin.browser', 'pgadmin.alertifyjs',
], function(gettext, _, S, $, pgAdmin, pgBrowser, Alertify) {
pgBrowser.ShowNodeSQL = pgBrowser.ShowNodeSQL || {};
@@ -28,7 +28,8 @@ define('misc.sql', [
);
pgBrowser.Events.on(
'pgadmin:browser:node:updated', function() {
'pgadmin:browser:node:updated',
function() {
if (this.sqlPanels && this.sqlPanels.length) {
$(this.sqlPanels[0]).data('node-prop', '');
this.sqlPanelVisibilityChanged(this.sqlPanels[0]);
@@ -49,9 +50,8 @@ define('misc.sql', [
);
}
}.bind(this)
);
}
else {
);
} else {
if ((sqlPanels[0].isVisible()) || sqlPanels.length != 1) {
pgBrowser.Events.on('pgadmin-browser:tree:selected', this.showSQL);
}
@@ -67,15 +67,13 @@ define('misc.sql', [
this.timeout && clearTimeout(this.timeout);
var that = this;
this.timeout = setTimeout(
this.timeout = setTimeout(
function() {
var sql = '';
if (node) {
sql = '-- ' + gettext("No SQL could be generated for the selected object.");
var self = this,
n_type = data._type,
n_value = -1,
treeHierarchy = node.getTreeNodeHierarchy(item);
sql = '-- ' + gettext('No SQL could be generated for the selected object.');
var n_type = data._type,
treeHierarchy = node.getTreeNodeHierarchy(item);
// Avoid unnecessary reloads
if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
@@ -88,19 +86,19 @@ define('misc.sql', [
sql = '';
var url = node.generate_url(item, 'sql', data, true),
timer;
timer;
$.ajax({
url: url,
type:'GET',
beforeSend: function(jqXHR, settings) {
type: 'GET',
beforeSend: function() {
// Generate a timer for the request
timer = setTimeout(function(){
// notify user if request is taking longer than 1 second
timer = setTimeout(function() {
// Notify user if request is taking longer than 1 second
pgAdmin.Browser.editor.setValue(
gettext("Retrieving data from the server...")
);
pgAdmin.Browser.editor.setValue(
gettext('Retrieving data from the server...')
);
}, 1000);
},
success: function(res) {
@@ -114,22 +112,19 @@ define('misc.sql', [
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'sql', xhr, error, message, item
);
if (
!Alertify.pgHandleItemError(xhr, error, message, {
item: item, info: treeHierarchy
})
) {
if (!Alertify.pgHandleItemError(xhr, error, message, {
item: item,
info: treeHierarchy,
})) {
Alertify.pgNotifier(
error, xhr,
S(gettext("Error retrieving the information - %s")).sprintf(
S(gettext('Error retrieving the information - %s')).sprintf(
message || _label
).value(),
function() {
console.log(arguments);
}
function() {}
);
}
}
},
});
}
}
@@ -142,9 +137,9 @@ define('misc.sql', [
sqlPanelVisibilityChanged: function(panel) {
if (panel.isVisible()) {
var t = pgBrowser.tree,
i = t.selected(),
d = i && t.itemData(i),
n = i && d && pgBrowser.Nodes[d._type];
i = t.selected(),
d = i && t.itemData(i),
n = i && d && pgBrowser.Nodes[d._type];
pgBrowser.ShowNodeSQL.showSQL.apply(pgBrowser.ShowNodeSQL, [i, d, n]);
@@ -154,8 +149,8 @@ define('misc.sql', [
// We don't need to listen the tree item selection event.
pgBrowser.Events.off('pgadmin-browser:tree:selected', pgBrowser.ShowNodeSQL.showSQL);
}
}
},
});
return pgBrowser.ShowNodeSQL;
});
});