aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-22 02:57:17 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-22 02:57:17 +0100
commit2d19233ba32fd23ad7182d3cccb58cec9e377a75 (patch)
tree38417190b36be27498757e0a181490ef3d142d37
parent9317bfc07c0fb7ef0fbbf3afa3a0cba293d3184e (diff)
parent13ae4dfb0952f604c527bdd3662be61a15b6fcb7 (diff)
Merge branch 'master' of github.com:tech-server/tgmanage
-rw-r--r--web/nms.gathering.org/js/nms-info-box.js25
-rw-r--r--web/nms.gathering.org/js/nms-map.js26
-rw-r--r--web/nms.gathering.org/js/nms.js8
3 files changed, 45 insertions, 14 deletions
diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js
index 545e62a..7975bae 100644
--- a/web/nms.gathering.org/js/nms-info-box.js
+++ b/web/nms.gathering.org/js/nms-info-box.js
@@ -250,6 +250,8 @@ nmsInfoBox._windowTypes.switchInfo = {
content.push([v, html]);
}
+ content.sort();
+
var table = nmsInfoBox._makeTable(content, "edit");
domObj.appendChild(table);
@@ -317,6 +319,7 @@ nmsInfoBox._windowTypes.switchInfo = {
nmsInfoBox.click = function(sw)
{
this.showWindow("switchInfo",sw);
+ this._windowTypes.switchInfo.showComments();
}
/*
@@ -440,6 +443,7 @@ nmsInfoBox._search = function() {
id = el.value;
}
if(id) {
+ nmsMap.enableHighlights();
for(var sw in nmsData.switches.switches) {
if (id[0] == "/") {
if (nmsInfoBox._searchSmart(id.slice(1),sw)) {
@@ -458,23 +462,32 @@ nmsInfoBox._search = function() {
}
}
} else {
- nmsMap.removeAllSwitchHighlights();
+ nmsMap.disableHighlights();
}
if(matches.length == 1) {
document.getElementById("searchbox-submit").classList.add("btn-primary");
document.getElementById("searchbox").dataset.match = matches[0];
- document.getElementById("searchbox").addEventListener("keydown",nmsInfoBox._searchKeyListener,false);
} else {
document.getElementById("searchbox-submit").classList.remove("btn-primary");
document.getElementById("searchbox").dataset.match = '';
- document.getElementById("searchbox").removeEventListener("keydown",nmsInfoBox._searchKeyListener,false);
}
}
nmsInfoBox._searchKeyListener = function(e) {
- if(e.keyCode == 13) {
- var sw = document.getElementById("searchbox").dataset.match;
- nmsInfoBox.showWindow("switchInfo",sw);
+ switch (e.keyCode) {
+ case 13:
+ var sw = document.getElementById("searchbox").dataset.match;
+ if(sw != '') {
+ nmsInfoBox.showWindow("switchInfo",sw);
+ this._windowTypes.switchInfo.showComments();
+ }
+ break;
+ case 27:
+ document.getElementById("searchbox").dataset.match = '';
+ document.getElementById("searchbox").value = '';
+ nmsInfoBox._search();
+ nmsInfoBox.hide();
+ break;
}
}
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js
index b74626a..11ee142 100644
--- a/web/nms.gathering.org/js/nms-map.js
+++ b/web/nms.gathering.org/js/nms-map.js
@@ -10,7 +10,8 @@
* nmsMap.setSwitchColor(switch,color)
* nmsMap.setSwitchInfo(switch,info)
* nmsMap.setSwitchHighlight(switch,true/false)
- * nmsMap.removeAllSwitchHighlights()
+ * nmsMap.enableHighlights()
+ * nmsMap.disableHighlights()
*/
@@ -47,6 +48,7 @@ var nmsMap = nmsMap || {
_color: { },
_highlight: { },
+ _highlightActive: false,
_c: {}
}
@@ -76,15 +78,19 @@ nmsMap.setSwitchHighlight = function(sw, highlight) {
if(highlight)
highlight == true;
if (this._highlight[sw] != highlight) {
- this._highlight[sw] = highlight;
- this._drawSwitch(sw);
this.stats.highlightChange++;
+ this._highlight[sw] = highlight;
}
+ this._drawSwitch(sw);
}
-nmsMap.removeAllSwitchHighlights = function() {
- for(var sw in this._highlight)
- this.setSwitchHighlight(sw,false);
+nmsMap.enableHighlights = function() {
+ this._highlightActive = true;
+}
+
+nmsMap.disableHighlights = function() {
+ this._highlightActive = false;
+ this._drawAllSwitches();
}
nmsMap.reset = function() {
@@ -247,8 +253,12 @@ nmsMap._drawSwitch = function(sw)
return;
var box = this._getBox(sw);
var color = nmsMap._color[sw];
- if(nmsMap._highlight[sw]) {
- color = red;
+ if(this._highlightActive) {
+ if(nmsMap._highlight[sw]) {
+ color = green;
+ } else {
+ color = white;
+ }
}
if (color == undefined) {
color = blue;
diff --git a/web/nms.gathering.org/js/nms.js b/web/nms.gathering.org/js/nms.js
index fd445d1..411fd1c 100644
--- a/web/nms.gathering.org/js/nms.js
+++ b/web/nms.gathering.org/js/nms.js
@@ -486,6 +486,7 @@ function initNMS() {
detectHandler();
nms.playback.play();
setupKeyhandler();
+ setupSearchKeyHandler();
}
function detectHandler() {
@@ -613,6 +614,13 @@ function setupKeyhandler()
});
}
+function setupSearchKeyHandler()
+{
+ $("#searchbox").keyup(function(e) {
+ nmsInfoBox._searchKeyListener(e);
+ });
+}
+
function getCookie(cname) {
var name = cname + "=";