+
diff --git a/js/apps/system/aardvark/frontend/js/templates/warningList.ejs b/js/apps/system/aardvark/frontend/js/templates/warningList.ejs
new file mode 100644
index 0000000000..1ef6a268e7
--- /dev/null
+++ b/js/apps/system/aardvark/frontend/js/templates/warningList.ejs
@@ -0,0 +1,11 @@
+
diff --git a/js/apps/system/aardvark/frontend/js/views/queryView.js b/js/apps/system/aardvark/frontend/js/views/queryView.js
index 35be91f7e3..0a9a39e4d2 100644
--- a/js/apps/system/aardvark/frontend/js/views/queryView.js
+++ b/js/apps/system/aardvark/frontend/js/views/queryView.js
@@ -1,15 +1,16 @@
/*jshint browser: true */
/*jshint unused: false */
/*global require, exports, Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _ */
-/*global _, arangoHelper, templateEngine, jQuery, Joi*/
+/*global _, arangoHelper, templateEngine, jQuery, Joi, d3*/
(function () {
"use strict";
window.queryView = Backbone.View.extend({
el: '#content',
id: '#customsDiv',
+ warningTemplate: templateEngine.createTemplate("warningList.ejs"),
tabArray: [],
- cachedQuery: "",
+ execPending: false,
initialize: function () {
this.getAQL();
@@ -21,8 +22,9 @@
"click #result-switch": "switchTab",
"click #query-switch": "switchTab",
'click #customs-switch': "switchTab",
- 'click #submitQueryIcon': 'submitQuery',
+ 'click #explain-switch': "switchTab",
'click #submitQueryButton': 'submitQuery',
+ 'click #explainQueryButton': 'explainQuery',
'click #commentText': 'commentText',
'click #uncommentText': 'uncommentText',
'click #undoText': 'undoText',
@@ -77,9 +79,9 @@
updateTable: function () {
this.tableDescription.rows = this.customQueries;
- _.each(this.tableDescription.rows, function(k, v) {
+ _.each(this.tableDescription.rows, function(k) {
k.thirdRow = '
';
+ ' title="Delete query">';
});
// escape all columns but the third (which contains HTML)
@@ -99,7 +101,7 @@
initTabArray: function() {
var self = this;
- $(".arango-tab").children().each( function(index) {
+ $(".arango-tab").children().each( function() {
self.tabArray.push($(this).children().first().attr("id"));
});
},
@@ -340,350 +342,520 @@
$.ajax("whoAmI", {async:false}).done(
function(data) {
- name = data.name;
+ name = data.name;
- if (name === null) {
- name = "root";
+ if (name === null) {
+ name = "root";
+ }
+
+ });
+
+ window.open("query/download/" + encodeURIComponent(name));
+ },
+
+ deselect: function (editor) {
+ var current = editor.getSelection();
+ var currentRow = current.lead.row;
+ var currentColumn = current.lead.column;
+
+ current.setSelectionRange({
+ start: {
+ row: currentRow,
+ column: currentColumn
+ },
+ end: {
+ row: currentRow,
+ column: currentColumn
+ }
+ });
+
+ editor.focus();
+ },
+
+ addAQL: function () {
+ //render options
+ this.createCustomQueryModal();
+ $('#new-query-name').val($('#querySelect').val());
+ setTimeout(function () {
+ $('#new-query-name').focus();
+ }, 500);
+ this.checkSaveName();
+ },
+
+ getAQL: function () {
+ var self = this, result;
+
+ this.collection.fetch({
+ async: false
+ });
+
+ //old storage method
+ var item = localStorage.getItem("customQueries");
+ if (item) {
+ var queries = JSON.parse(item);
+ //save queries in user collections extra attribute
+ _.each(queries, function(oldQuery) {
+ self.collection.add({
+ value: oldQuery.value,
+ name: oldQuery.name
+ });
+ });
+ result = self.collection.saveCollectionQueries();
+
+ if (result === true) {
+ //and delete them from localStorage
+ localStorage.removeItem("customQueries");
+ }
}
- });
+ this.updateLocalQueries();
+ },
- window.open("query/download/" + encodeURIComponent(name));
- },
+ deleteAQL: function (e) {
+ var deleteName = $(e.target).parent().parent().parent().children().first().text();
- deselect: function (editor) {
- var current = editor.getSelection();
- var currentRow = current.lead.row;
- var currentColumn = current.lead.column;
+ var toDelete = this.collection.findWhere({name: deleteName});
+ this.collection.remove(toDelete);
+ this.collection.saveCollectionQueries();
- current.setSelectionRange({
- start: {
- row: currentRow,
- column: currentColumn
- },
- end: {
- row: currentRow,
- column: currentColumn
- }
- });
+ this.updateLocalQueries();
+ this.renderSelectboxes();
+ this.updateTable();
+ },
- editor.focus();
- },
+ updateLocalQueries: function () {
+ var self = this;
+ this.customQueries = [];
- addAQL: function () {
- //render options
- this.createCustomQueryModal();
- $('#new-query-name').val($('#querySelect').val());
- setTimeout(function () {
- $('#new-query-name').focus();
- }, 500);
- this.checkSaveName();
- },
-
- getAQL: function () {
- var self = this, result;
-
- this.collection.fetch({
- async: false
- });
-
- //old storage method
- var item = localStorage.getItem("customQueries");
- if (item) {
- var queries = JSON.parse(item);
- //save queries in user collections extra attribute
- _.each(queries, function(oldQuery) {
- self.collection.add({
- value: oldQuery.value,
- name: oldQuery.name
+ this.collection.each(function(model) {
+ self.customQueries.push({
+ name: model.get("name"),
+ value: model.get("value")
});
});
- result = self.collection.saveCollectionQueries();
+ },
- if (result === true) {
- //and delete them from localStorage
- localStorage.removeItem("customQueries");
- }
- }
+ saveAQL: function (e) {
+ e.stopPropagation();
+ var inputEditor = ace.edit("aqlEditor");
+ var saveName = $('#new-query-name').val();
+ var isUpdate = $('#modalButton1').text() === 'Update';
- this.updateLocalQueries();
- },
-
- deleteAQL: function (e) {
- var deleteName = $(e.target).parent().parent().parent().children().first().text();
-
- var toDelete = this.collection.findWhere({name: deleteName});
- this.collection.remove(toDelete);
- this.collection.saveCollectionQueries();
-
- this.updateLocalQueries();
- this.renderSelectboxes();
- this.updateTable();
- },
-
- updateLocalQueries: function () {
- var self = this;
- this.customQueries = [];
-
- this.collection.each(function(model) {
- self.customQueries.push({
- name: model.get("name"),
- value: model.get("value")
- });
- });
- },
-
- saveAQL: function (e) {
- e.stopPropagation();
- var inputEditor = ace.edit("aqlEditor");
- var saveName = $('#new-query-name').val();
- var isUpdate = $('#modalButton1').text() === 'Update';
-
- if ($('#new-query-name').hasClass('invalid-input')) {
- return;
- }
-
- //Heiko: Form-Validator - illegal query name
- if (saveName.trim() === '') {
- return;
- }
-
- var content = inputEditor.getValue();
- //check for already existing entry
- var quit = false;
- $.each(this.customQueries, function (k, v) {
- if (v.name === saveName) {
- v.value = content;
- quit = !isUpdate;
+ if ($('#new-query-name').hasClass('invalid-input')) {
return;
}
- });
- if (quit === true) {
- //Heiko: Form-Validator - name already taken
- window.modalView.hide();
- return;
- }
+ //Heiko: Form-Validator - illegal query name
+ if (saveName.trim() === '') {
+ return;
+ }
- if (! isUpdate) {
- //this.customQueries.push({
- // name: saveName,
- // value: content
- //});
- this.collection.add({
- name: saveName,
- value: content
+ var content = inputEditor.getValue();
+ //check for already existing entry
+ var quit = false;
+ $.each(this.customQueries, function (k, v) {
+ if (v.name === saveName) {
+ v.value = content;
+ quit = !isUpdate;
+ return;
+ }
});
- }
- else {
- var toModifiy = this.collection.findWhere({name: saveName});
- toModifiy.set("value", content);
- }
- this.collection.saveCollectionQueries();
- window.modalView.hide();
-
- this.updateLocalQueries();
- this.renderSelectboxes();
- $('#querySelect').val(saveName);
- },
-
- getSystemQueries: function () {
- var self = this;
- $.ajax({
- type: "GET",
- cache: false,
- url: "js/arango/aqltemplates.json",
- contentType: "application/json",
- processData: false,
- async: false,
- success: function (data) {
- self.queries = data;
- },
- error: function (data) {
- arangoHelper.arangoNotification("Query", "Error while loading system templates");
+ if (quit === true) {
+ //Heiko: Form-Validator - name already taken
+ window.modalView.hide();
+ return;
}
- });
- },
- getCustomQueryValueByName: function (qName) {
- var returnVal;
- $.each(this.customQueries, function (k, v) {
- if (qName === v.name) {
- returnVal = v.value;
+ if (! isUpdate) {
+ //this.customQueries.push({
+ // name: saveName,
+ // value: content
+ //});
+ this.collection.add({
+ name: saveName,
+ value: content
+ });
}
- });
- return returnVal;
- },
-
- importSelected: function (e) {
- var inputEditor = ace.edit("aqlEditor");
- $.each(this.queries, function (k, v) {
- if ($('#' + e.currentTarget.id).val() === v.name) {
- inputEditor.setValue(v.value);
+ else {
+ var toModifiy = this.collection.findWhere({name: saveName});
+ toModifiy.set("value", content);
}
- });
- $.each(this.customQueries, function (k, v) {
- if ($('#' + e.currentTarget.id).val() === v.name) {
- inputEditor.setValue(v.value);
- }
- });
+ this.collection.saveCollectionQueries();
- this.deselect(ace.edit("aqlEditor"));
- },
+ window.modalView.hide();
- renderSelectboxes: function () {
- this.sortQueries();
- var selector = '';
- selector = '#querySelect';
- $(selector).empty();
+ this.updateLocalQueries();
+ this.renderSelectboxes();
+ $('#querySelect').val(saveName);
+ },
- $(selector).append('
');
+ getSystemQueries: function () {
+ var self = this;
+ $.ajax({
+ type: "GET",
+ cache: false,
+ url: "js/arango/aqltemplates.json",
+ contentType: "application/json",
+ processData: false,
+ async: false,
+ success: function (data) {
+ self.queries = data;
+ },
+ error: function (data) {
+ arangoHelper.arangoNotification("Query", "Error while loading system templates");
+ }
+ });
+ },
- $(selector).append('
');
+ getCustomQueryValueByName: function (qName) {
+ var returnVal;
+ $.each(this.customQueries, function (k, v) {
+ if (qName === v.name) {
+ returnVal = v.value;
+ }
+ });
+ return returnVal;
+ },
- if (this.customQueries.length > 0) {
- $(selector).append('