mark living monkeys in the UI

This commit is contained in:
itsikkes 2016-08-13 19:37:49 +03:00
parent fba5bea912
commit 2443e3fe4b
2 changed files with 19 additions and 3 deletions

View File

@ -102,6 +102,7 @@
<li><label style="color: blue">blue arrow</label> - tunnel</li> <li><label style="color: blue">blue arrow</label> - tunnel</li>
<li><label style="color: gray">gray arrow</label> - scan</li> <li><label style="color: gray">gray arrow</label> - scan</li>
<li><label style="color: red">red label</label> - patient zero</li> <li><label style="color: red">red label</label> - patient zero</li>
<li><label style="color: #aeeaae">green stroke</label> - living monkey</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -42,6 +42,9 @@ const EDGE_COLOR_PARENT = "red";
const EDGE_COLOR_TUNNEL = "blue"; const EDGE_COLOR_TUNNEL = "blue";
const EDGE_COLOR_SCAN = "gray"; const EDGE_COLOR_SCAN = "gray";
const NODE_MANUAL_RUN_COLOR = "red";
const NODE_ALIVE_STROKECOLOR = "#aeeaae";
// General options // General options
// If variable from local storage != null, assign it, otherwise set it's default value. // If variable from local storage != null, assign it, otherwise set it's default value.
@ -193,6 +196,14 @@ function updateMonkeys() {
index = getMonkeyIndex(new_monkeys[i].guid); index = getMonkeyIndex(new_monkeys[i].guid);
if(index != -1) { if(index != -1) {
monkeys[index] = new_monkeys[i]; monkeys[index] = new_monkeys[i];
monNode = getNode(monkeys[index].id);
if (!monkeys[index].dead) {
monNode.font.strokeWidth = 1;
monNode.font.strokeColor = NODE_ALIVE_STROKECOLOR;
}
else {
monNode.font.strokeWidth = 0;
}
} }
else else
{ {
@ -238,7 +249,7 @@ function createNodes() {
function createMonkeyNode(monkey) { function createMonkeyNode(monkey) {
var title = undefined; var title = undefined;
var font = undefined; var font = {};
var img = "monkey"; var img = "monkey";
if (monkey.description) { if (monkey.description) {
@ -252,15 +263,19 @@ function createMonkeyNode(monkey) {
img = ICONS_DIR + img + ICONS_EXT; img = ICONS_DIR + img + ICONS_EXT;
if (monkey.parent == null) { if (monkey.parent == null) {
font = { color: 'red' }; font['color'] = NODE_MANUAL_RUN_COLOR;
} }
else { else {
for (var i=0; i<monkey.parent.length; i++) { for (var i=0; i<monkey.parent.length; i++) {
if (monkey.parent[i][1] == null) { if (monkey.parent[i][1] == null) {
font = { color: 'red' }; font['color'] = NODE_MANUAL_RUN_COLOR;
} }
} }
} }
if (!monkey.dead) {
font['strokeColor'] = NODE_ALIVE_STROKECOLOR;
font['strokeWidth'] = 1;
}
return { return {
'id': monkey.id, 'id': monkey.id,