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>
<div class="modal-body"> <div class="modal-body">
<table> <table>
<tr colspan="2"> <tr>
<th>The overview requires a valid login to the cluster's _system database:</th> <th colspan="2">The overview requires a valid login to the cluster's _system database:</th>
<tr> <tr>
<th class="collectionTh">Username:</th> <th class="collectionTh">Username:</th>
<th class="collectionThSec"><input type="text" id="username" name="name" value="" class="modalInput" placeholder="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"> <script id="serverEntry.ejs" type="text/template">
<div class="control-group dispatcher"> <div class="control-group dispatcher">
<label class="control-label">Server:</label> <label class="control-label">Dispatcher:</label>
<div class="controls"> <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> <span class="searchEqualsLabel">:</span>
<input type="text" maxlength="5" class="input-mini port" placeholder="port" value="<%=port?port:''%>"></input> <input type="text" maxlength="5" class="input-mini port" placeholder="port" value="<%=port?port:''%>"></input>
<% if (isFirst) {%> <% if (isFirst) {%>

View File

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

View File

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

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' };
tmp = prefix.Sync.Commands; tmp = prefix.Sync.Commands;