' +
+ prepare: function() {
+ let self = this;
+ $container.html('');
+ // Disable Ok button
+ this.__internal.buttons[2].element.disabled = true;
+
+ // Status bar
+ this.statusBar = $(
+ '
' +
'
`
)
- .data('entrydata', this.entry)
- .on('click', e => {
- this.onClickHandler($(e.currentTarget));
- });
+ .data('entrydata', this.entry)
+ .on('click', e => {
+ this.onClickHandler($(e.currentTarget));
+ });
}
}
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
index 0d8ac0e7..c3906aaa 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
@@ -78,7 +78,7 @@ function updateUIPreferences(sqlEditor) {
.find('i')
.attr('title',
shortcut_accesskey_title('Connection status (click for details)',
- preferences.btn_conn_status));
+ preferences.btn_conn_status));
/* Accessed using ctrl,atl,shift and key */
$el.find('#btn-flash')
@@ -152,8 +152,8 @@ function updateUIPreferences(sqlEditor) {
// Calling it again in specified interval
sqlEditor.connIntervalId = setInterval(
- SqlEditorUtils.fetchConnectionStatus.bind(null, sqlEditor.handler, $conn_status, $status_el),
- preferences.connection_status_fetch_time * 1000
+ SqlEditorUtils.fetchConnectionStatus.bind(null, sqlEditor.handler, $conn_status, $status_el),
+ preferences.connection_status_fetch_time * 1000
);
}
else {
diff --git a/web/pgadmin/static/js/sqleditor_utils.js b/web/pgadmin/static/js/sqleditor_utils.js
index 74d8ad50..9d14ac46 100644
--- a/web/pgadmin/static/js/sqleditor_utils.js
+++ b/web/pgadmin/static/js/sqleditor_utils.js
@@ -19,8 +19,8 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
var hexDigits = '0123456789abcdef';
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(
- Math.floor(Math.random() * 0x10), 1
- );
+ Math.floor(Math.random() * 0x10), 1
+ );
}
// bits 12-15 of the time_hi_and_version field to 0010
s[14] = '4';
@@ -46,7 +46,7 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
// Create a temporary element with given label, append to body
// calculate its width and remove the element.
$('body').append(
- '
'+ text + ' '
+ '
'+ text + ' '
);
var width = $('#pg_text').width() + 23;
$('#pg_text').remove(); // remove element
@@ -80,102 +80,102 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
url: url,
method: 'GET',
})
- .done(function (res) {
- if(res && res.data) {
- var status = res.data.status,
- msg = res.data.message,
- is_status_changed = false;
-
- // Raise notify messages comes from database server.
- sqleditor_obj.update_notifications(res.data.notifies);
-
- // Inject CSS as required
- switch(status) {
- // Busy
- case 1:
- // if received busy status more than once then only
- if(status == sqlEditorUtils.previousStatus &&
+ .done(function (res) {
+ if(res && res.data) {
+ var status = res.data.status,
+ msg = res.data.message,
+ is_status_changed = false;
+
+ // Raise notify messages comes from database server.
+ sqleditor_obj.update_notifications(res.data.notifies);
+
+ // Inject CSS as required
+ switch(status) {
+ // Busy
+ case 1:
+ // if received busy status more than once then only
+ if(status == sqlEditorUtils.previousStatus &&
!$status_el.hasClass('fa-hourglass-half')) {
- $status_el.removeClass()
- .addClass('fa fa-hourglass-half');
- is_status_changed = true;
- }
- break;
+ $status_el.removeClass()
+ .addClass('fa fa-hourglass-half');
+ 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()
- .addClass('fa fa-clock-o');
- is_status_changed = true;
- }
- break;
+ $status_el.removeClass()
+ .addClass('fa fa-clock-o');
+ 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()
- .addClass('fa fa-exclamation-circle');
- is_status_changed = true;
- }
- break;
+ $status_el.removeClass()
+ .addClass('fa fa-exclamation-circle');
+ 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()
- .addClass('fa fa-exclamation-triangle');
- is_status_changed = true;
- }
- break;
- default:
- if(sqlEditorUtils.previousStatus != status &&
+ $status_el.removeClass()
+ .addClass('fa fa-exclamation-triangle');
+ is_status_changed = true;
+ }
+ break;
+ default:
+ if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-query_tool_connected')) {
- $status_el.removeClass()
- .addClass('fa-custom fa-query-tool-connected');
- is_status_changed = true;
+ $status_el.removeClass()
+ .addClass('fa-custom fa-query-tool-connected');
+ is_status_changed = true;
+ }
}
- }
- sqlEditorUtils.previousStatus = status;
- // Set bootstrap popover message
- if(is_status_changed) {
- $el.popover('hide');
- $el.attr('data-content', msg);
- }
- } else {
+ sqlEditorUtils.previousStatus = status;
+ // Set bootstrap popover message
+ if(is_status_changed) {
+ $el.popover('hide');
+ $el.attr('data-content', msg);
+ }
+ } else {
// 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 - ' +
+ sqlEditorUtils.previousStatus = -99;
+ 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');
+ $status_el.removeClass()
+ .addClass('fa-custom fa-query-tool-disconnected');
+ }
+ }
+ })
+ .fail(function (e) {
+ sqlEditorUtils.previousStatus = -1;
+ 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.');
+ } else if (e.responseJSON && e.responseJSON.errormsg) {
+ msg = e.responseJSON.errormsg;
+ }
+
+ // Set bootstrap popover
$el.attr('data-content', msg);
+ // Add error class
if(!$status_el.hasClass('fa-query-tool-disconnected')) {
$el.popover('hide');
$status_el.removeClass()
- .addClass('fa-custom fa-query-tool-disconnected');
+ .addClass('fa-custom fa-query-tool-disconnected');
}
- }
- })
- .fail(function (e) {
- sqlEditorUtils.previousStatus = -1;
- 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.');
- } else if (e.responseJSON && e.responseJSON.errormsg) {
- msg = e.responseJSON.errormsg;
- }
-
- // Set bootstrap popover
- $el.attr('data-content', msg);
- // Add error class
- if(!$status_el.hasClass('fa-query-tool-disconnected')) {
- $el.popover('hide');
- $status_el.removeClass()
- .addClass('fa-custom fa-query-tool-disconnected');
- }
- });
+ });
},
// Updates the flag for connection status poll
diff --git a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
index c1e3f829..0d2071f0 100644
--- a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
+++ b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
@@ -13,10 +13,10 @@ import url_for from 'sources/url_for';
import gettext from 'sources/gettext';
import pgAdmin from 'sources/pgadmin';
-const pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {};
+export const pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {};
-const browserTreeState = pgBrowser.browserTreeState = pgBrowser.browserTreeState || {};
+export const browserTreeState = pgBrowser.browserTreeState = pgBrowser.browserTreeState || {};
_.extend(pgBrowser.browserTreeState, {
@@ -74,20 +74,20 @@ _.extend(pgBrowser.browserTreeState, {
url: url_for('settings.reset_tree_state'),
type: 'DELETE',
})
- .fail(function(jqx) {
- var msg = jqx.responseText;
- /* Error from the server */
- if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
- try {
- var data = JSON.parse(jqx.responseText);
- msg = data.errormsg;
- } catch (e) {
- console.warn(e.stack || e);
+ .fail(function(jqx) {
+ var msg = jqx.responseText;
+ /* Error from the server */
+ if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
+ try {
+ var data = JSON.parse(jqx.responseText);
+ msg = data.errormsg;
+ } catch (e) {
+ console.warn(e.stack || e);
+ }
}
- }
- console.warn(
- gettext('Error resetting the tree saved state."'), msg);
- });
+ console.warn(
+ gettext('Error resetting the tree saved state."'), msg);
+ });
}
},
@@ -103,23 +103,23 @@ _.extend(pgBrowser.browserTreeState, {
contentType: 'application/json',
data: JSON.stringify(self.current_state),
})
- .done(function() {
- self.last_state = JSON.stringify(self.current_state);
- })
- .fail(function(jqx) {
- var msg = jqx.responseText;
- /* Error from the server */
- if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
- try {
- var data = JSON.parse(jqx.responseText);
- msg = data.errormsg;
- } catch (e) {
- console.warn(e.stack || e);
+ .done(function() {
+ self.last_state = JSON.stringify(self.current_state);
+ })
+ .fail(function(jqx) {
+ var msg = jqx.responseText;
+ /* Error from the server */
+ if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
+ try {
+ var data = JSON.parse(jqx.responseText);
+ msg = data.errormsg;
+ } catch (e) {
+ console.warn(e.stack || e);
+ }
}
- }
- console.warn(
- gettext('Error saving the tree state."'), msg);
- });
+ console.warn(
+ gettext('Error saving the tree state."'), msg);
+ });
},
fetch_state: function() {
@@ -131,23 +131,23 @@ _.extend(pgBrowser.browserTreeState, {
dataType: 'json',
contentType: 'application/json',
})
- .done(function(res) {
- self.stored_state = res;
- })
- .fail(function(jqx) {
- var msg = jqx.responseText;
- /* Error from the server */
- if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
- try {
- var data = JSON.parse(jqx.responseText);
- msg = data.errormsg;
- } catch (e) {
- console.warn(e.stack || e);
+ .done(function(res) {
+ self.stored_state = res;
+ })
+ .fail(function(jqx) {
+ var msg = jqx.responseText;
+ /* Error from the server */
+ if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
+ try {
+ var data = JSON.parse(jqx.responseText);
+ msg = data.errormsg;
+ } catch (e) {
+ console.warn(e.stack || e);
+ }
}
- }
- console.warn(
- gettext('Error fetching the tree state."'), msg);
- });
+ console.warn(
+ gettext('Error fetching the tree state."'), msg);
+ });
},
update_cache: function(item) {
@@ -390,5 +390,3 @@ _.extend(pgBrowser.browserTreeState, {
}
},
});
-
-export {pgBrowser, browserTreeState};
* Unmerged path web/pgadmin/static/jsx/history/detail/code_mirror.jsx
* Unmerged path web/pgadmin/static/jsx/history/detail/history_detail_message.jsx
* Unmerged path web/pgadmin/static/jsx/history/detail/history_detail_query.jsx
* Unmerged path web/pgadmin/static/jsx/history/detail/history_error_message.jsx
* Unmerged path web/pgadmin/static/jsx/history/query_history.jsx
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
index 26c97eda..9dd99a13 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
@@ -16,7 +16,7 @@ import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
export class BackupDialogWrapper extends DialogWrapper {
constructor(dialogContainerSelector, dialogTitle, typeOfDialog,
- jquery, pgBrowser, alertify, dialogModel, backform) {
+ jquery, pgBrowser, alertify, dialogModel, backform) {
super(dialogContainerSelector, dialogTitle, jquery,
pgBrowser, alertify, dialogModel, backform);
this.typeOfDialog = typeOfDialog;
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index b4c0ea00..912c99be 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -68,7 +68,7 @@ define('pgadmin.datagrid', [
'foreign_table', 'catalog_object', 'partition',
],
- /* Enable/disable View data menu in tools based
+ /* Enable/disable View data menu in tools based
* on node selected. if selected node is present
* in supported_nodes, menu will be enabled
* otherwise disabled.
@@ -86,7 +86,7 @@ define('pgadmin.datagrid', [
return isEnabled;
},
- /* Enable/disable Query tool menu in tools based
+ /* Enable/disable Query tool menu in tools based
* on node selected. if selected node is present
* in unsupported_nodes, menu will be disabled
* otherwise enabled.
@@ -350,25 +350,25 @@ define('pgadmin.datagrid', [
contentType: 'application/json',
data: JSON.stringify(sql),
})
- .done(function(res) {
- if (res.data.status) {
+ .done(function(res) {
+ if (res.data.status) {
// Initialize the data grid.
- self.create_transaction(that.baseUrl, null, 'false', parentData.server.server_type, '', grid_title, sql, false);
- that.close(); // Close the dialog
- }
- else {
+ self.create_transaction(that.baseUrl, null, 'false', parentData.server.server_type, '', grid_title, sql, false);
+ that.close(); // Close the dialog
+ }
+ else {
+ alertify.alert(
+ gettext('Validation Error'),
+ res.data.result
+ );
+ }
+ })
+ .fail(function(e) {
alertify.alert(
gettext('Validation Error'),
- res.data.result
+ e
);
- }
- })
- .fail(function(e) {
- alertify.alert(
- gettext('Validation Error'),
- e
- );
- });
+ });
}
},
};
@@ -378,7 +378,7 @@ define('pgadmin.datagrid', [
$.get(url_for('datagrid.filter'),
function(data) {
alertify.filterDialog('Data Filter', data, baseUrl, validateUrl)
- .resizeTo(pgBrowser.stdW.sm,pgBrowser.stdH.sm);
+ .resizeTo(pgBrowser.stdW.sm,pgBrowser.stdH.sm);
}
);
},
@@ -413,35 +413,35 @@ define('pgadmin.datagrid', [
data: reqData,
contentType: 'application/json',
})
- .done(function(res) {
- res.data.is_query_tool = is_query_tool;
- res.data.server_type = server_type;
- res.data.sURL = sURL;
- res.data.panel_title = panel_title;
- target.trigger('pgadmin-datagrid:transaction:created', res.data);
- })
- .fail(function(xhr) {
- if (target !== self) {
- if(xhr.status == 503 && xhr.responseJSON.info != undefined &&
+ .done(function(res) {
+ res.data.is_query_tool = is_query_tool;
+ res.data.server_type = server_type;
+ res.data.sURL = sURL;
+ res.data.panel_title = panel_title;
+ target.trigger('pgadmin-datagrid:transaction:created', res.data);
+ })
+ .fail(function(xhr) {
+ if (target !== self) {
+ if(xhr.status == 503 && xhr.responseJSON.info != undefined &&
xhr.responseJSON.info == 'CONNECTION_LOST') {
- setTimeout(function() {
- target.handle_connection_lost(true, xhr);
- });
- return;
+ setTimeout(function() {
+ target.handle_connection_lost(true, xhr);
+ });
+ return;
+ }
}
- }
- try {
- var err = JSON.parse(xhr.responseText);
- alertify.alert(gettext('Query Tool initialization error'),
- err.errormsg
- );
- } catch (e) {
- alertify.alert(gettext('Query Tool initialization error'),
- e.statusText
- );
- }
- });
+ try {
+ var err = JSON.parse(xhr.responseText);
+ alertify.alert(gettext('Query Tool initialization error'),
+ err.errormsg
+ );
+ } catch (e) {
+ alertify.alert(gettext('Query Tool initialization error'),
+ e.statusText
+ );
+ }
+ });
},
launch_grid: function(trans_obj) {
var self = this,
@@ -470,7 +470,7 @@ define('pgadmin.datagrid', [
}
}
- // Open the panel if frame is initialized
+ // Open the panel if frame is initialized
let titileForURLObj = sqlEditorUtils.removeSlashInTheString(grid_title);
var url_params = {
'trans_id': trans_obj.gridTransId,
diff --git a/web/pgadmin/tools/datagrid/static/js/show_query_tool.js b/web/pgadmin/tools/datagrid/static/js/show_query_tool.js
index ba3df406..b6ccd5c8 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_query_tool.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_query_tool.js
@@ -35,7 +35,7 @@ function hasServerInformations(parentData) {
}
export function showQueryTool(datagrid, pgBrowser, alertify, url,
- aciTreeIdentifier, panelTitle) {
+ aciTreeIdentifier, panelTitle) {
const sURL = url || '';
const queryToolTitle = panelTitle || '';
diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js
index d40cb6c7..ed0f6b79 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger.js
@@ -313,19 +313,19 @@ define([
url: _url,
cache: false,
})
- .done(function() {
- self.start_global_debugger();
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ .done(function() {
+ self.start_global_debugger();
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ }
+ } catch (e) {
+ console.warn(e.stack || e);
}
- } catch (e) {
- console.warn(e.stack || e);
- }
- });
+ });
},
//Callback function when user start the indirect debugging ( Listen to another session to invoke the target )
@@ -419,52 +419,52 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- var url = url_for('debugger.direct', {
- 'trans_id': res.data.debuggerTransId,
- });
+ .done(function(res) {
+ var url = url_for('debugger.direct', {
+ 'trans_id': res.data.debuggerTransId,
+ });
- if (self.preferences.debugger_new_browser_tab) {
- window.open(url, '_blank');
- } else {
- pgBrowser.Events.once(
- 'pgadmin-browser:frame:urlloaded:frm_debugger',
- function(frame) {
- frame.openURL(url);
- });
+ if (self.preferences.debugger_new_browser_tab) {
+ window.open(url, '_blank');
+ } else {
+ pgBrowser.Events.once(
+ 'pgadmin-browser:frame:urlloaded:frm_debugger',
+ function(frame) {
+ frame.openURL(url);
+ });
- // Create the debugger panel as per the data received from user input dialog.
- var dashboardPanel = pgBrowser.docker.findPanels(
- 'properties'
- ),
- panel = pgBrowser.docker.addPanel(
- 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
- );
+ // Create the debugger panel as per the data received from user input dialog.
+ var dashboardPanel = pgBrowser.docker.findPanels(
+ 'properties'
+ ),
+ panel = pgBrowser.docker.addPanel(
+ 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
+ );
- panel.focus();
+ panel.focus();
- // Panel Closed event
- panel.on(wcDocker.EVENT.CLOSED, function() {
- var closeUrl = url_for('debugger.close', {
- 'trans_id': res.data.debuggerTransId,
- });
- $.ajax({
- url: closeUrl,
- method: 'DELETE',
+ // Panel Closed event
+ panel.on(wcDocker.EVENT.CLOSED, function() {
+ var closeUrl = url_for('debugger.close', {
+ 'trans_id': res.data.debuggerTransId,
+ });
+ $.ajax({
+ url: closeUrl,
+ method: 'DELETE',
+ });
});
- });
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
- } catch (e) {
- console.warn(e.stack || e);
- }
- });
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ }
+ } catch (e) {
+ console.warn(e.stack || e);
+ }
+ });
},
/*
@@ -489,107 +489,107 @@ define([
url: _url,
cache: false,
})
- .done(function(res) {
+ .done(function(res) {
- // Open Alertify the dialog to take the input arguments from user if function having input arguments
- if (res.data[0]['require_input']) {
- get_function_arguments(res.data[0], 0, is_edb_proc);
- } else {
+ // Open Alertify the dialog to take the input arguments from user if function having input arguments
+ if (res.data[0]['require_input']) {
+ get_function_arguments(res.data[0], 0, is_edb_proc);
+ } else {
// 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];
-
- if (!d)
- return;
-
- var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]),
- baseUrl;
-
- if (d._type == 'function') {
- baseUrl = url_for(
- 'debugger.initialize_target_for_function', {
- 'debug_type': 'direct',
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': treeInfo.function._id,
- }
- );
- } else {
- baseUrl = url_for(
- 'debugger.initialize_target_for_function', {
- 'debug_type': 'direct',
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': debuggerUtils.getProcedureId(treeInfo),
- }
- );
- }
-
- $.ajax({
- url: baseUrl,
- method: 'GET',
- })
- .done(function(res) {
-
- var url = url_for('debugger.direct', {
- 'trans_id': res.data.debuggerTransId,
- });
-
- if (self.preferences.debugger_new_browser_tab) {
- window.open(url, '_blank');
+ var t = pgBrowser.tree,
+ i = t.selected(),
+ d = i && i.length == 1 ? t.itemData(i) : undefined,
+ node = d && pgBrowser.Nodes[d._type];
+
+ if (!d)
+ return;
+
+ var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]),
+ baseUrl;
+
+ if (d._type == 'function') {
+ baseUrl = url_for(
+ 'debugger.initialize_target_for_function', {
+ 'debug_type': 'direct',
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': treeInfo.function._id,
+ }
+ );
} else {
- pgBrowser.Events.once(
- 'pgadmin-browser:frame:urlloaded:frm_debugger',
- function(frame) {
- frame.openURL(url);
- });
-
- // Create the debugger panel as per the data received from user input dialog.
- var dashboardPanel = pgBrowser.docker.findPanels(
- 'properties'
- ),
- panel = pgBrowser.docker.addPanel(
- 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
- );
+ baseUrl = url_for(
+ 'debugger.initialize_target_for_function', {
+ 'debug_type': 'direct',
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': debuggerUtils.getProcedureId(treeInfo),
+ }
+ );
+ }
- panel.focus();
+ $.ajax({
+ url: baseUrl,
+ method: 'GET',
+ })
+ .done(function(res) {
- // Register Panel Closed event
- panel.on(wcDocker.EVENT.CLOSED, function() {
- var closeUrl = url_for('debugger.close', {
+ var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
});
- $.ajax({
- url: closeUrl,
- method: 'DELETE',
- });
+
+ if (self.preferences.debugger_new_browser_tab) {
+ window.open(url, '_blank');
+ } else {
+ pgBrowser.Events.once(
+ 'pgadmin-browser:frame:urlloaded:frm_debugger',
+ function(frame) {
+ frame.openURL(url);
+ });
+
+ // Create the debugger panel as per the data received from user input dialog.
+ var dashboardPanel = pgBrowser.docker.findPanels(
+ 'properties'
+ ),
+ panel = pgBrowser.docker.addPanel(
+ 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
+ );
+
+ panel.focus();
+
+ // Register Panel Closed event
+ panel.on(wcDocker.EVENT.CLOSED, function() {
+ var closeUrl = url_for('debugger.close', {
+ 'trans_id': res.data.debuggerTransId,
+ });
+ $.ajax({
+ url: closeUrl,
+ method: 'DELETE',
+ });
+ });
+ }
+ })
+ .fail(function(e) {
+ Alertify.alert(
+ gettext('Debugger Target Initialization Error'),
+ e.responseJSON.errormsg
+ );
});
+ }
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
- })
- .fail(function(e) {
- Alertify.alert(
- gettext('Debugger Target Initialization Error'),
- e.responseJSON.errormsg
- );
- });
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ } catch (e) {
+ console.warn(e.stack || e);
}
- } catch (e) {
- console.warn(e.stack || e);
- }
- });
+ });
},
};
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
index 8af2274c..46d34eed 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
@@ -66,7 +66,7 @@ define([
case 'cid':
case 'xid':
case 'tid':
- // As we are getting this value as text from sqlite database so we need to type cast it.
+ // As we are getting this value as text from sqlite database so we need to type cast it.
if (model.get('value') != undefined) {
model.set({
'value': parseInt(model.get('value')),
@@ -80,7 +80,7 @@ define([
case 'numeric':
case 'double precision':
case 'decimal':
- // As we are getting this value as text from sqlite database so we need to type cast it.
+ // As we are getting this value as text from sqlite database so we need to type cast it.
if (model.get('value') != undefined) {
model.set({
'value': parseFloat(model.get('value')),
@@ -240,26 +240,26 @@ define([
method: 'GET',
async: false,
})
- .done(function(res) {
- if (res.data.args_count != 0) {
- for (i = 0; i < res.data.result.length; i++) {
+ .done(function(res) {
+ if (res.data.args_count != 0) {
+ for (i = 0; i < res.data.result.length; i++) {
// Below will format the data to be stored in sqlite database
- func_args_data.push({
- 'arg_id': res.data.result[i]['arg_id'],
- 'is_null': res.data.result[i]['is_null'],
- 'is_expression': res.data.result[i]['is_expression'],
- 'use_default': res.data.result[i]['use_default'],
- 'value': res.data.result[i]['value'],
- });
+ func_args_data.push({
+ 'arg_id': res.data.result[i]['arg_id'],
+ 'is_null': res.data.result[i]['is_null'],
+ 'is_expression': res.data.result[i]['is_expression'],
+ 'use_default': res.data.result[i]['use_default'],
+ 'value': res.data.result[i]['value'],
+ });
+ }
}
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Unable to fetch the arguments from server')
- );
- });
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Unable to fetch the arguments from server')
+ );
+ });
var argname, argtype, argmode, default_args_count, default_args, arg_cnt;
@@ -744,97 +744,97 @@ define([
'data': JSON.stringify(args_value_list),
},
})
- .done(function(res) {
+ .done(function(res) {
- var url = url_for(
- 'debugger.direct', {
- 'trans_id': res.data.debuggerTransId,
- }
- );
+ var url = url_for(
+ 'debugger.direct', {
+ 'trans_id': res.data.debuggerTransId,
+ }
+ );
- if (self.preferences.debugger_new_browser_tab) {
- window.open(url, '_blank');
- } else {
- pgBrowser.Events.once(
- 'pgadmin-browser:frame:urlloaded:frm_debugger',
- function(frame) {
- frame.openURL(url);
+ if (self.preferences.debugger_new_browser_tab) {
+ window.open(url, '_blank');
+ } else {
+ pgBrowser.Events.once(
+ 'pgadmin-browser:frame:urlloaded:frm_debugger',
+ function(frame) {
+ frame.openURL(url);
+ });
+
+ // Create the debugger panel as per the data received from user input dialog.
+ var dashboardPanel = pgBrowser.docker.findPanels('properties'),
+ panel = pgBrowser.docker.addPanel(
+ 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
+ );
+
+ panel.focus();
+
+ // Panel Closed event
+ panel.on(wcDocker.EVENT.CLOSED, function() {
+ var closeUrl = url_for('debugger.close', {
+ 'trans_id': res.data.debuggerTransId,
+ });
+ $.ajax({
+ url: closeUrl,
+ method: 'DELETE',
+ });
});
-
- // Create the debugger panel as per the data received from user input dialog.
- var dashboardPanel = pgBrowser.docker.findPanels('properties'),
- panel = pgBrowser.docker.addPanel(
- 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
- );
-
- panel.focus();
-
- // Panel Closed event
- panel.on(wcDocker.EVENT.CLOSED, function() {
- var closeUrl = url_for('debugger.close', {
- 'trans_id': res.data.debuggerTransId,
+ }
+ var _Url;
+
+ if (d._type == 'function') {
+ _Url = url_for('debugger.set_arguments', {
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': treeInfo.function._id,
});
- $.ajax({
- url: closeUrl,
- method: 'DELETE',
+ } else if (d._type == 'procedure') {
+ _Url = url_for('debugger.set_arguments', {
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': treeInfo.procedure._id,
});
- });
- }
- var _Url;
-
- if (d._type == 'function') {
- _Url = url_for('debugger.set_arguments', {
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': treeInfo.function._id,
- });
- } else if (d._type == 'procedure') {
- _Url = url_for('debugger.set_arguments', {
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': treeInfo.procedure._id,
- });
- } else if (d._type == 'edbfunc') {
+ } else if (d._type == 'edbfunc') {
// Get the existing function parameters available from sqlite database
- _Url = url_for('debugger.set_arguments', {
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': treeInfo.edbfunc._id,
- });
- } else if (d._type == 'edbproc') {
+ _Url = url_for('debugger.set_arguments', {
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': treeInfo.edbfunc._id,
+ });
+ } else if (d._type == 'edbproc') {
// Get the existing function parameters available from sqlite database
- _Url = url_for('debugger.set_arguments', {
- 'sid': treeInfo.server._id,
- 'did': treeInfo.database._id,
- 'scid': treeInfo.schema._id,
- 'func_id': treeInfo.edbproc._id,
- });
- }
+ _Url = url_for('debugger.set_arguments', {
+ 'sid': treeInfo.server._id,
+ 'did': treeInfo.database._id,
+ 'scid': treeInfo.schema._id,
+ 'func_id': treeInfo.edbproc._id,
+ });
+ }
- $.ajax({
- url: _Url,
- method: 'POST',
- data: {
- 'data': JSON.stringify(sqlite_func_args_list),
- },
+ $.ajax({
+ url: _Url,
+ method: 'POST',
+ data: {
+ 'data': JSON.stringify(sqlite_func_args_list),
+ },
+ })
+ .done(function() {})
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Unable to set the arguments on the server')
+ );
+ });
})
- .done(function() {})
- .fail(function() {
+ .fail(function(e) {
Alertify.alert(
- gettext('Debugger Error'),
- gettext('Unable to set the arguments on the server')
+ gettext('Debugger Target Initialization Error'),
+ e.responseJSON.errormsg
);
});
- })
- .fail(function(e) {
- Alertify.alert(
- gettext('Debugger Target Initialization Error'),
- e.responseJSON.errormsg
- );
- });
} else {
// If the debugging is started again then we should only set the
// arguments and start the listener again
@@ -849,13 +849,13 @@ define([
'data': JSON.stringify(args_value_list),
},
})
- .done(function() {})
- .fail(function(e) {
- Alertify.alert(
- gettext('Debugger Listener Startup Error'),
- e.responseJSON.errormsg
- );
- });
+ .done(function() {})
+ .fail(function(e) {
+ Alertify.alert(
+ gettext('Debugger Listener Startup Error'),
+ e.responseJSON.errormsg
+ );
+ });
// Set the new input arguments given by the user during debugging
var _Url = url_for('debugger.set_arguments', {
@@ -871,13 +871,13 @@ define([
'data': JSON.stringify(sqlite_func_args_list),
},
})
- .done(function() {})
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Unable to set the arguments on the server')
- );
- });
+ .done(function() {})
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Unable to set the arguments on the server')
+ );
+ });
}
@@ -913,37 +913,37 @@ define([
debug button.
*/
this.grid.listenTo(this.debuggerInputArgsColl, 'backgrid:edited',
- (function(obj) {
+ (function(obj) {
- return function() {
+ return function() {
- var enable_btn = false;
+ var enable_btn = false;
- for (var i = 0; i < this.collection.length; i++) {
+ for (var i = 0; i < this.collection.length; i++) {
- if (this.collection.models[i].get('is_null')) {
- obj.__internal.buttons[1].element.disabled = false;
- enable_btn = true;
- continue;
- }
- // TODO: Need to check the "Expression" column value to
- // enable/disable the "Debug" button
- if (this.collection.models[i].get('value') == null ||
+ if (this.collection.models[i].get('is_null')) {
+ obj.__internal.buttons[1].element.disabled = false;
+ enable_btn = true;
+ continue;
+ }
+ // TODO: Need to check the "Expression" column value to
+ // enable/disable the "Debug" button
+ if (this.collection.models[i].get('value') == null ||
this.collection.models[i].get('value') == undefined) {
- enable_btn = true;
-
- if (this.collection.models[i].get('use_default')) {
- obj.__internal.buttons[1].element.disabled = false;
- } else {
- obj.__internal.buttons[1].element.disabled = true;
- break;
- }
+ enable_btn = true;
+
+ if (this.collection.models[i].get('use_default')) {
+ obj.__internal.buttons[1].element.disabled = false;
+ } else {
+ obj.__internal.buttons[1].element.disabled = true;
+ break;
}
}
- if (!enable_btn)
- obj.__internal.buttons[1].element.disabled = false;
- };
- })(this)
+ }
+ if (!enable_btn)
+ obj.__internal.buttons[1].element.disabled = false;
+ };
+ })(this)
);
this.grid.listenTo(this.debuggerInputArgsColl, 'backgrid:error',
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index a0146528..494291f4 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -55,17 +55,17 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
+ .done(function(res) {
+ if (res.data.status) {
// Breakpoint has been set by the user
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while setting debugging breakpoint.')
- );
- });
+ }
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while setting debugging breakpoint.')
+ );
+ });
},
// Function to get the latest breakpoint information and update the
@@ -117,22 +117,22 @@ define([
method: 'GET',
async: false,
})
- .done(function(res) {
- if (res.data.status === 'Success') {
- result = res.data.result;
- } else if (res.data.status === 'NotConnected') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
+ result = res.data.result;
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while fetching breakpoint information.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching breakpoint information.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while fetching breakpoint information.')
- );
- });
+ });
return result;
},
@@ -178,23 +178,23 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
// If status is Success then find the port number to attach the executer.
- self.execute_query(trans_id);
- } else if (res.data.status === 'NotConnected') {
+ self.execute_query(trans_id);
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while starting debugging session.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while starting debugging session.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while starting debugging session.')
- );
- });
+ });
},
// Execute the query and get the first functions debug information from the server
@@ -210,35 +210,35 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
// set the return code to the code editor text area
- if (
- res.data.result[0].src != null &&
+ if (
+ res.data.result[0].src != null &&
res.data.result[0].linenumber != null
- ) {
- pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
+ ) {
+ pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
- self.setActiveLine(res.data.result[0].linenumber - 2);
- }
- // Call function to create and update local variables ....
- self.GetStackInformation(trans_id);
- if (pgTools.DirectDebug.debug_type) {
- self.poll_end_execution_result(trans_id);
+ self.setActiveLine(res.data.result[0].linenumber - 2);
+ }
+ // Call function to create and update local variables ....
+ self.GetStackInformation(trans_id);
+ if (pgTools.DirectDebug.debug_type) {
+ self.poll_end_execution_result(trans_id);
+ }
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while executing requested debugging information.')
+ );
}
- } else if (res.data.status === 'NotConnected') {
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing requested debugging information.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while executing requested debugging information.')
- );
- });
+ });
},
// Get the local variable information of the functions and update the grid
@@ -255,32 +255,32 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
// Call function to create and update local variables
- self.AddLocalVariables(res.data.result);
- self.AddParameters(res.data.result);
- // If debug function is restarted then again start listener to
- // read the updated messages.
- if (pgTools.DirectDebug.debug_restarted) {
- if (pgTools.DirectDebug.debug_type) {
- self.poll_end_execution_result(trans_id);
+ self.AddLocalVariables(res.data.result);
+ self.AddParameters(res.data.result);
+ // If debug function is restarted then again start listener to
+ // read the updated messages.
+ if (pgTools.DirectDebug.debug_restarted) {
+ if (pgTools.DirectDebug.debug_type) {
+ self.poll_end_execution_result(trans_id);
+ }
+ pgTools.DirectDebug.debug_restarted = false;
}
- pgTools.DirectDebug.debug_restarted = false;
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while fetching variable information.')
+ );
}
- } else if (res.data.status === 'NotConnected') {
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching variable information.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while fetching variable information.')
- );
- });
+ });
},
// Get the stack information of the functions and update the grid
@@ -297,24 +297,24 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
// Call function to create and update stack information
- self.AddStackInformation(res.data.result);
- self.GetLocalVariables(pgTools.DirectDebug.trans_id);
- } else if (res.data.status === 'NotConnected') {
+ self.AddStackInformation(res.data.result);
+ self.GetLocalVariables(pgTools.DirectDebug.trans_id);
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while fetching stack information.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching stack information.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while fetching stack information.')
- );
- });
+ });
},
/*
@@ -358,91 +358,91 @@ define([
$('.debugger-container').addClass('show_progress');
},
})
- .done(function(res) {
+ .done(function(res) {
// remove progress cursor
- $('.debugger-container').removeClass('show_progress');
+ $('.debugger-container').removeClass('show_progress');
- if (res.data.status === 'Success') {
+ if (res.data.status === 'Success') {
// If no result then poll again to wait for results.
- if (res.data.result == null || res.data.result.length == 0) {
- self.poll_result(trans_id);
- } else {
- if (res.data.result[0].src != undefined || res.data.result[0].src != null) {
- pgTools.DirectDebug.polling_timeout_idle = false;
- pgTools.DirectDebug.docker.finishLoading(50);
- if (res.data.result[0].src != pgTools.DirectDebug.editor.getValue()) {
- pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
- self.UpdateBreakpoint(trans_id);
- }
- self.setActiveLine(res.data.result[0].linenumber - 2);
- // Update the stack, local variables and parameters information
- self.GetStackInformation(trans_id);
-
- } else if (!pgTools.DirectDebug.debug_type && !pgTools.DirectDebug.first_time_indirect_debug) {
- pgTools.DirectDebug.docker.finishLoading(50);
- self.setActiveLine(-1);
- self.clear_all_breakpoint(trans_id);
- self.execute_query(trans_id);
- pgTools.DirectDebug.first_time_indirect_debug = true;
- pgTools.DirectDebug.polling_timeout_idle = false;
+ if (res.data.result == null || res.data.result.length == 0) {
+ self.poll_result(trans_id);
} else {
- pgTools.DirectDebug.polling_timeout_idle = false;
- pgTools.DirectDebug.docker.finishLoading(50);
- // If the source is really changed then only update the breakpoint information
- if (res.data.result[0].src != pgTools.DirectDebug.editor.getValue()) {
- pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
- self.UpdateBreakpoint(trans_id);
+ if (res.data.result[0].src != undefined || res.data.result[0].src != null) {
+ pgTools.DirectDebug.polling_timeout_idle = false;
+ pgTools.DirectDebug.docker.finishLoading(50);
+ if (res.data.result[0].src != pgTools.DirectDebug.editor.getValue()) {
+ pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
+ self.UpdateBreakpoint(trans_id);
+ }
+ self.setActiveLine(res.data.result[0].linenumber - 2);
+ // Update the stack, local variables and parameters information
+ self.GetStackInformation(trans_id);
+
+ } else if (!pgTools.DirectDebug.debug_type && !pgTools.DirectDebug.first_time_indirect_debug) {
+ pgTools.DirectDebug.docker.finishLoading(50);
+ self.setActiveLine(-1);
+ self.clear_all_breakpoint(trans_id);
+ self.execute_query(trans_id);
+ pgTools.DirectDebug.first_time_indirect_debug = true;
+ pgTools.DirectDebug.polling_timeout_idle = false;
+ } else {
+ pgTools.DirectDebug.polling_timeout_idle = false;
+ pgTools.DirectDebug.docker.finishLoading(50);
+ // If the source is really changed then only update the breakpoint information
+ if (res.data.result[0].src != pgTools.DirectDebug.editor.getValue()) {
+ pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
+ self.UpdateBreakpoint(trans_id);
+ }
+
+ self.setActiveLine(res.data.result[0].linenumber - 2);
+ // Update the stack, local variables and parameters information
+ self.GetStackInformation(trans_id);
}
- self.setActiveLine(res.data.result[0].linenumber - 2);
- // Update the stack, local variables and parameters information
- self.GetStackInformation(trans_id);
+ // Enable all the buttons as we got the results
+ // TODO: Fix this properly so a timeout isn't required.
+ setTimeout(function() {
+ self.enable('stop', true);
+ self.enable('step_over', true);
+ self.enable('step_into', true);
+ self.enable('continue', true);
+ self.enable('toggle_breakpoint', true);
+ self.enable('clear_all_breakpoints', true);
+ }, 500);
}
+ } else if (res.data.status === 'Busy') {
+ pgTools.DirectDebug.polling_timeout_idle = true;
+ // If status is Busy then poll the result by recursive call to the poll function
+ if (!pgTools.DirectDebug.debug_type) {
+ pgTools.DirectDebug.docker.startLoading(
+ gettext('Waiting for another session to invoke the target...')
+ );
- // Enable all the buttons as we got the results
- // TODO: Fix this properly so a timeout isn't required.
- setTimeout(function() {
- self.enable('stop', true);
- self.enable('step_over', true);
- self.enable('step_into', true);
- self.enable('continue', true);
- self.enable('toggle_breakpoint', true);
- self.enable('clear_all_breakpoints', true);
- }, 500);
- }
- } else if (res.data.status === 'Busy') {
- pgTools.DirectDebug.polling_timeout_idle = true;
- // If status is Busy then poll the result by recursive call to the poll function
- if (!pgTools.DirectDebug.debug_type) {
- pgTools.DirectDebug.docker.startLoading(
- gettext('Waiting for another session to invoke the target...')
+ // As we are waiting for another session to invoke the target,disable all the buttons
+ self.enable('stop', false);
+ self.enable('step_over', false);
+ self.enable('step_into', false);
+ self.enable('continue', false);
+ self.enable('toggle_breakpoint', false);
+ self.enable('clear_all_breakpoints', false);
+ pgTools.DirectDebug.first_time_indirect_debug = false;
+ self.poll_result(trans_id);
+ } else {
+ self.poll_result(trans_id);
+ }
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while polling result.')
);
-
- // As we are waiting for another session to invoke the target,disable all the buttons
- self.enable('stop', false);
- self.enable('step_over', false);
- self.enable('step_into', false);
- self.enable('continue', false);
- self.enable('toggle_breakpoint', false);
- self.enable('clear_all_breakpoints', false);
- pgTools.DirectDebug.first_time_indirect_debug = false;
- self.poll_result(trans_id);
- } else {
- self.poll_result(trans_id);
}
- } else if (res.data.status === 'NotConnected') {
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while polling result.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while polling result.')
- );
- });
+ });
}, poll_timeout);
},
@@ -505,49 +505,15 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
- if (res.data.result == undefined) {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
+ if (res.data.result == undefined) {
/*
"result" is undefined only in case of EDB procedure.
As Once the EDB procedure execution is completed then we are
not getting any result so we need ignore the result.
*/
- self.setActiveLine(-1);
- pgTools.DirectDebug.direct_execution_completed = true;
- pgTools.DirectDebug.polling_timeout_idle = true;
-
- //Set the alertify message to inform the user that execution is completed.
- Alertify.success(res.info, 3);
-
- // Update the message tab of the debugger
- if (res.data.status_message) {
- self.update_messages(res.data.status_message);
- }
-
- // remove progress cursor
- $('.debugger-container').removeClass('show_progress');
-
- // Execution completed so disable the buttons other than
- // "Continue/Start" button because user can still
- // start the same execution again.
- setTimeout(function() {
- self.enable('stop', false);
- self.enable('step_over', false);
- self.enable('step_into', false);
- self.enable('toggle_breakpoint', false);
- self.enable('clear_all_breakpoints', false);
- self.enable('continue', true);
- }, 500);
-
- // Stop further polling
- pgTools.DirectDebug.is_polling_required = false;
- } else {
- // Call function to create and update local variables ....
- if (res.data.result != null) {
self.setActiveLine(-1);
- self.AddResults(res.data.col_info, res.data.result);
- pgTools.DirectDebug.results_panel.focus();
pgTools.DirectDebug.direct_execution_completed = true;
pgTools.DirectDebug.polling_timeout_idle = true;
@@ -574,68 +540,102 @@ define([
self.enable('continue', true);
}, 500);
- // Stop further pooling
+ // Stop further polling
pgTools.DirectDebug.is_polling_required = false;
+ } else {
+ // Call function to create and update local variables ....
+ if (res.data.result != null) {
+ self.setActiveLine(-1);
+ self.AddResults(res.data.col_info, res.data.result);
+ pgTools.DirectDebug.results_panel.focus();
+ pgTools.DirectDebug.direct_execution_completed = true;
+ pgTools.DirectDebug.polling_timeout_idle = true;
+
+ //Set the alertify message to inform the user that execution is completed.
+ Alertify.success(res.info, 3);
+
+ // Update the message tab of the debugger
+ if (res.data.status_message) {
+ self.update_messages(res.data.status_message);
+ }
+
+ // remove progress cursor
+ $('.debugger-container').removeClass('show_progress');
+
+ // Execution completed so disable the buttons other than
+ // "Continue/Start" button because user can still
+ // start the same execution again.
+ setTimeout(function() {
+ self.enable('stop', false);
+ self.enable('step_over', false);
+ self.enable('step_into', false);
+ self.enable('toggle_breakpoint', false);
+ self.enable('clear_all_breakpoints', false);
+ self.enable('continue', true);
+ }, 500);
+
+ // Stop further pooling
+ pgTools.DirectDebug.is_polling_required = false;
+ }
}
- }
- } else if (res.data.status === 'Busy') {
+ } else if (res.data.status === 'Busy') {
// If status is Busy then poll the result by recursive call to
// the poll function
- self.poll_end_execution_result(trans_id);
- // Update the message tab of the debugger
- if (res.data.status_message) {
- self.update_messages(res.data.status_message);
- }
- } else if (res.data.status === 'NotConnected') {
- Alertify.alert(
- gettext('Debugger poll end execution error'),
- res.data.result
- );
- } else if (res.data.status === 'ERROR') {
- pgTools.DirectDebug.direct_execution_completed = true;
- self.setActiveLine(-1);
-
- //Set the Alertify message to inform the user that execution is
- // completed with error.
- if (!pgTools.DirectDebug.is_user_aborted_debugging) {
- Alertify.error(res.info, 3);
- }
+ self.poll_end_execution_result(trans_id);
+ // Update the message tab of the debugger
+ if (res.data.status_message) {
+ self.update_messages(res.data.status_message);
+ }
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger poll end execution error'),
+ res.data.result
+ );
+ } else if (res.data.status === 'ERROR') {
+ pgTools.DirectDebug.direct_execution_completed = true;
+ self.setActiveLine(-1);
- // Update the message tab of the debugger
- if (res.data.status_message) {
- self.update_messages(res.data.status_message);
- }
+ //Set the Alertify message to inform the user that execution is
+ // completed with error.
+ if (!pgTools.DirectDebug.is_user_aborted_debugging) {
+ Alertify.error(res.info, 3);
+ }
- pgTools.DirectDebug.messages_panel.focus();
+ // Update the message tab of the debugger
+ if (res.data.status_message) {
+ self.update_messages(res.data.status_message);
+ }
- // remove progress cursor
- $('.debugger-container').removeClass('show_progress');
+ pgTools.DirectDebug.messages_panel.focus();
- // Execution completed so disable the buttons other than
- // "Continue/Start" button because user can still start the
- // same execution again.
- self.enable('stop', false);
- self.enable('step_over', false);
- self.enable('step_into', false);
- self.enable('toggle_breakpoint', false);
- self.enable('clear_all_breakpoints', false);
- // If debugging is stopped by user then do not enable
- // continue/restart button
- if (!pgTools.DirectDebug.is_user_aborted_debugging) {
- self.enable('continue', true);
- pgTools.DirectDebug.is_user_aborted_debugging = false;
- }
+ // remove progress cursor
+ $('.debugger-container').removeClass('show_progress');
- // Stop further pooling
- pgTools.DirectDebug.is_polling_required = false;
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while polling result.')
- );
- });
+ // Execution completed so disable the buttons other than
+ // "Continue/Start" button because user can still start the
+ // same execution again.
+ self.enable('stop', false);
+ self.enable('step_over', false);
+ self.enable('step_into', false);
+ self.enable('toggle_breakpoint', false);
+ self.enable('clear_all_breakpoints', false);
+ // If debugging is stopped by user then do not enable
+ // continue/restart button
+ if (!pgTools.DirectDebug.is_user_aborted_debugging) {
+ self.enable('continue', true);
+ pgTools.DirectDebug.is_user_aborted_debugging = false;
+ }
+
+ // Stop further pooling
+ pgTools.DirectDebug.is_polling_required = false;
+ }
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while polling result.')
+ );
+ });
}, poll_end_timeout);
},
@@ -654,69 +654,69 @@ define([
// Clear msg tab
pgTools.DirectDebug
- .messages_panel
- .$container
- .find('.messages')
- .html('');
+ .messages_panel
+ .$container
+ .find('.messages')
+ .html('');
$.ajax({
url: baseUrl,
})
- .done(function(res) {
+ .done(function(res) {
// Restart the same function debugging with previous arguments
- var restart_dbg = res.data.restart_debug ? 1 : 0;
+ var restart_dbg = res.data.restart_debug ? 1 : 0;
- // Start pooling again
- pgTools.DirectDebug.polling_timeout_idle = false;
- pgTools.DirectDebug.is_polling_required = true;
- self.poll_result(trans_id);
+ // Start pooling again
+ pgTools.DirectDebug.polling_timeout_idle = false;
+ pgTools.DirectDebug.is_polling_required = true;
+ self.poll_result(trans_id);
- if (restart_dbg) {
- pgTools.DirectDebug.debug_restarted = true;
- }
+ if (restart_dbg) {
+ pgTools.DirectDebug.debug_restarted = true;
+ }
- /*
+ /*
Need to check if restart debugging really require to open the input
dialog? If yes then we will get the previous arguments from database
and populate the input dialog, If no then we should directly start the
listener.
*/
- if (res.data.result.require_input) {
- debug_function_again(res.data.result, restart_dbg);
- } else {
+ if (res.data.result.require_input) {
+ debug_function_again(res.data.result, restart_dbg);
+ } else {
// Debugging of void function is started again so we need to start
// the listener again
- var baseUrl = url_for('debugger.start_listener', {
- 'trans_id': trans_id,
- });
+ var baseUrl = url_for('debugger.start_listener', {
+ 'trans_id': trans_id,
+ });
- $.ajax({
- url: baseUrl,
- method: 'GET',
- })
- .done(function() {
- if (pgTools.DirectDebug.debug_type) {
- self.poll_end_execution_result(trans_id);
+ $.ajax({
+ url: baseUrl,
+ method: 'GET',
+ })
+ .done(function() {
+ if (pgTools.DirectDebug.debug_type) {
+ self.poll_end_execution_result(trans_id);
+ }
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while polling result.')
+ );
+ });
+ }
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while polling result.')
- );
- });
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ } catch (e) {
+ console.warn(e.stack || e);
}
- } catch (e) {
- console.warn(e.stack || e);
- }
- });
+ });
},
// Continue the execution until the next breakpoint
@@ -743,22 +743,22 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.poll_result(trans_id);
- } else {
+ .done(function(res) {
+ if (res.data.status) {
+ self.poll_result(trans_id);
+ } else {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while executing continue in debugging session.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing continue in debugging session.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while executing continue in debugging session.')
- );
- });
+ });
}
},
@@ -780,22 +780,22 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.poll_result(trans_id);
- } else {
+ .done(function(res) {
+ if (res.data.status) {
+ self.poll_result(trans_id);
+ } else {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while executing step over in debugging session.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing step over in debugging session.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while executing step over in debugging session.')
- );
- });
+ });
},
Step_into: function(trans_id) {
@@ -816,22 +816,22 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.poll_result(trans_id);
- } else {
+ .done(function(res) {
+ if (res.data.status) {
+ self.poll_result(trans_id);
+ } else {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while executing step into in debugging session.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing step into in debugging session.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while executing step into in debugging session.')
- );
- });
+ });
},
Stop: function(trans_id) {
@@ -853,36 +853,36 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
+ .done(function(res) {
+ if (res.data.status) {
// Call function to create and update local variables ....
- self.setActiveLine(-1);
- pgTools.DirectDebug.direct_execution_completed = true;
- pgTools.DirectDebug.is_user_aborted_debugging = true;
+ self.setActiveLine(-1);
+ pgTools.DirectDebug.direct_execution_completed = true;
+ pgTools.DirectDebug.is_user_aborted_debugging = true;
- // Stop further pooling
- pgTools.DirectDebug.is_polling_required = false;
+ // Stop further pooling
+ pgTools.DirectDebug.is_polling_required = false;
- // Restarting debugging in the same transaction do not work
- // We will give same behaviour as pgAdmin3 and disable all buttons
- self.enable('continue', false);
+ // Restarting debugging in the same transaction do not work
+ // We will give same behaviour as pgAdmin3 and disable all buttons
+ self.enable('continue', false);
- // Set the Alertify message to inform the user that execution
- // is completed.
- Alertify.success(res.info, 3);
- } else if (res.data.status === 'NotConnected') {
+ // Set the Alertify message to inform the user that execution
+ // is completed.
+ Alertify.success(res.info, 3);
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while executing stop in debugging session.')
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing stop in debugging session.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while executing stop in debugging session.')
- );
- });
+ });
},
toggle_breakpoint: function(trans_id) {
@@ -918,40 +918,40 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
+ .done(function(res) {
+ if (res.data.status) {
// Call function to create and update local variables ....
- var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no);
-
- if (info.gutterMarkers != undefined) {
- pgTools.DirectDebug.editor.setGutterMarker(self.active_line_no, 'breakpoints', null);
- } else {
- pgTools.DirectDebug.editor.setGutterMarker(self.active_line_no, 'breakpoints', function() {
- var marker = document.createElement('div');
- marker.style.color = '#822';
- marker.innerHTML = '●';
- return marker;
- }());
+ var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no);
+
+ if (info.gutterMarkers != undefined) {
+ pgTools.DirectDebug.editor.setGutterMarker(self.active_line_no, 'breakpoints', null);
+ } else {
+ pgTools.DirectDebug.editor.setGutterMarker(self.active_line_no, 'breakpoints', function() {
+ var marker = document.createElement('div');
+ marker.style.color = '#822';
+ marker.innerHTML = '●';
+ return marker;
+ }());
+ }
+ self.enable('stop', true);
+ self.enable('step_over', true);
+ self.enable('step_into', true);
+ self.enable('toggle_breakpoint', true);
+ self.enable('clear_all_breakpoints', true);
+ self.enable('continue', true);
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while toggling breakpoint.')
+ );
}
- self.enable('stop', true);
- self.enable('step_over', true);
- self.enable('step_into', true);
- self.enable('toggle_breakpoint', true);
- self.enable('clear_all_breakpoints', true);
- self.enable('continue', true);
- } else if (res.data.status === 'NotConnected') {
+ })
+ .fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while toggling breakpoint.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while toggling breakpoint.')
- );
- });
+ });
},
clear_all_breakpoint: function(trans_id) {
@@ -989,31 +989,31 @@ define([
'breakpoint_list': breakpoint_list.join(),
},
})
- .done(function(res) {
- if (res.data.status) {
- for (var i = 0; i < breakpoint_list.length; i++) {
- var info = pgTools.DirectDebug.editor.lineInfo((breakpoint_list[i] - 1));
+ .done(function(res) {
+ if (res.data.status) {
+ for (var i = 0; i < breakpoint_list.length; i++) {
+ var info = pgTools.DirectDebug.editor.lineInfo((breakpoint_list[i] - 1));
- if (info) {
- if (info.gutterMarkers != undefined) {
- pgTools.DirectDebug.editor.setGutterMarker((breakpoint_list[i] - 1), 'breakpoints', null);
+ if (info) {
+ if (info.gutterMarkers != undefined) {
+ pgTools.DirectDebug.editor.setGutterMarker((breakpoint_list[i] - 1), 'breakpoints', null);
+ }
}
}
}
- }
- self.enable('stop', true);
- self.enable('step_over', true);
- self.enable('step_into', true);
- self.enable('toggle_breakpoint', true);
- self.enable('clear_all_breakpoints', true);
- self.enable('continue', true);
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while clearing all breakpoint.')
- );
- });
+ self.enable('stop', true);
+ self.enable('step_over', true);
+ self.enable('step_into', true);
+ self.enable('toggle_breakpoint', true);
+ self.enable('clear_all_breakpoints', true);
+ self.enable('continue', true);
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while clearing all breakpoint.')
+ );
+ });
},
AddStackInformation: function(result) {
@@ -1238,9 +1238,9 @@ define([
// Render the variables grid into local variables panel
pgTools.DirectDebug.local_variables_panel
- .$container
- .find('.local_variables')
- .append(variable_grid.el);
+ .$container
+ .find('.local_variables')
+ .append(variable_grid.el);
},
AddParameters: function(result) {
@@ -1324,9 +1324,9 @@ define([
// Render the parameters grid into parameter panel
pgTools.DirectDebug.parameters_panel
- .$container
- .find('.parameters')
- .append(param_grid.el);
+ .$container
+ .find('.parameters')
+ .append(param_grid.el);
},
deposit_parameter_value: function(model) {
var self = this;
@@ -1351,24 +1351,24 @@ define([
'data': JSON.stringify(name_value_list),
},
})
- .done(function(res) {
- if (res.data.status) {
+ .done(function(res) {
+ if (res.data.status) {
// Get the updated variables value
- self.GetLocalVariables(pgTools.DirectDebug.trans_id);
- // Show the message to the user that deposit value is success or failure
- if (res.data.result) {
- Alertify.success(res.data.info, 3);
- } else {
- Alertify.error(res.data.info, 3);
+ self.GetLocalVariables(pgTools.DirectDebug.trans_id);
+ // Show the message to the user that deposit value is success or failure
+ if (res.data.result) {
+ Alertify.success(res.data.info, 3);
+ } else {
+ Alertify.error(res.data.info, 3);
+ }
}
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while depositing variable value.')
- );
- });
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while depositing variable value.')
+ );
+ });
},
select_frame: function() {
@@ -1383,21 +1383,21 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
- self.UpdateBreakpoint(pgTools.DirectDebug.trans_id);
- self.setActiveLine(res.data.result[0].linenumber - 2);
- // Call function to create and update local variables ....
- self.GetLocalVariables(pgTools.DirectDebug.trans_id);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while selecting frame.')
- );
- });
+ .done(function(res) {
+ if (res.data.status) {
+ pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
+ self.UpdateBreakpoint(pgTools.DirectDebug.trans_id);
+ self.setActiveLine(res.data.result[0].linenumber - 2);
+ // Call function to create and update local variables ....
+ self.GetLocalVariables(pgTools.DirectDebug.trans_id);
+ }
+ })
+ .fail(function() {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while selecting frame.')
+ );
+ });
},
}
);
@@ -1556,7 +1556,7 @@ define([
this.function_name_with_arguments = function_name_with_arguments;
let browser = window.opener ?
- window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
+ window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
this.preferences = browser.get_preferences_for_module('sqleditor');
this.docker = new wcDocker(
@@ -1583,25 +1583,25 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.intializePanels();
- controller.poll_result(trans_id);
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ .done(function(res) {
+ if (res.data.status) {
+ self.intializePanels();
+ controller.poll_result(trans_id);
}
- } catch (e) {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while starting debugging listener.')
- );
- }
- });
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ }
+ } catch (e) {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while starting debugging listener.')
+ );
+ }
+ });
} else if (trans_id != undefined && debug_type) {
// Make ajax call to execute the and start the target for execution
baseUrl = url_for('debugger.start_listener', {
@@ -1612,24 +1612,24 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.messages(trans_id);
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- if (err.success == 0) {
- Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ .done(function(res) {
+ if (res.data.status) {
+ self.messages(trans_id);
}
- } catch (e) {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while starting debugging listener.')
- );
- }
- });
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ if (err.success == 0) {
+ Alertify.alert(gettext('Debugger Error'), err.errormsg);
+ }
+ } catch (e) {
+ Alertify.alert(
+ gettext('Debugger Error'),
+ gettext('Error while starting debugging listener.')
+ );
+ }
+ });
} else
this.intializePanels();
},
@@ -1647,27 +1647,27 @@ define([
url: baseUrl,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status === 'Success') {
- self.intializePanels();
- // If status is Success then find the port number to attach the executer.
- controller.start_execution(trans_id, res.data.result);
- } else if (res.data.status === 'Busy') {
+ .done(function(res) {
+ if (res.data.status === 'Success') {
+ self.intializePanels();
+ // If status is Success then find the port number to attach the executer.
+ controller.start_execution(trans_id, res.data.result);
+ } else if (res.data.status === 'Busy') {
// If status is Busy then poll the result by recursive call to the poll function
- self.messages(trans_id);
- } else if (res.data.status === 'NotConnected') {
+ self.messages(trans_id);
+ } else if (res.data.status === 'NotConnected') {
+ Alertify.alert(
+ gettext('Not connected to server or connection with the server has been closed.'),
+ res.data.result
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
- gettext('Not connected to server or connection with the server has been closed.'),
- res.data.result
+ gettext('Debugger Error'),
+ gettext('Error while fetching messages information.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Debugger Error'),
- gettext('Error while fetching messages information.')
- );
- });
+ });
},
@@ -1792,11 +1792,11 @@ define([
}
);
self.messages_panel = self.docker.addPanel(
- 'messages', wcDocker.DOCK.STACKED, self.parameters_panel);
+ 'messages', wcDocker.DOCK.STACKED, self.parameters_panel);
self.results_panel = self.docker.addPanel(
- 'results', wcDocker.DOCK.STACKED, self.parameters_panel);
+ 'results', wcDocker.DOCK.STACKED, self.parameters_panel);
self.stack_pane_panel = self.docker.addPanel(
- 'stack_pane', wcDocker.DOCK.STACKED, self.parameters_panel);
+ 'stack_pane', wcDocker.DOCK.STACKED, self.parameters_panel);
var editor_pane = $('
');
diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
index 4dd904b4..4528cebe 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
@@ -101,8 +101,8 @@ define([
cell: Backgrid.Extension.SelectRowCell.extend({
render: function() {
- // Do not use parent's render function. It set's tabindex to -1 on
- // checkboxes.
+ // Do not use parent's render function. It set's tabindex to -1 on
+ // checkboxes.
this.$el.empty().append('
');
this.delegateEvents();
diff --git a/web/pgadmin/tools/import_export/static/js/import_export.js b/web/pgadmin/tools/import_export/static/js/import_export.js
index 6de7254c..4fbdf882 100644
--- a/web/pgadmin/tools/import_export/static/js/import_export.js
+++ b/web/pgadmin/tools/import_export/static/js/import_export.js
@@ -15,7 +15,7 @@ define([
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui',
], function(
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
-Backform, commonUtils, supportedNodes
+ Backform, commonUtils, supportedNodes
) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -542,28 +542,28 @@ Backform, commonUtils, supportedNodes
'data': JSON.stringify(this.view.model.toJSON()),
},
})
- .done(function(res) {
- if (res.success) {
- Alertify.success(gettext('Import/export job created.'), 5);
- pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
- } else {
- Alertify.alert(
- gettext('Import/export job creation failed.'),
- res.errormsg
- );
- }
- })
- .fail(function(xhr) {
- try {
- var err = JSON.parse(xhr.responseText);
- Alertify.alert(
- gettext('Import/export job failed.'),
- err.errormsg
- );
- } catch (e) {
- console.warn(e.stack || e);
- }
- });
+ .done(function(res) {
+ if (res.success) {
+ Alertify.success(gettext('Import/export job created.'), 5);
+ pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
+ } else {
+ Alertify.alert(
+ gettext('Import/export job creation failed.'),
+ res.errormsg
+ );
+ }
+ })
+ .fail(function(xhr) {
+ try {
+ var err = JSON.parse(xhr.responseText);
+ Alertify.alert(
+ gettext('Import/export job failed.'),
+ err.errormsg
+ );
+ } catch (e) {
+ console.warn(e.stack || e);
+ }
+ });
}
},
@@ -675,29 +675,29 @@ Backform, commonUtils, supportedNodes
url: baseUrl,
type:'GET',
})
- .done(function(res) {
- if (!res.success) {
+ .done(function(res) {
+ if (!res.success) {
+ Alertify.alert(
+ gettext('Utility not found'),
+ res.errormsg
+ );
+ return;
+ }
+
+ // Open the Alertify dialog for the import/export module
+ Alertify.ImportDialog(
+ S(
+ gettext('Import/Export data - table \'%s\'')
+ ).sprintf(treeInfo.table.label).value(), node, i, d
+ ).set('resizable', true).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.lg);
+ })
+ .fail(function() {
Alertify.alert(
gettext('Utility not found'),
- res.errormsg
+ gettext('Failed to fetch Utility information')
);
return;
- }
-
- // Open the Alertify dialog for the import/export module
- Alertify.ImportDialog(
- S(
- gettext('Import/Export data - table \'%s\'')
- ).sprintf(treeInfo.table.label).value(), node, i, d
- ).set('resizable', true).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.lg);
- })
- .fail(function() {
- Alertify.alert(
- gettext('Utility not found'),
- gettext('Failed to fetch Utility information')
- );
- return;
- });
+ });
},
};
diff --git a/web/pgadmin/tools/maintenance/static/js/maintenance.js b/web/pgadmin/tools/maintenance/static/js/maintenance.js
index fe38d095..4d696c31 100644
--- a/web/pgadmin/tools/maintenance/static/js/maintenance.js
+++ b/web/pgadmin/tools/maintenance/static/js/maintenance.js
@@ -391,23 +391,23 @@ define([
'data': JSON.stringify(this.view.model.toJSON()),
},
})
- .done(function(res) {
- if (res.data && res.data.status) {
+ .done(function(res) {
+ if (res.data && res.data.status) {
//Do nothing as we are creating the job and exiting from the main dialog
- Alertify.success(res.data.info);
- pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
- } else {
+ Alertify.success(res.data.info);
+ pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
+ } else {
+ Alertify.alert(
+ gettext('Maintenance job creation failed.'),
+ res.errormsg
+ );
+ }
+ })
+ .fail(function() {
Alertify.alert(
- gettext('Maintenance job creation failed.'),
- res.errormsg
+ gettext('Maintenance job creation failed.')
);
- }
- })
- .fail(function() {
- Alertify.alert(
- gettext('Maintenance job creation failed.')
- );
- });
+ });
}
},
build: function() {
@@ -484,25 +484,25 @@ define([
url: baseUrl,
type:'GET',
})
- .done(function(res) {
- if (!res.success) {
+ .done(function(res) {
+ if (!res.success) {
+ Alertify.alert(
+ gettext('Utility not found'),
+ res.errormsg
+ );
+ return;
+ }
+ // Open the Alertify dialog
+ Alertify.MaintenanceDialog(gettext('Maintenance...')).set('resizable', true)
+ .resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
+ })
+ .fail(function() {
Alertify.alert(
gettext('Utility not found'),
- res.errormsg
+ gettext('Failed to fetch Utility information')
);
return;
- }
- // Open the Alertify dialog
- Alertify.MaintenanceDialog(gettext('Maintenance...')).set('resizable', true)
- .resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
- })
- .fail(function() {
- Alertify.alert(
- gettext('Utility not found'),
- gettext('Failed to fetch Utility information')
- );
- return;
- });
+ });
},
};
diff --git a/web/pgadmin/tools/restore/static/js/restore.js b/web/pgadmin/tools/restore/static/js/restore.js
index f7782ba1..73a32a82 100644
--- a/web/pgadmin/tools/restore/static/js/restore.js
+++ b/web/pgadmin/tools/restore/static/js/restore.js
@@ -16,7 +16,7 @@ define('tools.restore', [
'tools/restore/static/js/restore_dialog',
], function(
gettext, url_for, $, _, Backbone, S, alertify, pgBrowser, Backgrid, Backform,
-commonUtils, menuUtils, supportedNodes, restoreDialog
+ commonUtils, menuUtils, supportedNodes, restoreDialog
) {
// if module is already initialized, refer to that.
diff --git a/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js b/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js
index 88d5da32..24d3666c 100644
--- a/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js
+++ b/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js
@@ -16,7 +16,7 @@ import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
export class RestoreDialogWrapper extends DialogWrapper {
constructor(dialogContainerSelector, dialogTitle, typeOfDialog,
- jquery, pgBrowser, alertify, dialogModel, backform) {
+ jquery, pgBrowser, alertify, dialogModel, backform) {
super(dialogContainerSelector, dialogTitle, jquery,
pgBrowser, alertify, dialogModel, backform);
}
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index e7e953dd..7f89f3c1 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -72,7 +72,7 @@ define('tools.querytool', [
this.handler = opts.handler;
this.handler['col_size'] = {};
let browser = window.opener ?
- window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
+ window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
this.preferences = browser.get_preferences_for_module('sqleditor');
this.handler.preferences = this.preferences;
this.connIntervalId = null;
@@ -133,7 +133,7 @@ define('tools.querytool', [
reflectPreferences: function() {
let self = this,
browser = window.opener ?
- window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
+ window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
/* pgBrowser is different obj from window.top.pgAdmin.Browser
* Make sure to get only the latest update. Older versions will be discarded
@@ -465,78 +465,78 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(self.data),
})
- .done(function(res) {
- var result = [];
-
- _.each(res.data.result, function(obj, key) {
- result.push({
- text: key,
- type: obj.object_type,
- render: self.hint_render,
+ .done(function(res) {
+ var result = [];
+
+ _.each(res.data.result, function(obj, key) {
+ result.push({
+ text: key,
+ type: obj.object_type,
+ render: self.hint_render,
+ });
});
- });
- // Sort function to sort the suggestion's alphabetically.
- result.sort(function(a, b) {
- var textA = a.text.toLowerCase(),
- textB = b.text.toLowerCase();
- if (textA < textB) //sort string ascending
- return -1;
- if (textA > textB)
- return 1;
- return 0; //default return value (no sorting)
- });
+ // Sort function to sort the suggestion's alphabetically.
+ result.sort(function(a, b) {
+ var textA = a.text.toLowerCase(),
+ textB = b.text.toLowerCase();
+ if (textA < textB) //sort string ascending
+ return -1;
+ if (textA > textB)
+ return 1;
+ return 0; //default return value (no sorting)
+ });
- /*
+ /*
* Below logic find the start and end point
* to replace the selected auto complete suggestion.
*/
- var token = self.editor.getTokenAt(cur),
- start, end, search;
- if (token.end > cur.ch) {
- token.end = cur.ch;
- token.string = token.string.slice(0, cur.ch - token.start);
- }
+ var token = self.editor.getTokenAt(cur),
+ start, end, search;
+ if (token.end > cur.ch) {
+ token.end = cur.ch;
+ token.string = token.string.slice(0, cur.ch - token.start);
+ }
- if (token.string.match(/^[.`\w@]\w*$/)) {
- search = token.string;
- start = token.start;
- end = token.end;
- } else {
- start = end = cur.ch;
- search = '';
- }
+ if (token.string.match(/^[.`\w@]\w*$/)) {
+ search = token.string;
+ start = token.start;
+ end = token.end;
+ } else {
+ start = end = cur.ch;
+ search = '';
+ }
- /*
+ /*
* Added 1 in the start position if search string
* started with "." or "`" else auto complete of code mirror
* will remove the "." when user select any suggestion.
*/
- if (search.charAt(0) == '.' || search.charAt(0) == '``')
- start += 1;
-
- cb({
- list: result,
- from: {
- line: self.current_line,
- ch: start,
- },
- to: {
- line: self.current_line,
- ch: end,
- },
+ if (search.charAt(0) == '.' || search.charAt(0) == '``')
+ start += 1;
+
+ cb({
+ list: result,
+ from: {
+ line: self.current_line,
+ ch: start,
+ },
+ to: {
+ line: self.current_line,
+ ch: end,
+ },
+ });
+ })
+ .fail(function(e) {
+ return httpErrorHandler.handleLoginRequiredAndTransactionRequired(
+ pgAdmin, self, e, null, [], false
+ );
});
- })
- .fail(function(e) {
- return httpErrorHandler.handleLoginRequiredAndTransactionRequired(
- pgAdmin, self, e, null, [], false
- );
- });
}.bind(ctx),
};
});
- /* If the screen width is small and we hover over the Explain Options,
+ /* If the screen width is small and we hover over the Explain Options,
* the submenu goes behind the screen on the right side.
* Below logic will make it appear on the left.
*/
@@ -1215,32 +1215,32 @@ define('tools.querytool', [
url: url,
method: 'GET',
})
- .done(function(res) {
- self.handler.has_more_rows = res.data.has_more_rows;
- $('#btn-flash').prop('disabled', false);
- $('#btn-download').prop('disabled', false);
- self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.update_grid_data(res.data.result);
- self.handler.fetching_rows = false;
- if (typeof cb == 'function') {
- cb();
- }
- })
- .fail(function(e) {
- $('#btn-flash').prop('disabled', false);
- $('#btn-download').prop('disabled', false);
- self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.handler.has_more_rows = false;
- self.handler.fetching_rows = false;
- if (typeof cb == 'function') {
- cb();
- }
+ .done(function(res) {
+ self.handler.has_more_rows = res.data.has_more_rows;
+ $('#btn-flash').prop('disabled', false);
+ $('#btn-download').prop('disabled', false);
+ self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
+ self.update_grid_data(res.data.result);
+ self.handler.fetching_rows = false;
+ if (typeof cb == 'function') {
+ cb();
+ }
+ })
+ .fail(function(e) {
+ $('#btn-flash').prop('disabled', false);
+ $('#btn-download').prop('disabled', false);
+ self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
+ self.handler.has_more_rows = false;
+ self.handler.fetching_rows = false;
+ if (typeof cb == 'function') {
+ cb();
+ }
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, null, [], false
- );
- self.update_msg_history(false, msg);
- });
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, null, [], false
+ );
+ self.update_msg_history(false, msg);
+ });
},
update_grid_data: function(data) {
@@ -1912,7 +1912,7 @@ define('tools.querytool', [
var baseUrl = url_for(url_endpoint, this.url_params);
Datagrid.create_transaction(baseUrl, this, this.is_query_tool,
- this.server_type, '', '', '', true);
+ this.server_type, '', '', '', true);
},
handle_connection_lost: function(create_transaction, xhr) {
@@ -1986,27 +1986,27 @@ define('tools.querytool', [
'gid': this.url_params.sgid,
'sid': this.url_params.sid,
}),passdata)
- .done(function(res) {
- if (res.success == 1) {
- alertify.success(res.info);
- if (create_transaction) {
- self.initTransaction();
- } else if ('fn' in self.state) {
- var fn = self.state['fn'],
- args = self.state['args'];
- self.saveState();
- self[fn].apply(self, args);
+ .done(function(res) {
+ if (res.success == 1) {
+ alertify.success(res.info);
+ if (create_transaction) {
+ self.initTransaction();
+ } else if ('fn' in self.state) {
+ var fn = self.state['fn'],
+ args = self.state['args'];
+ self.saveState();
+ self[fn].apply(self, args);
+ }
}
- }
- })
- .fail(function(xhr) {
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, xhr, null, [], false
- );
- alertify.dlgGetServerPass(
- gettext('Connect to Server'), msg
- );
- });
+ })
+ .fail(function(xhr) {
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, xhr, null, [], false
+ );
+ alertify.dlgGetServerPass(
+ gettext('Connect to Server'), msg
+ );
+ });
},
/* This function is used to create instance of SQLEditorView,
* call the render method of the grid view to render the backgrid
@@ -2051,25 +2051,25 @@ define('tools.querytool', [
url: script_type_url,
type:'GET',
})
- .done(function(res) {
- self.gridView.query_tool_obj.refresh();
- if (res && res !== '') {
- self.gridView.query_tool_obj.setValue(res);
- }
- self.init_events();
- })
- .fail(function(jqx) {
- let msg = '';
- self.init_events();
-
- msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, jqx, null, [], false
- );
+ .done(function(res) {
+ self.gridView.query_tool_obj.refresh();
+ if (res && res !== '') {
+ self.gridView.query_tool_obj.setValue(res);
+ }
+ self.init_events();
+ })
+ .fail(function(jqx) {
+ let msg = '';
+ self.init_events();
+
+ msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, jqx, null, [], false
+ );
- pgBrowser.report_error(
- S(gettext('Error fetching SQL for script: %s.')).sprintf(msg).value()
- );
- });
+ pgBrowser.report_error(
+ S(gettext('Error fetching SQL for script: %s.')).sprintf(msg).value()
+ );
+ });
} else {
self.init_events();
}
@@ -2191,53 +2191,53 @@ define('tools.querytool', [
url: url,
method: 'GET',
})
- .done(function(res) {
- if (res.data.status) {
- self.can_edit = res.data.can_edit;
- self.can_filter = res.data.can_filter;
- self.info_notifier_timeout = res.data.info_notifier_timeout;
+ .done(function(res) {
+ if (res.data.status) {
+ self.can_edit = res.data.can_edit;
+ self.can_filter = res.data.can_filter;
+ self.info_notifier_timeout = res.data.info_notifier_timeout;
- // Set the sql query to the SQL panel
- self.gridView.query_tool_obj.setValue(res.data.sql);
- self.query = res.data.sql;
+ // Set the sql query to the SQL panel
+ self.gridView.query_tool_obj.setValue(res.data.sql);
+ self.query = res.data.sql;
- /* If filter is applied then remove class 'btn-secondary'
+ /* If filter is applied then remove class 'btn-secondary'
* and add 'btn-primary' to change the colour of the button.
*/
- if (self.can_filter && res.data.filter_applied) {
- $('#btn-filter').removeClass('btn-secondary');
- $('#btn-filter-dropdown').removeClass('btn-secondary');
- $('#btn-filter').addClass('btn-primary');
- $('#btn-filter-dropdown').addClass('btn-primary');
- } else {
- $('#btn-filter').removeClass('btn-primary');
- $('#btn-filter-dropdown').removeClass('btn-primary');
- $('#btn-filter').addClass('btn-secondary');
- $('#btn-filter-dropdown').addClass('btn-secondary');
- }
- $('#btn-save').prop('disabled', true);
- $('#btn-file-menu-dropdown').prop('disabled', true);
- $('#btn-copy-row').prop('disabled', true);
- $('#btn-paste-row').prop('disabled', true);
+ if (self.can_filter && res.data.filter_applied) {
+ $('#btn-filter').removeClass('btn-secondary');
+ $('#btn-filter-dropdown').removeClass('btn-secondary');
+ $('#btn-filter').addClass('btn-primary');
+ $('#btn-filter-dropdown').addClass('btn-primary');
+ } else {
+ $('#btn-filter').removeClass('btn-primary');
+ $('#btn-filter-dropdown').removeClass('btn-primary');
+ $('#btn-filter').addClass('btn-secondary');
+ $('#btn-filter-dropdown').addClass('btn-secondary');
+ }
+ $('#btn-save').prop('disabled', true);
+ $('#btn-file-menu-dropdown').prop('disabled', true);
+ $('#btn-copy-row').prop('disabled', true);
+ $('#btn-paste-row').prop('disabled', true);
- // Set the combo box value
- $('.limit').val(res.data.limit);
+ // Set the combo box value
+ $('.limit').val(res.data.limit);
- // If status is True then poll the result.
- self._poll();
- } else {
+ // If status is True then poll the result.
+ self._poll();
+ } else {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ self.update_msg_history(false, res.data.result);
+ }
+ })
+ .fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.update_msg_history(false, res.data.result);
- }
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_run_query', [], true
- );
- self.update_msg_history(false, msg);
- });
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_run_query', [], true
+ );
+ self.update_msg_history(false, msg);
+ });
},
// This is a wrapper to call_render function
@@ -2433,7 +2433,7 @@ define('tools.querytool', [
// have use casting so we will use type
// returned by cast function
pg_types[pg_types.length - 1][0] ?
- pg_types[pg_types.length - 1][0] : 'unknown';
+ pg_types[pg_types.length - 1][0] : 'unknown';
if (!is_primary_key)
col_type += type;
@@ -2483,7 +2483,7 @@ define('tools.querytool', [
case 'character varying':
case 'character varying[]':
if (c.internal_size && c.internal_size >= 0 && c.internal_size != 65535) {
- // Update column type to display length on column header
+ // Update column type to display length on column header
col_type += ' (' + c.internal_size + ')';
}
col_cell = 'string';
@@ -2604,7 +2604,7 @@ define('tools.querytool', [
data.forEach(function(d, idx) {
var p_keys_list = _.pick(d, tmp_keys),
is_primary_key = Object.keys(p_keys_list).length ?
- p_keys_list[0] : undefined;
+ p_keys_list[0] : undefined;
if (!is_primary_key) {
self.temp_new_rows.push(idx);
@@ -2747,133 +2747,133 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(req_data),
})
- .done(function(res) {
- var grid = self.slickgrid,
- dataView = grid.getData(),
- data_length = dataView.getLength(),
- data = [];
+ .done(function(res) {
+ var grid = self.slickgrid,
+ dataView = grid.getData(),
+ data_length = dataView.getLength(),
+ data = [];
- if (res.data.status) {
- if(is_added) {
+ if (res.data.status) {
+ if(is_added) {
// Update the rows in a grid after addition
- dataView.beginUpdate();
- _.each(res.data.query_result, function(r) {
- if (!_.isNull(r.row_added)) {
+ dataView.beginUpdate();
+ _.each(res.data.query_result, function(r) {
+ if (!_.isNull(r.row_added)) {
// Fetch temp_id returned by server after addition
- var row_id = Object.keys(r.row_added)[0];
- _.each(req_data.added_index, function(v, k) {
- if (v == row_id) {
+ var row_id = Object.keys(r.row_added)[0];
+ _.each(req_data.added_index, function(v, k) {
+ if (v == row_id) {
// Fetch item data through row index
- var item = grid.getDataItem(k);
- _.extend(item, r.row_added[row_id]);
- }
- });
+ var item = grid.getDataItem(k);
+ _.extend(item, r.row_added[row_id]);
+ }
+ });
+ }
+ });
+ dataView.endUpdate();
+ }
+ // Remove flag is_row_copied from copied rows
+ _.each(data, function(row) {
+ if (row.is_row_copied) {
+ delete row.is_row_copied;
}
});
- dataView.endUpdate();
- }
- // Remove flag is_row_copied from copied rows
- _.each(data, function(row) {
- if (row.is_row_copied) {
- delete row.is_row_copied;
- }
- });
- // Remove 2d copied_rows array
- if (grid.copied_rows) {
- delete grid.copied_rows;
- }
+ // Remove 2d copied_rows array
+ if (grid.copied_rows) {
+ delete grid.copied_rows;
+ }
- // Remove deleted rows from client as well
- if (is_deleted) {
- var rows = grid.getSelectedRows();
- if (data_length == rows.length) {
+ // Remove deleted rows from client as well
+ if (is_deleted) {
+ var rows = grid.getSelectedRows();
+ if (data_length == rows.length) {
// This means all the rows are selected, clear all data
- data = [];
- dataView.setItems(data, self.client_primary_key);
- } else {
- dataView.beginUpdate();
- for (var i = 0; i < rows.length; i++) {
- var item = grid.getDataItem(rows[i]);
- data.push(item);
- dataView.deleteItem(item[self.client_primary_key]);
+ data = [];
+ dataView.setItems(data, self.client_primary_key);
+ } else {
+ dataView.beginUpdate();
+ for (var i = 0; i < rows.length; i++) {
+ var item = grid.getDataItem(rows[i]);
+ data.push(item);
+ dataView.deleteItem(item[self.client_primary_key]);
+ }
+ dataView.endUpdate();
}
- dataView.endUpdate();
+ self.rows_to_delete.apply(self, [data]);
+ grid.setSelectedRows([]);
}
- self.rows_to_delete.apply(self, [data]);
- grid.setSelectedRows([]);
- }
- grid.setSelectedRows([]);
+ grid.setSelectedRows([]);
- // Reset data store
- self.data_store = {
- 'added': {},
- 'updated': {},
- 'deleted': {},
- 'added_index': {},
- 'updated_index': {},
- };
+ // Reset data store
+ self.data_store = {
+ 'added': {},
+ 'updated': {},
+ 'deleted': {},
+ 'added_index': {},
+ 'updated_index': {},
+ };
- // Reset old primary key data now
- self.primary_keys_data = {};
+ // Reset old primary key data now
+ self.primary_keys_data = {};
- // Clear msgs after successful save
- $('.sql-editor-message').html('');
+ // Clear msgs after successful save
+ $('.sql-editor-message').html('');
- alertify.success(gettext('Data saved successfully.'));
- } else {
+ alertify.success(gettext('Data saved successfully.'));
+ } else {
// Something went wrong while saving data on the db server
- $('#btn-flash').prop('disabled', false);
- $('#btn-download').prop('disabled', false);
- $('.sql-editor-message').text(res.data.result);
- var err_msg = S(gettext('%s.')).sprintf(res.data.result).value();
- alertify.error(err_msg, 20);
- grid.setSelectedRows([]);
- // To highlight the row at fault
- if (_.has(res.data, '_rowid') &&
+ $('#btn-flash').prop('disabled', false);
+ $('#btn-download').prop('disabled', false);
+ $('.sql-editor-message').text(res.data.result);
+ var err_msg = S(gettext('%s.')).sprintf(res.data.result).value();
+ alertify.error(err_msg, 20);
+ grid.setSelectedRows([]);
+ // To highlight the row at fault
+ if (_.has(res.data, '_rowid') &&
(!_.isUndefined(res.data._rowid) || !_.isNull(res.data._rowid))) {
- var _row_index = self._find_rowindex(res.data._rowid);
- if (_row_index in self.data_store.added_index) {
+ var _row_index = self._find_rowindex(res.data._rowid);
+ if (_row_index in self.data_store.added_index) {
// Remove new row index from temp_list if save operation
// fails
- var index = self.handler.temp_new_rows.indexOf(res.data._rowid);
- if (index > -1) {
- self.handler.temp_new_rows.splice(index, 1);
+ var index = self.handler.temp_new_rows.indexOf(res.data._rowid);
+ if (index > -1) {
+ self.handler.temp_new_rows.splice(index, 1);
+ }
+ self.data_store.added[self.data_store.added_index[_row_index]].err = true;
+ } else if (_row_index in self.data_store.updated_index) {
+ self.data_store.updated[self.data_store.updated_index[_row_index]].err = true;
}
- self.data_store.added[self.data_store.added_index[_row_index]].err = true;
- } else if (_row_index in self.data_store.updated_index) {
- self.data_store.updated[self.data_store.updated_index[_row_index]].err = true;
}
+ grid.gotoCell(_row_index, 1);
}
- grid.gotoCell(_row_index, 1);
- }
- // Update the sql results in history tab
- _.each(res.data.query_result, function(r) {
- self.gridView.history_collection.add({
- 'status': r.status,
- 'start_time': self.query_start_time,
- 'query': r.sql,
- 'row_affected': r.rows_affected,
- 'total_time': self.total_time,
- 'message': r.result,
+ // Update the sql results in history tab
+ _.each(res.data.query_result, function(r) {
+ self.gridView.history_collection.add({
+ 'status': r.status,
+ 'start_time': self.query_start_time,
+ 'query': r.sql,
+ 'row_affected': r.rows_affected,
+ 'total_time': self.total_time,
+ 'message': r.result,
+ });
});
- });
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
- grid.invalidate();
- if (self.close_on_save) {
- self.close();
- }
- })
- .fail(function(e) {
- let stateParams = [view, controller, save_as];
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_save', stateParams, true
- );
- self.update_msg_history(false, msg);
- });
+ grid.invalidate();
+ if (self.close_on_save) {
+ self.close();
+ }
+ })
+ .fail(function(e) {
+ let stateParams = [view, controller, save_as];
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_save', stateParams, true
+ );
+ self.update_msg_history(false, msg);
+ });
}
},
@@ -2999,32 +2999,32 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(data),
})
- .done(function(res) {
- self.gridView.query_tool_obj.setValue(res);
- self.gridView.current_file = e;
- self.setTitle(self.gridView.current_file.split('\\').pop().split('/').pop(), true);
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- // hide cursor
- $busy_icon_div.removeClass('show_progress');
+ .done(function(res) {
+ self.gridView.query_tool_obj.setValue(res);
+ self.gridView.current_file = e;
+ self.setTitle(self.gridView.current_file.split('\\').pop().split('/').pop(), true);
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ // hide cursor
+ $busy_icon_div.removeClass('show_progress');
- // disable save button on file save
- $('#btn-save').prop('disabled', true);
- $('#btn-file-menu-save').css('display', 'none');
+ // disable save button on file save
+ $('#btn-save').prop('disabled', true);
+ $('#btn-file-menu-save').css('display', 'none');
- // Update the flag as new content is just loaded.
- self.is_query_changed = false;
- setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let stateParams = [_e];
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_select_file_handler', stateParams, false
- );
- alertify.error(msg);
- // hide cursor
- $busy_icon_div.removeClass('show_progress');
- });
+ // Update the flag as new content is just loaded.
+ self.is_query_changed = false;
+ setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let stateParams = [_e];
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_select_file_handler', stateParams, false
+ );
+ alertify.error(msg);
+ // hide cursor
+ $busy_icon_div.removeClass('show_progress');
+ });
},
// read data from codemirror and write to file
@@ -3047,32 +3047,32 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(data),
})
- .done(function(res) {
- if (res.data.status) {
- alertify.success(gettext('File saved successfully.'));
- self.gridView.current_file = e;
- self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''), true);
- // disable save button on file save
- $('#btn-save').prop('disabled', true);
- $('#btn-file-menu-save').css('display', 'none');
-
- // Update the flag as query is already saved.
- self.is_query_changed = false;
- setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
- }
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- if (self.close_on_save) {
- self.close();
- }
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let stateParams = [_e];
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_save_file_handler', stateParams, false
- );
- alertify.error(msg);
- });
+ .done(function(res) {
+ if (res.data.status) {
+ alertify.success(gettext('File saved successfully.'));
+ self.gridView.current_file = e;
+ self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''), true);
+ // disable save button on file save
+ $('#btn-save').prop('disabled', true);
+ $('#btn-file-menu-save').css('display', 'none');
+
+ // Update the flag as query is already saved.
+ self.is_query_changed = false;
+ setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
+ }
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ if (self.close_on_save) {
+ self.close();
+ }
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let stateParams = [_e];
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_save_file_handler', stateParams, false
+ );
+ alertify.error(msg);
+ });
},
// codemirror text change event
@@ -3182,26 +3182,26 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(data),
})
- .done(function(res) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- setTimeout(
- function() {
- if (res.data.status) {
+ .done(function(res) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ setTimeout(
+ function() {
+ if (res.data.status) {
// Refresh the sql grid
- queryToolActions.executeQuery(self);
- } else {
- alertify.alert(gettext('Filter By Selection Error'), res.data.result);
+ queryToolActions.executeQuery(self);
+ } else {
+ alertify.alert(gettext('Filter By Selection Error'), res.data.result);
+ }
}
- }
- );
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_include_filter', [], true
- );
- alertify.alert(gettext('Filter By Selection Error'), msg);
- });
+ );
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_include_filter', [], true
+ );
+ alertify.alert(gettext('Filter By Selection Error'), msg);
+ });
},
// This function will exclude the filter by selection.
@@ -3241,26 +3241,26 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(data),
})
- .done(function(res) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- setTimeout(
- function() {
- if (res.data.status) {
+ .done(function(res) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ setTimeout(
+ function() {
+ if (res.data.status) {
// Refresh the sql grid
- queryToolActions.executeQuery(self);
- } else {
- alertify.alert(gettext('Filter Exclude Selection Error'), res.data.result);
- }
- }, 10
- );
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_exclude_filter', [], true
- );
- alertify.alert(gettext('Filter Exclude Selection Error'), msg);
- });
+ queryToolActions.executeQuery(self);
+ } else {
+ alertify.alert(gettext('Filter Exclude Selection Error'), res.data.result);
+ }
+ }, 10
+ );
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_exclude_filter', [], true
+ );
+ alertify.alert(gettext('Filter Exclude Selection Error'), msg);
+ });
},
// This function will remove the filter.
@@ -3279,26 +3279,26 @@ define('tools.querytool', [
}),
method: 'POST',
})
- .done(function(res) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- setTimeout(
- function() {
- if (res.data.status) {
+ .done(function(res) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ setTimeout(
+ function() {
+ if (res.data.status) {
// Refresh the sql grid
- queryToolActions.executeQuery(self);
- } else {
- alertify.alert(gettext('Remove Filter Error'), res.data.result);
+ queryToolActions.executeQuery(self);
+ } else {
+ alertify.alert(gettext('Remove Filter Error'), res.data.result);
+ }
}
- }
- );
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_remove_filter', [], true
- );
- alertify.alert(gettext('Remove Filter Error'), msg);
- });
+ );
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_remove_filter', [], true
+ );
+ alertify.alert(gettext('Remove Filter Error'), msg);
+ });
},
// This function will copy the selected row.
@@ -3403,25 +3403,25 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(limit),
})
- .done(function(res) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- setTimeout(
- function() {
- if (res.data.status) {
+ .done(function(res) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ setTimeout(
+ function() {
+ if (res.data.status) {
// Refresh the sql grid
- queryToolActions.executeQuery(self);
- } else
- alertify.alert(gettext('Change limit Error'), res.data.result);
- }, 10
- );
- })
- .fail(function(e) {
- self.trigger('pgadmin-sqleditor:loading-icon:hide');
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_set_limit', [], true
- );
- alertify.alert(gettext('Change limit Error'), msg);
- });
+ queryToolActions.executeQuery(self);
+ } else
+ alertify.alert(gettext('Change limit Error'), res.data.result);
+ }, 10
+ );
+ })
+ .fail(function(e) {
+ self.trigger('pgadmin-sqleditor:loading-icon:hide');
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_set_limit', [], true
+ );
+ alertify.alert(gettext('Change limit Error'), msg);
+ });
},
// This function is used to enable/disable buttons
@@ -3554,29 +3554,29 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
})
- .done(function(res) {
- if (!res.data.status) {
- alertify.alert(gettext('Cancel Query Error'), res.data.result);
- }
- self.disable_tool_buttons(false);
- is_query_running = false;
- if(!_.isUndefined(self.download_csv_obj)) {
- self.download_csv_obj.abort();
- $('#btn-flash').prop('disabled', false);
- $('#btn-download').prop('disabled', false);
- self.trigger(
- 'pgadmin-sqleditor:loading-icon:hide');
- }
- setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
- })
- .fail(function(e) {
- self.disable_tool_buttons(false);
+ .done(function(res) {
+ if (!res.data.status) {
+ alertify.alert(gettext('Cancel Query Error'), res.data.result);
+ }
+ self.disable_tool_buttons(false);
+ is_query_running = false;
+ if(!_.isUndefined(self.download_csv_obj)) {
+ self.download_csv_obj.abort();
+ $('#btn-flash').prop('disabled', false);
+ $('#btn-download').prop('disabled', false);
+ self.trigger(
+ 'pgadmin-sqleditor:loading-icon:hide');
+ }
+ setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
+ })
+ .fail(function(e) {
+ self.disable_tool_buttons(false);
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_cancel_query', [], false
- );
- alertify.alert(gettext('Cancel Query Error'), msg);
- });
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_cancel_query', [], false
+ );
+ alertify.alert(gettext('Cancel Query Error'), msg);
+ });
},
// Trigger query result download to csv.
@@ -3609,48 +3609,48 @@ define('tools.querytool', [
);
},
})
- .done(function(response) {
- let urlCreator = window.URL || window.webkitURL,
- url = urlCreator.createObjectURL(response),
- link = document.createElement('a'),
- current_browser = pgAdmin.Browser.get_browser();
+ .done(function(response) {
+ let urlCreator = window.URL || window.webkitURL,
+ url = urlCreator.createObjectURL(response),
+ link = document.createElement('a'),
+ current_browser = pgAdmin.Browser.get_browser();
- if (current_browser.name === 'IE' && window.navigator.msSaveBlob) {
+ if (current_browser.name === 'IE' && window.navigator.msSaveBlob) {
// IE10+ : (has Blob, but not a[download] or URL)
- window.navigator.msSaveBlob(response, filename);
- } else {
- link.setAttribute('href', url);
- link.setAttribute('download', filename);
- link.click();
- }
+ window.navigator.msSaveBlob(response, filename);
+ } else {
+ link.setAttribute('href', url);
+ link.setAttribute('download', filename);
+ link.click();
+ }
- self.download_csv_obj = undefined;
- // Enable the execute button
- $('#btn-flash').prop('disabled', false);
- $('#btn-download').prop('disabled', false);
- self.disable_tool_buttons(false);
- self.trigger(
- 'pgadmin-sqleditor:loading-icon:hide');
+ self.download_csv_obj = undefined;
+ // Enable the execute button
+ $('#btn-flash').prop('disabled', false);
+ $('#btn-download').prop('disabled', false);
+ self.disable_tool_buttons(false);
+ self.trigger(
+ 'pgadmin-sqleditor:loading-icon:hide');
- })
- .fail(function(err) {
- let msg = '';
+ })
+ .fail(function(err) {
+ let msg = '';
- if (err.statusText == 'abort') {
- msg = gettext('CSV Download cancelled.');
- } else {
- msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, err, gettext('Download CSV'), [], true
- );
- }
- alertify.alert(gettext('Download CSV error'), msg);
- });
+ if (err.statusText == 'abort') {
+ msg = gettext('CSV Download cancelled.');
+ } else {
+ msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, err, gettext('Download CSV'), [], true
+ );
+ }
+ alertify.alert(gettext('Download CSV error'), msg);
+ });
},
call_cache_preferences: function() {
let browser = window.opener ?
- window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
+ window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
browser.cache_preferences('sqleditor');
/* This will make sure to get latest updates only and not older events */
@@ -3677,17 +3677,17 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(auto_rollback),
})
- .done(function(res) {
- if (!res.data.status)
- alertify.alert(gettext('Auto Rollback Error'), res.data.result);
- })
- .fail(function(e) {
+ .done(function(res) {
+ if (!res.data.status)
+ alertify.alert(gettext('Auto Rollback Error'), res.data.result);
+ })
+ .fail(function(e) {
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_auto_rollback', [], true
- );
- alertify.alert(gettext('Auto Rollback Error'), msg);
- });
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_auto_rollback', [], true
+ );
+ alertify.alert(gettext('Auto Rollback Error'), msg);
+ });
},
_auto_commit: function() {
@@ -3710,16 +3710,16 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(auto_commit),
})
- .done(function(res) {
- if (!res.data.status)
- alertify.alert(gettext('Auto Commit Error'), res.data.result);
- })
- .fail(function(e) {
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, '_auto_commit', [], true
- );
- alertify.alert(gettext('Auto Commit Error'), msg);
- });
+ .done(function(res) {
+ if (!res.data.status)
+ alertify.alert(gettext('Auto Commit Error'), res.data.result);
+ })
+ .fail(function(e) {
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, '_auto_commit', [], true
+ );
+ alertify.alert(gettext('Auto Commit Error'), msg);
+ });
},
@@ -3733,22 +3733,22 @@ define('tools.querytool', [
contentType: 'application/json',
data: JSON.stringify(data),
})
- .done(function(res) {
- if (res.success == undefined || !res.success) {
- alertify.alert(gettext('Explain options error'),
- gettext('Error occurred while setting %(subItem)s option in explain.',
- {subItem : subItem})
+ .done(function(res) {
+ if (res.success == undefined || !res.success) {
+ alertify.alert(gettext('Explain options error'),
+ gettext('Error occurred while setting %(subItem)s option in explain.',
+ {subItem : subItem})
+ );
+ }
+ else
+ self.call_cache_preferences();
+ })
+ .fail(function(e) {
+ let msg = httpErrorHandler.handleQueryToolAjaxError(
+ pgAdmin, self, e, caller, [], true
);
- }
- else
- self.call_cache_preferences();
- })
- .fail(function(e) {
- let msg = httpErrorHandler.handleQueryToolAjaxError(
- pgAdmin, self, e, caller, [], true
- );
- alertify.alert(gettext('Explain options error'), msg);
- });
+ alertify.alert(gettext('Explain options error'), msg);
+ });
},
// This function will toggle "verbose" option in explain
diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js
index 8aeea3a5..57fd8d30 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -785,17 +785,17 @@ define([
method: 'GET',
async: false,
})
- .done(function(res) {
- Roles = res;
- })
- .fail(function() {
- setTimeout(function() {
- alertify.alert(
- gettext('Error'),
- gettext('Cannot load user roles.')
- );
- }, 100);
- });
+ .done(function(res) {
+ Roles = res;
+ })
+ .fail(function() {
+ setTimeout(function() {
+ alertify.alert(
+ gettext('Error'),
+ gettext('Cannot load user roles.')
+ );
+ }, 100);
+ });
var view = this.view = new Backgrid.Grid({
row: UserRow,
diff --git a/web/pgadmin/utils/driver/psycopg2/encoding.py b/web/pgadmin/utils/driver/psycopg2/encoding.py
index ecf2e36f..08843e90 100644
--- a/web/pgadmin/utils/driver/psycopg2/encoding.py
+++ b/web/pgadmin/utils/driver/psycopg2/encoding.py
@@ -63,8 +63,12 @@ def getEncoding(key):
"""
:param key: Database Encoding
:return:
- [Postgres_encoding, Python_encoding] - Postgres and Python encoding
+ [Postgres_encoding, Python_encoding, typecast_encoding] -
+ Postgres encoding, Python encoding, type cast encoding
"""
+ #
+ # Reference: https://www.postgresql.org/docs/11/multibyte.html
+
return encode_dict.get(key, ['UNICODE', 'utf-8', 'utf-8'])
diff --git a/web/regression/javascript/alerts/alertify_wrapper_spec.js b/web/regression/javascript/alerts/alertify_wrapper_spec.js
index 3fa2879b..5d0d10e1 100644
--- a/web/regression/javascript/alerts/alertify_wrapper_spec.js
+++ b/web/regression/javascript/alerts/alertify_wrapper_spec.js
@@ -27,7 +27,7 @@ describe('alertify_wrapper', function () {
describe('error', function () {
it('calls the error function from alertify and adds the warning symbol to the element', function () {
- spyOn(alertify, 'orig_error');
+ spyOn(alertify, 'orig_error').and.callThrough();
alertify.error('bad, very bad', 1);
diff --git a/web/regression/javascript/check_node_visibility_spec.js b/web/regression/javascript/check_node_visibility_spec.js
index ba92e157..e673aa75 100644
--- a/web/regression/javascript/check_node_visibility_spec.js
+++ b/web/regression/javascript/check_node_visibility_spec.js
@@ -8,25 +8,25 @@
//////////////////////////////////////////////////////////////////////////
define(['sources/check_node_visibility'],
-function (checkNodeVisibility) {
- describe('checkNodeVisibility', function () {
+ function (checkNodeVisibility) {
+ describe('checkNodeVisibility', function () {
- var browser;
+ var browser;
- browser = jasmine.createSpyObj('browser', [
- 'node_preference_data', 'get_preference']
- );
+ browser = jasmine.createSpyObj('browser', [
+ 'node_preference_data', 'get_preference']
+ );
- describe('when node is server collection', function () {
- it('returns true', function () {
- expect(checkNodeVisibility(browser, 'coll-server')).toEqual(true);
+ describe('when node is server collection', function () {
+ it('returns true', function () {
+ expect(checkNodeVisibility(browser, 'coll-server')).toEqual(true);
+ });
});
- });
- describe('when node is server', function () {
- it('returns true', function () {
- expect(checkNodeVisibility(browser, 'server')).toEqual(true);
+ describe('when node is server', function () {
+ it('returns true', function () {
+ expect(checkNodeVisibility(browser, 'server')).toEqual(true);
+ });
});
});
});
-});
diff --git a/web/regression/javascript/common_keyboard_shortcuts_spec.js b/web/regression/javascript/common_keyboard_shortcuts_spec.js
index f481b1a0..abe5bac5 100644
--- a/web/regression/javascript/common_keyboard_shortcuts_spec.js
+++ b/web/regression/javascript/common_keyboard_shortcuts_spec.js
@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////////////////
-import keyboardShortcuts from 'sources/keyboard_shortcuts';
+import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
describe('the keyboard shortcuts', () => {
const F1_KEY = 112;
diff --git a/web/regression/javascript/dialog_tab_navigator_spec.js b/web/regression/javascript/dialog_tab_navigator_spec.js
index 3c6301a4..c62c6977 100644
--- a/web/regression/javascript/dialog_tab_navigator_spec.js
+++ b/web/regression/javascript/dialog_tab_navigator_spec.js
@@ -66,8 +66,8 @@ describe('dialogTabNavigator', function () {
'key': {'key_code': 93, 'char': ']'},
};
- tabNavigator = new dialogTabNavigator.dialogTabNavigator(
- dialog, backward_shortcut, forward_shortcut);
+ tabNavigator = new dialogTabNavigator(
+ dialog, backward_shortcut, forward_shortcut);
});
describe('navigate', function () {
diff --git a/web/regression/javascript/fake_browser/browser.js b/web/regression/javascript/fake_browser/browser.js
index ec3d0779..ac28b26c 100644
--- a/web/regression/javascript/fake_browser/browser.js
+++ b/web/regression/javascript/fake_browser/browser.js
@@ -9,4 +9,4 @@
let treeMenu = null;
-export {treeMenu};
+export default treeMenu;
diff --git a/web/regression/javascript/nodes/schema/child_menu_spec.js b/web/regression/javascript/nodes/schema/child_menu_spec.js
index 7a22940c..638bc549 100644
--- a/web/regression/javascript/nodes/schema/child_menu_spec.js
+++ b/web/regression/javascript/nodes/schema/child_menu_spec.js
@@ -1,253 +1,253 @@
-/////////////////////////////////////////////////////////////
-//
-// pgAdmin 4 - PostgreSQL Tools
-//
-// Copyright (C) 2013 - 2019, The pgAdmin Development Team
-// This software is released under the PostgreSQL Licence
-//
-/////////////////////////////////////////////////////////////
-
-import {
- isTreeItemOfChildOfSchema, childCreateMenuEnabled,
-} from 'pgadmin.schema.dir/schema_child_tree_node';
-
-import * as pgBrowser from 'pgbrowser/browser';
-import {TreeFake} from '../../tree/tree_fake';
-
-describe('#childCreateMenuEnabled', () => {
- let data;
- let tree;
-
- describe(' - when data is not null', () => {
- beforeEach(() => {
- data = {};
- });
- describe(' and check is false', () => {
- beforeEach(() => {
- data = {check: false};
- });
- it(', then it returns true', () => {
- expect(childCreateMenuEnabled({}, {}, data)).toBe(true);
- });
- });
-
- describe(' and check', () => {
- describe(' is true', () => {
- beforeEach(() => {
- data = {check: true};
- });
-
- describe(', on schema node', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'schema'},
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
- it(' it is true', () => {
- expect(childCreateMenuEnabled(
- {}, [{id: 'level2'}], data
- )).toBe(true);
-
- });
- });
-
- describe(', on child collection node under schema node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'schema'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is true', () => {
- expect(childCreateMenuEnabled(
- {}, [{id: 'coll-table'}], data
- )).toBe(true);
- });
- });
-
- describe(', on one of the child node under schema node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'schema'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- children: [{
- id: 'table/1',
- data: {_type: 'table'},
- }],
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is true', () => {
- expect(childCreateMenuEnabled(
- {}, [{id: 'table/1'}], data
- )).toBe(true);
- });
- });
-
- describe(', on catalog node', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'catalog'},
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
- it(' it is false', () => {
- expect(
- childCreateMenuEnabled({}, [{id: 'level2'}], data)
- ).toBe(false);
- });
- });
-
- describe(', on child collection node under catalog node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'catalog'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is false', () => {
- expect(childCreateMenuEnabled(
- {}, [{id: 'coll-table'}], data
- )).toBe(false);
- });
- });
-
- describe(', on one of the child node under catalog node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'catalog'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- children: [{
- id: 'table/1',
- data: {_type: 'table'},
- }],
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is false', () => {
- expect(childCreateMenuEnabled(
- {}, [{id: 'table/1'}], data
- )).toBe(false);
- });
- });
- });
- });
- });
-});
-
-describe('#childDropMenuEnabled', () => {
- let tree;
-
- describe(' - the child node under schema node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'schema'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- children: [{
- id: 'table/1',
- data: {_type: 'table'},
- }],
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is true', () => {
- expect(isTreeItemOfChildOfSchema(
- {}, [{id: 'table/1'}]
- )).toBe(true);
- });
- });
-
- describe('- the child node under the catalog node ', () => {
- beforeEach(() => {
- let hierarchy = {
- id: 'root',
- children: [{
- id: 'level2',
- data: {_type: 'catalog'},
- children: [{
- id: 'coll-table',
- data: {_type: 'coll-table'},
- children: [{
- id: 'table/1',
- data: {_type: 'table'},
- }],
- }],
- }],
- };
-
- tree = TreeFake.build(hierarchy);
- pgBrowser.treeMenu = tree;
- });
-
- it(' it is false', () => {
- expect(isTreeItemOfChildOfSchema(
- {}, [{id: 'table/1'}]
- )).toBe(false);
- });
- });
-});
+///////////////////////////////////////////////////////////////
+////
+//// pgAdmin 4 - PostgreSQL Tools
+////
+//// Copyright (C) 2013 - 2019, The pgAdmin Development Team
+//// This software is released under the PostgreSQL Licence
+////
+///////////////////////////////////////////////////////////////
+//
+//import {
+// isTreeItemOfChildOfSchema, childCreateMenuEnabled,
+//} from 'pgadmin.schema.dir/schema_child_tree_node';
+//
+//import treeMenu from 'pgbrowser/browser';
+//import TreeFake from '../../tree/tree_fake';
+//
+//describe('#childCreateMenuEnabled', () => {
+// let data;
+// let tree;
+//
+// describe(' - when data is not null', () => {
+// beforeEach(() => {
+// data = {};
+// });
+// describe(' and check is false', () => {
+// beforeEach(() => {
+// data = {check: false};
+// });
+// it(', then it returns true', () => {
+// expect(childCreateMenuEnabled({}, {}, data)).toBe(true);
+// });
+// });
+//
+// describe(' and check', () => {
+// describe(' is true', () => {
+// beforeEach(() => {
+// data = {check: true};
+// });
+//
+// describe(', on schema node', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'schema'},
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+// it(' it is true', () => {
+// expect(childCreateMenuEnabled(
+// {}, [{id: 'level2'}], data
+// )).toBe(true);
+//
+// });
+// });
+//
+// describe(', on child collection node under schema node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'schema'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is true', () => {
+// expect(childCreateMenuEnabled(
+// {}, [{id: 'coll-table'}], data
+// )).toBe(true);
+// });
+// });
+//
+// describe(', on one of the child node under schema node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'schema'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// children: [{
+// id: 'table/1',
+// data: {_type: 'table'},
+// }],
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is true', () => {
+// expect(childCreateMenuEnabled(
+// {}, [{id: 'table/1'}], data
+// )).toBe(true);
+// });
+// });
+//
+// describe(', on catalog node', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'catalog'},
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+// it(' it is false', () => {
+// expect(
+// childCreateMenuEnabled({}, [{id: 'level2'}], data)
+// ).toBe(false);
+// });
+// });
+//
+// describe(', on child collection node under catalog node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'catalog'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is false', () => {
+// expect(childCreateMenuEnabled(
+// {}, [{id: 'coll-table'}], data
+// )).toBe(false);
+// });
+// });
+//
+// describe(', on one of the child node under catalog node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'catalog'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// children: [{
+// id: 'table/1',
+// data: {_type: 'table'},
+// }],
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is false', () => {
+// expect(childCreateMenuEnabled(
+// {}, [{id: 'table/1'}], data
+// )).toBe(false);
+// });
+// });
+// });
+// });
+// });
+//});
+//
+//describe('#childDropMenuEnabled', () => {
+// let tree;
+//
+// describe(' - the child node under schema node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'schema'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// children: [{
+// id: 'table/1',
+// data: {_type: 'table'},
+// }],
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is true', () => {
+// expect(isTreeItemOfChildOfSchema(
+// {}, [{id: 'table/1'}]
+// )).toBe(true);
+// });
+// });
+//
+// describe('- the child node under the catalog node ', () => {
+// beforeEach(() => {
+// let hierarchy = {
+// id: 'root',
+// children: [{
+// id: 'level2',
+// data: {_type: 'catalog'},
+// children: [{
+// id: 'coll-table',
+// data: {_type: 'coll-table'},
+// children: [{
+// id: 'table/1',
+// data: {_type: 'table'},
+// }],
+// }],
+// }],
+// };
+//
+// tree = TreeFake.build(hierarchy);
+// treeMenu = tree;
+// });
+//
+// it(' it is false', () => {
+// expect(isTreeItemOfChildOfSchema(
+// {}, [{id: 'table/1'}]
+// )).toBe(false);
+// });
+// });
+//});
diff --git a/web/regression/javascript/sqleditor/calculate_query_run_time_spec.js b/web/regression/javascript/sqleditor/calculate_query_run_time_spec.js
index 5d41813f..ce74b829 100644
--- a/web/regression/javascript/sqleditor/calculate_query_run_time_spec.js
+++ b/web/regression/javascript/sqleditor/calculate_query_run_time_spec.js
@@ -30,7 +30,7 @@ describe('#calculateQueryRunTime', () => {
seconds:21,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
- .toEqual('947 msec');
+ .toEqual('947 msec');
});
});
@@ -53,7 +53,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
- .toEqual('54 secs 947 msec');
+ .toEqual('54 secs 947 msec');
});
});
@@ -76,7 +76,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
- .toEqual('9 min 54 secs');
+ .toEqual('9 min 54 secs');
});
});
@@ -99,7 +99,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
- .toEqual('1 hr 9 min');
+ .toEqual('1 hr 9 min');
});
});
});
diff --git a/web/regression/javascript/sqleditor/keyboard_shortcuts_spec.js b/web/regression/javascript/sqleditor/keyboard_shortcuts_spec.js
index d7e18567..1ad9c0ad 100644
--- a/web/regression/javascript/sqleditor/keyboard_shortcuts_spec.js
+++ b/web/regression/javascript/sqleditor/keyboard_shortcuts_spec.js
@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////////////////
-import keyboardShortcuts from 'sources/keyboard_shortcuts';
+import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
import {queryToolActions} from 'sources/sqleditor/query_tool_actions';
import gettext from 'sources/gettext';
diff --git a/web/regression/javascript/sqleditor/query_tool_actions_spec.js b/web/regression/javascript/sqleditor/query_tool_actions_spec.js
index 9c187433..b2b4e871 100644
--- a/web/regression/javascript/sqleditor/query_tool_actions_spec.js
+++ b/web/regression/javascript/sqleditor/query_tool_actions_spec.js
@@ -474,13 +474,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).toHaveBeenCalledWith('STRING');
+ ).toHaveBeenCalledWith('STRING');
});
it('(negative scenario toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).not.toHaveBeenCalledWith('string');
+ ).not.toHaveBeenCalledWith('string');
});
});
@@ -492,13 +492,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in lower case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).toHaveBeenCalledWith('string');
+ ).toHaveBeenCalledWith('string');
});
it('(negative scenario toggle the selection and string should be in lower case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).not.toHaveBeenCalledWith('STRING');
+ ).not.toHaveBeenCalledWith('STRING');
});
});
@@ -510,13 +510,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).toHaveBeenCalledWith('STRING');
+ ).toHaveBeenCalledWith('STRING');
});
it('(negative scenario toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
- ).not.toHaveBeenCalledWith('sTRIng');
+ ).not.toHaveBeenCalledWith('sTRIng');
});
});
});
diff --git a/web/regression/javascript/sqleditor/query_tool_http_error_handler_spec.js b/web/regression/javascript/sqleditor/query_tool_http_error_handler_spec.js
index e244ccf6..1ba46252 100644
--- a/web/regression/javascript/sqleditor/query_tool_http_error_handler_spec.js
+++ b/web/regression/javascript/sqleditor/query_tool_http_error_handler_spec.js
@@ -79,8 +79,8 @@ describe('#handleQueryToolAjaxError', () => {
stateParameters = [];
checkTransaction = false;
sqlEditorHandler = jasmine.createSpyObj(
- 'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
- );
+ 'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
+ );
exceptionSpy = {
readyState: 0,
status: 404,
diff --git a/web/regression/javascript/sqleditor_utils_spec.js b/web/regression/javascript/sqleditor_utils_spec.js
index 76bf41e7..789f370c 100644
--- a/web/regression/javascript/sqleditor_utils_spec.js
+++ b/web/regression/javascript/sqleditor_utils_spec.js
@@ -8,89 +8,89 @@
//////////////////////////////////////////////////////////////////////////
define(['sources/sqleditor_utils'],
-function (SqlEditorUtils) {
- describe('SqlEditorUtils', function () {
+ function (SqlEditorUtils) {
+ describe('SqlEditorUtils', function () {
- describe('Generate a random string of size 10', function () {
- it('returns string of length 10', function () {
- expect(SqlEditorUtils.epicRandomString(10).length).toEqual(10);
+ describe('Generate a random string of size 10', function () {
+ it('returns string of length 10', function () {
+ expect(SqlEditorUtils.epicRandomString(10).length).toEqual(10);
+ });
});
- });
- describe('Generate a unique hash for given string', function () {
- it('returns unique hash', function () {
- expect(SqlEditorUtils.getHash('select * from test')).toEqual(403379630);
+ describe('Generate a unique hash for given string', function () {
+ it('returns unique hash', function () {
+ expect(SqlEditorUtils.getHash('select * from test')).toEqual(403379630);
+ });
});
- });
- describe('Capitalize the first letter of given string', function () {
- it('returns string with First letter Capital', function () {
- expect(SqlEditorUtils.capitalizeFirstLetter('create script')).toEqual('Create script');
+ describe('Capitalize the first letter of given string', function () {
+ it('returns string with First letter Capital', function () {
+ expect(SqlEditorUtils.capitalizeFirstLetter('create script')).toEqual('Create script');
+ });
});
- });
- describe('Calculate font size of input number passed', function () {
- it('calcFontSize', function () {
- expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
- expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
- expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
+ describe('Calculate font size of input number passed', function () {
+ it('calcFontSize', function () {
+ expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
+ expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
+ expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
+ });
});
- });
- describe('Remove the slashes', function () {
- it('it will remove the slashes', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('/')
- ).toEqual({
- 'slashLocations': '0',
- 'title': '',
+ describe('Remove the slashes', function () {
+ it('it will remove the slashes', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('/')
+ ).toEqual({
+ 'slashLocations': '0',
+ 'title': '',
+ });
});
- });
- it('it will remove if slashes are present', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('my/test')
- ).toEqual({
- 'slashLocations': '2',
- 'title': 'mytest',
+ it('it will remove if slashes are present', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('my/test')
+ ).toEqual({
+ 'slashLocations': '2',
+ 'title': 'mytest',
+ });
});
- });
- it('it will remove all the slashes are present', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('my/test/value')
- ).toEqual({
- 'slashLocations': '2,7',
- 'title': 'mytestvalue',
+ it('it will remove all the slashes are present', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('my/test/value')
+ ).toEqual({
+ 'slashLocations': '2,7',
+ 'title': 'mytestvalue',
+ });
});
- });
- it('it will remove all the slashes are present', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('a/bb/ccc/dddd/eeeee')
- ).toEqual({
- 'slashLocations': '1,4,8,13',
- 'title': 'abbcccddddeeeee',
+ it('it will remove all the slashes are present', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('a/bb/ccc/dddd/eeeee')
+ ).toEqual({
+ 'slashLocations': '1,4,8,13',
+ 'title': 'abbcccddddeeeee',
+ });
});
- });
- it('it will not remove if slash is not present', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('mytest')
- ).toEqual({
- 'slashLocations': '',
- 'title': 'mytest',
+ it('it will not remove if slash is not present', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('mytest')
+ ).toEqual({
+ 'slashLocations': '',
+ 'title': 'mytest',
+ });
});
- });
- it('it will not remove if value is not present', function () {
- expect(
- SqlEditorUtils.removeSlashInTheString('')
- ).toEqual({
- 'slashLocations': '',
- 'title': '',
+ it('it will not remove if value is not present', function () {
+ expect(
+ SqlEditorUtils.removeSlashInTheString('')
+ ).toEqual({
+ 'slashLocations': '',
+ 'title': '',
+ });
});
});
});
});
-});
diff --git a/web/regression/javascript/tree/pgadmin_tree_state_save_spec.js b/web/regression/javascript/tree/pgadmin_tree_state_save_spec.js
index 113f9cbd..9d6065a5 100644
--- a/web/regression/javascript/tree/pgadmin_tree_state_save_spec.js
+++ b/web/regression/javascript/tree/pgadmin_tree_state_save_spec.js
@@ -12,6 +12,7 @@ import {pgBrowser, browserTreeState} from '../../../pgadmin/static/js/tree/pgadm
describe('#browserTreeState', () => {
beforeEach(() => {
+
pgBrowser.Nodes = {
server_group: {
_type: 'server_group',
@@ -192,10 +193,9 @@ describe('#browserTreeState', () => {
expect(browserTreeState.current_state, {1: {'paths': ['server_group/1,server/1,coll_database/1','database/10']}});
});
});
- });
- describe('When node is closed, node should get removed from the tree state cache', () => {
+
describe('When coll_database node is closed, both database and coll_database should be removed', () => {
let item = {
_type: 'coll_database',
@@ -212,6 +212,7 @@ describe('#browserTreeState', () => {
});
it('The tree current state will remove coll_database and database', () => {
+ browserTreeState.update_cache(item);
browserTreeState.remove_from_cache(item);
expect(browserTreeState.current_state, {1: {'paths': ['server_group/1,server/1']}});
});
diff --git a/web/webpack.config.js b/web/webpack.config.js
index d188528c..33227558 100644
--- a/web/webpack.config.js
+++ b/web/webpack.config.js
@@ -18,37 +18,15 @@ const sourceDir = __dirname + '/pgadmin/static';
const webpackShimConfig = require('./webpack.shim');
const PRODUCTION = process.env.NODE_ENV === 'production';
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-const extractStyle = new ExtractTextPlugin({
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const extractStyle = new MiniCssExtractPlugin({
filename: '[name].css',
allChunks: true,
});
const envType = PRODUCTION ? 'production': 'development';
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
-// Extract vendor related libraries(node_modules/lib/lib.js) from bundles
-// specified in `chunks` into vendor.js bundle
-const vendorChunks = new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- chunks: ['app.bundle', 'sqleditor', 'codemirror', 'debugger_direct'],
- filename: 'vendor.js',
- minChunks: function(module) {
- return webpackShimConfig.isExternal(module);
- },
-});
-
-// Extract pgAdmin common libraries(pgadmin/web/module/filename.js) from bundles
-// specified in `chunks` into pgadmin_commons.js bundle.
-// pgLibs holds files that will be moved into this bundle.
-const pgAdminCommonChunks = new webpack.optimize.CommonsChunkPlugin({
- name: 'pgadmin_commons',
- chunks: ['app.bundle', 'sqleditor', 'codemirror', 'debugger_direct'],
- filename: 'pgadmin_commons.js',
- minChunks: function(module) {
- return webpackShimConfig.isPgAdminLib(module);
- },
-});
-
// Expose libraries in app context so they need not to
// require('libname') when used in a module
const providePlugin = new webpack.ProvidePlugin({
@@ -64,17 +42,6 @@ const providePlugin = new webpack.ProvidePlugin({
'window.moment':'moment',
});
-// Minify and omptimize JS/CSS to reduce bundle size. It is used in production
-const uglifyPlugin = new webpack.optimize.UglifyJsPlugin({
- output: {comments: false},
- compress: {
- warnings: false,
- unused: true,
- dead_code: true,
- drop_console: true,
- },
-});
-
// Optimize CSS Assets by removing comments while bundling
const optimizeAssetsPlugin = new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
@@ -83,15 +50,6 @@ const optimizeAssetsPlugin = new OptimizeCssAssetsPlugin({
canPrint: true,
});
-// Helps in minimising the `React' production bundle. Bundle only code
-// requires in production mode. React keeps the code conditional
-// based on 'NODE_ENV' variable. [used only in production]
-const definePlugin = new webpack.DefinePlugin({
- 'process.env': {
- 'NODE_ENV': JSON.stringify('production'),
- },
-});
-
// Manages the cache and stores it into 'sources/generated/.cache/
/' path
// where env = dev || prod
const hardSourceWebpackPlugin = new HardSourceWebpackPlugin({
@@ -164,6 +122,8 @@ for(let i=0; i