mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smell 'potential hiding of variables declared in an outer scope'.
This commit is contained in:
parent
703faf3b15
commit
9d0f3ce90b
@ -21,13 +21,13 @@ define([
|
||||
'jquery', 'underscore', 'pgadmin.alertifyjs',
|
||||
'sources/gettext', 'sources/url_for', 'dropzone', 'sources/pgadmin',
|
||||
'sources/csrf', 'tablesorter', 'tablesorter-metric',
|
||||
], function($, _, Alertify, gettext, url_for, Dropzone, pgAdmin, csrfToken) {
|
||||
], function($, _, Alertify, gettext, url_for, Dropzone, pgAdmin, csrf) {
|
||||
|
||||
/*---------------------------------------------------------
|
||||
Define functions used for various operations
|
||||
---------------------------------------------------------*/
|
||||
// Set the CSRF Token
|
||||
csrfToken.setPGCSRFToken(pgAdmin.csrf_token_header, pgAdmin.csrf_token);
|
||||
csrf.setPGCSRFToken(pgAdmin.csrf_token_header, pgAdmin.csrf_token);
|
||||
|
||||
// Return file extension
|
||||
var getFileExtension = function(name) {
|
||||
|
@ -23,9 +23,9 @@ define('pgadmin.misc.explain', [
|
||||
var initSnap = function(snapModule) {
|
||||
Snap = snapModule;
|
||||
// Snap.svg plug-in to write multitext as image name
|
||||
Snap.plugin(function(Snap, Element, Paper) {
|
||||
Snap.plugin(function(_Snap, Element, Paper) {
|
||||
Paper.prototype.multitext = function(x, y, txt, max_width, attributes) {
|
||||
var svg = Snap(),
|
||||
var svg = _Snap(),
|
||||
abc = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
temp = svg.text(0, 0, abc);
|
||||
|
||||
@ -1431,7 +1431,7 @@ define('pgadmin.misc.explain', [
|
||||
curr_zoom_factor = curr_zoom_factor < MIN_ZOOM_FACTOR ? MIN_ZOOM_FACTOR : curr_zoom_factor;
|
||||
curr_zoom_factor = curr_zoom_factor > INIT_ZOOM_FACTOR ? INIT_ZOOM_FACTOR : curr_zoom_factor;
|
||||
|
||||
var zoomInMatrix = new Snap.matrix();
|
||||
let zoomInMatrix = new Snap.matrix();
|
||||
zoomInMatrix.scale(curr_zoom_factor, curr_zoom_factor);
|
||||
|
||||
$svg.find('g').first().attr({
|
||||
@ -1446,7 +1446,7 @@ define('pgadmin.misc.explain', [
|
||||
|
||||
zoomInBtn.on('click', function() {
|
||||
curr_zoom_factor = ((curr_zoom_factor + ZOOM_RATIO) > MAX_ZOOM_FACTOR) ? MAX_ZOOM_FACTOR : (curr_zoom_factor + ZOOM_RATIO);
|
||||
var zoomInMatrix = new Snap.matrix();
|
||||
let zoomInMatrix = new Snap.matrix();
|
||||
zoomInMatrix.scale(curr_zoom_factor, curr_zoom_factor);
|
||||
|
||||
$svg.find('g').first().attr({
|
||||
@ -1461,7 +1461,7 @@ define('pgadmin.misc.explain', [
|
||||
|
||||
zoomOutBtn.on('click', function() {
|
||||
curr_zoom_factor = ((curr_zoom_factor - ZOOM_RATIO) < MIN_ZOOM_FACTOR) ? MIN_ZOOM_FACTOR : (curr_zoom_factor - ZOOM_RATIO);
|
||||
var zoomInMatrix = new Snap.matrix();
|
||||
let zoomInMatrix = new Snap.matrix();
|
||||
zoomInMatrix.scale(curr_zoom_factor, curr_zoom_factor);
|
||||
|
||||
$svg.find('g').first().attr({
|
||||
@ -1476,7 +1476,7 @@ define('pgadmin.misc.explain', [
|
||||
|
||||
zoomToNormal.on('click', function() {
|
||||
curr_zoom_factor = INIT_ZOOM_FACTOR;
|
||||
var zoomInMatrix = new Snap.matrix();
|
||||
let zoomInMatrix = new Snap.matrix();
|
||||
zoomInMatrix.scale(curr_zoom_factor, curr_zoom_factor);
|
||||
|
||||
$svg.find('g').first().attr({
|
||||
|
@ -13,7 +13,7 @@
|
||||
* @namespace Slick
|
||||
*/
|
||||
|
||||
import JSONBigNumber from 'json-bignumber';
|
||||
import JSONBigNumberLib from 'json-bignumber';
|
||||
import gettext from 'sources/gettext';
|
||||
|
||||
(function($, JSONBigNumber) {
|
||||
@ -975,4 +975,4 @@ import gettext from 'sources/gettext';
|
||||
this.init();
|
||||
}
|
||||
|
||||
})(window.jQuery, JSONBigNumber);
|
||||
})(window.jQuery, JSONBigNumberLib);
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
// Set up Backform appropriately for the environment. Start with AMD.
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['underscore', 'jquery', 'backbone'], function(_, $, Backbone) {
|
||||
define(['underscore', 'jquery', 'backbone'], function(underscore, $, Backbone) {
|
||||
// Export global even in AMD case in case this script is loaded with
|
||||
// others that may still expect a global Backform.
|
||||
return factory(root, _, $, Backbone);
|
||||
return factory(root, underscore, $, Backbone);
|
||||
});
|
||||
|
||||
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
|
||||
|
34
web/pgadmin/static/vendor/require/require.js
vendored
34
web/pgadmin/static/vendor/require/require.js
vendored
@ -449,8 +449,8 @@ var requirejs, require, define;
|
||||
if (prefix) {
|
||||
if (pluginModule && pluginModule.normalize) {
|
||||
//Plugin is loaded, use its normalize method.
|
||||
normalizedName = pluginModule.normalize(name, function (name) {
|
||||
return normalize(name, parentName, applyMap);
|
||||
normalizedName = pluginModule.normalize(name, function (_name) {
|
||||
return normalize(_name, parentName, applyMap);
|
||||
});
|
||||
} else {
|
||||
// If nested plugin references, then do not try to
|
||||
@ -962,8 +962,8 @@ var requirejs, require, define;
|
||||
if (this.map.unnormalized) {
|
||||
//Normalize the ID if the plugin allows it.
|
||||
if (plugin.normalize) {
|
||||
name = plugin.normalize(name, function (name) {
|
||||
return normalize(name, parentName, true);
|
||||
name = plugin.normalize(name, function (_name) {
|
||||
return normalize(_name, parentName, true);
|
||||
}) || '';
|
||||
}
|
||||
|
||||
@ -1267,11 +1267,11 @@ var requirejs, require, define;
|
||||
* Set a configuration for the context.
|
||||
* @param {Object} cfg config object to integrate.
|
||||
*/
|
||||
configure: function (cfg) {
|
||||
configure: function (_cfg) {
|
||||
//Make sure the baseUrl ends in a slash.
|
||||
if (cfg.baseUrl) {
|
||||
if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
|
||||
cfg.baseUrl += '/';
|
||||
if (_cfg.baseUrl) {
|
||||
if (_cfg.baseUrl.charAt(_cfg.baseUrl.length - 1) !== '/') {
|
||||
_cfg.baseUrl += '/';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1285,7 +1285,7 @@ var requirejs, require, define;
|
||||
map: true
|
||||
};
|
||||
|
||||
eachProp(cfg, function (value, prop) {
|
||||
eachProp(_cfg, function (value, prop) {
|
||||
if (objs[prop]) {
|
||||
if (!config[prop]) {
|
||||
config[prop] = {};
|
||||
@ -1297,8 +1297,8 @@ var requirejs, require, define;
|
||||
});
|
||||
|
||||
//Reverse map the bundles
|
||||
if (cfg.bundles) {
|
||||
eachProp(cfg.bundles, function (value, prop) {
|
||||
if (_cfg.bundles) {
|
||||
eachProp(_cfg.bundles, function (value, prop) {
|
||||
each(value, function (v) {
|
||||
if (v !== prop) {
|
||||
bundlesMap[v] = prop;
|
||||
@ -1308,8 +1308,8 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
//Merge shim
|
||||
if (cfg.shim) {
|
||||
eachProp(cfg.shim, function (value, id) {
|
||||
if (_cfg.shim) {
|
||||
eachProp(_cfg.shim, function (value, id) {
|
||||
//Normalize the structure
|
||||
if (isArray(value)) {
|
||||
value = {
|
||||
@ -1325,8 +1325,8 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
//Adjust packages if necessary.
|
||||
if (cfg.packages) {
|
||||
each(cfg.packages, function (pkgObj) {
|
||||
if (_cfg.packages) {
|
||||
each(_cfg.packages, function (pkgObj) {
|
||||
var location, name;
|
||||
|
||||
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
|
||||
@ -1363,8 +1363,8 @@ var requirejs, require, define;
|
||||
//If a deps array or a config callback is specified, then call
|
||||
//require with those args. This is useful when require is defined as a
|
||||
//config object before require.js is loaded.
|
||||
if (cfg.deps || cfg.callback) {
|
||||
context.require(cfg.deps || [], cfg.callback);
|
||||
if (_cfg.deps || _cfg.callback) {
|
||||
context.require(_cfg.deps || [], _cfg.callback);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -488,37 +488,37 @@ define([
|
||||
// Initialize the target and create asynchronous connection and unique transaction ID
|
||||
// If there is no arguments to the functions then we should not ask for for function arguments and
|
||||
// Directly open the panel
|
||||
var t = pgBrowser.tree,
|
||||
i = t.selected(),
|
||||
d = i && i.length == 1 ? t.itemData(i) : undefined,
|
||||
node = d && pgBrowser.Nodes[d._type];
|
||||
var _t = pgBrowser.tree,
|
||||
_i = _t.selected(),
|
||||
_d = _i && _i.length == 1 ? _t.itemData(_i) : undefined,
|
||||
_node = _d && pgBrowser.Nodes[_d._type];
|
||||
|
||||
if (!d)
|
||||
if (!_d)
|
||||
return;
|
||||
|
||||
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]),
|
||||
var newTreeInfo = _node.getTreeNodeHierarchy.apply(_node, [_i]),
|
||||
baseUrl;
|
||||
|
||||
if (d._type == 'function' || d._type == 'edbfunc') {
|
||||
if (_d._type == 'function' || _d._type == 'edbfunc') {
|
||||
baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'trans_id': trans_id,
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': debuggerUtils.getFunctionId(treeInfo),
|
||||
'sid': newTreeInfo.server._id,
|
||||
'did': newTreeInfo.database._id,
|
||||
'scid': newTreeInfo.schema._id,
|
||||
'func_id': debuggerUtils.getFunctionId(newTreeInfo),
|
||||
}
|
||||
);
|
||||
} else if(d._type == 'procedure' || d._type == 'edbproc') {
|
||||
} else if(_d._type == 'procedure' || _d._type == 'edbproc') {
|
||||
baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'trans_id': trans_id,
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': debuggerUtils.getProcedureId(treeInfo),
|
||||
'sid': newTreeInfo.server._id,
|
||||
'did': newTreeInfo.database._id,
|
||||
'scid': newTreeInfo.schema._id,
|
||||
'func_id': debuggerUtils.getProcedureId(newTreeInfo),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -677,13 +677,13 @@ export default class SchemaDiffUI {
|
||||
placeholder: gettext('Select database...'),
|
||||
},
|
||||
disabled: function(m) {
|
||||
let self = this;
|
||||
let self_local = this;
|
||||
if (!_.isUndefined(m.get('target_sid')) && !_.isNull(m.get('target_sid'))
|
||||
&& m.get('target_sid') !== '') {
|
||||
setTimeout(function() {
|
||||
for (var i = 0; i < self.options.length; i++) {
|
||||
if (self.options[i].is_maintenance_db) {
|
||||
m.set('target_did', self.options[i].value);
|
||||
for (var i = 0; i < self_local.options.length; i++) {
|
||||
if (self_local.options[i].is_maintenance_db) {
|
||||
m.set('target_did', self_local.options[i].value);
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
@ -713,12 +713,12 @@ export default class SchemaDiffUI {
|
||||
placeholder: gettext('Select schema...'),
|
||||
},
|
||||
disabled: function(m) {
|
||||
let self = this;
|
||||
let self_local = this;
|
||||
if (!_.isUndefined(m.get('target_did')) && !_.isNull(m.get('target_did'))
|
||||
&& m.get('target_did') !== '') {
|
||||
setTimeout(function() {
|
||||
if (self.options.length > 0) {
|
||||
m.set('target_scid', self.options[0].value);
|
||||
if (self_local.options.length > 0) {
|
||||
m.set('target_scid', self_local.options[0].value);
|
||||
}
|
||||
}, 10);
|
||||
return false;
|
||||
@ -801,23 +801,23 @@ export default class SchemaDiffUI {
|
||||
|
||||
connect_server(server_id, callback) {
|
||||
var onFailure = function(
|
||||
xhr, status, error, server_id, callback
|
||||
xhr, status, error, sid, err_callback
|
||||
) {
|
||||
Alertify.pgNotifier('error', xhr, error, function(msg) {
|
||||
setTimeout(function() {
|
||||
Alertify.dlgServerPass(
|
||||
gettext('Connect to Server'),
|
||||
msg,
|
||||
server_id,
|
||||
callback
|
||||
sid,
|
||||
err_callback
|
||||
).resizeTo();
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
onSuccess = function(res, callback) {
|
||||
onSuccess = function(res, suc_callback) {
|
||||
if (res && res.data) {
|
||||
// We're not reconnecting
|
||||
callback(res.data);
|
||||
suc_callback(res.data);
|
||||
}
|
||||
};
|
||||
|
||||
@ -827,11 +827,11 @@ export default class SchemaDiffUI {
|
||||
Alertify.dialog('dlgServerPass', function factory() {
|
||||
return {
|
||||
main: function(
|
||||
title, message, server_id, success_callback, _onSuccess, _onFailure, _onCancel
|
||||
title, message, sid, success_callback, _onSuccess, _onFailure, _onCancel
|
||||
) {
|
||||
this.set('title', title);
|
||||
this.message = message;
|
||||
this.server_id = server_id;
|
||||
this.server_id = sid;
|
||||
this.success_callback = success_callback;
|
||||
this.onSuccess = _onSuccess || onSuccess;
|
||||
this.onFailure = _onFailure || onFailure;
|
||||
|
@ -281,9 +281,9 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
|
||||
treeMenu.selectNode(treeItem.domNode, true);
|
||||
this.showMessage(null);
|
||||
})
|
||||
.catch((args)=>{
|
||||
.catch((error)=>{
|
||||
this.showMessage(gettext('Unable to locate this object in the browser.'), true);
|
||||
console.warn(args, rowData.id_path);
|
||||
console.warn(error, rowData.id_path);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -242,13 +242,13 @@ var themeCssRules = function(theme_name) {
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: function(theme_name){
|
||||
resources: function(_theme_name){
|
||||
let ret_res = [
|
||||
'./pgadmin/static/scss/resources/' + theme_name + '/_theme.variables.scss',
|
||||
'./pgadmin/static/scss/resources/' + _theme_name + '/_theme.variables.scss',
|
||||
'./pgadmin/static/scss/resources/pgadmin.resources.scss',
|
||||
];
|
||||
if(theme_name!='standard') {
|
||||
ret_res.unshift('./pgadmin/static/scss/resources/' + theme_name + '/_theme.variables.scss');
|
||||
if(_theme_name!='standard') {
|
||||
ret_res.unshift('./pgadmin/static/scss/resources/' + _theme_name + '/_theme.variables.scss');
|
||||
}
|
||||
return ret_res;
|
||||
}(theme_name),
|
||||
|
Loading…
Reference in New Issue
Block a user