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

View File

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

View File

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

View File

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

View File

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