1
0
Fork 0

query editor bugfix

This commit is contained in:
hkernbach 2016-10-04 19:10:35 +02:00
parent 8cc6a5194a
commit 4936511b64
1 changed files with 13 additions and 6 deletions

View File

@ -331,6 +331,7 @@
this.toggleQueries();
}
var lastQueryName = $('#lastQueryName').html();
// backup the last query
this.state.lastQuery.query = this.aqlEditor.getValue();
this.state.lastQuery.bindParam = this.bindParamTableObj;
@ -350,10 +351,12 @@
// render a button to revert back to last query
$('#lastQuery').remove();
$('#queryContent .arangoToolbarTop .pull-left')
.append('<span id="lastQuery" class="clickable">Previous Query</span>');
if (lastQueryName !== name) {
$('#queryContent .arangoToolbarTop .pull-left')
.append('<span id="lastQuery" class="clickable">Previous Query</span>');
this.breadcrumb(name);
this.breadcrumb(name);
}
$('#lastQuery').hide().fadeIn(500)
.on('click', function () {
@ -1206,7 +1209,6 @@
addAQL: function () {
// update queries first, before showing
this.refreshAQL(true);
// render options
this.createCustomQueryModal();
setTimeout(function () {
@ -1218,14 +1220,19 @@
var content = this.aqlEditor.getValue();
var queryName = localStorage.getItem('lastOpenQuery');
var query = this.collection.findWhere({name: queryName});
if (query) {
// SET QUERY STRING
query.set('value', content);
// SET QUERY BIND PARAMS
query.set('parameter', this.bindParamTableObj);
var callback = function (error) {
if (error) {
arangoHelper.arangoError('Query', 'Could not save query');
} else {
var self = this;
arangoHelper.arangoNotification('Queries', 'Saved query ' + queryName);
arangoHelper.arangoNotification('Saved query', '"' + queryName + '"');
this.collection.fetch({
success: function () {
self.updateLocalQueries();
@ -1376,7 +1383,7 @@
window.setTimeout(function () {
if (name) {
$('#subNavigationBar .breadcrumb').html(
'Query: ' + name
'Query: <span id="lastQueryName">' + name + '</span>'
);
} else {
$('#subNavigationBar .breadcrumb').html('');