1
0
Fork 0

Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Max Neunhoeffer 2014-03-07 11:37:31 +01:00
commit 79ac8949dd
3 changed files with 9 additions and 71 deletions

View File

@ -6,6 +6,11 @@
<script> <script>
$.get("cluster/amIDispatcher", function(data) { $.get("cluster/amIDispatcher", function(data) {
var url = window.location.origin; var url = window.location.origin;
if (! url) {
// hello IE
url = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}
url += window.location.pathname; url += window.location.pathname;
if (data) { if (data) {
url = url.replace("index", "cluster"); url = url.replace("index", "cluster");

View File

@ -158,74 +158,7 @@
}, },
FormatJSON: function (oData, sIndent) { FormatJSON: function (oData, sIndent) {
var self = this; return JSON.stringify(oData, undefined, 2);
var sHTML, iCount;
if (sIndent === undefined) {
sIndent = "";
}
var sIndentStyle = " ";
var sDataType = self.RealTypeOf(oData);
if (sDataType === "array") {
if (oData.length === 0) {
return "[]";
}
sHTML = "[";
} else {
iCount = 0;
$.each(oData, function() {
iCount++;
return;
});
if (iCount === 0) { // object is empty
return "{}";
}
sHTML = "{";
}
iCount = 0;
$.each(oData, function(sKey, vValue) {
if (iCount > 0) {
sHTML += ",";
}
if (sDataType === "array") {
sHTML += ("\n" + sIndent + sIndentStyle);
} else {
sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": ");
}
// display relevant data type
switch (self.RealTypeOf(vValue)) {
case "array":
case "object":
sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle));
break;
case "boolean":
case "number":
sHTML += vValue.toString();
break;
case "null":
sHTML += "null";
break;
case "string":
sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
break;
default:
sHTML += ("TYPEOF: " + typeof vValue);
}
// loop
iCount++;
});
// close object
if (sDataType === "array") {
sHTML += ("\n" + sIndent + "]");
} else {
sHTML += ("\n" + sIndent + "}");
}
// return
return sHTML;
}, },
RealTypeOf: function (v) { RealTypeOf: function (v) {

View File

@ -533,7 +533,7 @@ Planner.prototype.makePlan = function() {
= '"'+exchangePort(dispatchers[s.dispatcher].endpoint,s.port)+'"'; = '"'+exchangePort(dispatchers[s.dispatcher].endpoint,s.port)+'"';
launchers[s.dispatcher].Coordinators.push(s.id); launchers[s.dispatcher].Coordinators.push(s.id);
} }
tmp.Databases = { "_system" : '{"name":"_system"}' }; tmp.Databases = { "_system" : '{"name":"_system", "id":"1"}' };
tmp.Collections = { "_system" : {} }; tmp.Collections = { "_system" : {} };
// Now Plan: // Now Plan:
@ -545,7 +545,7 @@ Planner.prototype.makePlan = function() {
"Version" : '"1"', "Version" : '"1"',
"DBservers" : {}, "DBservers" : {},
"Coordinators" : {}, "Coordinators" : {},
"Databases" : {"_system":{}}, "Databases" : {"_system":{ "name": '"name"', "id": '"1"' }},
"Collections" : {"_system":{}}, "Collections" : {"_system":{}},
"ServersRegistered": {"Version":'"1"'}, "ServersRegistered": {"Version":'"1"'},
"ShardsCopied" : {} }; "ShardsCopied" : {} };
@ -553,7 +553,7 @@ Planner.prototype.makePlan = function() {
// Now Sync: // Now Sync:
prefix.Sync = { "ServerStates" : {}, prefix.Sync = { "ServerStates" : {},
"Problems" : {}, "Problems" : {},
"LatestID" : '"0"', "LatestID" : '"1"',
"Commands" : {}, "Commands" : {},
"HeartbeatIntervalMs": '1000', "HeartbeatIntervalMs": '1000',
"UserVersion" : '"1"' }; "UserVersion" : '"1"' };