mirror of https://gitee.com/bigwinds/arangodb
new query view
This commit is contained in:
parent
874ae123f6
commit
335b638670
|
@ -146,6 +146,12 @@
|
|||
content: [{
|
||||
label: "Submit",
|
||||
letter: "Ctrl + Return"
|
||||
},{
|
||||
label: "Explain Query",
|
||||
letter: "Ctrl + Shift + E"
|
||||
},{
|
||||
label: "Save Query",
|
||||
letter: "Ctrl + Shift + S"
|
||||
},{
|
||||
label: "Toggle comments",
|
||||
letter: "Ctrl + Shift + C"
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -5708,7 +5708,6 @@ div.headerBar {
|
|||
.modal-body .tab-content #appstore {
|
||||
max-height: 290px; }
|
||||
.modal-body .errorMessage {
|
||||
background-color: #fff;
|
||||
color: #da4f49;
|
||||
font-size: 9pt;
|
||||
font-weight: 400;
|
||||
|
|
Binary file not shown.
|
@ -10496,6 +10496,12 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
|
|||
content: [{
|
||||
label: "Submit",
|
||||
letter: "Ctrl + Return"
|
||||
},{
|
||||
label: "Explain Query",
|
||||
letter: "Ctrl + Shift + E"
|
||||
},{
|
||||
label: "Save Query",
|
||||
letter: "Ctrl + Shift + S"
|
||||
},{
|
||||
label: "Toggle comments",
|
||||
letter: "Ctrl + Shift + C"
|
||||
|
@ -27611,6 +27617,8 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
outputTemplate: templateEngine.createTemplate("queryViewOutput.ejs"),
|
||||
outputCounter: 0,
|
||||
|
||||
allowUpload: false,
|
||||
|
||||
customQueries: [],
|
||||
queries: [],
|
||||
|
||||
|
@ -27650,10 +27658,19 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
"click .outputEditorWrapper .fa-close": "closeResult",
|
||||
"click #toggleQueries1": "toggleQueries",
|
||||
"click #toggleQueries2": "toggleQueries",
|
||||
"click #saveCurrentQuery": "addAQL",
|
||||
"click #exportQuery": "exportCustomQueries",
|
||||
"click #importQuery": "openImportDialog",
|
||||
"click #removeResults": "removeResults",
|
||||
"click #deleteQuery": "selectAndDeleteQueryFromTable",
|
||||
"click #explQuery": "selectAndExplainQueryFromTable",
|
||||
"keyup #arangoBindParamTable input": "updateBindParams",
|
||||
"change #arangoBindParamTable input": "updateBindParams",
|
||||
"click #arangoMyQueriesTable tr" : "showQueryPreview",
|
||||
"dblclick #arangoMyQueriesTable tr" : "selectQueryFromTable",
|
||||
"click #arangoMyQueriesTable #copyQuery" : "selectQueryFromTable",
|
||||
'click #closeQueryModal': 'closeExportDialog',
|
||||
'click #confirmQueryImport': 'importCustomQueries',
|
||||
"click #arangoMyQueriesTable #runQuery" : "selectAndRunQueryFromTable"
|
||||
},
|
||||
|
||||
|
@ -27661,12 +27678,78 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.aqlEditor.setValue('');
|
||||
},
|
||||
|
||||
initQueryImport: function () {
|
||||
var self = this;
|
||||
self.allowUpload = false;
|
||||
$('#importQueries').change(function(e) {
|
||||
self.files = e.target.files || e.dataTransfer.files;
|
||||
self.file = self.files[0];
|
||||
|
||||
self.allowUpload = true;
|
||||
$('#confirmQueryImport').removeClass('disabled');
|
||||
});
|
||||
},
|
||||
|
||||
importCustomQueries: function () {
|
||||
var self = this;
|
||||
if (this.allowUpload === true) {
|
||||
|
||||
var callback = function() {
|
||||
this.collection.fetch({
|
||||
success: function() {
|
||||
self.updateLocalQueries();
|
||||
self.updateQueryTable();
|
||||
self.resize();
|
||||
self.allowUpload = false;
|
||||
$('#confirmQueryImport').addClass('disabled');
|
||||
$('#queryImportDialog').modal('hide');
|
||||
},
|
||||
error: function(data) {
|
||||
arangoHelper.arangoError("Custom Queries", data.responseText);
|
||||
}
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
self.collection.saveImportQueries(self.file, callback.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
removeResults: function() {
|
||||
$('.outputEditorWrapper').hide('fast', function() {
|
||||
$('.outputEditorWrapper').remove();
|
||||
});
|
||||
$('#removeResults').hide();
|
||||
},
|
||||
|
||||
getCustomQueryParameterByName: function (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("parameter");
|
||||
},
|
||||
|
||||
getCustomQueryValueByName: function (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("value");
|
||||
if (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("value");
|
||||
}
|
||||
},
|
||||
|
||||
openImportDialog: function() {
|
||||
$('#queryImportDialog').modal('show');
|
||||
},
|
||||
|
||||
closeImportDialog: function() {
|
||||
$('#queryImportDialog').modal('hide');
|
||||
},
|
||||
|
||||
exportCustomQueries: function () {
|
||||
var name;
|
||||
|
||||
$.ajax("whoAmI?_=" + Date.now()).success(function(data) {
|
||||
name = data.user;
|
||||
|
||||
if (name === null || name === false) {
|
||||
name = "root";
|
||||
}
|
||||
window.open("query/download/" + encodeURIComponent(name));
|
||||
});
|
||||
},
|
||||
|
||||
toggleQueries: function(e) {
|
||||
|
@ -27681,7 +27764,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
"aqlEditor", "queryTable", "previewWrapper",
|
||||
"bindParamEditor", "toggleQueries1", "toggleQueries2",
|
||||
"saveCurrentQuery", "querySize", "executeQuery",
|
||||
"explainQuery", "clearQuery"
|
||||
"explainQuery", "clearQuery", "importQuery", "exportQuery"
|
||||
];
|
||||
_.each(divs, function(div) {
|
||||
$("#" + div).toggle();
|
||||
|
@ -27693,19 +27776,64 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
$('#arangoMyQueriesTable tr').removeClass('selected');
|
||||
$(e.currentTarget).addClass('selected');
|
||||
|
||||
var name = $(e.currentTarget).children().first().text();
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
this.queryPreview.setValue(this.getCustomQueryValueByName(name));
|
||||
this.deselect(this.queryPreview);
|
||||
},
|
||||
|
||||
getQueryNameFromTable: function(e) {
|
||||
var name;
|
||||
if ($(e.currentTarget).is('tr')) {
|
||||
name = $(e.currentTarget).children().first().text();
|
||||
}
|
||||
else if ($(e.currentTarget).is('span')) {
|
||||
name = $(e.currentTarget).parent().parent().prev().text();
|
||||
}
|
||||
return name;
|
||||
},
|
||||
|
||||
deleteQueryModal: function(name){
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createReadOnlyEntry(
|
||||
undefined,
|
||||
name,
|
||||
'Do you want to delete the query?',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
undefined
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createDeleteButton('Delete', this.deleteAQL.bind(this, name))
|
||||
);
|
||||
window.modalView.show(
|
||||
'modalTable.ejs', 'Delete Query', buttons, tableContent
|
||||
);
|
||||
},
|
||||
|
||||
selectAndDeleteQueryFromTable: function(e) {
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
this.deleteQueryModal(name);
|
||||
},
|
||||
|
||||
selectAndExplainQueryFromTable: function(e) {
|
||||
this.selectQueryFromTable(e, false);
|
||||
this.explainQuery();
|
||||
},
|
||||
|
||||
selectAndRunQueryFromTable: function(e) {
|
||||
this.selectQueryFromTable(e);
|
||||
this.selectQueryFromTable(e, false);
|
||||
this.executeQuery();
|
||||
},
|
||||
|
||||
selectQueryFromTable: function(e) {
|
||||
var name = $(e.currentTarget).parent().parent().prev().text();
|
||||
this.toggleQueries();
|
||||
selectQueryFromTable: function(e, toggle) {
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
|
||||
if (toggle === undefined) {
|
||||
this.toggleQueries();
|
||||
}
|
||||
|
||||
this.aqlEditor.setValue(this.getCustomQueryValueByName(name));
|
||||
this.fillBindParamTable(this.getCustomQueryParameterByName(name));
|
||||
|
@ -27713,6 +27841,25 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.deselect(this.aqlEditor);
|
||||
},
|
||||
|
||||
deleteAQL: function (name) {
|
||||
var callbackRemove = function(error) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Query", "Could not delete query.");
|
||||
}
|
||||
else {
|
||||
this.updateLocalQueries();
|
||||
this.updateQueryTable();
|
||||
this.resize();
|
||||
window.modalView.hide();
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
var toDelete = this.collection.findWhere({name: name});
|
||||
|
||||
this.collection.remove(toDelete);
|
||||
this.collection.saveCollectionQueries(callbackRemove);
|
||||
},
|
||||
|
||||
switchAce: function(e) {
|
||||
var count = $(e.currentTarget).attr('counter');
|
||||
|
||||
|
@ -27818,8 +27965,8 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
self.deselect(outputEditor);
|
||||
$.noty.clearQueue();
|
||||
$.noty.closeAll();
|
||||
self.handleResult(counter);
|
||||
}
|
||||
window.progressView.hide();
|
||||
},
|
||||
error: function (data) {
|
||||
window.progressView.hide();
|
||||
|
@ -27830,7 +27977,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
catch (e) {
|
||||
arangoHelper.arangoError("Explain error", "ERROR");
|
||||
}
|
||||
window.progressView.hide();
|
||||
self.handleResult(counter);
|
||||
this.removeOutputEditor(counter);
|
||||
}
|
||||
});
|
||||
|
@ -27890,6 +28037,9 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
var target = $("#" + $(e.currentTarget).attr('element')).parent();
|
||||
$(target).hide('fast', function() {
|
||||
$(target).remove();
|
||||
if ($('.outputEditorWrapper').length === 0) {
|
||||
$('#removeResults').hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -27921,12 +28071,14 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.getCachedQueryAfterRender();
|
||||
this.fillSelectBoxes();
|
||||
this.makeResizeable();
|
||||
this.initQueryImport();
|
||||
|
||||
//set height of editor wrapper
|
||||
$('.inputEditorWrapper').height($(window).height() / 10 * 3);
|
||||
window.setTimeout(function() {
|
||||
self.resize();
|
||||
}, 10);
|
||||
self.deselect(self.aqlEditor);
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
|
@ -27984,6 +28136,24 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.$(this.myQueriesId).html(this.table.render({content: this.myQueriesTableDesc}));
|
||||
},
|
||||
|
||||
checkType: function(val) {
|
||||
var type = "stringtype";
|
||||
|
||||
try {
|
||||
val = JSON.parse(val);
|
||||
if (val instanceof Array) {
|
||||
type = 'arraytype';
|
||||
}
|
||||
else {
|
||||
type = typeof val + 'type';
|
||||
}
|
||||
}
|
||||
catch(ignore) {
|
||||
}
|
||||
|
||||
return type;
|
||||
},
|
||||
|
||||
updateBindParams: function(e) {
|
||||
|
||||
var id, self = this;
|
||||
|
@ -27992,6 +28162,14 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
id = $(e.currentTarget).attr("name");
|
||||
//this.bindParamTableObj[id] = $(e.currentTarget).val();
|
||||
this.bindParamTableObj[id] = arangoHelper.parseInput(e.currentTarget);
|
||||
|
||||
var types = [
|
||||
"arraytype", "objecttype", "booleantype", "numbertype", "stringtype"
|
||||
];
|
||||
_.each(types, function(type) {
|
||||
$(e.currentTarget).removeClass(type);
|
||||
});
|
||||
$(e.currentTarget).addClass(self.checkType($(e.currentTarget).val()));
|
||||
}
|
||||
else {
|
||||
_.each($('#arangoBindParamTable input'), function(element) {
|
||||
|
@ -28060,7 +28238,15 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
counter ++;
|
||||
_.each($('#arangoBindParamTable input'), function(element) {
|
||||
if ($(element).attr('name') === key) {
|
||||
$(element).val(val);
|
||||
if (val instanceof Array) {
|
||||
$(element).val(JSON.stringify(val)).addClass('arraytype');
|
||||
}
|
||||
else if (typeof val === 'object') {
|
||||
$(element).val(JSON.stringify(val)).addClass(typeof val + 'type');
|
||||
}
|
||||
else {
|
||||
$(element).val(val).addClass(typeof val + 'type');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -28100,6 +28286,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
}
|
||||
self.resize();
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
|
||||
|
@ -28109,6 +28296,29 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "executeQuery",
|
||||
bindKey: {win: "Ctrl-Return", mac: "Command-Return", linux: "Ctrl-Return"},
|
||||
exec: function() {
|
||||
self.executeQuery();
|
||||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "saveQuery",
|
||||
bindKey: {win: "Ctrl-Shift-S", mac: "Command-Shift-S", linux: "Ctrl-Shift-S"},
|
||||
exec: function() {
|
||||
self.addAQL();
|
||||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "explainQuery",
|
||||
bindKey: {win: "Ctrl-Shift-E", mac: "Command-Shift-E", linux: "Ctrl-Shift-E"},
|
||||
exec: function() {
|
||||
self.explainQuery();
|
||||
}
|
||||
});
|
||||
|
||||
this.queryPreview = ace.edit("queryPreview");
|
||||
this.queryPreview.getSession().setMode("ace/mode/aql");
|
||||
|
@ -28124,9 +28334,10 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
|
||||
_.each(this.myQueriesTableDesc.rows, function(k) {
|
||||
k.thirdRow = '<span class="spanWrapper">' +
|
||||
'<span id="deleteQuery" title="Delete query"><i class="fa fa-minus-circle"></i></span>' +
|
||||
'<span id="copyQuery" title="Copy query"><i class="fa fa-copy"></i></span>' +
|
||||
'<span id="explQuery" title="Explain query"><i class="fa fa-comments"></i></i></span>' +
|
||||
'<span id="runQuery" title="Run query"><i class="fa fa-play-circle-o"></i></i></span>' +
|
||||
'<span id="deleteQuery" title="Delete query"><i class="fa fa-minus-circle"></i></span>' +
|
||||
'</span>';
|
||||
if (k.hasOwnProperty('parameter')) {
|
||||
delete k.parameter;
|
||||
|
@ -28140,6 +28351,49 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.$(this.myQueriesId).html(this.table.render({content: this.myQueriesTableDesc}));
|
||||
},
|
||||
|
||||
listenKey: function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.saveAQL(e);
|
||||
}
|
||||
this.checkSaveName();
|
||||
},
|
||||
|
||||
addAQL: function () {
|
||||
//update queries first, before showing
|
||||
this.refreshAQL(true);
|
||||
|
||||
//render options
|
||||
this.createCustomQueryModal();
|
||||
setTimeout(function () {
|
||||
$('#new-query-name').focus();
|
||||
}, 500);
|
||||
},
|
||||
|
||||
createCustomQueryModal: function(){
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createTextEntry(
|
||||
'new-query-name',
|
||||
'Name',
|
||||
'',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
[
|
||||
{
|
||||
rule: Joi.string().required(),
|
||||
msg: "No query name given."
|
||||
}
|
||||
]
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createSuccessButton('Save', this.saveAQL.bind(this))
|
||||
);
|
||||
window.modalView.show('modalTable.ejs', 'Save Query', buttons, tableContent, undefined, undefined,
|
||||
{'keyup #new-query-name' : this.listenKey.bind(this)});
|
||||
},
|
||||
|
||||
checkSaveName: function() {
|
||||
var saveName = $('#new-query-name').val();
|
||||
if ( saveName === "Insert Query"){
|
||||
|
@ -28152,11 +28406,12 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
var found = this.customQueries.some(function(query){
|
||||
return query.name === saveName;
|
||||
});
|
||||
if(found){
|
||||
if (found) {
|
||||
$('#modalButton1').removeClass('button-success');
|
||||
$('#modalButton1').addClass('button-warning');
|
||||
$('#modalButton1').text('Update');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$('#modalButton1').removeClass('button-warning');
|
||||
$('#modalButton1').addClass('button-success');
|
||||
$('#modalButton1').text('Save');
|
||||
|
@ -28169,9 +28424,8 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
//update queries first, before writing
|
||||
this.refreshAQL();
|
||||
|
||||
var varsEditor = ace.edit("varsEditor"),
|
||||
saveName = $('#new-query-name').val(),
|
||||
bindVars = varsEditor.getValue();
|
||||
var saveName = $('#new-query-name').val(),
|
||||
bindVars = this.bindParamTableObj;
|
||||
|
||||
if ($('#new-query-name').hasClass('invalid-input')) {
|
||||
return;
|
||||
|
@ -28227,8 +28481,6 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.collection.fetch({
|
||||
success: function() {
|
||||
self.updateLocalQueries();
|
||||
self.renderSelectboxes();
|
||||
$('#querySelect').val(saveName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -28257,6 +28509,8 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
sentQueryEditor.getSession().setMode("ace/mode/aql");
|
||||
outputEditor.getSession().setMode("ace/mode/json");
|
||||
outputEditor.setReadOnly(true);
|
||||
outputEditor.setFontSize("13px");
|
||||
sentQueryEditor.setFontSize("13px");
|
||||
sentQueryEditor.setReadOnly(true);
|
||||
|
||||
this.fillResult(outputEditor, sentQueryEditor, counter);
|
||||
|
@ -28313,6 +28567,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
}
|
||||
$.noty.clearQueue();
|
||||
$.noty.closeAll();
|
||||
self.handleResult(counter);
|
||||
},
|
||||
error: function (data) {
|
||||
try {
|
||||
|
@ -28323,12 +28578,22 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
outputEditor.setValue('ERROR');
|
||||
arangoHelper.arangoError("Query error", "ERROR");
|
||||
}
|
||||
window.progressView.hide();
|
||||
self.handleResult(counter);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleResult: function(counter) {
|
||||
window.progressView.hide();
|
||||
$('#removeResults').show();
|
||||
|
||||
//TODO animate not sure
|
||||
//$('html,body').animate({
|
||||
// scrollTop: $('#outputEditorWrapper' + counter).offset().top - 120
|
||||
//}, 500);
|
||||
},
|
||||
|
||||
setEditorAutoHeight: function (editor) {
|
||||
editor.setOptions({
|
||||
maxLines: Infinity
|
||||
|
@ -28367,6 +28632,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
window.clearTimeout(self.checkQueryTimer);
|
||||
arangoHelper.arangoNotification("Query", "Query canceled.");
|
||||
window.progressView.hide();
|
||||
//TODO REMOVE OUTPUT BOX
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -28429,12 +28695,23 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
try {
|
||||
var error = JSON.parse(resp.responseText);
|
||||
if (error.errorMessage) {
|
||||
arangoHelper.arangoError("Query", error.errorMessage);
|
||||
if (error.errorMessage.match(/\d+:\d+/g) !== null) {
|
||||
self.markPositionError(
|
||||
error.errorMessage.match(/'.*'/g)[0],
|
||||
error.errorMessage.match(/\d+:\d+/g)[0]
|
||||
);
|
||||
arangoHelper.arangoError("Query", error.errorMessage);
|
||||
}
|
||||
else {
|
||||
console.log(resp);
|
||||
}
|
||||
self.removeOutputEditor(counter);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
arangoHelper.arangoError("Query", "Something went wrong.");
|
||||
self.removeOutputEditor(counter);
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
window.progressView.hide();
|
||||
|
@ -28444,6 +28721,19 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
checkQueryStatus();
|
||||
},
|
||||
|
||||
markPositionError: function(text, pos) {
|
||||
var row = pos.split(":")[0],
|
||||
line = pos.split(":")[1];
|
||||
text = text.substr(1, text.length - 2);
|
||||
|
||||
this.aqlEditor.find(text);
|
||||
|
||||
window.setTimeout(function() {
|
||||
$('.ace_start').first().css('background', 'rgba(255, 129, 129, 0.7)');
|
||||
}, 100);
|
||||
|
||||
},
|
||||
|
||||
refreshAQL: function() {
|
||||
var self = this;
|
||||
|
||||
|
@ -28453,6 +28743,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
}
|
||||
else {
|
||||
self.updateLocalQueries();
|
||||
self.updateQueryTable();
|
||||
}
|
||||
}.bind(self);
|
||||
|
||||
|
|
Binary file not shown.
|
@ -2483,6 +2483,57 @@ if (list.length > 0) {
|
|||
|
||||
</div>
|
||||
|
||||
</div></script><script id="queryView2.ejs" type="text/template"><div class="headerBar">
|
||||
<a class="arangoHeader">AQL Editor 2</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="queryContent" class="queryContent">
|
||||
|
||||
<div class="arangoToolbar arangoToolbarTop">
|
||||
<div class="pull-left">
|
||||
<button id="toggleQueries1" class="button-success"><i class="fa fa-star-o"></i>Queries</button>
|
||||
<button id="toggleQueries2" class="button-success" 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>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<div class="styled-select">
|
||||
<select id="querySize" class="query-size"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputEditorWrapper">
|
||||
<div class="aqlEditorWrapper" class="arangoEditor">
|
||||
<span id="clearQuery" class="aceAction"><i class="fa fa-times-circle"></i></span>
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="queryTable" style="display: none"></div>
|
||||
</div>
|
||||
<div class="bindParamEditorWrapper" class="arangoEditor">
|
||||
<div id="bindParamEditor"></div>
|
||||
<div id="previewWrapper" class="previewWrapper" style="display: none">
|
||||
<div id="previewBar" class="previewBar">
|
||||
<span>Preview</span>
|
||||
</div>
|
||||
<div id="queryPreview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="arangoToolbar arangoToolbarBottom">
|
||||
<div class="pull-right">
|
||||
<button id="exportQuery" class="button-success query-button" style="display:none">Export Queries</button>
|
||||
<button id="importQuery" class="button-success query-button" style="display:none">Import Queries</button>
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-success query-button">Explain</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove results</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outputEditors" class="outputEditors">
|
||||
</div>
|
||||
|
||||
<div id="queryImportDialog" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
|
||||
|
@ -2519,57 +2570,7 @@ if (list.length > 0) {
|
|||
<div class="modal-footer">
|
||||
<button id="confirmQueryImport" class="button-success disabled" style="float:right">Import</button>
|
||||
<button id="closeQueryModal" class="button-close">Cancel</button>
|
||||
</div>
|
||||
|
||||
</div></script><script id="queryView2.ejs" type="text/template"><div class="headerBar">
|
||||
<a class="arangoHeader">AQL Editor 2</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="queryContent" class="queryContent">
|
||||
|
||||
<div class="arangoToolbar arangoToolbarTop">
|
||||
<div class="pull-left">
|
||||
<button id="toggleQueries1" class="button-success"><i class="fa fa-star-o"></i>Queries</button>
|
||||
<button id="toggleQueries2" class="button-success" 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>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<div class="styled-select">
|
||||
<select id="querySize" class="query-size"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputEditorWrapper">
|
||||
<div class="aqlEditorWrapper" class="arangoEditor">
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="queryTable" style="display: none"></div>
|
||||
</div>
|
||||
<div class="bindParamEditorWrapper" class="arangoEditor">
|
||||
<div id="bindParamEditor"></div>
|
||||
<div id="previewWrapper" class="previewWrapper" style="display: none">
|
||||
<div id="previewBar" class="previewBar">
|
||||
<span>Preview</span>
|
||||
</div>
|
||||
<div id="queryPreview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="arangoToolbar arangoToolbarBottom">
|
||||
<div class="pull-right">
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-success query-button">Explain</button>
|
||||
<button id="clearQuery" class="button-close query-button">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outputEditors" class="outputEditors">
|
||||
</div></script><script id="queryViewOutput.ejs" type="text/template"><div id="outputEditorWrapper<%= counter %>" class="outputEditorWrapper">
|
||||
</div></script><script id="queryViewOutput.ejs" type="text/template"><div id="outputEditorWrapper<%= counter %>" class="outputEditorWrapper">
|
||||
<div class="arangoToolbar arangoToolbarTop">
|
||||
<div class="pull-left">
|
||||
<span class="toolbarType"><%=type%></span>
|
||||
|
@ -2597,6 +2598,8 @@ if (list.length > 0) {
|
|||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></script><script id="shellView.ejs" type="text/template"><div class="headerBar">
|
||||
<a class="arangoHeader">JS Shell</a>
|
||||
</div>
|
||||
|
|
Binary file not shown.
|
@ -2670,6 +2670,64 @@ if (list.length > 0) {
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script id="queryView2.ejs" type="text/template">
|
||||
|
||||
<div class="headerBar">
|
||||
<a class="arangoHeader">AQL Editor 2</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="queryContent" class="queryContent">
|
||||
|
||||
<div class="arangoToolbar arangoToolbarTop">
|
||||
<div class="pull-left">
|
||||
<button id="toggleQueries1" class="button-success"><i class="fa fa-star-o"></i>Queries</button>
|
||||
<button id="toggleQueries2" class="button-success" 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>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<div class="styled-select">
|
||||
<select id="querySize" class="query-size"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputEditorWrapper">
|
||||
<div class="aqlEditorWrapper" class="arangoEditor">
|
||||
<span id="clearQuery" class="aceAction"><i class="fa fa-times-circle"></i></span>
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="queryTable" style="display: none"></div>
|
||||
</div>
|
||||
<div class="bindParamEditorWrapper" class="arangoEditor">
|
||||
<div id="bindParamEditor"></div>
|
||||
<div id="previewWrapper" class="previewWrapper" style="display: none">
|
||||
<div id="previewBar" class="previewBar">
|
||||
<span>Preview</span>
|
||||
</div>
|
||||
<div id="queryPreview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="arangoToolbar arangoToolbarBottom">
|
||||
<div class="pull-right">
|
||||
<button id="exportQuery" class="button-success query-button" style="display:none">Export Queries</button>
|
||||
<button id="importQuery" class="button-success query-button" style="display:none">Import Queries</button>
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-success query-button">Explain</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove results</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outputEditors" class="outputEditors">
|
||||
</div>
|
||||
|
||||
<div id="queryImportDialog" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
|
@ -2706,61 +2764,6 @@ if (list.length > 0) {
|
|||
<button id="closeQueryModal" class="button-close">Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
<script id="queryView2.ejs" type="text/template">
|
||||
|
||||
<div class="headerBar">
|
||||
<a class="arangoHeader">AQL Editor 2</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="queryContent" class="queryContent">
|
||||
|
||||
<div class="arangoToolbar arangoToolbarTop">
|
||||
<div class="pull-left">
|
||||
<button id="toggleQueries1" class="button-success"><i class="fa fa-star-o"></i>Queries</button>
|
||||
<button id="toggleQueries2" class="button-success" 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>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<div class="styled-select">
|
||||
<select id="querySize" class="query-size"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputEditorWrapper">
|
||||
<div class="aqlEditorWrapper" class="arangoEditor">
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="queryTable" style="display: none"></div>
|
||||
</div>
|
||||
<div class="bindParamEditorWrapper" class="arangoEditor">
|
||||
<div id="bindParamEditor"></div>
|
||||
<div id="previewWrapper" class="previewWrapper" style="display: none">
|
||||
<div id="previewBar" class="previewBar">
|
||||
<span>Preview</span>
|
||||
</div>
|
||||
<div id="queryPreview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="arangoToolbar arangoToolbarBottom">
|
||||
<div class="pull-right">
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-success query-button">Explain</button>
|
||||
<button id="clearQuery" class="button-close query-button">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="outputEditors" class="outputEditors">
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -2796,6 +2799,7 @@ if (list.length > 0) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id="shellView.ejs" type="text/template">
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -5700,7 +5700,6 @@ div.headerBar {
|
|||
.modal-body .tab-content #appstore {
|
||||
max-height: 290px; }
|
||||
.modal-body .errorMessage {
|
||||
background-color: #fff;
|
||||
color: #da4f49;
|
||||
font-size: 9pt;
|
||||
font-weight: 400;
|
||||
|
@ -6088,6 +6087,10 @@ div.headerBar {
|
|||
.arangoToolbarBottom {
|
||||
border-bottom-left-radius: 3px;
|
||||
border-bottom-right-radius: 3px; }
|
||||
.arangoToolbarBottom #executeQuery {
|
||||
margin-right: 5px; }
|
||||
.arangoToolbarBottom .button-close:last-child {
|
||||
margin-right: 10px; }
|
||||
|
||||
.dbselection {
|
||||
float: left;
|
||||
|
@ -6791,6 +6794,21 @@ toolbar {
|
|||
.inputEditorWrapper .aqlEditorWrapper {
|
||||
background: #eee;
|
||||
overflow: hidden; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper .stringtype,
|
||||
.inputEditorWrapper .aqlEditorWrapper .stringtype {
|
||||
color: black; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper .objecttype,
|
||||
.inputEditorWrapper .aqlEditorWrapper .objecttype {
|
||||
color: blue; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper .arraytype,
|
||||
.inputEditorWrapper .aqlEditorWrapper .arraytype {
|
||||
color: green; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper .numbertype,
|
||||
.inputEditorWrapper .aqlEditorWrapper .numbertype {
|
||||
color: red; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper .booleantype,
|
||||
.inputEditorWrapper .aqlEditorWrapper .booleantype {
|
||||
color: lightgreen; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table,
|
||||
.inputEditorWrapper .aqlEditorWrapper table {
|
||||
border-top: 0;
|
||||
|
@ -6810,7 +6828,9 @@ toolbar {
|
|||
.inputEditorWrapper .aqlEditorWrapper table tr.selected .spanWrapper {
|
||||
background-color: rgba(255, 255, 255, 0.65); }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table tr.selected .fa-copy,
|
||||
.inputEditorWrapper .aqlEditorWrapper table tr.selected .fa-copy {
|
||||
.inputEditorWrapper .bindParamEditorWrapper table tr.selected .fa-comments,
|
||||
.inputEditorWrapper .aqlEditorWrapper table tr.selected .fa-copy,
|
||||
.inputEditorWrapper .aqlEditorWrapper table tr.selected .fa-comments {
|
||||
color: #000; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table thead,
|
||||
.inputEditorWrapper .aqlEditorWrapper table thead {
|
||||
|
@ -6823,13 +6843,20 @@ toolbar {
|
|||
.inputEditorWrapper .bindParamEditorWrapper table td .spanWrapper,
|
||||
.inputEditorWrapper .aqlEditorWrapper table td .spanWrapper {
|
||||
border-radius: 3px;
|
||||
cursor: auto;
|
||||
float: right; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table td .spanWrapper:hover,
|
||||
.inputEditorWrapper .aqlEditorWrapper table td .spanWrapper:hover {
|
||||
cursor: auto; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table td .spanWrapper .fa,
|
||||
.inputEditorWrapper .aqlEditorWrapper table td .spanWrapper .fa {
|
||||
cursor: pointer;
|
||||
font-size: 18pt;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table td .spanWrapper .fa-minus-circle,
|
||||
.inputEditorWrapper .aqlEditorWrapper table td .spanWrapper .fa-minus-circle {
|
||||
margin-left: 20px; }
|
||||
.inputEditorWrapper .bindParamEditorWrapper table td .spanWrapper .fa-play-circle-o,
|
||||
.inputEditorWrapper .aqlEditorWrapper table td .spanWrapper .fa-play-circle-o {
|
||||
color: #8aa051; }
|
||||
|
@ -6851,6 +6878,30 @@ toolbar {
|
|||
.inputEditorWrapper .aqlEditorWrapper,
|
||||
.inputEditorWrapper .bindParamEditorWrapper {
|
||||
height: 100%; }
|
||||
.inputEditorWrapper .aqlEditorWrapper .selectError,
|
||||
.inputEditorWrapper .bindParamEditorWrapper .selectError {
|
||||
background: #da4f49; }
|
||||
.inputEditorWrapper .aqlEditorWrapper .aceAction,
|
||||
.inputEditorWrapper .bindParamEditorWrapper .aceAction {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
border-radius: 3px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 13pt;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
text-align: center;
|
||||
top: 10px;
|
||||
width: 33px;
|
||||
z-index: 10; }
|
||||
.inputEditorWrapper .aqlEditorWrapper .aceAction i,
|
||||
.inputEditorWrapper .bindParamEditorWrapper .aceAction i {
|
||||
margin-bottom: 3px; }
|
||||
.inputEditorWrapper .aqlEditorWrapper .aceAction:hover,
|
||||
.inputEditorWrapper .bindParamEditorWrapper .aceAction:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1; }
|
||||
.inputEditorWrapper .aqlEditorWrapper .previewWrapper,
|
||||
.inputEditorWrapper .bindParamEditorWrapper .previewWrapper {
|
||||
background-color: #fff; }
|
||||
|
|
Binary file not shown.
|
@ -146,6 +146,12 @@
|
|||
content: [{
|
||||
label: "Submit",
|
||||
letter: "Ctrl + Return"
|
||||
},{
|
||||
label: "Explain Query",
|
||||
letter: "Ctrl + Shift + E"
|
||||
},{
|
||||
label: "Save Query",
|
||||
letter: "Ctrl + Shift + S"
|
||||
},{
|
||||
label: "Toggle comments",
|
||||
letter: "Ctrl + Shift + C"
|
||||
|
|
|
@ -97,42 +97,5 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div id="queryImportDialog" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Import custom queries</a>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr class="tableRow">
|
||||
<th class="collectionTh">Format:</th>
|
||||
<th class="collectionTh" colspan="2">
|
||||
<p>JSON documents embedded into a list:</p>
|
||||
<p></p>
|
||||
<p>[{</p>
|
||||
<p style="margin-left: 10px">"name": "Query Name",</p>
|
||||
<p style="margin-left: 10px">"value": "Query Definition",</p>
|
||||
<p style="margin-left: 10px">"parameter": "Query Bind Parameter as Object"</p>
|
||||
<p>}]</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tableRow">
|
||||
<th class="collectionTh">File:</th>
|
||||
<th class="collectionTh" colspan="2">
|
||||
<input id="importQueries" name="importQueries" type="file" style="border: 0" />
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button id="confirmQueryImport" class="button-success disabled" style="float:right">Import</button>
|
||||
<button id="closeQueryModal" class="button-close">Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
<div class="inputEditorWrapper">
|
||||
<div class="aqlEditorWrapper" class="arangoEditor">
|
||||
<span id="clearQuery" class="aceAction"><i class="fa fa-times-circle"></i></span>
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="queryTable" style="display: none"></div>
|
||||
</div>
|
||||
|
@ -39,9 +40,11 @@
|
|||
|
||||
<div class="arangoToolbar arangoToolbarBottom">
|
||||
<div class="pull-right">
|
||||
<button id="exportQuery" class="button-success query-button" style="display:none">Export Queries</button>
|
||||
<button id="importQuery" class="button-success query-button" style="display:none">Import Queries</button>
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-success query-button">Explain</button>
|
||||
<button id="clearQuery" class="button-close query-button">Clear</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove results</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -50,6 +53,43 @@
|
|||
<div id="outputEditors" class="outputEditors">
|
||||
</div>
|
||||
|
||||
<div id="queryImportDialog" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Import custom queries</a>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr class="tableRow">
|
||||
<th class="collectionTh">Format:</th>
|
||||
<th class="collectionTh" colspan="2">
|
||||
<p>JSON documents embedded into a list:</p>
|
||||
<p></p>
|
||||
<p>[{</p>
|
||||
<p style="margin-left: 10px">"name": "Query Name",</p>
|
||||
<p style="margin-left: 10px">"value": "Query Definition",</p>
|
||||
<p style="margin-left: 10px">"parameter": "Query Bind Parameter as Object"</p>
|
||||
<p>}]</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tableRow">
|
||||
<th class="collectionTh">File:</th>
|
||||
<th class="collectionTh" colspan="2">
|
||||
<input id="importQueries" name="importQueries" type="file" style="border: 0" />
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button id="confirmQueryImport" class="button-success disabled" style="float:right">Import</button>
|
||||
<button id="closeQueryModal" class="button-close">Cancel</button>
|
||||
</div>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script id="queryViewOutput.ejs" type="text/template">
|
||||
|
@ -84,4 +124,5 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
outputTemplate: templateEngine.createTemplate("queryViewOutput.ejs"),
|
||||
outputCounter: 0,
|
||||
|
||||
allowUpload: false,
|
||||
|
||||
customQueries: [],
|
||||
queries: [],
|
||||
|
||||
|
@ -55,10 +57,19 @@
|
|||
"click .outputEditorWrapper .fa-close": "closeResult",
|
||||
"click #toggleQueries1": "toggleQueries",
|
||||
"click #toggleQueries2": "toggleQueries",
|
||||
"click #saveCurrentQuery": "addAQL",
|
||||
"click #exportQuery": "exportCustomQueries",
|
||||
"click #importQuery": "openImportDialog",
|
||||
"click #removeResults": "removeResults",
|
||||
"click #deleteQuery": "selectAndDeleteQueryFromTable",
|
||||
"click #explQuery": "selectAndExplainQueryFromTable",
|
||||
"keyup #arangoBindParamTable input": "updateBindParams",
|
||||
"change #arangoBindParamTable input": "updateBindParams",
|
||||
"click #arangoMyQueriesTable tr" : "showQueryPreview",
|
||||
"dblclick #arangoMyQueriesTable tr" : "selectQueryFromTable",
|
||||
"click #arangoMyQueriesTable #copyQuery" : "selectQueryFromTable",
|
||||
'click #closeQueryModal': 'closeExportDialog',
|
||||
'click #confirmQueryImport': 'importCustomQueries',
|
||||
"click #arangoMyQueriesTable #runQuery" : "selectAndRunQueryFromTable"
|
||||
},
|
||||
|
||||
|
@ -66,12 +77,78 @@
|
|||
this.aqlEditor.setValue('');
|
||||
},
|
||||
|
||||
initQueryImport: function () {
|
||||
var self = this;
|
||||
self.allowUpload = false;
|
||||
$('#importQueries').change(function(e) {
|
||||
self.files = e.target.files || e.dataTransfer.files;
|
||||
self.file = self.files[0];
|
||||
|
||||
self.allowUpload = true;
|
||||
$('#confirmQueryImport').removeClass('disabled');
|
||||
});
|
||||
},
|
||||
|
||||
importCustomQueries: function () {
|
||||
var self = this;
|
||||
if (this.allowUpload === true) {
|
||||
|
||||
var callback = function() {
|
||||
this.collection.fetch({
|
||||
success: function() {
|
||||
self.updateLocalQueries();
|
||||
self.updateQueryTable();
|
||||
self.resize();
|
||||
self.allowUpload = false;
|
||||
$('#confirmQueryImport').addClass('disabled');
|
||||
$('#queryImportDialog').modal('hide');
|
||||
},
|
||||
error: function(data) {
|
||||
arangoHelper.arangoError("Custom Queries", data.responseText);
|
||||
}
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
self.collection.saveImportQueries(self.file, callback.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
removeResults: function() {
|
||||
$('.outputEditorWrapper').hide('fast', function() {
|
||||
$('.outputEditorWrapper').remove();
|
||||
});
|
||||
$('#removeResults').hide();
|
||||
},
|
||||
|
||||
getCustomQueryParameterByName: function (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("parameter");
|
||||
},
|
||||
|
||||
getCustomQueryValueByName: function (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("value");
|
||||
if (qName) {
|
||||
return this.collection.findWhere({name: qName}).get("value");
|
||||
}
|
||||
},
|
||||
|
||||
openImportDialog: function() {
|
||||
$('#queryImportDialog').modal('show');
|
||||
},
|
||||
|
||||
closeImportDialog: function() {
|
||||
$('#queryImportDialog').modal('hide');
|
||||
},
|
||||
|
||||
exportCustomQueries: function () {
|
||||
var name;
|
||||
|
||||
$.ajax("whoAmI?_=" + Date.now()).success(function(data) {
|
||||
name = data.user;
|
||||
|
||||
if (name === null || name === false) {
|
||||
name = "root";
|
||||
}
|
||||
window.open("query/download/" + encodeURIComponent(name));
|
||||
});
|
||||
},
|
||||
|
||||
toggleQueries: function(e) {
|
||||
|
@ -86,7 +163,7 @@
|
|||
"aqlEditor", "queryTable", "previewWrapper",
|
||||
"bindParamEditor", "toggleQueries1", "toggleQueries2",
|
||||
"saveCurrentQuery", "querySize", "executeQuery",
|
||||
"explainQuery", "clearQuery"
|
||||
"explainQuery", "clearQuery", "importQuery", "exportQuery"
|
||||
];
|
||||
_.each(divs, function(div) {
|
||||
$("#" + div).toggle();
|
||||
|
@ -98,19 +175,64 @@
|
|||
$('#arangoMyQueriesTable tr').removeClass('selected');
|
||||
$(e.currentTarget).addClass('selected');
|
||||
|
||||
var name = $(e.currentTarget).children().first().text();
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
this.queryPreview.setValue(this.getCustomQueryValueByName(name));
|
||||
this.deselect(this.queryPreview);
|
||||
},
|
||||
|
||||
getQueryNameFromTable: function(e) {
|
||||
var name;
|
||||
if ($(e.currentTarget).is('tr')) {
|
||||
name = $(e.currentTarget).children().first().text();
|
||||
}
|
||||
else if ($(e.currentTarget).is('span')) {
|
||||
name = $(e.currentTarget).parent().parent().prev().text();
|
||||
}
|
||||
return name;
|
||||
},
|
||||
|
||||
deleteQueryModal: function(name){
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createReadOnlyEntry(
|
||||
undefined,
|
||||
name,
|
||||
'Do you want to delete the query?',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
undefined
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createDeleteButton('Delete', this.deleteAQL.bind(this, name))
|
||||
);
|
||||
window.modalView.show(
|
||||
'modalTable.ejs', 'Delete Query', buttons, tableContent
|
||||
);
|
||||
},
|
||||
|
||||
selectAndDeleteQueryFromTable: function(e) {
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
this.deleteQueryModal(name);
|
||||
},
|
||||
|
||||
selectAndExplainQueryFromTable: function(e) {
|
||||
this.selectQueryFromTable(e, false);
|
||||
this.explainQuery();
|
||||
},
|
||||
|
||||
selectAndRunQueryFromTable: function(e) {
|
||||
this.selectQueryFromTable(e);
|
||||
this.selectQueryFromTable(e, false);
|
||||
this.executeQuery();
|
||||
},
|
||||
|
||||
selectQueryFromTable: function(e) {
|
||||
var name = $(e.currentTarget).parent().parent().prev().text();
|
||||
this.toggleQueries();
|
||||
selectQueryFromTable: function(e, toggle) {
|
||||
var name = this.getQueryNameFromTable(e);
|
||||
|
||||
if (toggle === undefined) {
|
||||
this.toggleQueries();
|
||||
}
|
||||
|
||||
this.aqlEditor.setValue(this.getCustomQueryValueByName(name));
|
||||
this.fillBindParamTable(this.getCustomQueryParameterByName(name));
|
||||
|
@ -118,6 +240,25 @@
|
|||
this.deselect(this.aqlEditor);
|
||||
},
|
||||
|
||||
deleteAQL: function (name) {
|
||||
var callbackRemove = function(error) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Query", "Could not delete query.");
|
||||
}
|
||||
else {
|
||||
this.updateLocalQueries();
|
||||
this.updateQueryTable();
|
||||
this.resize();
|
||||
window.modalView.hide();
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
var toDelete = this.collection.findWhere({name: name});
|
||||
|
||||
this.collection.remove(toDelete);
|
||||
this.collection.saveCollectionQueries(callbackRemove);
|
||||
},
|
||||
|
||||
switchAce: function(e) {
|
||||
var count = $(e.currentTarget).attr('counter');
|
||||
|
||||
|
@ -223,8 +364,8 @@
|
|||
self.deselect(outputEditor);
|
||||
$.noty.clearQueue();
|
||||
$.noty.closeAll();
|
||||
self.handleResult(counter);
|
||||
}
|
||||
window.progressView.hide();
|
||||
},
|
||||
error: function (data) {
|
||||
window.progressView.hide();
|
||||
|
@ -235,7 +376,7 @@
|
|||
catch (e) {
|
||||
arangoHelper.arangoError("Explain error", "ERROR");
|
||||
}
|
||||
window.progressView.hide();
|
||||
self.handleResult(counter);
|
||||
this.removeOutputEditor(counter);
|
||||
}
|
||||
});
|
||||
|
@ -295,6 +436,9 @@
|
|||
var target = $("#" + $(e.currentTarget).attr('element')).parent();
|
||||
$(target).hide('fast', function() {
|
||||
$(target).remove();
|
||||
if ($('.outputEditorWrapper').length === 0) {
|
||||
$('#removeResults').hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -326,12 +470,14 @@
|
|||
this.getCachedQueryAfterRender();
|
||||
this.fillSelectBoxes();
|
||||
this.makeResizeable();
|
||||
this.initQueryImport();
|
||||
|
||||
//set height of editor wrapper
|
||||
$('.inputEditorWrapper').height($(window).height() / 10 * 3);
|
||||
window.setTimeout(function() {
|
||||
self.resize();
|
||||
}, 10);
|
||||
self.deselect(self.aqlEditor);
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
|
@ -389,6 +535,24 @@
|
|||
this.$(this.myQueriesId).html(this.table.render({content: this.myQueriesTableDesc}));
|
||||
},
|
||||
|
||||
checkType: function(val) {
|
||||
var type = "stringtype";
|
||||
|
||||
try {
|
||||
val = JSON.parse(val);
|
||||
if (val instanceof Array) {
|
||||
type = 'arraytype';
|
||||
}
|
||||
else {
|
||||
type = typeof val + 'type';
|
||||
}
|
||||
}
|
||||
catch(ignore) {
|
||||
}
|
||||
|
||||
return type;
|
||||
},
|
||||
|
||||
updateBindParams: function(e) {
|
||||
|
||||
var id, self = this;
|
||||
|
@ -397,6 +561,14 @@
|
|||
id = $(e.currentTarget).attr("name");
|
||||
//this.bindParamTableObj[id] = $(e.currentTarget).val();
|
||||
this.bindParamTableObj[id] = arangoHelper.parseInput(e.currentTarget);
|
||||
|
||||
var types = [
|
||||
"arraytype", "objecttype", "booleantype", "numbertype", "stringtype"
|
||||
];
|
||||
_.each(types, function(type) {
|
||||
$(e.currentTarget).removeClass(type);
|
||||
});
|
||||
$(e.currentTarget).addClass(self.checkType($(e.currentTarget).val()));
|
||||
}
|
||||
else {
|
||||
_.each($('#arangoBindParamTable input'), function(element) {
|
||||
|
@ -465,7 +637,15 @@
|
|||
counter ++;
|
||||
_.each($('#arangoBindParamTable input'), function(element) {
|
||||
if ($(element).attr('name') === key) {
|
||||
$(element).val(val);
|
||||
if (val instanceof Array) {
|
||||
$(element).val(JSON.stringify(val)).addClass('arraytype');
|
||||
}
|
||||
else if (typeof val === 'object') {
|
||||
$(element).val(JSON.stringify(val)).addClass(typeof val + 'type');
|
||||
}
|
||||
else {
|
||||
$(element).val(val).addClass(typeof val + 'type');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -505,6 +685,7 @@
|
|||
}
|
||||
self.resize();
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
|
||||
|
@ -514,6 +695,29 @@
|
|||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "executeQuery",
|
||||
bindKey: {win: "Ctrl-Return", mac: "Command-Return", linux: "Ctrl-Return"},
|
||||
exec: function() {
|
||||
self.executeQuery();
|
||||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "saveQuery",
|
||||
bindKey: {win: "Ctrl-Shift-S", mac: "Command-Shift-S", linux: "Ctrl-Shift-S"},
|
||||
exec: function() {
|
||||
self.addAQL();
|
||||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: "explainQuery",
|
||||
bindKey: {win: "Ctrl-Shift-E", mac: "Command-Shift-E", linux: "Ctrl-Shift-E"},
|
||||
exec: function() {
|
||||
self.explainQuery();
|
||||
}
|
||||
});
|
||||
|
||||
this.queryPreview = ace.edit("queryPreview");
|
||||
this.queryPreview.getSession().setMode("ace/mode/aql");
|
||||
|
@ -529,9 +733,10 @@
|
|||
|
||||
_.each(this.myQueriesTableDesc.rows, function(k) {
|
||||
k.thirdRow = '<span class="spanWrapper">' +
|
||||
'<span id="deleteQuery" title="Delete query"><i class="fa fa-minus-circle"></i></span>' +
|
||||
'<span id="copyQuery" title="Copy query"><i class="fa fa-copy"></i></span>' +
|
||||
'<span id="explQuery" title="Explain query"><i class="fa fa-comments"></i></i></span>' +
|
||||
'<span id="runQuery" title="Run query"><i class="fa fa-play-circle-o"></i></i></span>' +
|
||||
'<span id="deleteQuery" title="Delete query"><i class="fa fa-minus-circle"></i></span>' +
|
||||
'</span>';
|
||||
if (k.hasOwnProperty('parameter')) {
|
||||
delete k.parameter;
|
||||
|
@ -545,6 +750,49 @@
|
|||
this.$(this.myQueriesId).html(this.table.render({content: this.myQueriesTableDesc}));
|
||||
},
|
||||
|
||||
listenKey: function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.saveAQL(e);
|
||||
}
|
||||
this.checkSaveName();
|
||||
},
|
||||
|
||||
addAQL: function () {
|
||||
//update queries first, before showing
|
||||
this.refreshAQL(true);
|
||||
|
||||
//render options
|
||||
this.createCustomQueryModal();
|
||||
setTimeout(function () {
|
||||
$('#new-query-name').focus();
|
||||
}, 500);
|
||||
},
|
||||
|
||||
createCustomQueryModal: function(){
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createTextEntry(
|
||||
'new-query-name',
|
||||
'Name',
|
||||
'',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
[
|
||||
{
|
||||
rule: Joi.string().required(),
|
||||
msg: "No query name given."
|
||||
}
|
||||
]
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createSuccessButton('Save', this.saveAQL.bind(this))
|
||||
);
|
||||
window.modalView.show('modalTable.ejs', 'Save Query', buttons, tableContent, undefined, undefined,
|
||||
{'keyup #new-query-name' : this.listenKey.bind(this)});
|
||||
},
|
||||
|
||||
checkSaveName: function() {
|
||||
var saveName = $('#new-query-name').val();
|
||||
if ( saveName === "Insert Query"){
|
||||
|
@ -557,11 +805,12 @@
|
|||
var found = this.customQueries.some(function(query){
|
||||
return query.name === saveName;
|
||||
});
|
||||
if(found){
|
||||
if (found) {
|
||||
$('#modalButton1').removeClass('button-success');
|
||||
$('#modalButton1').addClass('button-warning');
|
||||
$('#modalButton1').text('Update');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$('#modalButton1').removeClass('button-warning');
|
||||
$('#modalButton1').addClass('button-success');
|
||||
$('#modalButton1').text('Save');
|
||||
|
@ -574,9 +823,8 @@
|
|||
//update queries first, before writing
|
||||
this.refreshAQL();
|
||||
|
||||
var varsEditor = ace.edit("varsEditor"),
|
||||
saveName = $('#new-query-name').val(),
|
||||
bindVars = varsEditor.getValue();
|
||||
var saveName = $('#new-query-name').val(),
|
||||
bindVars = this.bindParamTableObj;
|
||||
|
||||
if ($('#new-query-name').hasClass('invalid-input')) {
|
||||
return;
|
||||
|
@ -632,8 +880,6 @@
|
|||
this.collection.fetch({
|
||||
success: function() {
|
||||
self.updateLocalQueries();
|
||||
self.renderSelectboxes();
|
||||
$('#querySelect').val(saveName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -662,6 +908,8 @@
|
|||
sentQueryEditor.getSession().setMode("ace/mode/aql");
|
||||
outputEditor.getSession().setMode("ace/mode/json");
|
||||
outputEditor.setReadOnly(true);
|
||||
outputEditor.setFontSize("13px");
|
||||
sentQueryEditor.setFontSize("13px");
|
||||
sentQueryEditor.setReadOnly(true);
|
||||
|
||||
this.fillResult(outputEditor, sentQueryEditor, counter);
|
||||
|
@ -718,6 +966,7 @@
|
|||
}
|
||||
$.noty.clearQueue();
|
||||
$.noty.closeAll();
|
||||
self.handleResult(counter);
|
||||
},
|
||||
error: function (data) {
|
||||
try {
|
||||
|
@ -728,12 +977,22 @@
|
|||
outputEditor.setValue('ERROR');
|
||||
arangoHelper.arangoError("Query error", "ERROR");
|
||||
}
|
||||
window.progressView.hide();
|
||||
self.handleResult(counter);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleResult: function(counter) {
|
||||
window.progressView.hide();
|
||||
$('#removeResults').show();
|
||||
|
||||
//TODO animate not sure
|
||||
//$('html,body').animate({
|
||||
// scrollTop: $('#outputEditorWrapper' + counter).offset().top - 120
|
||||
//}, 500);
|
||||
},
|
||||
|
||||
setEditorAutoHeight: function (editor) {
|
||||
editor.setOptions({
|
||||
maxLines: Infinity
|
||||
|
@ -772,6 +1031,7 @@
|
|||
window.clearTimeout(self.checkQueryTimer);
|
||||
arangoHelper.arangoNotification("Query", "Query canceled.");
|
||||
window.progressView.hide();
|
||||
//TODO REMOVE OUTPUT BOX
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -834,12 +1094,23 @@
|
|||
try {
|
||||
var error = JSON.parse(resp.responseText);
|
||||
if (error.errorMessage) {
|
||||
arangoHelper.arangoError("Query", error.errorMessage);
|
||||
if (error.errorMessage.match(/\d+:\d+/g) !== null) {
|
||||
self.markPositionError(
|
||||
error.errorMessage.match(/'.*'/g)[0],
|
||||
error.errorMessage.match(/\d+:\d+/g)[0]
|
||||
);
|
||||
arangoHelper.arangoError("Query", error.errorMessage);
|
||||
}
|
||||
else {
|
||||
console.log(resp);
|
||||
}
|
||||
self.removeOutputEditor(counter);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
arangoHelper.arangoError("Query", "Something went wrong.");
|
||||
self.removeOutputEditor(counter);
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
window.progressView.hide();
|
||||
|
@ -849,6 +1120,19 @@
|
|||
checkQueryStatus();
|
||||
},
|
||||
|
||||
markPositionError: function(text, pos) {
|
||||
var row = pos.split(":")[0],
|
||||
line = pos.split(":")[1];
|
||||
text = text.substr(1, text.length - 2);
|
||||
|
||||
this.aqlEditor.find(text);
|
||||
|
||||
window.setTimeout(function() {
|
||||
$('.ace_start').first().css('background', 'rgba(255, 129, 129, 0.7)');
|
||||
}, 100);
|
||||
|
||||
},
|
||||
|
||||
refreshAQL: function() {
|
||||
var self = this;
|
||||
|
||||
|
@ -858,6 +1142,7 @@
|
|||
}
|
||||
else {
|
||||
self.updateLocalQueries();
|
||||
self.updateQueryTable();
|
||||
}
|
||||
}.bind(self);
|
||||
|
||||
|
|
|
@ -296,7 +296,6 @@
|
|||
}
|
||||
|
||||
.errorMessage {
|
||||
background-color: $c-white;
|
||||
color: $c-negative;
|
||||
font-size: 9pt;
|
||||
font-weight: 400;
|
||||
|
|
|
@ -29,6 +29,26 @@
|
|||
background: #eee;
|
||||
overflow: hidden;
|
||||
|
||||
.stringtype {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.objecttype {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.arraytype {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.numbertype {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.booleantype {
|
||||
color: lightgreen;
|
||||
}
|
||||
|
||||
table {
|
||||
border-top: 0;
|
||||
font: 13px/normal Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace;
|
||||
|
@ -51,9 +71,11 @@
|
|||
background-color: rgba(255, 255, 255, .65);
|
||||
}
|
||||
|
||||
.fa-copy {
|
||||
.fa-copy,
|
||||
.fa-comments {
|
||||
color: $c-black;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,8 +90,13 @@
|
|||
|
||||
.spanWrapper {
|
||||
border-radius: 3px;
|
||||
cursor: auto;
|
||||
float: right;
|
||||
|
||||
&:hover {
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.fa {
|
||||
cursor: pointer;
|
||||
font-size: 18pt;
|
||||
|
@ -77,6 +104,10 @@
|
|||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.fa-minus-circle {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.fa-play-circle-o {
|
||||
color: $c-positive;
|
||||
}
|
||||
|
@ -107,6 +138,34 @@
|
|||
.bindParamEditorWrapper {
|
||||
height: 100%;
|
||||
|
||||
.selectError {
|
||||
background: $c-negative;
|
||||
}
|
||||
|
||||
.aceAction {
|
||||
background-color: rgba(0, 0, 0, .6);
|
||||
border-radius: 3px;
|
||||
color: $c-white;
|
||||
cursor: pointer;
|
||||
font-size: 13pt;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
text-align: center;
|
||||
top: 10px;
|
||||
width: 33px;
|
||||
z-index: 10;
|
||||
|
||||
i {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.previewWrapper {
|
||||
background-color: $c-white;
|
||||
|
||||
|
|
|
@ -71,4 +71,14 @@
|
|||
.arangoToolbarBottom {
|
||||
border-bottom-left-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
|
||||
#executeQuery {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.button-close {
|
||||
&:last-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue