1
0
Fork 0

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

This commit is contained in:
Frank Celler 2014-03-07 11:33:20 +01:00
commit 9a7eb4d779
7 changed files with 26 additions and 87 deletions

View File

@ -6,8 +6,8 @@
</div>
<div class="modal-body">
<table>
<tr colspan="2">
<th>The overview requires a valid login to the cluster's _system database:</th>
<tr>
<th colspan="2">The overview requires a valid login to the cluster's _system database:</th>
<tr>
<th class="collectionTh">Username:</th>
<th class="collectionThSec"><input type="text" id="username" name="name" value="" class="modalInput" placeholder="Username" /></th>

View File

@ -1,8 +1,8 @@
<script id="serverEntry.ejs" type="text/template">
<div class="control-group dispatcher">
<label class="control-label">Server:</label>
<label class="control-label">Dispatcher:</label>
<div class="controls">
<input type="text" placeholder="Server" class="input-xlarge host" value="<%=host?host:''%>"></input>
<input type="text" placeholder="Dispatcher" class="input-xlarge host" value="<%=host?host:''%>"></input>
<span class="searchEqualsLabel">:</span>
<input type="text" maxlength="5" class="input-mini port" placeholder="port" value="<%=port?port:''%>"></input>
<% if (isFirst) {%>

View File

@ -5,9 +5,9 @@
<form action="javascript:void(0);" autocomplete="on" class="form-horizontal">
<fieldset>
<div class="control-group">
<label for="host" class="control-label">Server:</label>
<label for="host" class="control-label">Dispatcher:</label>
<div class="controls">
<input type="text" id="host" placeholder="Server" class="input-xlarge" value="<%=hostname%>"></input>
<input type="text" id="host" placeholder="Dispatcher" class="input-xlarge" value="<%=hostname%>"></input>
<span class="searchEqualsLabel">:</span>
<input type="text" maxlength="5" class="input-mini" id="port" placeholder="port" value="<%=port%>" ></input>
</div>

View File

@ -283,18 +283,19 @@
statCollect.add(stat);
});
statCollect.fetch({
beforeSend: window.App.addAuth.bind(window.App)
beforeSend: window.App.addAuth.bind(window.App),
async: false
});
statCollect.forEach(function(m) {
var uptime = m.get("server").uptime * 1000
var time = self.serverTime;
if (self.hist[m.get("name")].lastTime && (time - self.hist[m.get("name")].lastTime) > uptime) {
self.hist[m.get("name")][
self.hist[m.get("name")].lastTime +
(time-self.hist[m.get("name")].lastTime) / 2] = null;
}
self.hist[m.get("name")].lastTime = time;
self.hist[m.get("name")][time] = m.get("client").totalTime.sum / m.get("client").totalTime.count;
var uptime = m.get("server").uptime * 1000
var time = self.serverTime;
if (self.hist[m.get("name")].lastTime && (time - self.hist[m.get("name")].lastTime) > uptime) {
self.hist[m.get("name")][
self.hist[m.get("name")].lastTime +
(time-self.hist[m.get("name")].lastTime) / 2] = null;
}
self.hist[m.get("name")].lastTime = time;
self.hist[m.get("name")][time] = m.get("client").totalTime.sum / m.get("client").totalTime.count;
});
this.data = statCollect;
},

View File

@ -6,6 +6,11 @@
<script>
$.get("cluster/amIDispatcher", function(data) {
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;
if (data) {
url = url.replace("index", "cluster");

View File

@ -158,74 +158,7 @@
},
FormatJSON: function (oData, sIndent) {
var self = this;
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;
return JSON.stringify(oData, undefined, 2);
},
RealTypeOf: function (v) {

View File

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