1
0
Fork 0

added autocomplete to query & shell

This commit is contained in:
Heiko Kernbach 2012-05-25 14:57:51 +02:00
parent fbffd43209
commit f0cc293635
1 changed files with 17 additions and 2 deletions

View File

@ -24,6 +24,8 @@ var checkCollectionName;
var printedHelp = false; var printedHelp = false;
var open = false; var open = false;
var rowCounter = 0; var rowCounter = 0;
var shArray = [];
var quArray = [];
$(document).ready(function() { $(document).ready(function() {
showCursor(); showCursor();
@ -709,6 +711,9 @@ var logTable = $('#logTableID').dataTable({
$('#queryView').show(); $('#queryView').show();
createnav ("Query"); createnav ("Query");
$('#queryContent').focus(); $('#queryContent').focus();
$("#queryContent").autocomplete({
source: quArray
});
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -727,6 +732,9 @@ var logTable = $('#logTableID').dataTable({
printedHelp = true; printedHelp = true;
start_pretty_print(); start_pretty_print();
} }
$("#avocshContent").autocomplete({
source: shArray
});
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1198,6 +1206,10 @@ var lastFormatQuestion = true;
$('#submitAvoc').live('click', function () { $('#submitAvoc').live('click', function () {
var data = $('#avocshContent').val(); var data = $('#avocshContent').val();
shArray.push(data);
$("#avocshContent").autocomplete({
source: shArray
});
if (data == "help") { if (data == "help") {
data = "help()"; data = "help()";
@ -1218,6 +1230,7 @@ var lastFormatQuestion = true;
} }
} }
var client = "arangosh> " + escapeHTML(data) + "<br>"; var client = "arangosh> " + escapeHTML(data) + "<br>";
$('#avocshWindow').append('<b class="avocshClient">' + client + '</b>'); $('#avocshWindow').append('<b class="avocshClient">' + client + '</b>');
evaloutput(data); evaloutput(data);
@ -1226,8 +1239,6 @@ var lastFormatQuestion = true;
return false; return false;
}); });
$('#refreshShell').live('click', function () { $('#refreshShell').live('click', function () {
location.reload(); location.reload();
return false; return false;
@ -1238,6 +1249,10 @@ var lastFormatQuestion = true;
$('#submitQuery').live('click', function () { $('#submitQuery').live('click', function () {
var data = {query:$('#queryContent').val()}; var data = {query:$('#queryContent').val()};
quArray.push(data);
$("#queryContent").autocomplete({
source: quArray
});
var formattedJSON; var formattedJSON;
$.ajax({ $.ajax({
type: "POST", type: "POST",