mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of https://github.com/triAGENS/ArangoDB into sharding
This commit is contained in:
commit
8981d51257
|
@ -408,11 +408,6 @@ li:hover h6, li.hover h6 {
|
|||
padding-left: 8px;
|
||||
}
|
||||
|
||||
#shortcutDiv {
|
||||
font-size: 12px;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.headerH6 {
|
||||
margin-left: 30px;
|
||||
float:left;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.ui-resizable-s {
|
||||
bottom: 0;
|
||||
height: 10px;
|
||||
height: 0px;
|
||||
background-color: #F0F0F0 !important;
|
||||
border: 1px solid #C0C0C0;
|
||||
cursor: ns-resize;
|
||||
|
@ -87,16 +87,24 @@
|
|||
background:none;
|
||||
}
|
||||
|
||||
/*
|
||||
#aqlEditor .ui-resizable-handle {
|
||||
border-left: 0 !important;
|
||||
border-bottom: 0 !important;
|
||||
border-top: 0 !important;
|
||||
}*/
|
||||
|
||||
#aqlEditor {
|
||||
border-left: 0 !important;
|
||||
border-bottom: 0 !important;
|
||||
border-top: 0 !important;
|
||||
}
|
||||
|
||||
#wideButtonDiv {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
margin-bottom: 15px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
#submitQueryButton, #clearQueryButton {
|
||||
|
@ -190,8 +198,12 @@
|
|||
float: left;
|
||||
width: auto;
|
||||
margin-top: -5px;
|
||||
padding-left: 45px;
|
||||
font-size: 11px;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
|
||||
#queryDiv > * {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
@ -199,7 +211,7 @@
|
|||
.styled-select select {
|
||||
background: white;
|
||||
padding: 5px;
|
||||
font-size: 16px;
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
border: 0;
|
||||
|
|
|
@ -1,100 +1,100 @@
|
|||
<script id="queryView.ejs" type="text/template">
|
||||
<ul class="thumbnails2">
|
||||
<div class="headerBar">
|
||||
<div class="headerButtonBar pull-right">
|
||||
<ul class="headerButtonList">
|
||||
<li class="enabled" style="visibility:hidden">
|
||||
<a id="aqlToggle" class="headerButton">
|
||||
<span class="" title="Settings"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="enabled">
|
||||
<a id="editAQL" class="headerButton">
|
||||
<span class="icon_arangodb_checklist" title="Edit custom Queries"></span>
|
||||
</a>
|
||||
</li>
|
||||
<div class="thumbnails2">
|
||||
<div class="headerBar">
|
||||
<a class="arangoHeader">AQL Editor</a>
|
||||
</div>
|
||||
|
||||
<div id="queryContent">
|
||||
<ul class="nav nav-tabs arangoTab">
|
||||
<li class="pull-right"><a href="#result" data-toggle="pill" id="result-switch">Result</a></li>
|
||||
<li class="pull-right"><a href="#query" data-toggle="pill" id="query-switch">Query</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="arangoHeader">AQL Editor</a>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="tab-content" id="tabContentQuery">
|
||||
<div class="tab-pane active" id="query">
|
||||
|
||||
<div id="queryDropdown" class="headerDropdown">
|
||||
<div class="dropdownInner" id="queryDropdownIn">
|
||||
<a class="arangoHeader">Edit custom queries</a>
|
||||
<div id="queryDropdownLeft">
|
||||
Name
|
||||
<select id="queryModalSelect"/>
|
||||
</div>
|
||||
<div id="queryDropdownRight">
|
||||
Query
|
||||
<textarea id="edit-aql-textarea"/>
|
||||
</div>
|
||||
<div class="buttonContainer">
|
||||
<button id="delete-edit-query" class="button-danger">Delete</button>
|
||||
<button id="save-edit-query" class="button-success">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-error" style="display:none" id="reallyDeleteQueryDiv">
|
||||
<strong>Really delete query?</strong>
|
||||
<button id="confirmDeleteQuery" class="button-danger pull-right" style="margin-top: -4px; margin-right: -18px !important;">Yes</button>
|
||||
<button id="abortDeleteQuery" class="button-neutral pull-right" style="margin-top: -4px; margin-right:10px;">No</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="queryDropdown" class="headerDropdown">
|
||||
<div class="dropdownInner" id="queryDropdownIn">
|
||||
<a class="arangoHeader">Edit custom queries</a>
|
||||
|
||||
<div id="queryDropdownLeft">
|
||||
Name
|
||||
<select id="queryModalSelect"/>
|
||||
</div>
|
||||
<div id="queryDropdownRight">
|
||||
Query
|
||||
<textarea id="edit-aql-textarea"/>
|
||||
</div>
|
||||
<div class="buttonContainer">
|
||||
<button id="delete-edit-query" class="button-danger">Delete</button>
|
||||
<button id="save-edit-query" class="button-success">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-error" style="display:none" id="reallyDeleteQueryDiv">
|
||||
<strong>Really delete query?</strong>
|
||||
<button id="confirmDeleteQuery" class="button-danger pull-right"
|
||||
style="margin-top: -4px; margin-right: -18px !important;">Yes
|
||||
</button>
|
||||
<button id="abortDeleteQuery" class="button-neutral pull-right" style="margin-top: -4px; margin-right:10px;">No
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="queryDiv" style="display:none">
|
||||
<div id="editorLabel"><h6>Query</h6></div>
|
||||
<div id="editorToolbar" class="queryToolbar">
|
||||
<span class="icon_arangodb icon_arangodb_trash queryTooltips" title="Clear" id="clearInput"/>
|
||||
<span class="icon_arangodb icon_arangodb_adddoc queryTooltips" title="Save current query" id="addAQL"/>
|
||||
<span class="icon_arangodb icon_arangodb_bubble1 queryTooltips" title="Comment" id="commentText"/>
|
||||
<span class="icon_arangodb icon_arangodb_arrow6 queryTooltips" title="Redo" id="redoText"/>
|
||||
<span class="icon_arangodb icon_arangodb_arrow5 queryTooltips" title="Undo" id="undoText"/>
|
||||
</div>
|
||||
|
||||
<div id="aqlEditor"></div>
|
||||
|
||||
|
||||
<div id="wideButtonDiv">
|
||||
<div>
|
||||
|
||||
<div id="shortcutDiv">
|
||||
<b>Submit:</b> CTRL/CMD + Return ; <b>Undo:</b> CTRL/CMD + Z ; <b>Redo:</b> CTRL/CMD + SHIFT + Z ;
|
||||
<b>Toggle Comments:</b> CTRL/CMD + SHIFT + C
|
||||
<br/><b>Warning:</b> Right now there is a bug in Safari, the cursor is misplaced. Please use a different
|
||||
browser for now. Fix in progress.
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<button id="submitQueryButton" class="btn btn-success">Submit</button>
|
||||
<button id="clearQueryButton" class="btn">Clear</button>
|
||||
<div class="styled-select">
|
||||
<select id="querySelect"/>
|
||||
</div>
|
||||
<div class="styled-select querySizeDiv">
|
||||
<select id="querySize"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" id="tabContentResult">
|
||||
|
||||
<div class="tab-pane" id="result">
|
||||
<div id="editorLabel"><h6>Result</h6></div>
|
||||
<div id="outputToolbar" class="queryToolbar">
|
||||
<span class="icon_arangodb icon_arangodb_trash queryTooltips" title="Clear" id="clearOutput"></span>
|
||||
<span class="icon_arangodb icon_arangodb_arrow1 queryTooltips" title="Unfold" id="bigOutput"></span>
|
||||
</div>
|
||||
<div id="queryOutput" class="contentDiv">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="queryDiv" style="display:none">
|
||||
<div id="editorLabel"><h6>Query</h6></div>
|
||||
<div id="editorToolbar" class="queryToolbar">
|
||||
<span class="icon_arangodb icon_arangodb_trash queryTooltips" title="Clear" id="clearInput"/>
|
||||
<span class="icon_arangodb icon_arangodb_adddoc queryTooltips" title="Save current query" id="addAQL"/>
|
||||
<span class="icon_arangodb icon_arangodb_bubble1 queryTooltips" title="Comment" id="commentText"/>
|
||||
<span class="icon_arangodb icon_arangodb_arrow6 queryTooltips" title="Redo" id="redoText"/>
|
||||
<span class="icon_arangodb icon_arangodb_arrow5 queryTooltips" title="Undo" id="undoText"/>
|
||||
</div>
|
||||
<div id="aqlEditor"></div>
|
||||
<div id="wideButtonDiv">
|
||||
<button id="submitQueryButton" class="button-success">Submit</button>
|
||||
<button id="clearQueryButton" class="button-neutral">Clear</button>
|
||||
<div class="styled-select">
|
||||
<select id="querySelect"/>
|
||||
</div>
|
||||
<div class="styled-select querySizeDiv">
|
||||
<select id="querySize"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="editorLabel"><h6>Result</h6></div>
|
||||
<div id="outputToolbar" class="queryToolbar">
|
||||
<span class="icon_arangodb icon_arangodb_trash queryTooltips" title="Clear" id="clearOutput"></span>
|
||||
<span class="icon_arangodb icon_arangodb_arrow1 queryTooltips" title="Unfold" id="bigOutput"></span>
|
||||
</div>
|
||||
<div id="queryOutput" class="contentDiv">
|
||||
</div>
|
||||
<div id="shortcutDiv">
|
||||
<b>Submit:</b> CTRL/CMD + Return ; <b>Undo:</b> CTRL/CMD + Z ; <b>Redo:</b> CTRL/CMD + SHIFT + Z ;
|
||||
<b>Toggle Comments:</b> CTRL/CMD + SHIFT + C
|
||||
<br /><b>Warning:</b> Right now there is a bug in Safari, the cursor is misplaced. Please use a different browser for now. Fix in progress.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="new-aql-query" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Save new query</a>
|
||||
</div>
|
||||
<div id="new-aql-body" class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th class="queryTH">Name:</th>
|
||||
<th class="queryTH2"><input type="text" id="new-query-name" name="name" value=""/></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="colFooter" class="modal-footer">
|
||||
<button class="btn btn-close" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button id="save-new-query" class="button-success pull-right">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
|
|
@ -303,8 +303,7 @@
|
|||
'" type="text" placeholder="Attribute value" ' +
|
||||
'class="filterValue">'+
|
||||
' <a class="removeFilterItem" id="removeFilter' + num + '">' +
|
||||
'<i class="icon icon-minus"></i></a>'+
|
||||
' <span>AND</span></div>');
|
||||
'<i class="icon icon-minus"></i></a></div>');
|
||||
this.filters[num] = true;
|
||||
},
|
||||
|
||||
|
@ -422,11 +421,11 @@
|
|||
var result;
|
||||
if (this.type === 'document') {
|
||||
result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
||||
if (result === true) {
|
||||
if (result) {
|
||||
//on success
|
||||
deleted = true;
|
||||
}
|
||||
else if (result === false) {
|
||||
else {
|
||||
arangoHelper.arangoError('Doc error');
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +435,7 @@
|
|||
//on success
|
||||
deleted = true;
|
||||
}
|
||||
else if (result === false) {
|
||||
else {
|
||||
arangoHelper.arangoError('Edge error');
|
||||
}
|
||||
}
|
||||
|
@ -594,13 +593,12 @@
|
|||
showLoadingState: function () {
|
||||
$('.dataTables_empty').text('Loading...');
|
||||
},
|
||||
renderPagination: function (totalPages, filter) {
|
||||
|
||||
var checkFilter = filter;
|
||||
renderPagination: function (totalPages, checkFilter) {
|
||||
$('#documentsToolbarF').html("");
|
||||
var self = this;
|
||||
|
||||
var currentPage;
|
||||
if (checkFilter === true) {
|
||||
if (checkFilter) {
|
||||
currentPage = window.arangoDocumentsStore.currentFilterPage;
|
||||
}
|
||||
else {
|
||||
|
@ -614,7 +612,7 @@
|
|||
lastPage: totalPages,
|
||||
click: function(i) {
|
||||
options.page = i;
|
||||
if (checkFilter === true) {
|
||||
if (checkFilter) {
|
||||
var filterArray = self.getFilterContent();
|
||||
var filters = filterArray[0];
|
||||
var bindValues = filterArray[1];
|
||||
|
|
|
@ -2,523 +2,485 @@
|
|||
/*global require, exports, Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _ */
|
||||
/*global arangoHelper, templateEngine*/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
window.queryView = Backbone.View.extend({
|
||||
el: '#content',
|
||||
el: '#content',
|
||||
|
||||
initialize: function () {
|
||||
this.getAQL();
|
||||
this.getSystemQueries();
|
||||
localStorage.setItem("queryContent", "");
|
||||
localStorage.setItem("queryOutput", "");
|
||||
},
|
||||
initialize: function () {
|
||||
this.getAQL();
|
||||
this.getSystemQueries();
|
||||
localStorage.setItem("queryContent", "");
|
||||
localStorage.setItem("queryOutput", "");
|
||||
},
|
||||
|
||||
events: {
|
||||
'click #submitQueryIcon': 'submitQuery',
|
||||
'click #submitQueryButton': 'submitQuery',
|
||||
'click #commentText': 'commentText',
|
||||
'click #uncommentText': 'uncommentText',
|
||||
'click #undoText': 'undoText',
|
||||
'click #redoText': 'redoText',
|
||||
'click #smallOutput': 'smallOutput',
|
||||
'click #bigOutput': 'bigOutput',
|
||||
'click #clearOutput': 'clearOutput',
|
||||
'click #clearInput': 'clearInput',
|
||||
'click #addAQL': 'addAQL',
|
||||
'click #editAQL': 'editAQL',
|
||||
'click #save-new-query': 'saveAQL',
|
||||
'click #save-edit-query': 'saveAQL',
|
||||
'click #delete-edit-query': 'showDeleteField',
|
||||
'click #confirmDeleteQuery': 'deleteAQL',
|
||||
'click #abortDeleteQuery': 'hideDeleteField',
|
||||
'keydown #new-query-name': 'listenKey',
|
||||
'change #queryModalSelect': 'updateEditSelect',
|
||||
'change #querySelect': 'importSelected',
|
||||
'change #querySize': 'changeSize',
|
||||
'keypress #aqlEditor': 'aqlShortcuts'
|
||||
},
|
||||
events: {
|
||||
"click #result-switch": "result",
|
||||
"click #query-switch": "query",
|
||||
'click #submitQueryIcon': 'submitQuery',
|
||||
'click #submitQueryButton': 'submitQuery',
|
||||
'click #commentText': 'commentText',
|
||||
'click #uncommentText': 'uncommentText',
|
||||
'click #undoText': 'undoText',
|
||||
'click #redoText': 'redoText',
|
||||
'click #smallOutput': 'smallOutput',
|
||||
'click #bigOutput': 'bigOutput',
|
||||
'click #clearOutput': 'clearOutput',
|
||||
'click #clearInput': 'clearInput',
|
||||
'click #addAQL': 'addAQL',
|
||||
'click #editAQL': 'editAQL',
|
||||
'click #save-new-query': 'saveAQL',
|
||||
'click #save-edit-query': 'saveAQL',
|
||||
'click #delete-edit-query': 'showDeleteField',
|
||||
'click #confirmDeleteQuery': 'deleteAQL',
|
||||
'click #abortDeleteQuery': 'hideDeleteField',
|
||||
'keydown #new-query-name': 'listenKey',
|
||||
'change #queryModalSelect': 'updateEditSelect',
|
||||
'change #querySelect': 'importSelected',
|
||||
'change #querySize': 'changeSize',
|
||||
'keypress #aqlEditor': 'aqlShortcuts'
|
||||
},
|
||||
|
||||
listenKey: function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.saveAQL(e);
|
||||
listenKey: function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.saveAQL(e);
|
||||
}
|
||||
},
|
||||
|
||||
clearOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.setValue('');
|
||||
},
|
||||
|
||||
clearInput: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.setValue('');
|
||||
},
|
||||
|
||||
smallOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.getSession().foldAll();
|
||||
},
|
||||
|
||||
bigOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.getSession().unfold();
|
||||
},
|
||||
|
||||
aqlShortcuts: function (e) {
|
||||
if (e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
}
|
||||
else if (e.metaKey && !e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
}
|
||||
else if (e.ctrlKey && e.keyCode === 90) {
|
||||
// TO_DO: undo/redo seems to work even without this. check if can be removed
|
||||
this.undoText();
|
||||
}
|
||||
else if (e.ctrlKey && e.shiftKey && e.keyCode === 90) {
|
||||
// TO_DO: undo/redo seems to work even without this. check if can be removed
|
||||
this.redoText();
|
||||
}
|
||||
},
|
||||
|
||||
queries: [
|
||||
],
|
||||
|
||||
customQueries: [],
|
||||
|
||||
template: templateEngine.createTemplate("queryView.ejs"),
|
||||
|
||||
render: function () {
|
||||
$(this.el).html(this.template.render({}));
|
||||
|
||||
// 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);
|
||||
outputEditor.getSession().setMode("ace/mode/json");
|
||||
outputEditor.setFontSize("16px");
|
||||
outputEditor.setValue('');
|
||||
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.getSession().setMode("ace/mode/aql");
|
||||
inputEditor.setFontSize("16px");
|
||||
inputEditor.commands.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: {win: "Ctrl-Shift-C", linux: "Ctrl-Shift-C", mac: "Command-Shift-C"},
|
||||
exec: function (editor) {
|
||||
editor.toggleCommentLines();
|
||||
},
|
||||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
inputEditor.getSession().selection.on('changeCursor', function (e) {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var session = inputEditor.getSession();
|
||||
var cursor = inputEditor.getCursorPosition();
|
||||
var token = session.getTokenAt(cursor.row, cursor.column);
|
||||
if (token) {
|
||||
if (token.type === "comment") {
|
||||
$("#commentText")
|
||||
.removeClass("arango-icon-comment")
|
||||
.addClass("arango-icon-uncomment")
|
||||
.attr("data-original-title", "Uncomment");
|
||||
} else {
|
||||
$("#commentText")
|
||||
.addClass("arango-icon-comment")
|
||||
.removeClass("arango-icon-uncomment")
|
||||
.attr("data-original-title", "Comment");
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
$('#queryOutput').resizable({
|
||||
handles: "s",
|
||||
ghost: true,
|
||||
stop: function () {
|
||||
setTimeout(function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.resize();
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
clearOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.setValue('');
|
||||
},
|
||||
arangoHelper.fixTooltips(".queryTooltips, .icon_arangodb", "top");
|
||||
|
||||
clearInput: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.setValue('');
|
||||
},
|
||||
$('#aqlEditor .ace_text-input').focus();
|
||||
|
||||
smallOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.getSession().foldAll();
|
||||
},
|
||||
if (typeof Storage) {
|
||||
var queryContent = localStorage.getItem("queryContent");
|
||||
var queryOutput = localStorage.getItem("queryOutput");
|
||||
inputEditor.setValue(queryContent);
|
||||
outputEditor.setValue(queryOutput);
|
||||
}
|
||||
|
||||
bigOutput: function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.getSession().unfold();
|
||||
},
|
||||
var windowHeight = $(window).height() - 295;
|
||||
$('#aqlEditor').height(windowHeight - 19);
|
||||
$('#queryOutput').height(windowHeight);
|
||||
|
||||
aqlShortcuts: function (e) {
|
||||
if (e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
inputEditor.resize();
|
||||
outputEditor.resize();
|
||||
|
||||
this.renderSelectboxes();
|
||||
this.deselect(outputEditor);
|
||||
this.deselect(inputEditor);
|
||||
|
||||
$('#queryDiv').show();
|
||||
//outputEditor.setTheme("ace/theme/merbivore_soft");
|
||||
$("#tabContentResult").hide();
|
||||
$("#query-switch").parent().addClass("active");
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
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
|
||||
$('#new-query-name').val('');
|
||||
$('#new-aql-query').modal('show');
|
||||
setTimeout(function () {
|
||||
$('#new-query-name').focus();
|
||||
}, 500);
|
||||
},
|
||||
editAQL: function () {
|
||||
if (this.customQueries.length === 0) {
|
||||
//Heiko: display information that no custom queries are available
|
||||
return;
|
||||
}
|
||||
|
||||
this.hideDeleteField();
|
||||
$('#queryDropdown').slideToggle();
|
||||
//$('#edit-aql-queries').modal('show');
|
||||
this.renderSelectboxes(true);
|
||||
this.updateEditSelect();
|
||||
},
|
||||
getAQL: function () {
|
||||
if (localStorage.getItem("customQueries")) {
|
||||
this.customQueries = JSON.parse(localStorage.getItem("customQueries"));
|
||||
}
|
||||
},
|
||||
showDeleteField: function () {
|
||||
$('#reallyDeleteQueryDiv').show();
|
||||
},
|
||||
hideDeleteField: function () {
|
||||
$('#reallyDeleteQueryDiv').hide();
|
||||
},
|
||||
deleteAQL: function () {
|
||||
var queryName = $('#queryModalSelect').val();
|
||||
var tempArray = [];
|
||||
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (queryName !== v.name) {
|
||||
tempArray.push({
|
||||
name: v.name,
|
||||
value: v.value
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.customQueries = tempArray;
|
||||
localStorage.setItem("customQueries", JSON.stringify(this.customQueries));
|
||||
$('#edit-aql-queries').modal('hide');
|
||||
this.renderSelectboxes();
|
||||
},
|
||||
saveAQL: function (e) {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var queryName = $('#new-query-name').val();
|
||||
var content = inputEditor.getValue();
|
||||
|
||||
if (e) {
|
||||
if (e.target.id === 'save-edit-query') {
|
||||
content = $('#edit-aql-textarea').val();
|
||||
queryName = $('#queryModalSelect').val();
|
||||
}
|
||||
}
|
||||
|
||||
if (queryName.trim() === '') {
|
||||
//Heiko: Form-Validator - illegal query name
|
||||
return;
|
||||
}
|
||||
|
||||
//check for already existing entry
|
||||
var tempArray = [];
|
||||
var quit = false;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (e.target.id !== 'save-edit-query') {
|
||||
if (v.name === queryName) {
|
||||
quit = true;
|
||||
return;
|
||||
}
|
||||
else if (e.metaKey && !e.ctrlKey && e.keyCode === 13) {
|
||||
this.submitQuery();
|
||||
}
|
||||
else if (e.ctrlKey && e.keyCode === 90) {
|
||||
// TO_DO: undo/redo seems to work even without this. check if can be removed
|
||||
this.undoText();
|
||||
}
|
||||
else if (e.ctrlKey && e.shiftKey && e.keyCode === 90) {
|
||||
// TO_DO: undo/redo seems to work even without this. check if can be removed
|
||||
this.redoText();
|
||||
}
|
||||
},
|
||||
}
|
||||
if (v.name !== queryName) {
|
||||
tempArray.push({
|
||||
name: v.name,
|
||||
value: v.value
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
queries: [
|
||||
],
|
||||
if (quit === true) {
|
||||
//Heiko: Form-Validator - name already taken
|
||||
return;
|
||||
}
|
||||
|
||||
customQueries: [],
|
||||
this.customQueries = tempArray;
|
||||
|
||||
template: templateEngine.createTemplate("queryView.ejs"),
|
||||
this.customQueries.push({
|
||||
name: queryName,
|
||||
value: content
|
||||
});
|
||||
|
||||
render: function () {
|
||||
$(this.el).html(this.template.render({}));
|
||||
$('#new-aql-query').modal('hide');
|
||||
$('#edit-aql-queries').modal('hide');
|
||||
|
||||
// fill select box with # of results
|
||||
var querySize = 1000;
|
||||
localStorage.setItem("customQueries", JSON.stringify(this.customQueries));
|
||||
this.renderSelectboxes();
|
||||
},
|
||||
updateEditSelect: function () {
|
||||
var value = this.getCustomQueryValueByName($('#queryModalSelect').val());
|
||||
$('#edit-aql-textarea').val(value);
|
||||
$('#edit-aql-textarea').focus();
|
||||
},
|
||||
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");
|
||||
}
|
||||
});
|
||||
},
|
||||
getCustomQueryValueByName: function (qName) {
|
||||
var returnVal;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (qName === v.name) {
|
||||
returnVal = v.value;
|
||||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if ($('#' + e.currentTarget.id).val() === v.name) {
|
||||
inputEditor.setValue(v.value);
|
||||
}
|
||||
});
|
||||
|
||||
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 = '';
|
||||
if (modal === true) {
|
||||
selector = '#queryModalSelect';
|
||||
$(selector).empty();
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
}
|
||||
else {
|
||||
selector = '#querySelect';
|
||||
$(selector).empty();
|
||||
$(selector).append('<option id="emptyquery">Insert Query</option>');
|
||||
|
||||
$(selector).append('<optgroup label="Example queries">');
|
||||
$.each(this.queries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
$(selector).append('</optgroup>');
|
||||
|
||||
if (this.customQueries.length > 0) {
|
||||
$(selector).append('<optgroup label="Custom queries">');
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
$(selector).append('</optgroup>');
|
||||
}
|
||||
}
|
||||
},
|
||||
undoText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.undo();
|
||||
},
|
||||
redoText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.redo();
|
||||
},
|
||||
commentText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.toggleCommentLines();
|
||||
},
|
||||
sortQueries: function () {
|
||||
this.queries = _.sortBy(this.queries, 'name');
|
||||
this.customQueries = _.sortBy(this.customQueries, 'name');
|
||||
},
|
||||
submitQuery: function () {
|
||||
console.log("submitQuery");
|
||||
this.result();
|
||||
var self = this;
|
||||
var sizeBox = $('#querySize');
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var data = {
|
||||
query: inputEditor.getValue(),
|
||||
batchSize: parseInt(sizeBox.val(), 10)
|
||||
};
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/_api/cursor",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
outputEditor.setValue(arangoHelper.FormatJSON(data.result));
|
||||
if (typeof Storage) {
|
||||
if (localStorage.getItem("querySize") > 0) {
|
||||
querySize = parseInt(localStorage.getItem("querySize"), 10);
|
||||
localStorage.setItem("queryContent", inputEditor.getValue());
|
||||
localStorage.setItem("queryOutput", outputEditor.getValue());
|
||||
}
|
||||
self.deselect(outputEditor);
|
||||
},
|
||||
error: function (data) {
|
||||
try {
|
||||
var temp = JSON.parse(data.responseText);
|
||||
outputEditor.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
|
||||
|
||||
if (typeof Storage) {
|
||||
localStorage.setItem("queryContent", inputEditor.getValue());
|
||||
localStorage.setItem("queryOutput", outputEditor.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
outputEditor.getSession().setMode("ace/mode/json");
|
||||
outputEditor.setFontSize("16px");
|
||||
outputEditor.setValue('');
|
||||
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.getSession().setMode("ace/mode/aql");
|
||||
inputEditor.setFontSize("16px");
|
||||
inputEditor.commands.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: {win:"Ctrl-Shift-C", linux:"Ctrl-Shift-C", mac:"Command-Shift-C"},
|
||||
exec: function (editor) {
|
||||
editor.toggleCommentLines();
|
||||
},
|
||||
multiSelectAction: "forEach"
|
||||
});
|
||||
|
||||
inputEditor.getSession().selection.on('changeCursor', function (e) {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var session = inputEditor.getSession();
|
||||
var cursor = inputEditor.getCursorPosition();
|
||||
var token = session.getTokenAt(cursor.row, cursor.column);
|
||||
if (token) {
|
||||
if (token.type === "comment") {
|
||||
$("#commentText")
|
||||
.removeClass("arango-icon-comment")
|
||||
.addClass("arango-icon-uncomment")
|
||||
.attr("data-original-title", "Uncomment");
|
||||
} else {
|
||||
$("#commentText")
|
||||
.addClass("arango-icon-comment")
|
||||
.removeClass("arango-icon-uncomment")
|
||||
.attr("data-original-title", "Comment");
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#queryOutput').resizable({
|
||||
handles: "s",
|
||||
ghost: true,
|
||||
stop: function () {
|
||||
setTimeout(function () {
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
outputEditor.resize();
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
$('#aqlEditor').resizable({
|
||||
handles: "s",
|
||||
ghost: true,
|
||||
//helper: "resizable-helper",
|
||||
stop: function () {
|
||||
setTimeout(function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.resize();
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
arangoHelper.fixTooltips(".queryTooltips, .icon_arangodb", "top");
|
||||
|
||||
$('#aqlEditor .ace_text-input').focus();
|
||||
|
||||
if (typeof Storage) {
|
||||
var queryContent = localStorage.getItem("queryContent");
|
||||
var queryOutput = localStorage.getItem("queryOutput");
|
||||
inputEditor.setValue(queryContent);
|
||||
outputEditor.setValue(queryOutput);
|
||||
catch (e) {
|
||||
outputEditor.setValue('ERROR');
|
||||
}
|
||||
}
|
||||
});
|
||||
outputEditor.resize();
|
||||
this.deselect(inputEditor);
|
||||
|
||||
var windowHeight = $(window).height() - 250;
|
||||
$('#queryOutput').height(windowHeight / 3);
|
||||
$('#aqlEditor').height(windowHeight / 2);
|
||||
},
|
||||
|
||||
inputEditor.resize();
|
||||
outputEditor.resize();
|
||||
result: function (e) {
|
||||
$("#result-switch").parent().addClass("active");
|
||||
$("#query-switch").parent().removeClass("active");
|
||||
$("#result").addClass("active");
|
||||
$("#query").removeClass("active");
|
||||
$("#tabContentResult").show();
|
||||
$("#tabContentQuery").hide();
|
||||
/* console.log($(e.currentTarget).closest(".pull-right").addClass("active"));
|
||||
this.resetState();
|
||||
this.table = "logTableID";
|
||||
this.clearTable();
|
||||
this.collection.fillLocalStorage(this.table, this.offset, this.size);*/
|
||||
},
|
||||
|
||||
this.renderSelectboxes();
|
||||
this.deselect(outputEditor);
|
||||
this.deselect(inputEditor);
|
||||
query: function (e) {
|
||||
$("#query-switch").parent().addClass("active");
|
||||
$("#result-switch").parent().removeClass("active");
|
||||
$("#query").addClass("active");
|
||||
$("#result").removeClass("active");
|
||||
$("#tabContentQuery").show();
|
||||
$("#tabContentResult").hide();
|
||||
/* console.log("BLUBBBBBER2");
|
||||
this.resetState();
|
||||
this.table = "logTableID";
|
||||
this.clearTable();
|
||||
this.collection.fillLocalStorage(this.table, this.offset, this.size);*/
|
||||
},
|
||||
|
||||
$('#queryDiv').show();
|
||||
//outputEditor.setTheme("ace/theme/merbivore_soft");
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
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
|
||||
$('#new-query-name').val('');
|
||||
$('#new-aql-query').modal('show');
|
||||
setTimeout(function () {
|
||||
$('#new-query-name').focus();
|
||||
}, 500);
|
||||
},
|
||||
editAQL: function () {
|
||||
if (this.customQueries.length === 0) {
|
||||
//Heiko: display information that no custom queries are available
|
||||
return;
|
||||
}
|
||||
|
||||
this.hideDeleteField();
|
||||
$('#queryDropdown').slideToggle();
|
||||
//$('#edit-aql-queries').modal('show');
|
||||
this.renderSelectboxes(true);
|
||||
this.updateEditSelect();
|
||||
},
|
||||
getAQL: function () {
|
||||
if (localStorage.getItem("customQueries")) {
|
||||
this.customQueries = JSON.parse(localStorage.getItem("customQueries"));
|
||||
}
|
||||
},
|
||||
showDeleteField: function () {
|
||||
$('#reallyDeleteQueryDiv').show();
|
||||
},
|
||||
hideDeleteField: function () {
|
||||
$('#reallyDeleteQueryDiv').hide();
|
||||
},
|
||||
deleteAQL: function () {
|
||||
var queryName = $('#queryModalSelect').val();
|
||||
var tempArray = [];
|
||||
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (queryName !== v.name) {
|
||||
tempArray.push({
|
||||
name: v.name,
|
||||
value: v.value
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.customQueries = tempArray;
|
||||
localStorage.setItem("customQueries", JSON.stringify(this.customQueries));
|
||||
$('#edit-aql-queries').modal('hide');
|
||||
this.renderSelectboxes();
|
||||
},
|
||||
saveAQL: function (e) {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var queryName = $('#new-query-name').val();
|
||||
var content = inputEditor.getValue();
|
||||
|
||||
if (e) {
|
||||
if (e.target.id === 'save-edit-query') {
|
||||
content = $('#edit-aql-textarea').val();
|
||||
queryName = $('#queryModalSelect').val();
|
||||
}
|
||||
}
|
||||
|
||||
if (queryName.trim() === '') {
|
||||
//Heiko: Form-Validator - illegal query name
|
||||
return;
|
||||
}
|
||||
|
||||
//check for already existing entry
|
||||
var tempArray = [];
|
||||
var quit = false;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (e.target.id !== 'save-edit-query') {
|
||||
if (v.name === queryName) {
|
||||
quit = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (v.name !== queryName) {
|
||||
tempArray.push({
|
||||
name: v.name,
|
||||
value: v.value
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (quit === true) {
|
||||
//Heiko: Form-Validator - name already taken
|
||||
return;
|
||||
}
|
||||
|
||||
this.customQueries = tempArray;
|
||||
|
||||
this.customQueries.push({
|
||||
name: queryName,
|
||||
value: content
|
||||
});
|
||||
|
||||
$('#new-aql-query').modal('hide');
|
||||
$('#edit-aql-queries').modal('hide');
|
||||
|
||||
localStorage.setItem("customQueries", JSON.stringify(this.customQueries));
|
||||
this.renderSelectboxes();
|
||||
},
|
||||
updateEditSelect: function () {
|
||||
var value = this.getCustomQueryValueByName($('#queryModalSelect').val());
|
||||
$('#edit-aql-textarea').val(value);
|
||||
$('#edit-aql-textarea').focus();
|
||||
},
|
||||
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");
|
||||
}
|
||||
});
|
||||
},
|
||||
getCustomQueryValueByName: function (qName) {
|
||||
var returnVal;
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if (qName === v.name) {
|
||||
returnVal = v.value;
|
||||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
if ($('#' + e.currentTarget.id).val() === v.name) {
|
||||
inputEditor.setValue(v.value);
|
||||
}
|
||||
});
|
||||
|
||||
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 = '';
|
||||
if (modal === true) {
|
||||
selector = '#queryModalSelect';
|
||||
$(selector).empty();
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
}
|
||||
else {
|
||||
selector = '#querySelect';
|
||||
$(selector).empty();
|
||||
$(selector).append('<option id="emptyquery">Insert Query</option>');
|
||||
|
||||
$(selector).append('<optgroup label="Example queries">');
|
||||
$.each(this.queries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
$(selector).append('</optgroup>');
|
||||
|
||||
if (this.customQueries.length > 0) {
|
||||
$(selector).append('<optgroup label="Custom queries">');
|
||||
$.each(this.customQueries, function (k, v) {
|
||||
$(selector).append('<option id="' + v.name + '">' + v.name + '</option>');
|
||||
});
|
||||
$(selector).append('</optgroup>');
|
||||
}
|
||||
}
|
||||
},
|
||||
undoText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.undo();
|
||||
},
|
||||
redoText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.redo();
|
||||
},
|
||||
commentText: function () {
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
inputEditor.toggleCommentLines();
|
||||
|
||||
// var value;
|
||||
// var newValue;
|
||||
// var flag = false;
|
||||
// var cursorRange = inputEditor.getSelection().getRange();
|
||||
//
|
||||
// var regExp = new RegExp(/\*\//);
|
||||
// var regExp2 = new RegExp(/\/\*/);
|
||||
//
|
||||
// if (cursorRange.end.row === cursorRange.start.row) {
|
||||
// //single line comment /* */
|
||||
// value = inputEditor.getSession().getLine(cursorRange.start.row);
|
||||
// if (value.search(regExp) === -1 && value.search(regExp2) === -1) {
|
||||
// newValue = '/*' + value + '*/';
|
||||
// flag = true;
|
||||
// }
|
||||
// else if (value.search(regExp) !== -1 && value.search(regExp2) !== -1) {
|
||||
// newValue = value.replace(regExp, '').replace(regExp2, '');
|
||||
// flag = true;
|
||||
// }
|
||||
// if (flag === true) {
|
||||
// inputEditor.find(value, {
|
||||
// range: cursorRange
|
||||
// });
|
||||
// inputEditor.replace(newValue);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// //multi line comment
|
||||
// value = inputEditor.getSession().getLines(
|
||||
// cursorRange.start.row,
|
||||
// cursorRange.end.row
|
||||
// );
|
||||
// var firstString = value[0];
|
||||
// var lastString = value[value.length - 1];
|
||||
// var newFirstString;
|
||||
// var newLastString;
|
||||
//
|
||||
// if (firstString.search(regExp2) === -1 && lastString.search(regExp) === -1) {
|
||||
// newFirstString = '/*' + firstString;
|
||||
// newLastString = lastString + '*/';
|
||||
// flag = true;
|
||||
// }
|
||||
// else if (firstString.search(regExp2) !== -1 && lastString.search(regExp) !== -1) {
|
||||
// newFirstString = firstString.replace(regExp2, '');
|
||||
// newLastString = lastString.replace(regExp, '');
|
||||
// flag = true;
|
||||
// }
|
||||
// if (flag === true) {
|
||||
// inputEditor.find(firstString, {
|
||||
// range: cursorRange
|
||||
// });
|
||||
// inputEditor.replace(newFirstString);
|
||||
// inputEditor.find(lastString, {
|
||||
// range: cursorRange
|
||||
// });
|
||||
// inputEditor.replace(newLastString);
|
||||
// }
|
||||
// }
|
||||
// cursorRange.end.column = cursorRange.end.column + 2;
|
||||
// inputEditor.getSelection().setSelectionRange(cursorRange, false);
|
||||
},
|
||||
sortQueries: function () {
|
||||
this.queries = _.sortBy(this.queries, 'name');
|
||||
this.customQueries = _.sortBy(this.customQueries, 'name');
|
||||
},
|
||||
submitQuery: function () {
|
||||
var self = this;
|
||||
var sizeBox = $('#querySize');
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var data = {
|
||||
query: inputEditor.getValue(),
|
||||
batchSize: parseInt(sizeBox.val(), 10)
|
||||
};
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/_api/cursor",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
outputEditor.setValue(arangoHelper.FormatJSON(data.result));
|
||||
if (typeof Storage) {
|
||||
localStorage.setItem("queryContent", inputEditor.getValue());
|
||||
localStorage.setItem("queryOutput", outputEditor.getValue());
|
||||
}
|
||||
self.deselect(outputEditor);
|
||||
},
|
||||
error: function (data) {
|
||||
try {
|
||||
var temp = JSON.parse(data.responseText);
|
||||
outputEditor.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
|
||||
|
||||
if (typeof Storage) {
|
||||
localStorage.setItem("queryContent", inputEditor.getValue());
|
||||
localStorage.setItem("queryOutput", outputEditor.getValue());
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
outputEditor.setValue('ERROR');
|
||||
}
|
||||
}
|
||||
});
|
||||
outputEditor.resize();
|
||||
this.deselect(inputEditor);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -46,6 +46,8 @@ div.centralRow {
|
|||
|
||||
div.centralContent {
|
||||
padding: 5px;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: $c_content_transp;
|
||||
|
|
|
@ -604,6 +604,8 @@ div.centralRow {
|
|||
|
||||
div.centralContent {
|
||||
padding: 5px;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.0675);
|
||||
|
|
|
@ -604,6 +604,8 @@ div.centralRow {
|
|||
|
||||
div.centralContent {
|
||||
padding: 5px;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.0675);
|
||||
|
|
|
@ -604,6 +604,8 @@ div.centralRow {
|
|||
|
||||
div.centralContent {
|
||||
padding: 5px;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.0675);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
In order to manage your cluster later you have to save this configuration.
|
||||
Without this configuration you cannot shutdown or restart your cluster using this interface.
|
||||
</p>
|
||||
<button class="btn btn-success" id="startDownload">Save Configuration</button>
|
||||
<button class="button-success" id="startDownload">Save Configuration</button>
|
||||
</div>
|
||||
|
||||
<legend class="gv_inner">The following ArangoDBs have been started</legend>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button class="btn btn-success" id="startSymmetricPlan">Create Cluster</button>
|
||||
<button class="button-success" id="startSymmetricPlan">Create Cluster</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</fieldset>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button class="btn btn-success" id="startTestPlan">Create Cluster</button>
|
||||
<button class="button-success" id="startTestPlan">Create Cluster</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue