aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-06-30 10:04:00 +0200
committerKristian Lyngstol <kly@kly.no>2016-06-30 10:04:00 +0200
commit2e5ae67caa93a2652ea8e24e45126075c569e0cc (patch)
tree165b7e17b8a60ef7d5e3cb96ada321a65b61bd04 /web/js
parent2ed8912b353101bbe1b23fd74446eb9bce1a6751 (diff)
Uplink logic for DX
Diffstat (limited to 'web/js')
-rw-r--r--web/js/nms-map-handlers.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js
index 42044d9..2c47536 100644
--- a/web/js/nms-map-handlers.js
+++ b/web/js/nms-map-handlers.js
@@ -15,6 +15,7 @@
var handler_uplinks = {
init:uplinkInit,
+ getInfo:uplinkInfo,
tag:"uplink",
name:"Uplink"
};
@@ -127,6 +128,33 @@ var handlers = [
handler_cpu
];
+function uplinkInfo(sw)
+{
+ var ret = new handlerInfo("uplink","Uplinks");
+ ret.why = "Uplinks";
+ ret.score =0;
+ if (testTree(nmsData,['switchstate','switches',sw,'uplinks'])) {
+ var u = parseInt(nmsData.switchstate.switches[sw].uplinks.live);
+ ret.data[0].value = u;
+ ret.data[0].description = "Uplinks";
+ if (nmsData.switches.switches[sw].subnet4 == undefined ||
+ nmsData.switches.switches[sw].subnet4 == null) {
+ if (u == 0) {
+ ret.score = 700
+ ret.why = "0 uplinks with clientnet?";
+ } else if (u == 1) {
+ ret.score = 600;
+ ret.why = "Only 1 uplink";
+ } else if (u == 2) {
+ ret.score = 0;
+ } else {
+ ret.score = 500;
+ ret.why = u + " uplinks";
+ }
+ }
+ }
+ return ret;
+}
/*
* Update function for uplink map
*/
@@ -163,6 +191,7 @@ function uplinkUpdater()
}
}
+
/*
* Init-function for uplink map
*/