mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB
This commit is contained in:
commit
426bbb307c
|
@ -58,12 +58,14 @@ namespace triagens {
|
||||||
int port,
|
int port,
|
||||||
double requestTimeout,
|
double requestTimeout,
|
||||||
double connectTimeout,
|
double connectTimeout,
|
||||||
size_t connectRetries) :
|
size_t connectRetries,
|
||||||
|
bool warn = true) :
|
||||||
_hostname(hostname),
|
_hostname(hostname),
|
||||||
_port(port),
|
_port(port),
|
||||||
_requestTimeout(requestTimeout),
|
_requestTimeout(requestTimeout),
|
||||||
_connectTimeout(connectTimeout),
|
_connectTimeout(connectTimeout),
|
||||||
_connectRetries(connectRetries),
|
_connectRetries(connectRetries),
|
||||||
|
_warn(warn),
|
||||||
_writeBuffer(TRI_UNKNOWN_MEM_ZONE),
|
_writeBuffer(TRI_UNKNOWN_MEM_ZONE),
|
||||||
_readBuffer(TRI_UNKNOWN_MEM_ZONE) {
|
_readBuffer(TRI_UNKNOWN_MEM_ZONE) {
|
||||||
|
|
||||||
|
@ -129,7 +131,9 @@ namespace triagens {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWorking() && _errorMessage=="" ) {
|
if (isWorking() && _errorMessage=="" ) {
|
||||||
LOGGER_ERROR << "Request timeout reached.";
|
if (_warn) {
|
||||||
|
LOGGER_WARNING << "Request timeout reached.";
|
||||||
|
}
|
||||||
_errorMessage = "Request timeout reached.";
|
_errorMessage = "Request timeout reached.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,14 +157,15 @@ namespace triagens {
|
||||||
_numConnectRetries++;
|
_numConnectRetries++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGGER_ERROR << "Could not connect to '" << _hostname << ":" << _port << "'! Connection is dead";
|
if (_warn) {
|
||||||
|
LOGGER_WARNING << "Could not connect to '" << _hostname << ":" << _port << "'! Connection is dead";
|
||||||
|
}
|
||||||
_state = DEAD;
|
_state = DEAD;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_hostname == "" || _port == 0) {
|
if (_hostname == "" || _port == 0) {
|
||||||
_errorMessage = "Could not connect to '" + _hostname + ":" + StringUtils::itoa(_port) + "'";
|
_errorMessage = "Could not connect to '" + _hostname + ":" + StringUtils::itoa(_port) + "'";
|
||||||
LOGGER_ERROR << "Could not connect to '" << _hostname << ":" << _port << "'! Connection is dead";
|
|
||||||
_state = DEAD;
|
_state = DEAD;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ namespace triagens {
|
||||||
int port,
|
int port,
|
||||||
double requestTimeout,
|
double requestTimeout,
|
||||||
double connectTimeout,
|
double connectTimeout,
|
||||||
size_t connectRetries);
|
size_t connectRetries,
|
||||||
|
bool warn);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief destructs a http client
|
/// @brief destructs a http client
|
||||||
|
@ -302,6 +303,7 @@ namespace triagens {
|
||||||
double _requestTimeout;
|
double _requestTimeout;
|
||||||
double _connectTimeout;
|
double _connectTimeout;
|
||||||
size_t _connectRetries;
|
size_t _connectRetries;
|
||||||
|
bool _warn;
|
||||||
|
|
||||||
socket_t _socket;
|
socket_t _socket;
|
||||||
|
|
||||||
|
|
|
@ -66,12 +66,13 @@ namespace triagens {
|
||||||
int port,
|
int port,
|
||||||
double requestTimeout,
|
double requestTimeout,
|
||||||
size_t retries,
|
size_t retries,
|
||||||
double connectionTimeout) : _client(0), _httpResult(0) {
|
double connectionTimeout,
|
||||||
|
bool warn) : _client(0), _httpResult(0) {
|
||||||
|
|
||||||
_connected = false;
|
_connected = false;
|
||||||
_lastHttpReturnCode = 0;
|
_lastHttpReturnCode = 0;
|
||||||
_lastErrorMessage = "";
|
_lastErrorMessage = "";
|
||||||
_client = new SimpleHttpClient(hostname, port, requestTimeout, retries, connectionTimeout);
|
_client = new SimpleHttpClient(hostname, port, requestTimeout, retries, connectionTimeout, warn);
|
||||||
|
|
||||||
// connect to server and get version number
|
// connect to server and get version number
|
||||||
map<string, string> headerFields;
|
map<string, string> headerFields;
|
||||||
|
|
|
@ -81,7 +81,8 @@ namespace triagens {
|
||||||
int port,
|
int port,
|
||||||
double requestTimeout,
|
double requestTimeout,
|
||||||
size_t retries,
|
size_t retries,
|
||||||
double connectionTimeout);
|
double connectionTimeout,
|
||||||
|
bool warn);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief destructor
|
/// @brief destructor
|
||||||
|
|
|
@ -64,9 +64,9 @@ using namespace triagens::v8client;
|
||||||
|
|
||||||
static string DEFAULT_SERVER_NAME = "localhost";
|
static string DEFAULT_SERVER_NAME = "localhost";
|
||||||
static int DEFAULT_SERVER_PORT = 8529;
|
static int DEFAULT_SERVER_PORT = 8529;
|
||||||
static double DEFAULT_REQUEST_TIMEOUT = 10.0;
|
static int64_t DEFAULT_REQUEST_TIMEOUT = 300;
|
||||||
static size_t DEFAULT_RETRIES = 5;
|
static size_t DEFAULT_RETRIES = 5;
|
||||||
static double DEFAULT_CONNECTION_TIMEOUT = 1.0;
|
static int64_t DEFAULT_CONNECTION_TIMEOUT = 5;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief server address
|
/// @brief server address
|
||||||
|
@ -86,6 +86,18 @@ V8ClientConnection* clientConnection = 0;
|
||||||
|
|
||||||
static uint64_t maxUploadSize = 500000;
|
static uint64_t maxUploadSize = 500000;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief connect timeout (in s)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static int64_t connectTimeout = DEFAULT_CONNECTION_TIMEOUT;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief request timeout (in s)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static int64_t requestTimeout = DEFAULT_REQUEST_TIMEOUT;
|
||||||
|
|
||||||
static string QuoteChar = "\"";
|
static string QuoteChar = "\"";
|
||||||
static string SeparatorChar = ",";
|
static string SeparatorChar = ",";
|
||||||
static string FileName = "";
|
static string FileName = "";
|
||||||
|
@ -164,6 +176,8 @@ static void ParseProgramOptions (int argc, char* argv[]) {
|
||||||
("quote", &QuoteChar, "quote character")
|
("quote", &QuoteChar, "quote character")
|
||||||
("separator", &SeparatorChar, "separator character")
|
("separator", &SeparatorChar, "separator character")
|
||||||
("max-upload-size", &maxUploadSize, "maximum size of import chunks")
|
("max-upload-size", &maxUploadSize, "maximum size of import chunks")
|
||||||
|
("connect-timeout", &connectTimeout, "connect timeout in seconds")
|
||||||
|
("request-timeout", &requestTimeout, "request timeout in seconds")
|
||||||
;
|
;
|
||||||
|
|
||||||
vector<string> myargs;
|
vector<string> myargs;
|
||||||
|
@ -218,6 +232,17 @@ int main (int argc, char* argv[]) {
|
||||||
// parse the program options
|
// parse the program options
|
||||||
ParseProgramOptions(argc, argv);
|
ParseProgramOptions(argc, argv);
|
||||||
|
|
||||||
|
// check connection args
|
||||||
|
if (connectTimeout <= 0) {
|
||||||
|
cout << "invalid value for connect-timeout." << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestTimeout <= 0) {
|
||||||
|
cout << "invalid value for request-timeout." << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// processComandLineArguments(argc, argv);
|
// processComandLineArguments(argc, argv);
|
||||||
if (! splitServerAdress(ServerAddress, DEFAULT_SERVER_NAME, DEFAULT_SERVER_PORT)) {
|
if (! splitServerAdress(ServerAddress, DEFAULT_SERVER_NAME, DEFAULT_SERVER_PORT)) {
|
||||||
if (ServerAddress.length()) {
|
if (ServerAddress.length()) {
|
||||||
|
@ -228,10 +253,11 @@ int main (int argc, char* argv[]) {
|
||||||
clientConnection = new V8ClientConnection(
|
clientConnection = new V8ClientConnection(
|
||||||
DEFAULT_SERVER_NAME,
|
DEFAULT_SERVER_NAME,
|
||||||
DEFAULT_SERVER_PORT,
|
DEFAULT_SERVER_PORT,
|
||||||
DEFAULT_REQUEST_TIMEOUT,
|
(double) requestTimeout,
|
||||||
DEFAULT_RETRIES,
|
DEFAULT_RETRIES,
|
||||||
DEFAULT_CONNECTION_TIMEOUT);
|
(double) connectTimeout,
|
||||||
|
true);
|
||||||
|
|
||||||
if (clientConnection->isConnected()) {
|
if (clientConnection->isConnected()) {
|
||||||
printf("Connected to Arango DB %s:%d Version %s\n",
|
printf("Connected to Arango DB %s:%d Version %s\n",
|
||||||
clientConnection->getHostname().c_str(),
|
clientConnection->getHostname().c_str(),
|
||||||
|
@ -239,12 +265,14 @@ int main (int argc, char* argv[]) {
|
||||||
clientConnection->getVersion().c_str());
|
clientConnection->getVersion().c_str());
|
||||||
|
|
||||||
cout << "----------------------------------------" << endl;
|
cout << "----------------------------------------" << endl;
|
||||||
cout << "collection : " << CollectionName << endl;
|
cout << "collection : " << CollectionName << endl;
|
||||||
cout << "create : " << (CreateCollection ? "yes" : "no") << endl;
|
cout << "create : " << (CreateCollection ? "yes" : "no") << endl;
|
||||||
cout << "file : " << FileName << endl;
|
cout << "file : " << FileName << endl;
|
||||||
cout << "type : " << TypeImport << endl;
|
cout << "type : " << TypeImport << endl;
|
||||||
cout << "quote : " << QuoteChar << endl;
|
cout << "quote : " << QuoteChar << endl;
|
||||||
cout << "separator : " << SeparatorChar << endl;
|
cout << "separator : " << SeparatorChar << endl;
|
||||||
|
cout << "connect timeout : " << connectTimeout << endl;
|
||||||
|
cout << "request timeout : " << requestTimeout << endl;
|
||||||
cout << "----------------------------------------" << endl;
|
cout << "----------------------------------------" << endl;
|
||||||
|
|
||||||
ImportHelper ih(clientConnection->getHttpClient(), maxUploadSize);
|
ImportHelper ih(clientConnection->getHttpClient(), maxUploadSize);
|
||||||
|
@ -257,7 +285,7 @@ int main (int argc, char* argv[]) {
|
||||||
ih.setQuote(QuoteChar[0]);
|
ih.setQuote(QuoteChar[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cout << "Wrong lenght of quote character." << endl;
|
cout << "Wrong length of quote character." << endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +293,7 @@ int main (int argc, char* argv[]) {
|
||||||
ih.setSeparator(SeparatorChar[0]);
|
ih.setSeparator(SeparatorChar[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cout << "Wrong lenght of separator character." << endl;
|
cout << "Wrong length of separator character." << endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,9 @@ using namespace triagens::arango;
|
||||||
|
|
||||||
static string DEFAULT_SERVER_NAME = "localhost";
|
static string DEFAULT_SERVER_NAME = "localhost";
|
||||||
static int DEFAULT_SERVER_PORT = 8529;
|
static int DEFAULT_SERVER_PORT = 8529;
|
||||||
static double DEFAULT_REQUEST_TIMEOUT = 10.0;
|
static int64_t DEFAULT_REQUEST_TIMEOUT = 300;
|
||||||
static size_t DEFAULT_RETRIES = 5;
|
static size_t DEFAULT_RETRIES = 5;
|
||||||
static double DEFAULT_CONNECTION_TIMEOUT = 1.0;
|
static int64_t DEFAULT_CONNECTION_TIMEOUT = 5;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief quite start
|
/// @brief quite start
|
||||||
|
@ -189,6 +189,18 @@ regex_t intRegex;
|
||||||
|
|
||||||
static uint64_t maxUploadSize = 500000;
|
static uint64_t maxUploadSize = 500000;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief connect timeout (in s)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static int64_t connectTimeout = DEFAULT_CONNECTION_TIMEOUT;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief request timeout (in s)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static int64_t requestTimeout = DEFAULT_REQUEST_TIMEOUT;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @}
|
/// @}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -534,6 +546,8 @@ static void ParseProgramOptions (int argc, char* argv[]) {
|
||||||
("pretty-print", "pretty print values")
|
("pretty-print", "pretty print values")
|
||||||
("no-colors", "deactivate color support")
|
("no-colors", "deactivate color support")
|
||||||
("no-auto-complete", "disable auto completion")
|
("no-auto-complete", "disable auto completion")
|
||||||
|
("connect-timeout", &connectTimeout, "connect timeout in seconds")
|
||||||
|
("request-timeout", &requestTimeout, "request timeout in seconds")
|
||||||
("unit-tests", &UnitTests, "do not start as shell, run unit tests instead")
|
("unit-tests", &UnitTests, "do not start as shell, run unit tests instead")
|
||||||
("max-upload-size", &maxUploadSize, "maximum size of import chunks")
|
("max-upload-size", &maxUploadSize, "maximum size of import chunks")
|
||||||
(hidden, true)
|
(hidden, true)
|
||||||
|
@ -649,10 +663,8 @@ static v8::Handle<v8::Value> ClientConnection_ConstructorCallback (v8::Arguments
|
||||||
|
|
||||||
string server = DEFAULT_SERVER_NAME;
|
string server = DEFAULT_SERVER_NAME;
|
||||||
int port = DEFAULT_SERVER_PORT;
|
int port = DEFAULT_SERVER_PORT;
|
||||||
double requestTimeout = DEFAULT_REQUEST_TIMEOUT;
|
|
||||||
size_t retries = DEFAULT_RETRIES;
|
size_t retries = DEFAULT_RETRIES;
|
||||||
double connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
|
|
||||||
|
|
||||||
if (argv.Length() > 0 && argv[0]->IsString()) {
|
if (argv.Length() > 0 && argv[0]->IsString()) {
|
||||||
string definition = TRI_ObjectToString(argv[0]);
|
string definition = TRI_ObjectToString(argv[0]);
|
||||||
|
|
||||||
|
@ -663,7 +675,7 @@ static v8::Handle<v8::Value> ClientConnection_ConstructorCallback (v8::Arguments
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
V8ClientConnection* connection = new V8ClientConnection(server, port, requestTimeout, retries, connectionTimeout);
|
V8ClientConnection* connection = new V8ClientConnection(server, port, (double) requestTimeout, retries, (double) connectTimeout, false);
|
||||||
|
|
||||||
if (connection->isConnected()) {
|
if (connection->isConnected()) {
|
||||||
printf("Connected to Arango DB %s:%d Version %s\n",
|
printf("Connected to Arango DB %s:%d Version %s\n",
|
||||||
|
@ -1153,6 +1165,17 @@ int main (int argc, char* argv[]) {
|
||||||
|
|
||||||
// parse the program options
|
// parse the program options
|
||||||
ParseProgramOptions(argc, argv);
|
ParseProgramOptions(argc, argv);
|
||||||
|
|
||||||
|
// check connection args
|
||||||
|
if (connectTimeout <= 0) {
|
||||||
|
cout << "invalid value for connect-timeout." << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestTimeout <= 0) {
|
||||||
|
cout << "invalid value for request-timeout." << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
|
|
||||||
|
@ -1193,9 +1216,10 @@ int main (int argc, char* argv[]) {
|
||||||
clientConnection = new V8ClientConnection(
|
clientConnection = new V8ClientConnection(
|
||||||
DEFAULT_SERVER_NAME,
|
DEFAULT_SERVER_NAME,
|
||||||
DEFAULT_SERVER_PORT,
|
DEFAULT_SERVER_PORT,
|
||||||
DEFAULT_REQUEST_TIMEOUT,
|
(double) requestTimeout,
|
||||||
DEFAULT_RETRIES,
|
DEFAULT_RETRIES,
|
||||||
DEFAULT_CONNECTION_TIMEOUT);
|
(double) connectTimeout,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
|
|
|
@ -15,6 +15,10 @@ table.dataTable thead th {
|
||||||
*cursor: hand;
|
*cursor: hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#subCenterView table.dataTable thead th {
|
||||||
|
cursor: default !important;
|
||||||
|
}
|
||||||
|
|
||||||
table.dataTable tfoot th {
|
table.dataTable tfoot th {
|
||||||
padding: 3px 10px;
|
padding: 3px 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.writeable {
|
.writeable {
|
||||||
width: 100%;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
width:auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#delete {
|
#delete {
|
||||||
|
@ -346,6 +346,13 @@ form {
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#formatshellJSONyesno {
|
||||||
|
float:right;
|
||||||
|
padding-right:10px;
|
||||||
|
margin-top: -3px;
|
||||||
|
color: #797979;
|
||||||
|
}
|
||||||
|
|
||||||
#formatJSONyesno {
|
#formatJSONyesno {
|
||||||
margin-top: -40px;
|
margin-top: -40px;
|
||||||
float:right;
|
float:right;
|
||||||
|
@ -654,7 +661,7 @@ form {
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-shadow: 0 1px 0 #fff;
|
text-shadow: 0 1px 0 #fff;
|
||||||
width: 80px;
|
width: 90px;
|
||||||
}
|
}
|
||||||
#menue button.minimal:hover {
|
#menue button.minimal:hover {
|
||||||
background: #d9d9d9;
|
background: #d9d9d9;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>WebAdmin</title>
|
<title>ArangoDB - WebAdmin</title>
|
||||||
<style type="text/css" title="screen">
|
<style type="text/css" title="screen">
|
||||||
@import "css/layout.css";
|
@import "css/layout.css";
|
||||||
@import "css/jquery.snippet.css";
|
@import "css/jquery.snippet.css";
|
||||||
|
@ -161,8 +161,8 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<form id="uploadFile" action="/_api/import/?collection=...&createCollection=false" method=POST enctype="multipart/form-data">
|
<form id="uploadFile" action="/_api/import/?collection=...&createCollection=false" method=POST enctype="multipart/form-data">
|
||||||
<input type="submit" value="Import" />
|
<input id="uploadFileImport" type="submit" value="Import" />
|
||||||
<input type="file" name="filename" />
|
<input id="uploadFileSearch" type="file" name="filename" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="documentsTableID" width="100%">
|
<table cellpadding="0" cellspacing="0" border="0" class="display" id="documentsTableID" width="100%">
|
||||||
|
@ -397,6 +397,11 @@
|
||||||
<input type="text" class="editBox" id="avocshContent"></input><button class="minimal" id="submitAvoc">Ok</button>
|
<input type="text" class="editBox" id="avocshContent"></input><button class="minimal" id="submitAvoc">Ok</button>
|
||||||
</form>
|
</form>
|
||||||
<button class="minimal" id="refreshShell">Refresh</button>
|
<button class="minimal" id="refreshShell">Refresh</button>
|
||||||
|
<form action="#" id="formatshellJSONyesno">
|
||||||
|
Format JSON?
|
||||||
|
<input type="radio" name="formatshellJSONyesno" value=true checked>yes</input>
|
||||||
|
<input type="radio" name="formatshellJSONyesno" value=false>no</input>
|
||||||
|
</form>
|
||||||
<a href="http://www.arangodb.org/manuals/UserManual.html" target="_blank">ArangoDB Shell - click for more information</a>
|
<a href="http://www.arangodb.org/manuals/UserManual.html" target="_blank">ArangoDB Shell - click for more information</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -410,12 +415,11 @@
|
||||||
<a id="aqlinfo" href="http://www.arangodb.org/manuals/Aql.html" target="_blank">ArangoDB Query Language - click for more information</a>
|
<a id="aqlinfo" href="http://www.arangodb.org/manuals/Aql.html" target="_blank">ArangoDB Query Language - click for more information</a>
|
||||||
<br></br>
|
<br></br>
|
||||||
</form>
|
</form>
|
||||||
<form action="#" id="formatJSONyesno">
|
<form action="#" id="formatJSONyesno">
|
||||||
Format JSON?
|
Format JSON?
|
||||||
<input type="radio" name="formatJSONyesno" value=true checked>yes</input>
|
<input type="radio" name="formatJSONyesno" value=true checked>yes</input>
|
||||||
<input type="radio" name="formatJSONyesno" value=false>no</input>
|
<input type="radio" name="formatJSONyesno" value=false>no</input>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,6 +12,7 @@ var welcomeMSG = ""
|
||||||
+ " \n"
|
+ " \n"
|
||||||
+ "Welcome to arangosh 0.5.1. Copyright (c) 2012 triAGENS GmbH."
|
+ "Welcome to arangosh 0.5.1. Copyright (c) 2012 triAGENS GmbH."
|
||||||
|
|
||||||
|
|
||||||
// documents global vars
|
// documents global vars
|
||||||
var collectionCount;
|
var collectionCount;
|
||||||
var totalCollectionCount;
|
var totalCollectionCount;
|
||||||
|
@ -23,10 +24,16 @@ var checkCollectionName;
|
||||||
var printedHelp = false;
|
var printedHelp = false;
|
||||||
var open = false;
|
var open = false;
|
||||||
var rowCounter = 0;
|
var rowCounter = 0;
|
||||||
|
var shArray = [];
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
showCursor();
|
showCursor();
|
||||||
|
|
||||||
|
//hide incomplete functions
|
||||||
|
$("#uploadFile").attr("disabled", "disabled");
|
||||||
|
$("#uploadFileImport").attr("disabled", "disabled");
|
||||||
|
$("#uploadFileSearch").attr("disabled", "disabled");
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// global variables
|
/// global variables
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -160,7 +167,7 @@ var collectionTable = $('#collectionsTableID').dataTable({
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
"iDisplayLength": -1,
|
"iDisplayLength": -1,
|
||||||
"bJQueryUI": true,
|
"bJQueryUI": true,
|
||||||
"aoColumns": [{"sWidth":"120px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, null ],
|
"aoColumns": [{"sWidth":"150px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, null, {"sWidth": "200px"}, {"sWidth": "200px"} ],
|
||||||
"aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 4, 5 ] }],
|
"aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 4, 5 ] }],
|
||||||
"oLanguage": {"sEmptyTable": "No collections"}
|
"oLanguage": {"sEmptyTable": "No collections"}
|
||||||
});
|
});
|
||||||
|
@ -176,12 +183,11 @@ var documentEditTable = $('#documentEditTableID').dataTable({
|
||||||
"bSortable": false,
|
"bSortable": false,
|
||||||
"bLengthChange": false,
|
"bLengthChange": false,
|
||||||
"bDeferRender": true,
|
"bDeferRender": true,
|
||||||
"bAutoWidth": true,
|
|
||||||
"iDisplayLength": -1,
|
"iDisplayLength": -1,
|
||||||
"bJQueryUI": true,
|
"bJQueryUI": true,
|
||||||
"aoColumns": [{ "sClass":"center", "sClass":"read_only","bSortable": false, "sWidth": "30px"},
|
"aoColumns": [{ "sClass":"center", "sClass":"read_only","bSortable": false, "sWidth": "30px"},
|
||||||
{"sClass":"writeable", "bSortable": false, "sWidth":"250px" },
|
{"sClass":"writeable", "bSortable": false, "sWidth":"300px" },
|
||||||
{"sClass":"writeable", "bSortable": false },
|
{"sClass":"writeable", "bSortable": false},
|
||||||
{"bVisible": false } ],
|
{"bVisible": false } ],
|
||||||
"oLanguage": {"sEmptyTable": "No documents"}
|
"oLanguage": {"sEmptyTable": "No documents"}
|
||||||
});
|
});
|
||||||
|
@ -218,7 +224,7 @@ var documentsTable = $('#documentsTableID').dataTable({
|
||||||
"bAutoWidth": true,
|
"bAutoWidth": true,
|
||||||
"iDisplayLength": -1,
|
"iDisplayLength": -1,
|
||||||
"bJQueryUI": true,
|
"bJQueryUI": true,
|
||||||
"aoColumns": [{ "sClass":"center", "sClass":"read_only","bSortable": false, "sWidth": "70px"},
|
"aoColumns": [{ "sClass":"read_only","bSortable": false, "sWidth": "80px"},
|
||||||
{"sClass":"read_only","bSortable": false, "sWidth": "125px"},
|
{"sClass":"read_only","bSortable": false, "sWidth": "125px"},
|
||||||
{"sClass":"read_only","bSortable": false, "sWidth": "60px"},
|
{"sClass":"read_only","bSortable": false, "sWidth": "60px"},
|
||||||
{"bSortable": false}],
|
{"bSortable": false}],
|
||||||
|
@ -344,6 +350,7 @@ var logTable = $('#logTableID').dataTable({
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
else if (location.hash.substr(0, 12) == "#collection?" ) {
|
else if (location.hash.substr(0, 12) == "#collection?" ) {
|
||||||
|
$("#addNewDocButton").removeAttr("disabled");
|
||||||
tableView = true;
|
tableView = true;
|
||||||
$('#toggleNewDocButtonText').text('Edit Source');
|
$('#toggleNewDocButtonText').text('Edit Source');
|
||||||
|
|
||||||
|
@ -386,6 +393,7 @@ var logTable = $('#logTableID').dataTable({
|
||||||
|
|
||||||
else if (location.hash.substr(0, 14) == "#editDocument?") {
|
else if (location.hash.substr(0, 14) == "#editDocument?") {
|
||||||
tableView = true;
|
tableView = true;
|
||||||
|
$("#addEditedDocRowButton").removeAttr("disabled");
|
||||||
$('#toggleEditedDocButton').val('Edit Source');
|
$('#toggleEditedDocButton').val('Edit Source');
|
||||||
|
|
||||||
$('#documentEditSourceView').hide();
|
$('#documentEditSourceView').hide();
|
||||||
|
@ -716,9 +724,13 @@ var logTable = $('#logTableID').dataTable({
|
||||||
createnav ("ArangoDB Shell");
|
createnav ("ArangoDB Shell");
|
||||||
$('#avocshContent').focus();
|
$('#avocshContent').focus();
|
||||||
if (printedHelp === false) {
|
if (printedHelp === false) {
|
||||||
print(welcomeMSG + HELP);
|
print(welcomeMSG + require("arangosh").HELP);
|
||||||
printedHelp = true;
|
printedHelp = true;
|
||||||
|
start_pretty_print();
|
||||||
}
|
}
|
||||||
|
$("#avocshContent").autocomplete({
|
||||||
|
source: shArray
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -805,7 +817,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.log(e);
|
|
||||||
alert("Please make sure the entered value is a valid json string.");
|
alert("Please make sure the entered value is a valid json string.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -903,7 +914,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.log(e);
|
|
||||||
alert("Please make sure the entered value is a valid json string.");
|
alert("Please make sure the entered value is a valid json string.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,6 +959,7 @@ var logTable = $('#logTableID').dataTable({
|
||||||
$('#documentEditSourceView').toggle();
|
$('#documentEditSourceView').toggle();
|
||||||
tableView = false;
|
tableView = false;
|
||||||
$('#toggleEditedDocButtonText').text('Edit Table');
|
$('#toggleEditedDocButtonText').text('Edit Table');
|
||||||
|
$("#addEditedDocRowButton").attr("disabled", "disabled");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
|
@ -968,10 +979,10 @@ var logTable = $('#logTableID').dataTable({
|
||||||
$('#documentEditSourceView').toggle();
|
$('#documentEditSourceView').toggle();
|
||||||
tableView = true;
|
tableView = true;
|
||||||
$('#toggleEditedDocButtonText').text('Edit Source');
|
$('#toggleEditedDocButtonText').text('Edit Source');
|
||||||
|
$("#addEditedDocRowButton").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.log(e);
|
|
||||||
alert("Please make sure the entered value is a valid json string.");
|
alert("Please make sure the entered value is a valid json string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,6 +1083,7 @@ var logTable = $('#logTableID').dataTable({
|
||||||
$('#NewDocumentSourceView').toggle();
|
$('#NewDocumentSourceView').toggle();
|
||||||
tableView = false;
|
tableView = false;
|
||||||
$('#toggleNewDocButtonText').text('Edit Table');
|
$('#toggleNewDocButtonText').text('Edit Table');
|
||||||
|
$("#addNewDocButton").attr("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
@ -1097,8 +1109,8 @@ var logTable = $('#logTableID').dataTable({
|
||||||
$('#NewDocumentTableView').toggle();
|
$('#NewDocumentTableView').toggle();
|
||||||
$('#NewDocumentSourceView').toggle();
|
$('#NewDocumentSourceView').toggle();
|
||||||
tableView = true;
|
tableView = true;
|
||||||
var img = $(this).find('img');
|
$('#toggleNewDocButtonText').text('Edit Source');
|
||||||
img.attr('src', '/_admin/html/media/icons/off_icon16.png');
|
$("#addNewDocButton").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
@ -1185,10 +1197,29 @@ var logTable = $('#logTableID').dataTable({
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// submit avocsh content
|
/// submit avocsh content
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var lastFormatQuestion = true;
|
||||||
|
|
||||||
$('#submitAvoc').live('click', function () {
|
$('#submitAvoc').live('click', function () {
|
||||||
var data = $('#avocshContent').val();
|
var data = $('#avocshContent').val();
|
||||||
|
|
||||||
|
var r = [ ];
|
||||||
|
for (var i = 0; i < shArray.length; ++i) {
|
||||||
|
if (shArray[i] != data) {
|
||||||
|
r.push(shArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shArray = r;
|
||||||
|
if (shArray.length > 4) {
|
||||||
|
shArray.shift();
|
||||||
|
}
|
||||||
|
shArray.push(data);
|
||||||
|
|
||||||
|
$("#avocshContent").autocomplete({
|
||||||
|
source: shArray
|
||||||
|
});
|
||||||
|
|
||||||
if (data == "help") {
|
if (data == "help") {
|
||||||
data = "help()";
|
data = "help()";
|
||||||
}
|
}
|
||||||
|
@ -1196,8 +1227,19 @@ var logTable = $('#logTableID').dataTable({
|
||||||
location.reload();
|
location.reload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
formatQuestion = JSON.parse($('input:radio[name=formatshellJSONyesno]:checked').val());
|
||||||
|
if (formatQuestion != lastFormatQuestion) {
|
||||||
|
if (formatQuestion == true) {
|
||||||
|
start_pretty_print();
|
||||||
|
lastFormatQuestion = true;
|
||||||
|
}
|
||||||
|
if (formatQuestion == false) {
|
||||||
|
stop_pretty_print();
|
||||||
|
lastFormatQuestion = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
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);
|
||||||
|
@ -1206,8 +1248,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#refreshShell').live('click', function () {
|
$('#refreshShell').live('click', function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1217,8 +1257,8 @@ var logTable = $('#logTableID').dataTable({
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$('#submitQuery').live('click', function () {
|
$('#submitQuery').live('click', function () {
|
||||||
var data = {query:$('#queryContent').val()};
|
var data = {query:$('#queryContent').val()};
|
||||||
var formattedJSON;
|
var formattedJSON;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/_api/cursor",
|
url: "/_api/cursor",
|
||||||
|
@ -1237,7 +1277,6 @@ var logTable = $('#logTableID').dataTable({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
console.log(data);
|
|
||||||
var temp = JSON.parse(data.responseText);
|
var temp = JSON.parse(data.responseText);
|
||||||
$("#queryOutput").empty();
|
$("#queryOutput").empty();
|
||||||
$("#queryOutput").append('<a class="queryError"><font color=red>[' + temp.errorNum + '] ' + temp.errorMessage + '</font></a>');
|
$("#queryOutput").append('<a class="queryError"><font color=red>[' + temp.errorNum + '] ' + temp.errorMessage + '</font></a>');
|
||||||
|
@ -1948,8 +1987,8 @@ function showCursor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cutByResolution (string) {
|
function cutByResolution (string) {
|
||||||
if (string.length > 150) {
|
if (string.length > 100) {
|
||||||
return escaped(string.substr(0, 150)) + '...';
|
return escaped(string.substr(0, 100)) + '...';
|
||||||
}
|
}
|
||||||
return escaped(string);
|
return escaped(string);
|
||||||
}
|
}
|
||||||
|
@ -2237,7 +2276,6 @@ $('#submitDocPageInput').live('click', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
console.log("out of reach");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue