More monitor

This commit is contained in:
Tony Garnock-Jones 2019-06-06 15:55:01 +01:00
parent 35c5dd1b30
commit 6638be41d7
2 changed files with 51 additions and 2 deletions

View File

@ -164,4 +164,7 @@ function spawnMonitorAppServer(port) {
spawn named 'monitorApp' {
during P.POAScope($connId, $scope) assert P.Proposal('monitor', P.POAScope(connId, scope));
on message P.Envelope('monitor', P.Disconnect($connId)) send P.Disconnect(connId);
during Federation.ManagementScope($scope) {
assert P.Proposal('monitor', Federation.ManagementScope(scope));
}
}

View File

@ -7,12 +7,22 @@ const UI = activate require("@syndicate-lang/driver-browser-ui");
const { WSServer, ToServer, FromServer, ServerConnected } = activate require("./client");
const P = activate require("./internal_protocol");
const Federation = require("./federation");
assertion type DetectedOverlay(scope);
assertion type AddressMap(from, nodeId, to);
spawn {
const ui = new UI.Anchor();
assert ui.html('body',
<div id="main">
<h1>Server monitor</h1>
<div id="scopes"></div>
<h1>Server monitor</h1>
<h2>Local scopes</h2>
<div id="scopes"></div>
<h2>Federated scopes</h2>
<div id="federated_scopes"></div>
<h2>Overlays</h2>
<div id="overlays"></div>
</div>);
const url = (function () {
@ -40,5 +50,41 @@ spawn {
}
}
}
during FromServer(addr, Federation.ManagementScope($scope)) {
const addr = WSServer(url, scope);
during ServerConnected(addr) {
const ui = new UI.Anchor();
assert ui.html('#federated_scopes',
<div class={`fs_${scope}`}>
<p>Management scope <tt>{scope}</tt></p>
<ul></ul>
</div>);
during FromServer(addr, P.FederatedLink($id, $federatedScope)) {
assert DetectedOverlay(federatedScope);
const ui = new UI.Anchor();
assert ui.html(`#federated_scopes div.fs_${scope} ul`,
<li>FederatedLink: session <tt>{id.toString()}</tt>
scope <tt>{federatedScope.toString()}</tt></li>);
}
}
}
during DetectedOverlay($scope) {
const addr = WSServer(url, scope);
during ServerConnected(addr) {
const ui = new UI.Anchor();
assert ui.html('#overlays',
<div class={`o_${scope}`}>
<p>Overlay <tt>{scope}</tt></p>
<ul></ul>
</div>);
during FromServer(addr, $item(AddressMap(_, _, _))) {
const ui = new UI.Anchor();
assert ui.html(`#overlays div.o_${scope} ul`,
<li><tt>{item && item.toString()}</tt></li>);
}
}
}
}
}