Fixing the javascript file after running pga_eslint.js script

This commit is contained in:
Ashesh Vashi 2018-01-17 13:24:25 +05:30
parent 4d8b7556f8
commit 404f1cc8ef
5 changed files with 64 additions and 64 deletions

View File

@ -1,23 +1,23 @@
define('app', [
'babel-polyfill', 'sources/pgadmin', 'bundled_browser', 'pgadmin.datagrid'
], function() {
var initializeModules = function(Object) {
for (var key in Object) {
var module = Object[key];
if (module.init && typeof module.init == 'function') {
module.init();
}
else if (module.Init && typeof module.Init == 'function') {
module.Init();
}
'babel-polyfill', 'sources/pgadmin', 'bundled_browser', 'pgadmin.datagrid',
], function(babelPolyFill, pgAdmin) {
var initializeModules = function(Object) {
for (var key in Object) {
var module = Object[key];
if (module.init && typeof module.init == 'function') {
module.init();
}
else if (module.Init && typeof module.Init == 'function') {
module.Init();
}
}
};
// Initialize modules registered to pgAdmin, pgAdmin.Browser and Tools object.
initializeModules(pgAdmin);
initializeModules(pgAdmin.Browser);
initializeModules(pgAdmin.Tools);
initializeModules(pgAdmin);
initializeModules(pgAdmin.Browser);
initializeModules(pgAdmin.Tools);
// create menus after all modules are initialized.
pgAdmin.Browser.create_menus();
pgAdmin.Browser.create_menus();
});

View File

@ -1,5 +1,5 @@
define('bundled_browser',[
'pgadmin.browser'
'pgadmin.browser',
], function(pgBrowser) {
pgBrowser.init();
});

View File

@ -13,7 +13,7 @@ import 'codemirror/addon/search/searchcursor';
import 'codemirror/addon/search/jump-to-line';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/comment/comment'
import 'codemirror/addon/comment/comment';
import '../js/codemirror/addon/fold/pgadmin-sqlfoldcode';
export default CodeMirror;

View File

@ -81,49 +81,49 @@ define(['jquery', 'sources/gettext'],
// Inject CSS as required
switch(status) {
// Busy
case 1:
case 1:
// if received busy status more than once then only
if(status == sqlEditorUtils.previousStatus &&
if(status == sqlEditorUtils.previousStatus &&
!$status_el.hasClass('fa-hourglass-half')) {
$status_el.removeClass()
$status_el.removeClass()
.addClass('fa fa-hourglass-half');
is_status_changed = true;
}
break;
is_status_changed = true;
}
break;
// Idle in transaction
case 2:
if(sqlEditorUtils.previousStatus != status &&
case 2:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-clock-o')) {
$status_el.removeClass()
$status_el.removeClass()
.addClass('fa fa-clock-o');
is_status_changed = true;
}
break;
is_status_changed = true;
}
break;
// Failed in transaction
case 3:
if(sqlEditorUtils.previousStatus != status &&
case 3:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-circle')) {
$status_el.removeClass()
$status_el.removeClass()
.addClass('fa fa-exclamation-circle');
is_status_changed = true;
}
break;
is_status_changed = true;
}
break;
// Failed in transaction with unknown server side error
case 4:
if(sqlEditorUtils.previousStatus != status &&
case 4:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-triangle')) {
$status_el.removeClass()
$status_el.removeClass()
.addClass('fa fa-exclamation-triangle');
is_status_changed = true;
}
break;
default:
if(sqlEditorUtils.previousStatus != status &&
is_status_changed = true;
}
break;
default:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-query_tool_connected')) {
$status_el.removeClass()
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-connected');
is_status_changed = true;
}
is_status_changed = true;
}
}
sqlEditorUtils.previousStatus = status;
@ -136,8 +136,8 @@ define(['jquery', 'sources/gettext'],
// We come here means we did not receive expected response
// from server, we need to error out
sqlEditorUtils.previousStatus = -99;
msg = gettext("An unexpected error occurred - " +
"ensure you are logged into the application.");
msg = gettext('An unexpected error occurred - ' +
'ensure you are logged into the application.');
$el.attr('data-content', msg);
if(!$status_el.hasClass('fa-query-tool-disconnected')) {
$el.popover('hide');
@ -148,10 +148,10 @@ define(['jquery', 'sources/gettext'],
},
error: function (e) {
sqlEditorUtils.previousStatus = -1;
var msg = gettext("Transaction status check failed.");
var msg = gettext('Transaction status check failed.');
if (e.readyState == 0) {
msg = gettext("Not connected to the server or the connection to " +
"the server has been closed.");
msg = gettext('Not connected to the server or the connection to ' +
'the server has been closed.');
} else if (e.responseJSON && e.responseJSON.errormsg) {
msg = e.responseJSON.errormsg;
}
@ -164,14 +164,14 @@ define(['jquery', 'sources/gettext'],
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-disconnected');
}
}
},
});
},
// This function will update the connection status
updateConnectionStatus: function(url, poll_time) {
var $el = $(".connection_status"),
$status_el = $($($el).find(".fa-custom"));
var $el = $('.connection_status'),
$status_el = $($($el).find('.fa-custom'));
// Apply popover on element
$el.popover();
@ -188,7 +188,7 @@ define(['jquery', 'sources/gettext'],
// Updates the flag for connection status poll
updateConnectionStatusFlag: function(status) {
var $el = $(".connection_status");
var $el = $('.connection_status');
if ($el.data('panel-visible') != status) {
$el.data('panel-visible', status);
}

View File

@ -156,7 +156,7 @@ define('tools.querytool', [
'filename': 'css',
}),
theme: 'webcabin.overrides.css',
});
});
var sql_panel = new pgAdmin.Browser.Panel({
name: 'sql_panel',
@ -298,13 +298,13 @@ define('tools.querytool', [
transId = self.handler.transId;
// If transaction id is already set
if($container.data('trans-id') != transId) {
$container.data('trans-id', transId)
$container.data('trans-id', transId);
}
if (!$container.hasClass('wcPanelTabContentHidden')) {
setTimeout(function () {
self.handler.gridView.query_tool_obj.focus();
}, 200);
setTimeout(function () {
self.handler.gridView.query_tool_obj.focus();
}, 200);
// Trigger an event to update connection status flag
pgBrowser.Events.trigger(
'pgadmin:query_tool:panel:gain_focus:' + transId
@ -321,10 +321,10 @@ define('tools.querytool', [
pgBrowser.Events.trigger(
'pgadmin:query_tool:panel:lost_focus:' + transId
);
}
});
}
});
}
});
}
});
// Code to update connection status polling flag
pgBrowser.Events.on(