mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/ArangoDB into pipeline
This commit is contained in:
commit
f5b9f01a13
|
@ -255,6 +255,7 @@
|
||||||
);
|
);
|
||||||
if (!menu.disabled) {
|
if (!menu.disabled) {
|
||||||
$('#subNavigationBar .bottom').children().last().bind('click', function () {
|
$('#subNavigationBar .bottom').children().last().bind('click', function () {
|
||||||
|
$('#subNavigationBar .breadcrumb').html('');
|
||||||
window.App.navigate(menu.route, {trigger: true});
|
window.App.navigate(menu.route, {trigger: true});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
saveCollectionQueries: function (callback) {
|
saveCollectionQueries: function (callback) {
|
||||||
if (this.activeUser === false || this.activeUser === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.activeUser === false || this.activeUser === null) {
|
if (this.activeUser === false || this.activeUser === null) {
|
||||||
this.activeUser = 'root';
|
this.activeUser = 'root';
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<button id="toggleQueries1" class="button-primary"><i class="fa fa-star-o"></i>Queries</button>
|
<button id="toggleQueries1" class="button-primary"><i class="fa fa-star-o"></i>Queries</button>
|
||||||
<button id="toggleQueries2" class="button-primary" style="display: none"><i class="fa fa-star"></i>Queries</button>
|
<button id="toggleQueries2" class="button-primary" style="display: none"><i class="fa fa-star"></i>Queries</button>
|
||||||
<button id="saveCurrentQuery" class="button-success"><i class="fa fa-save"></i>Save</button>
|
<button id="createNewQuery" class="button-warning">New</button>
|
||||||
|
<button id="updateCurrentQuery" class="button-success" style="display: none"><i class="fa fa-save"></i>Save</button>
|
||||||
|
<button id="saveCurrentQuery" class="button-success"><i class="fa fa-save"></i>Save as</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
|
|
|
@ -262,6 +262,7 @@
|
||||||
);
|
);
|
||||||
if (!menu.disabled) {
|
if (!menu.disabled) {
|
||||||
$(self.subEl + ' .bottom').children().last().bind('click', function (elem) {
|
$(self.subEl + ' .bottom').children().last().bind('click', function (elem) {
|
||||||
|
$('#subNavigationBar .breadcrumb').html('');
|
||||||
self.activeSubMenu = menu;
|
self.activeSubMenu = menu;
|
||||||
self.renderSubView(menu, elem);
|
self.renderSubView(menu, elem);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
outputCounter: 0,
|
outputCounter: 0,
|
||||||
|
|
||||||
allowUpload: false,
|
allowUpload: false,
|
||||||
|
renderComplete: false,
|
||||||
|
|
||||||
customQueries: [],
|
customQueries: [],
|
||||||
queries: [],
|
queries: [],
|
||||||
|
@ -72,7 +73,9 @@
|
||||||
'click .outputEditorWrapper .fa-close': 'closeResult',
|
'click .outputEditorWrapper .fa-close': 'closeResult',
|
||||||
'click #toggleQueries1': 'toggleQueries',
|
'click #toggleQueries1': 'toggleQueries',
|
||||||
'click #toggleQueries2': 'toggleQueries',
|
'click #toggleQueries2': 'toggleQueries',
|
||||||
|
'click #createNewQuery': 'createAQL',
|
||||||
'click #saveCurrentQuery': 'addAQL',
|
'click #saveCurrentQuery': 'addAQL',
|
||||||
|
'click #updateCurrentQuery': 'updateAQL',
|
||||||
'click #exportQuery': 'exportCustomQueries',
|
'click #exportQuery': 'exportCustomQueries',
|
||||||
'click #importQuery': 'openImportDialog',
|
'click #importQuery': 'openImportDialog',
|
||||||
'click #removeResults': 'removeResults',
|
'click #removeResults': 'removeResults',
|
||||||
|
@ -219,11 +222,16 @@
|
||||||
this.queryPreview.setValue('No query selected.', 1);
|
this.queryPreview.setValue('No query selected.', 1);
|
||||||
this.deselect(this.queryPreview);
|
this.deselect(this.queryPreview);
|
||||||
} else {
|
} else {
|
||||||
|
$('#updateCurrentQuery').hide();
|
||||||
if (this.settings.aqlWidth === undefined) {
|
if (this.settings.aqlWidth === undefined) {
|
||||||
$('.aqlEditorWrapper').first().width($(window).width() * 0.33);
|
$('.aqlEditorWrapper').first().width($(window).width() * 0.33);
|
||||||
} else {
|
} else {
|
||||||
$('.aqlEditorWrapper').first().width(this.settings.aqlWidth);
|
$('.aqlEditorWrapper').first().width(this.settings.aqlWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage.getItem('lastOpenQuery') !== 'undefined') {
|
||||||
|
$('#updateCurrentQuery').show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.settings.aqlWidth === undefined) {
|
if (this.settings.aqlWidth === undefined) {
|
||||||
|
@ -236,7 +244,7 @@
|
||||||
|
|
||||||
var divs = [
|
var divs = [
|
||||||
'aqlEditor', 'queryTable', 'previewWrapper', 'querySpotlight',
|
'aqlEditor', 'queryTable', 'previewWrapper', 'querySpotlight',
|
||||||
'bindParamEditor', 'toggleQueries1', 'toggleQueries2',
|
'bindParamEditor', 'toggleQueries1', 'toggleQueries2', 'createNewQuery',
|
||||||
'saveCurrentQuery', 'querySize', 'executeQuery', 'switchTypes',
|
'saveCurrentQuery', 'querySize', 'executeQuery', 'switchTypes',
|
||||||
'explainQuery', 'importQuery', 'exportQuery'
|
'explainQuery', 'importQuery', 'exportQuery'
|
||||||
];
|
];
|
||||||
|
@ -318,17 +326,39 @@
|
||||||
this.fillBindParamTable(this.getCustomQueryParameterByName(name));
|
this.fillBindParamTable(this.getCustomQueryParameterByName(name));
|
||||||
this.updateBindParams();
|
this.updateBindParams();
|
||||||
|
|
||||||
|
this.currentQuery = this.collection.findWhere({name: name});
|
||||||
|
|
||||||
|
if (this.currentQuery) {
|
||||||
|
localStorage.setItem('lastOpenQuery', this.currentQuery.get('name'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#updateCurrentQuery').show();
|
||||||
|
|
||||||
// render a button to revert back to last query
|
// render a button to revert back to last query
|
||||||
$('#lastQuery').remove();
|
$('#lastQuery').remove();
|
||||||
|
|
||||||
$('#queryContent .arangoToolbarTop .pull-left')
|
$('#queryContent .arangoToolbarTop .pull-left')
|
||||||
.append('<span id="lastQuery" class="clickable">Previous Query</span>');
|
.append('<span id="lastQuery" class="clickable">Previous Query</span>');
|
||||||
|
|
||||||
|
this.breadcrumb(name);
|
||||||
|
|
||||||
$('#lastQuery').hide().fadeIn(500)
|
$('#lastQuery').hide().fadeIn(500)
|
||||||
.on('click', function () {
|
.on('click', function () {
|
||||||
|
$('#updateCurrentQuery').hide();
|
||||||
self.aqlEditor.setValue(self.state.lastQuery.query, 1);
|
self.aqlEditor.setValue(self.state.lastQuery.query, 1);
|
||||||
self.fillBindParamTable(self.state.lastQuery.bindParam);
|
self.fillBindParamTable(self.state.lastQuery.bindParam);
|
||||||
self.updateBindParams();
|
self.updateBindParams();
|
||||||
|
|
||||||
|
self.collection.each(function (model) {
|
||||||
|
model = model.toJSON();
|
||||||
|
|
||||||
|
if (model.value === self.state.lastQuery.query) {
|
||||||
|
self.breadcrumb(model.name);
|
||||||
|
} else {
|
||||||
|
self.breadcrumb();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#lastQuery').fadeOut(500, function () {
|
$('#lastQuery').fadeOut(500, function () {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
|
@ -515,6 +545,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
getCachedQueryAfterRender: function () {
|
getCachedQueryAfterRender: function () {
|
||||||
|
if (this.renderComplete === false) {
|
||||||
// get cached query if available
|
// get cached query if available
|
||||||
var queryObject = this.getCachedQuery();
|
var queryObject = this.getCachedQuery();
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -522,6 +553,19 @@
|
||||||
if (queryObject !== null && queryObject !== undefined && queryObject !== '') {
|
if (queryObject !== null && queryObject !== undefined && queryObject !== '') {
|
||||||
this.aqlEditor.setValue(queryObject.query, 1);
|
this.aqlEditor.setValue(queryObject.query, 1);
|
||||||
|
|
||||||
|
var queryName = localStorage.getItem('lastOpenQuery');
|
||||||
|
|
||||||
|
if (queryName !== undefined && queryName !== 'undefined') {
|
||||||
|
try {
|
||||||
|
var query = this.collection.findWhere({name: queryName}).toJSON();
|
||||||
|
if (query.value === queryObject.query) {
|
||||||
|
self.breadcrumb(queryName);
|
||||||
|
$('#updateCurrentQuery').show();
|
||||||
|
}
|
||||||
|
} catch (ignore) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// reset undo history for initial text value
|
// reset undo history for initial text value
|
||||||
this.aqlEditor.getSession().setUndoManager(new ace.UndoManager());
|
this.aqlEditor.getSession().setUndoManager(new ace.UndoManager());
|
||||||
|
|
||||||
|
@ -541,6 +585,8 @@
|
||||||
} catch (ignore) {}
|
} catch (ignore) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.renderComplete = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getCachedQuery: function () {
|
getCachedQuery: function () {
|
||||||
|
@ -612,7 +658,6 @@
|
||||||
this.fillSelectBoxes();
|
this.fillSelectBoxes();
|
||||||
this.makeResizeable();
|
this.makeResizeable();
|
||||||
this.initQueryImport();
|
this.initQueryImport();
|
||||||
this.getCachedQueryAfterRender();
|
|
||||||
|
|
||||||
// set height of editor wrapper
|
// set height of editor wrapper
|
||||||
$('.inputEditorWrapper').height($(window).height() / 10 * 5 + 25);
|
$('.inputEditorWrapper').height($(window).height() / 10 * 5 + 25);
|
||||||
|
@ -1119,6 +1164,41 @@
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateAQL: function () {
|
||||||
|
var content = this.aqlEditor.getValue();
|
||||||
|
var queryName = localStorage.getItem('lastOpenQuery');
|
||||||
|
var query = this.collection.findWhere({name: queryName});
|
||||||
|
if (query) {
|
||||||
|
query.set('value', content);
|
||||||
|
var callback = function (error) {
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError('Query', 'Could not save query');
|
||||||
|
} else {
|
||||||
|
var self = this;
|
||||||
|
arangoHelper.arangoNotification('Queries', 'Saved query ' + queryName);
|
||||||
|
this.collection.fetch({
|
||||||
|
success: function () {
|
||||||
|
self.updateLocalQueries();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
this.collection.saveCollectionQueries(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refreshAQL(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
createAQL: function () {
|
||||||
|
localStorage.setItem('lastOpenQuery', undefined);
|
||||||
|
this.aqlEditor.setValue('');
|
||||||
|
|
||||||
|
this.refreshAQL(true);
|
||||||
|
|
||||||
|
this.breadcrumb();
|
||||||
|
$('#updateCurrentQuery').hide();
|
||||||
|
},
|
||||||
|
|
||||||
createCustomQueryModal: function () {
|
createCustomQueryModal: function () {
|
||||||
var buttons = [];
|
var buttons = [];
|
||||||
var tableContent = [];
|
var tableContent = [];
|
||||||
|
@ -1231,6 +1311,9 @@
|
||||||
this.collection.fetch({
|
this.collection.fetch({
|
||||||
success: function () {
|
success: function () {
|
||||||
self.updateLocalQueries();
|
self.updateLocalQueries();
|
||||||
|
$('#updateCurrentQuery').show();
|
||||||
|
|
||||||
|
self.breadcrumb(saveName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1239,6 +1322,18 @@
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
breadcrumb: function (name) {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
if (name) {
|
||||||
|
$('#subNavigationBar .breadcrumb').html(
|
||||||
|
'Query: ' + name
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$('#subNavigationBar .breadcrumb').html('');
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
},
|
||||||
|
|
||||||
verifyQueryAndParams: function () {
|
verifyQueryAndParams: function () {
|
||||||
var quit = false;
|
var quit = false;
|
||||||
|
|
||||||
|
@ -1861,6 +1956,8 @@
|
||||||
|
|
||||||
this.collection.fetch({
|
this.collection.fetch({
|
||||||
success: function () {
|
success: function () {
|
||||||
|
self.getCachedQueryAfterRender();
|
||||||
|
|
||||||
// old storage method
|
// old storage method
|
||||||
var item = localStorage.getItem('customQueries');
|
var item = localStorage.getItem('customQueries');
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|
|
@ -53,6 +53,10 @@
|
||||||
font-weight: 100;
|
font-weight: 100;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
|
&.toolbarText {
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
&.clickable {
|
&.clickable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
|
Loading…
Reference in New Issue