mirror of https://gitee.com/bigwinds/arangodb
jslint
This commit is contained in:
commit
969826af27
|
@ -382,13 +382,11 @@ static string GetArangoVersion () {
|
|||
|
||||
static bool GetArangoIsCluster () {
|
||||
map<string, string> headers;
|
||||
string command = "return ArangoServerState.role();";
|
||||
|
||||
SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_POST,
|
||||
"/_admin/execute?returnAsJSON=true",
|
||||
command.c_str(),
|
||||
command.size(),
|
||||
headers);
|
||||
SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_GET,
|
||||
"/_admin/server/role",
|
||||
"",
|
||||
0,
|
||||
headers);
|
||||
|
||||
if (response == 0 || ! response->isComplete()) {
|
||||
if (response != 0) {
|
||||
|
@ -401,8 +399,16 @@ static bool GetArangoIsCluster () {
|
|||
string role = "UNDEFINED";
|
||||
|
||||
if (response->getHttpReturnCode() == HttpResponse::OK) {
|
||||
// default value
|
||||
role.assign(response->getBody().c_str(), response->getBody().length());
|
||||
// convert response body to json
|
||||
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE,
|
||||
response->getBody().c_str());
|
||||
|
||||
if (json != 0) {
|
||||
// look up "server" value
|
||||
role = JsonHelper::getStringValue(json, "role", "UNDEFINED");
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (response->wasHttpError()) {
|
||||
|
@ -414,7 +420,7 @@ static bool GetArangoIsCluster () {
|
|||
|
||||
delete response;
|
||||
|
||||
return role == "\"COORDINATOR\"";
|
||||
return role == "COORDINATOR";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -376,13 +376,11 @@ static string GetArangoVersion () {
|
|||
|
||||
static bool GetArangoIsCluster () {
|
||||
map<string, string> headers;
|
||||
string command = "return ArangoServerState.role();";
|
||||
|
||||
SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_POST,
|
||||
"/_admin/execute?returnAsJSON=true",
|
||||
command.c_str(),
|
||||
command.size(),
|
||||
headers);
|
||||
SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_GET,
|
||||
"/_admin/server/role",
|
||||
"",
|
||||
0,
|
||||
headers);
|
||||
|
||||
if (response == 0 || ! response->isComplete()) {
|
||||
if (response != 0) {
|
||||
|
@ -395,8 +393,16 @@ static bool GetArangoIsCluster () {
|
|||
string role = "UNDEFINED";
|
||||
|
||||
if (response->getHttpReturnCode() == HttpResponse::OK) {
|
||||
// default value
|
||||
role.assign(response->getBody().c_str(), response->getBody().length());
|
||||
// convert response body to json
|
||||
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE,
|
||||
response->getBody().c_str());
|
||||
|
||||
if (json != 0) {
|
||||
// look up "server" value
|
||||
role = JsonHelper::getStringValue(json, "role", "UNDEFINED");
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (response->wasHttpError()) {
|
||||
|
@ -408,7 +414,7 @@ static bool GetArangoIsCluster () {
|
|||
|
||||
delete response;
|
||||
|
||||
return role == "\"COORDINATOR\"";
|
||||
return role == "COORDINATOR";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
url: function() {
|
||||
var type, rtnStr, offset, size;
|
||||
offset = this.page * this.pagesize;
|
||||
//var inverseOffset = this.totalAmount - (this.totalAmount % this.pagesize) - (this.pagesize * this.page);
|
||||
var inverseOffset = this.totalAmount - ((this.page + 1) * this.pagesize);
|
||||
if (inverseOffset < 0 && this.page === (this.totalPages - 1)) {
|
||||
inverseOffset = 0;
|
||||
|
|
|
@ -69,9 +69,8 @@
|
|||
},
|
||||
|
||||
invertArray: function (array) {
|
||||
var rtnArr = [];
|
||||
var counter = 0;
|
||||
for (var i = array.length-1; i >= 0; i--) {
|
||||
var rtnArr = [], counter = 0, i;
|
||||
for (i = array.length-1; i >= 0; i--) {
|
||||
rtnArr[counter] = array[i];
|
||||
counter++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue