Author:   Lars Michelsen <[email protected]>
Date:     Sun Sep  2 12:04:43 2012 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Sep  2 12:04:43 2012 +0200

Added new weathermap line type which shows only the used bandwidth in labels

---

 ChangeLog                             |    1 +
 TODO                                  |    2 --
 share/frontend/nagvis-js/js/lines.js  |   29 +++++++++++++++++++++++++++--
 share/server/core/defines/matches.php |    2 +-
 share/server/core/mapcfg/default.php  |    9 +++++----
 5 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1426670..8c79cee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 Core
   * Bugfix: Geomaps use real generated object_ids instead of hostnames for 
transactions
     (prevents problems with spaces in hostnames and so on)
+  * Added new weathermap line type which shows only the used bandwidth in 
labels
 
 1.7b3
 Core
diff --git a/TODO b/TODO
index 7bac4f9..a24d816 100644
--- a/TODO
+++ b/TODO
@@ -17,8 +17,6 @@ Offene Punkte:
 
 - Rotationen: Externe Seiten alternativ in iframe öffnen (z.B. Check_MK Views)
 - Hover-Menu Positionen
-- Geomap: Spaces in Hostnamen ("i" does not match ...)
--
 
 Nice2have:
   - Option zum persistieren der Optionen für einen selbst
diff --git a/share/frontend/nagvis-js/js/lines.js 
b/share/frontend/nagvis-js/js/lines.js
index 25391c8..6edab5d 100644
--- a/share/frontend/nagvis-js/js/lines.js
+++ b/share/frontend/nagvis-js/js/lines.js
@@ -149,7 +149,7 @@ function drawLabel(objectId, num, lineType, lx, ly, z, 
perfdataA, perfdataB, yOf
     // Maybe use function to detect the real height in future
     var labelHeight = 21;
 
-    if(lineType == '13') {
+    if(lineType == '13' || lineType == '15') {
         if(oLinkContainer)
             drawNagVisTextbox(oLinkContainer, objectId+'-link'+num, 'box', 
'#ffffff', '#000000', (lx-labelShift), parseInt(ly - labelHeight / 2), z, 
'auto', 'auto', '<b>' + perfdataA + '</b>');
 
@@ -354,6 +354,31 @@ function drawNagVisLine(objectId, lineType, cuts, x, y, z, 
width, colorFill, col
             drawArrow(objectId, 3, xEnd, yEnd, xMid, yMid, z, width, 
colorFill2, colorBorder);
             drawLinkOrLabel(objectId, 3, lineType, middle(xEnd, xMid, cutIn), 
middle(yEnd, yMid, cutIn), z, perfdataA, perfdataB, bLinkArea, bLabelShow, 
yOffset);
         break;
+        case '15':
+            // -BW-><-BW- lines
+            if(x.length == 2) {
+                var xMid = middle(xStart, xEnd, cut);
+                var yMid = middle(yStart, yEnd, cut);
+            } else {
+                var xMid = x[1];
+                var yMid = y[1];
+            }
+
+            // Take the configured line width into account
+            yOffset = yOffset + width;
+
+            // perfdataA contains the bandwith info
+            if(isset(perfdata[2]) && isset(perfdata[2][1]) && 
isset(perfdata[2][2]))
+                perfdataA = perfdata[2][1] + perfdata[2][2];
+            drawArrow(objectId, 1, xStart, yStart, xMid, yMid, z, width, 
colorFill, colorBorder);
+            drawLinkOrLabel(objectId, 1, lineType, middle(xStart, xMid, 
cutOut), middle(yStart, yMid, cutOut), z, perfdataA, perfdataB, bLinkArea, 
bLabelShow, yOffset);
+
+            if(isset(perfdata[3]) && isset(perfdata[3][1]) && 
isset(perfdata[3][2]))
+                perfdataA = perfdata[3][1] + perfdata[3][2];
+           // Needs to be num = 3 because drawLinkOrLabel() call above 
consumes two ids
+            drawArrow(objectId, 3, xEnd, yEnd, xMid, yMid, z, width, 
colorFill2, colorBorder);
+            drawLinkOrLabel(objectId, 3, lineType, middle(xEnd, xMid, cutIn), 
middle(yEnd, yMid, cutIn), z, perfdataA, perfdataB, bLinkArea, bLabelShow, 
yOffset);
+        break;
         default:
             // Unknown
             alert('Error: Unknown line type');
@@ -363,7 +388,7 @@ function drawNagVisLine(objectId, lineType, cuts, x, y, z, 
width, colorFill, col
 function drawLinkOrLabel(objectId, num, lineType, x, y, z, perfdataA, 
perfdataB, bLinkArea, bLabelShow, yOffset) {
     // First try to create the labels (For weathermap lines only atm) and if 
none
     // should be shown try to create link a link area for the line.
-    if(bLabelShow && (lineType == 13 || lineType == 14))
+    if(bLabelShow && (lineType == 13 || lineType == 14 || lineType == 15))
         drawLabel(objectId, num, lineType, x, y, z, perfdataA, perfdataB, 
yOffset);
     else
         drawLinkArea(objectId, num, x, y, z);
diff --git a/share/server/core/defines/matches.php 
b/share/server/core/defines/matches.php
index fdd5526..ff06f3c 100644
--- a/share/server/core/defines/matches.php
+++ b/share/server/core/defines/matches.php
@@ -80,7 +80,7 @@ define('MATCH_OBJECT_TYPES', 
'/^(host|service|hostgroup|servicegroup|map)$/');
 define('MATCH_AUTOMAP_RENDER_MODE', 
'/^(directed|undirected|radial|circular|undirected2|undirected3)?$/');
 define('MATCH_AUTOMAP_RANKDIR', '/^(TB|LR|BT|RL)?$/');
 define('MATCH_AUTOMAP_OVERLAP', 
'/^(true|false|scale|scalexy|ortho|orthoxy|orthoyx|compress|ipsep|vpsc)?$/');
-define('MATCH_LINE_TYPE', '/^(10|11|12|13|14)?$/');
+define('MATCH_LINE_TYPE', '/^(10|11|12|13|14|15)?$/');
 define('MATCH_LINE_ARROW', '/^(none|forward|back|both)?$/');
 define('MATCH_USER_NAME', '/^[0-9A-Za-z_\-\.\@\s]+$/');
 define('MATCH_ROLE_NAME', '/^[0-9A-Za-z_\-\.\@\s]+$/');
diff --git a/share/server/core/mapcfg/default.php 
b/share/server/core/mapcfg/default.php
index 362af46..a6f2c03 100644
--- a/share/server/core/mapcfg/default.php
+++ b/share/server/core/mapcfg/default.php
@@ -23,11 +23,12 @@ function listIconsets($CORE) {
 
 function listLineTypes($CORE) {
     return Array(
-        '10' => '------><------',
-        '11' => '-------------->',
-        '12' => '---------------',
-        '13' => '--%--><--%--',
+        '10' => '-------><-------',
+        '11' => '--------------->',
+        '12' => '----------------',
+        '13' => '---%---><---%---',
         '14' => '--%+BW-><-%+BW--',
+        '15' => '---BW--><--BW---',
     );
 }
 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to