Update all Python and JS dependencies. Fixes #4019

This commit is contained in:
Khushboo Vashi
2019-03-14 15:11:16 +00:00
committed by Dave Page
parent c7b29d35ae
commit e4417229aa
133 changed files with 8649 additions and 8569 deletions
@@ -355,25 +355,25 @@ define([
),
dataType: 'json',
})
.done(function(res) {
if (res.success && 'connected' in res.data) {
if (res.data.connected) {
.done(function(res) {
if (res.success && 'connected' in res.data) {
if (res.data.connected) {
// Server is connected, but - the connection with the
// particular database has been lost.
pgBrowser.Events.trigger(
'pgadmin:database:connection:lost', args.item, jsonResp
);
return;
pgBrowser.Events.trigger(
'pgadmin:database:connection:lost', args.item, jsonResp
);
return;
}
}
}
// Serever was not connected, we should first try to connect
// the server.
reconnectServer();
})
.fail(function() {
reconnectServer();
});
// Serever was not connected, we should first try to connect
// the server.
reconnectServer();
})
.fail(function() {
reconnectServer();
});
return true;
}
return false;
+3 -3
View File
@@ -22,9 +22,9 @@ import {getTreeNodeHierarchyFromIdentifier} from '../tree/pgadmin_tree_node';
*/
export class Dialog {
constructor(errorAlertTitle,
dialogContainerSelector,
pgBrowser, $, alertify, DialogModel,
backform = Backform) {
dialogContainerSelector,
pgBrowser, $, alertify, DialogModel,
backform = Backform) {
this.errorAlertTitle = errorAlertTitle;
this.alertify = alertify;
this.pgBrowser = pgBrowser;
@@ -12,8 +12,8 @@ import {RestoreDialogWrapper} from '../../../tools/restore/static/js/restore_dia
export class DialogFactory {
constructor(pgBrowser, $,
alertify, DialogModel,
backform, dialogContainerSelector) {
alertify, DialogModel,
backform, dialogContainerSelector) {
this.pgBrowser = pgBrowser;
this.jquery = $;
this.alertify = alertify;
+20 -20
View File
@@ -511,7 +511,7 @@ define([
data.options = _.defaults({
disabled: evalF(field.disabled, field, this.model),
}, this.field.get('options'), this.defaults.options,
$.fn.bootstrapToggle.defaults);
$.fn.bootstrapToggle.defaults);
this.$el.html(this.template(data)).addClass(field.name);
@@ -573,8 +573,8 @@ define([
this.cleanup();
var c = this.$el
.children().first().children('.active')
.first().attr('id'),
.children().first().children('.active')
.first().attr('id'),
m = this.model,
controls = this.controls,
tmpls = this.template,
@@ -625,15 +625,15 @@ define([
function() {
self.hidden_tab = $(this).data('tabIndex');
}).on('shown.bs.tab', function() {
var self = this;
self.shown_tab = $(self).data('tabIndex');
m.trigger('pg-property-tab-changed', {
'model': m,
'shown': self.shown_tab,
'hidden': self.hidden_tab,
'tab': self,
});
var self = this;
self.shown_tab = $(self).data('tabIndex');
m.trigger('pg-property-tab-changed', {
'model': m,
'shown': self.shown_tab,
'hidden': self.hidden_tab,
'tab': self,
});
});
});
var makeActive = tabHead.find('[id="' + c + '"]').first();
@@ -1748,7 +1748,7 @@ define([
var visible = true;
ver_in_limit = (_.isUndefined(server_info) ? true :
((_.isUndefined(s.server_type) ? true :
(server_info.type in s.server_type)) &&
(server_info.type in s.server_type)) &&
(_.isUndefined(s.min_version) ? true :
(server_info.version >= s.min_version)) &&
(_.isUndefined(s.max_version) ? true :
@@ -1783,7 +1783,7 @@ define([
groups[group] = (groups[group] || []);
ver_in_limit = (_.isUndefined(server_info) ? true :
((_.isUndefined(s.server_type) ? true :
(server_info.type in s.server_type)) &&
(server_info.type in s.server_type)) &&
(_.isUndefined(s.min_version) ? true :
(server_info.version >= s.min_version)) &&
(_.isUndefined(s.max_version) ? true :
@@ -2242,7 +2242,7 @@ define([
* SQL Editor can be in different tab
*/
let browser = window.opener ?
window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
let sqlEditPreferences = browser.get_preferences_for_module('sqleditor');
@@ -2916,12 +2916,12 @@ define([
_.each(innerFields, function(fld) {
var f = new Backform.Field(
_.extend({}, {
id: fld['name'],
name: fld['name'],
control: fld['type'] == 'checkbox' ? 'checkboxWithBox' : fld['type'],
label: fld['label'],
})
_.extend({}, {
id: fld['name'],
name: fld['name'],
control: fld['type'] == 'checkbox' ? 'checkboxWithBox' : fld['type'],
label: fld['label'],
})
),
cntr = new (f.get('control')) ({
field: f,
+18 -18
View File
@@ -68,10 +68,10 @@ define([
var col_type = column.get('cell').prototype.className || 'string-cell',
comparator = this.makeComparator(column.get('name'), order,
order ?
column.sortValue() :
function(model) {
return model.cid.replace('c', '') * 1;
}, col_type);
column.sortValue() :
function(model) {
return model.cid.replace('c', '') * 1;
}, col_type);
if (Backbone.PageableCollection &&
collection instanceof Backbone.PageableCollection) {
@@ -527,9 +527,9 @@ define([
tabIndex: -1,
type: 'checkbox',
}).prop('checked', rawValue).prop('disabled', !editable).attr('data-toggle', 'toggle')
.attr('data-size', options.size).attr('data-on', options.onText).attr('data-off', options.offText)
.attr('data-width', options.width).attr('data-height', options.height)
.attr('data-onstyle', options.onColor).attr('data-offstyle', options.offColor));
.attr('data-size', options.size).attr('data-on', options.onText).attr('data-off', options.offText)
.attr('data-width', options.width).attr('data-height', options.height)
.attr('data-onstyle', options.onColor).attr('data-offstyle', options.offColor));
this.$input = this.$el.find('input[type=checkbox]').first();
@@ -633,9 +633,9 @@ define([
'<%= selected ? \'selected="selected"\' : "" %>>',
'<%- label %></option>',
].join(''),
null, {
variable: null,
}),
null, {
variable: null,
}),
initialize: function() {
Backgrid.SelectCell.prototype.initialize.apply(this, arguments);
@@ -683,7 +683,7 @@ define([
openOnEnter: false,
multiple: false,
}, self.defaults.select2,
(col.select2 || {})
(col.select2 || {})
),
selectTpl = _.template('<select <%=multiple ? "multiple" : "" %>></select>');
@@ -1409,9 +1409,9 @@ define([
var m = this.modelInUnixOffset ? moment(rawData) :
this.modelInUnixTimestamp ? moment.unix(rawData) :
this.modelInUTC ?
moment.utc(rawData, this.modelFormat, this.modelLang) :
moment(rawData, this.modelFormat, this.modelLang);
this.modelInUTC ?
moment.utc(rawData, this.modelFormat, this.modelLang) :
moment(rawData, this.modelFormat, this.modelLang);
if (this.displayInUnixOffset) return +m;
@@ -1439,9 +1439,9 @@ define([
var m = this.displayInUnixOffset ? moment(+formattedData) :
this.displayInUnixTimestamp ? moment.unix(+formattedData) :
this.displayInUTC ?
moment.utc(formattedData, this.displayFormat, this.displayLang) :
moment(formattedData, this.displayFormat, this.displayLang);
this.displayInUTC ?
moment.utc(formattedData, this.displayFormat, this.displayLang) :
moment(formattedData, this.displayFormat, this.displayLang);
if (!m || !m.isValid()) return (this.allowEmpty && formattedData === '') ? null : undefined;
@@ -1636,7 +1636,7 @@ define([
if (
_.isFunction(editable) ? !!editable.apply(column, [model]) :
!!editable
!!editable
) {
this.$el.addClass('editable');
} else {
+13 -24
View File
@@ -212,21 +212,21 @@ function keyboardShortcutsQueryTool(
queryToolActions.executeRollback(sqlEditorController);
}
} else if ((
(this.isMac() && event.metaKey) ||
(this.isMac() && event.metaKey) ||
(!this.isMac() && event.ctrlKey)
) && !event.altKey && event.shiftKey && keyCode === FWD_SLASH_KEY) {
) && !event.altKey && event.shiftKey && keyCode === FWD_SLASH_KEY) {
this._stopEventPropagation(event);
queryToolActions.commentBlockCode(sqlEditorController);
} else if ((
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
(!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
) && keyCode === FWD_SLASH_KEY) {
) && keyCode === FWD_SLASH_KEY) {
this._stopEventPropagation(event);
queryToolActions.commentLineCode(sqlEditorController);
} else if ((
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
(!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
) && keyCode === PERIOD_KEY) {
) && keyCode === PERIOD_KEY) {
this._stopEventPropagation(event);
queryToolActions.uncommentLineCode(sqlEditorController);
} else if (keyCode == ESC_KEY) {
@@ -296,22 +296,11 @@ function keyboardShortcutsQueryTool(
return panel_id;
}
module.exports = {
processEventDebugger: keyboardShortcutsDebugger,
processEventQueryTool: keyboardShortcutsQueryTool,
getInnerPanel: getInnerPanel,
validateShortcutKeys: validateShortcutKeys,
// misc functions
_stopEventPropagation: _stopEventPropagation,
isMac: isMac,
isKeyCtrlAlt: isKeyCtrlAlt,
isKeyAltShift: isKeyAltShift,
isKeyCtrlShift: isKeyCtrlShift,
isKeyCtrlAltShift: isKeyCtrlAltShift,
isAltShiftBoth: isAltShiftBoth,
isCtrlShiftBoth: isCtrlShiftBoth,
isCtrlAltBoth: isCtrlAltBoth,
shortcut_key : shortcut_key,
shortcut_title : shortcut_title,
shortcut_accesskey_title : shortcut_accesskey_title,
export {
keyboardShortcutsDebugger as processEventDebugger,
keyboardShortcutsQueryTool as processEventQueryTool,
getInnerPanel, validateShortcutKeys,
_stopEventPropagation, isMac, isKeyCtrlAlt, isKeyAltShift, isKeyCtrlShift,
isKeyCtrlAltShift, isAltShiftBoth, isCtrlShiftBoth, isCtrlAltBoth,
shortcut_key, shortcut_title, shortcut_accesskey_title,
};
+4 -4
View File
@@ -57,17 +57,17 @@ function modifyAlertifyAnimation(pgBrowser) {
if(enableAcitreeAnimation) {
$(document).find('link#alertify-no-animation')
.attr('disabled', 'disabled');
.attr('disabled', 'disabled');
_.each(document.getElementsByTagName('iframe'), function(frame) {
$(frame.contentDocument).find('link#alertify-no-animation')
.attr('disabled', 'disabled');
.attr('disabled', 'disabled');
});
} else {
$(document).find('link#alertify-no-animation')
.removeAttr('disabled', 'disabled');
.removeAttr('disabled', 'disabled');
_.each(document.getElementsByTagName('iframe'), function(frame) {
$(frame.contentDocument).find('link#alertify-no-animation')
.removeAttr('disabled', 'disabled');
.removeAttr('disabled', 'disabled');
});
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ import JSONBigNumber from 'json-bignumber';
$('<button class=\'btn ' + button_type + ' long_text_editor pg-alertify-button\' data-label="'+label+'">' +
'<span class="fa '+ button_icon +' pg-alertify-button"></span>&nbsp;'+ label +
'</button>')
.appendTo($buttons);
.appendTo($buttons);
if (editable) {
$('<button class=\'btn btn-primary long_text_editor\' data-label="Save">'+
@@ -97,7 +97,7 @@ class ExecuteQuery {
}).catch(function (error) {
self.onExecuteHTTPError(error);
}
);
);
}
generateURLReconnectionFlag(shouldReconnect) {
+198 -198
View File
@@ -14,7 +14,7 @@ import Alertify from 'pgadmin.alertifyjs';
import pgAdmin from 'sources/pgadmin';
import Backform from 'pgadmin.backform';
import axios from 'axios';
import queryToolActions from 'sources/sqleditor/query_tool_actions';
var queryToolActions = require('sources/sqleditor/query_tool_actions');
import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
import {handleQueryToolAjaxError} from 'sources/sqleditor/query_tool_http_error_handler';
@@ -40,89 +40,89 @@ let FilterDialog = {
'Cache-Control' : 'no-cache',
},
})
.done(function (res) {
let response = res.data.result;
.done(function (res) {
let response = res.data.result;
// Check the alertify dialog already loaded then delete it to clear
// the cache
if (Alertify.filterDialog) {
delete Alertify.filterDialog;
}
// Check the alertify dialog already loaded then delete it to clear
// the cache
if (Alertify.filterDialog) {
delete Alertify.filterDialog;
}
// Create Dialog
Alertify.dialog('filterDialog', function factory() {
let $container = $('<div class=\'data_sorting_dialog\'></div>');
return {
main: function() {
this.set('title', gettext('Sort/Filter options'));
},
build: function() {
this.elements.content.appendChild($container.get(0));
Alertify.pgDialogBuild.apply(this);
},
setup: function() {
return {
buttons: [{
text: '',
key: 112,
className: 'btn btn-secondary pull-left fa fa-question pg-alertify-icon-button',
attrs: {
name: 'dialog_help',
type: 'button',
label: gettext('Help'),
url: url_for('help.static', {
'filename': 'editgrid.html',
}),
},
}, {
text: gettext('Cancel'),
key: 27,
className: 'btn btn-secondary fa fa-times pg-alertify-button',
'data-btn-name': 'cancel',
}, {
text: gettext('OK'),
className: 'btn btn-primary fa fa-check pg-alertify-button',
'data-btn-name': 'ok',
}],
// Set options for dialog
options: {
title: title,
//disable both padding and overflow control.
padding: !1,
overflow: !1,
model: 0,
resizable: true,
maximizable: true,
pinnable: false,
closableByDimmer: false,
modal: false,
autoReset: false,
},
};
},
hooks: {
// triggered when the dialog is closed
onclose: function() {
if (this.view) {
this.filterCollectionModel.stopSession();
this.view.model.stopSession();
this.view.remove({
data: true,
internal: true,
silent: true,
});
}
// Create Dialog
Alertify.dialog('filterDialog', function factory() {
let $container = $('<div class=\'data_sorting_dialog\'></div>');
return {
main: function() {
this.set('title', gettext('Sort/Filter options'));
},
},
prepare: function() {
let self = this;
$container.html('');
// Disable Ok button
this.__internal.buttons[2].element.disabled = true;
build: function() {
this.elements.content.appendChild($container.get(0));
Alertify.pgDialogBuild.apply(this);
},
setup: function() {
return {
buttons: [{
text: '',
key: 112,
className: 'btn btn-secondary pull-left fa fa-question pg-alertify-icon-button',
attrs: {
name: 'dialog_help',
type: 'button',
label: gettext('Help'),
url: url_for('help.static', {
'filename': 'editgrid.html',
}),
},
}, {
text: gettext('Cancel'),
key: 27,
className: 'btn btn-secondary fa fa-times pg-alertify-button',
'data-btn-name': 'cancel',
}, {
text: gettext('OK'),
className: 'btn btn-primary fa fa-check pg-alertify-button',
'data-btn-name': 'ok',
}],
// Set options for dialog
options: {
title: title,
//disable both padding and overflow control.
padding: !1,
overflow: !1,
model: 0,
resizable: true,
maximizable: true,
pinnable: false,
closableByDimmer: false,
modal: false,
autoReset: false,
},
};
},
hooks: {
// triggered when the dialog is closed
onclose: function() {
if (this.view) {
this.filterCollectionModel.stopSession();
this.view.model.stopSession();
this.view.remove({
data: true,
internal: true,
silent: true,
});
}
},
},
prepare: function() {
let self = this;
$container.html('');
// Disable Ok button
this.__internal.buttons[2].element.disabled = true;
// Status bar
this.statusBar = $(
'<div class=\'pg-prop-status-bar pg-el-xs-12 d-none\'>' +
// Status bar
this.statusBar = $(
'<div class=\'pg-prop-status-bar pg-el-xs-12 d-none\'>' +
' <div class="error-in-footer"> ' +
' <div class="d-flex px-2 py-1"> ' +
' <div class="pr-2"> ' +
@@ -133,144 +133,144 @@ let FilterDialog = {
' </div> ' +
'</div>').appendTo($container);
// To show progress on filter Saving/Updating on AJAX
this.showFilterProgress = $(
`<div id="show_filter_progress" class="pg-sp-container sql-editor-busy-fetching d-none">
// To show progress on filter Saving/Updating on AJAX
this.showFilterProgress = $(
`<div id="show_filter_progress" class="pg-sp-container sql-editor-busy-fetching d-none">
<div class="pg-sp-content">
<div class="row"><div class="col-12 pg-sp-icon sql-editor-busy-icon"></div></div>
<div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">${gettext('Loading data...')}</div></div>
</div>
</div>`
).appendTo($container);
$(
self.showFilterProgress[0]
).removeClass('d-none');
self.filterCollectionModel = filterDialogModel(response);
let fields = Backform.generateViewSchema(
null, self.filterCollectionModel, 'create', null, null, true
);
let view = this.view = new Backform.Dialog({
el: '<div></div>',
model: self.filterCollectionModel,
schema: fields,
});
$(this.elements.body.childNodes[0]).addClass(
'alertify_tools_dialog_properties obj_properties'
);
$container.append(view.render().$el);
// Enable/disable save button and show/hide statusbar based on session
view.listenTo(view.model, 'pgadmin-session:start', function() {
view.listenTo(view.model, 'pgadmin-session:invalid', function(msg) {
self.statusBar.removeClass('d-none');
$(self.statusBar.find('.alert-text')).html(msg);
// Disable Okay button
self.__internal.buttons[2].element.disabled = true;
});
view.listenTo(view.model, 'pgadmin-session:valid', function() {
self.statusBar.addClass('d-none');
$(self.statusBar.find('.alert-text')).html('');
// Enable Okay button
self.__internal.buttons[2].element.disabled = false;
});
});
view.listenTo(view.model, 'pgadmin-session:stop', function() {
view.stopListening(view.model, 'pgadmin-session:invalid');
view.stopListening(view.model, 'pgadmin-session:valid');
});
// Starts monitoring changes to model
view.model.startNewSession();
// Set data in collection
let viewDataSortingModel = view.model.get('data_sorting');
viewDataSortingModel.add(response['data_sorting']);
// Hide Progress ...
$(
self.showFilterProgress[0]
).addClass('d-none');
},
// Callback functions when click on the buttons of the Alertify dialogs
callback: function(e) {
let self = this;
if (e.button.element.name == 'dialog_help') {
e.cancel = true;
pgAdmin.Browser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
null, null);
return;
} else if (e.button['data-btn-name'] === 'ok') {
e.cancel = true; // Do not close dialog
let filterCollectionModel = this.filterCollectionModel.toJSON();
// Show Progress ...
$(
self.showFilterProgress[0]
).removeClass('d-none');
axios.put(
url_for('sqleditor.set_filter_data', {
'trans_id': handler.transId,
}),
filterCollectionModel
).then(function (result) {
// Hide Progress ...
self.filterCollectionModel = filterDialogModel(response);
let fields = Backform.generateViewSchema(
null, self.filterCollectionModel, 'create', null, null, true
);
let view = this.view = new Backform.Dialog({
el: '<div></div>',
model: self.filterCollectionModel,
schema: fields,
});
$(this.elements.body.childNodes[0]).addClass(
'alertify_tools_dialog_properties obj_properties'
);
$container.append(view.render().$el);
// Enable/disable save button and show/hide statusbar based on session
view.listenTo(view.model, 'pgadmin-session:start', function() {
view.listenTo(view.model, 'pgadmin-session:invalid', function(msg) {
self.statusBar.removeClass('d-none');
$(self.statusBar.find('.alert-text')).html(msg);
// Disable Okay button
self.__internal.buttons[2].element.disabled = true;
});
view.listenTo(view.model, 'pgadmin-session:valid', function() {
self.statusBar.addClass('d-none');
$(self.statusBar.find('.alert-text')).html('');
// Enable Okay button
self.__internal.buttons[2].element.disabled = false;
});
});
view.listenTo(view.model, 'pgadmin-session:stop', function() {
view.stopListening(view.model, 'pgadmin-session:invalid');
view.stopListening(view.model, 'pgadmin-session:valid');
});
// Starts monitoring changes to model
view.model.startNewSession();
// Set data in collection
let viewDataSortingModel = view.model.get('data_sorting');
viewDataSortingModel.add(response['data_sorting']);
// Hide Progress ...
$(
self.showFilterProgress[0]
).addClass('d-none');
},
// Callback functions when click on the buttons of the Alertify dialogs
callback: function(e) {
let self = this;
if (e.button.element.name == 'dialog_help') {
e.cancel = true;
pgAdmin.Browser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
null, null);
return;
} else if (e.button['data-btn-name'] === 'ok') {
e.cancel = true; // Do not close dialog
let filterCollectionModel = this.filterCollectionModel.toJSON();
// Show Progress ...
$(
self.showFilterProgress[0]
).addClass('d-none');
).removeClass('d-none');
let response = result.data.data;
axios.put(
url_for('sqleditor.set_filter_data', {
'trans_id': handler.transId,
}),
filterCollectionModel
).then(function (result) {
// Hide Progress ...
$(
self.showFilterProgress[0]
).addClass('d-none');
if (response.status) {
setTimeout(
function() {
self.close(); // Close the dialog now
Alertify.success(gettext('Filter updated successfully'));
queryToolActions.executeQuery(handler);
}, 10
);
} else {
Alertify.alert(
let response = result.data.data;
if (response.status) {
setTimeout(
function() {
self.close(); // Close the dialog now
Alertify.success(gettext('Filter updated successfully'));
queryToolActions.executeQuery(handler);
}, 10
);
} else {
Alertify.alert(
gettext('Validation Error'),
response.result
);
}
);
}
}).catch(function (error) {
}).catch(function (error) {
// Hide Progress ...
$(
self.showFilterProgress[0]
).addClass('d-none');
handler.onExecuteHTTPError(error);
$(
self.showFilterProgress[0]
).addClass('d-none');
handler.onExecuteHTTPError(error);
setTimeout(
function() {
Alertify.error(error);
}, 10
);
});
} else {
self.close();
}
},
};
setTimeout(
function() {
Alertify.error(error);
}, 10
);
});
} else {
self.close();
}
},
};
});
Alertify.filterDialog(title).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
})
.fail(function(e) {
handleQueryToolAjaxError(pgAdmin, handler, e, '_show_filter', [], true);
});
Alertify.filterDialog(title).resizeTo(pgAdmin.Browser.stdW.md,pgAdmin.Browser.stdH.md);
})
.fail(function(e) {
handleQueryToolAjaxError(pgAdmin, handler, e, '_show_filter', [], true);
});
},
};
@@ -13,7 +13,7 @@ import pgAdmin from 'sources/pgadmin';
import Backgrid from 'pgadmin.backgrid';
import Backform from 'pgadmin.backform';
let initModel = function(response) {
export default function filterDialogModel(response) {
let order_mapping = {
'asc': gettext('ASC'),
@@ -135,7 +135,4 @@ let initModel = function(response) {
let model = new FilterCollectionModel();
return model;
};
module.exports = initModel;
}
@@ -106,9 +106,9 @@ export default class QueryHistoryDetails {
`<div class='metadata'>
${itemTemplate(this.formatDate(this.entry.start_time), 'Date')}
${itemTemplate(
this.entry.row_affected.toLocaleString(),
'Rows Affected'
)}
this.entry.row_affected.toLocaleString(),
'Rows Affected'
)}
${itemTemplate(this.entry.total_time, 'Duration')}
</div>`
);
@@ -126,8 +126,8 @@ export default class QueryHistoryDetails {
this.$errMsgBlock.empty().append(
`<div class='history-error-text'>
<span>Error Message</span> ${this.parseErrorMessage(
this.entry.message
)}
this.entry.message
)}
</div>`
);
} else {
@@ -75,10 +75,10 @@ export class QueryHistoryItem {
</div>
</li>`
)
.data('entrydata', this.entry)
.on('click', e => {
this.onClickHandler($(e.currentTarget));
});
.data('entrydata', this.entry)
.on('click', e => {
this.onClickHandler($(e.currentTarget));
});
}
}
@@ -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 {
+79 -79
View File
@@ -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(
'<span id="pg_text" style="visibility: hidden;">'+ text + '</span>'
'<span id="pg_text" style="visibility: hidden;">'+ text + '</span>'
);
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;
.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);
// 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 &&
// 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
@@ -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};