mirror of https://gitee.com/bigwinds/arangodb
make number of results adjustable in AQL editor
This commit is contained in:
parent
500c270158
commit
d1b32bfcab
|
@ -163,6 +163,19 @@
|
|||
z-index: 9999 !important;
|
||||
}
|
||||
|
||||
#querySize {
|
||||
height: 20px !important;
|
||||
line-height: 20px !important;
|
||||
z-index: 9999 !important;
|
||||
border-radius: 0 !important;
|
||||
padding: 0 !important;
|
||||
margin-bottom: 0;
|
||||
border: 0 !important;
|
||||
float: left !important;
|
||||
margin-left: 50px;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.queryTH {
|
||||
width: 20% !important;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<span class="glyphicon glyphicon-cog queryTooltips" title="Edit custom queries" id="editAQL"/>
|
||||
<span class="arangoicon arango-icon-disk queryTooltips" title="Save current query" id="addAQL"/>
|
||||
<span class="arangoicon arango-icon-remove queryTooltips" title="Clear" id="clearInput"/>
|
||||
<select id="querySize"/>
|
||||
<span class="arangoicon arango-icon-comment queryTooltips" title="Comment" id="commentText"/>
|
||||
<span class="arangoicon arango-icon-redo queryTooltips" title="Redo" id="redoText"/>
|
||||
<span class="arangoicon arango-icon-undo queryTooltips" title="Undo" id="undoText"/>
|
||||
|
|
|
@ -33,6 +33,7 @@ var queryView = Backbone.View.extend({
|
|||
'keydown #new-query-name': 'listenKey',
|
||||
'change #queryModalSelect': 'updateEditSelect',
|
||||
'change #querySelect': 'importSelected',
|
||||
'change #querySize': 'changeSize',
|
||||
'keypress #aqlEditor': 'aqlShortcuts'
|
||||
},
|
||||
|
||||
|
@ -66,16 +67,17 @@ var queryView = Backbone.View.extend({
|
|||
if (e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
}
|
||||
else if (e.metaKey && !e.ctrlKey && e.keyCode === 13) {
|
||||
else if (e.metaKey && ! e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
}
|
||||
else if (e.ctrlKey && e.keyCode === 90) {
|
||||
// TODO: undo/redo seems to work even without this. check if can be removed
|
||||
this.undoText();
|
||||
}
|
||||
else if (e.ctrlKey && e.shiftKey && e.keyCode === 90) {
|
||||
this.redeText();
|
||||
// TODO: undo/redo seems to work even without this. check if can be removed
|
||||
this.redoText();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
queries: [
|
||||
|
@ -88,6 +90,20 @@ var queryView = Backbone.View.extend({
|
|||
render: function () {
|
||||
$(this.el).html(this.template.text);
|
||||
|
||||
// fill select box with # of results
|
||||
var querySize = 1000;
|
||||
if (typeof Storage) {
|
||||
if (localStorage.getItem("querySize") > 0) {
|
||||
querySize = parseInt(localStorage.getItem("querySize"), 10);
|
||||
}
|
||||
}
|
||||
|
||||
var sizeBox = $('#querySize');
|
||||
sizeBox.empty();
|
||||
[ 100, 250, 500, 1000, 2500, 5000 ].forEach(function (value) {
|
||||
sizeBox.append('<option value="' + value + '"' + (querySize === value ? ' selected' : '') + '>' + value + ' results</option>');
|
||||
});
|
||||
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.setReadOnly(true);
|
||||
outputEditor.setHighlightActiveLine(false);
|
||||
|
@ -340,6 +356,11 @@ var queryView = Backbone.View.extend({
|
|||
|
||||
this.deselect(ace.edit("aqlEditor"));
|
||||
},
|
||||
changeSize: function (e) {
|
||||
if (Storage) {
|
||||
localStorage.setItem("querySize", parseInt($('#' + e.currentTarget.id).val(), 10));
|
||||
}
|
||||
},
|
||||
renderSelectboxes: function (modal) {
|
||||
this.sortQueries();
|
||||
var selector = '';
|
||||
|
@ -446,8 +467,12 @@ var queryView = Backbone.View.extend({
|
|||
},
|
||||
submitQuery: function () {
|
||||
var self = this;
|
||||
var sizeBox = $('#querySize');
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var data = {query: inputEditor.getValue()};
|
||||
var data = {
|
||||
query: inputEditor.getValue(),
|
||||
batchSize: parseInt(sizeBox.val(), 10)
|
||||
};
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
|
||||
$.ajax({
|
||||
|
|
Loading…
Reference in New Issue