You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2018/01/12 18:48:18 UTC

qpid-dispatch git commit: DISPATCH-909 Handle inter-router connections with blank host

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master cabc6f075 -> 770edaf17


DISPATCH-909 Handle inter-router connections with blank host


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/770edaf1
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/770edaf1
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/770edaf1

Branch: refs/heads/master
Commit: 770edaf17e40bdf40add2b3ecfdc00a0897ee9ad
Parents: cabc6f0
Author: Ernest Allen <ea...@redhat.com>
Authored: Fri Jan 12 13:47:59 2018 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Fri Jan 12 13:47:59 2018 -0500

----------------------------------------------------------------------
 console/stand-alone/index.html                  |  1 +
 console/stand-alone/plugin/js/navbar.js         |  2 +-
 .../stand-alone/plugin/js/qdrChartService.js    | 37 ++++++++++++++++----
 console/stand-alone/plugin/js/qdrOverview.js    | 37 ++++++++++----------
 4 files changed, 52 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/770edaf1/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index add2116..92782c2 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -140,6 +140,7 @@ under the License.
 <script type="text/javascript" src="plugin/js/qdrSchema.js"></script>
 <script type="text/javascript" src="plugin/js/qdrService.js"></script>
 <script type="text/javascript" src="plugin/js/qdrChartService.js"></script>
+<script type="text/javascript" src="plugin/js/c3Charts.js"></script>
 <script type="text/javascript" src="plugin/js/qdrTopology.js"></script>
 <script type="text/javascript" src="plugin/js/qdrSettings.js"></script>
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/770edaf1/console/stand-alone/plugin/js/navbar.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/navbar.js b/console/stand-alone/plugin/js/navbar.js
index 7cb129a..9aa376d 100644
--- a/console/stand-alone/plugin/js/navbar.js
+++ b/console/stand-alone/plugin/js/navbar.js
@@ -277,7 +277,7 @@ var QDR = (function (QDR) {
         setTimeout(showChart, 100);
         return;
       }
-      dialogSvgChart = new QDRChartService.pfAreaChart($scope.dialogChart, $scope.svgDivId)
+      dialogSvgChart = new QDRChartService.pfAggChart($scope.dialogChart, $scope.svgDivId)
 /*
       $('input[name=areaColor]').val($scope.dialogChart.areaColor);
       $('input[name=areaColor]').on('input', function (e) {

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/770edaf1/console/stand-alone/plugin/js/qdrChartService.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrChartService.js b/console/stand-alone/plugin/js/qdrChartService.js
index ed96fd4..51b033f 100644
--- a/console/stand-alone/plugin/js/qdrChartService.js
+++ b/console/stand-alone/plugin/js/qdrChartService.js
@@ -591,7 +591,32 @@ var QDR = (function(QDR) {
           if (!defer)
             this.generate()
         },
+
+        // aggregate chart is based on pfAreaChart
+        pfAggChart: function (chart, chartId, defer) {
+          // inherit pfChart's properties, but force a defer
+          self.pfAreaChart.call(this, chart, chartId, true)
+
+          // the request is for aggregate data, but the chart is for the sum and not the detail
+          // Explanation: When the chart.request is aggregate, each data point is composed of 3 parts:
+          //  1. the datetime stamp
+          //  2. the sum of the value for all routers
+          //  3. an object with each router's name and value for this data point
+          // Normally, an aggregate chart shows lines for each of the routers and ignores the sum
+          // For this chart, we want to chart the sum (the 2nd value), so we set stacked to false
+          this.stacked = false
+
+          // let chart legends and tooltips show 'Total' instead of a router name
+          this.aggregate = true
+
+          if (!defer)
+            this.generate()
+        }
       }
+      // allow pfAggChart to inherit prototyped methods
+      self.pfAggChart.prototype = Object.create(self.pfAreaChart.prototype);
+      // except for the constructor
+      self.pfAggChart.prototype.constructor = self.pfAggChart;
 
       // create the svg and bind it to the given div.id
       self.pfAreaChart.prototype.generate = function () {
@@ -626,7 +651,7 @@ var QDR = (function(QDR) {
             },
             label: {
               text: chart.name()
-            }
+        }
           },
           y: {
             tick: {
@@ -708,7 +733,7 @@ var QDR = (function(QDR) {
       */
       self.pfAreaChart.prototype.chartData = function() {
         var data = this.chart.data();
-        var nodeList = QDRService.management.topology.nodeIdList();
+        var nodeList = QDRService.management.topology.nodeNameList();
 
         // oldest data point that should be visible
         var now = new Date();
@@ -727,11 +752,11 @@ var QDR = (function(QDR) {
         if (this.stacked) {
           // for stacked, there is a line per router
           nodeList.forEach( function (node) {
-            dlines.push([QDRService.management.topology.nameFromId(node)])
+            dlines.push([node])
           })
         } else {
           // for non-stacked, there is only one line
-          dlines.push([this.chart.router()])
+          dlines.push([this.aggregate ? 'Total' : this.chart.router()])
         }
         for (var i=0; i<data.length; i++) {
           var d = data[i], elapsed = 1, d1
@@ -744,9 +769,9 @@ var QDR = (function(QDR) {
             if (this.chart.type !== 'rate' || i < data.length-1) {
               dx.push(d[0])
               if (this.stacked) {
-                nodeList.forEach( (function (node, nodeIndex) {
+                for (var nodeIndex=0; nodeIndex<nodeList.length; nodeIndex++) {
                   dlines[nodeIndex].push(accessor.call(this, d, d1, elapsed, nodeIndex))
-                }).bind(this))
+                }
               } else {
                 dlines[0].push(accessor.call(this, d, d1, elapsed))
               }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/770edaf1/console/stand-alone/plugin/js/qdrOverview.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrOverview.js b/console/stand-alone/plugin/js/qdrOverview.js
index 9c2ae0a..ff64efe 100644
--- a/console/stand-alone/plugin/js/qdrOverview.js
+++ b/console/stand-alone/plugin/js/qdrOverview.js
@@ -457,7 +457,7 @@ var QDR = (function (QDR) {
         }
         return include;
       })
-      QDR.log.debug("setting linkFields in updateLinkGrid")
+      QDR.log.info("setting linkFields in updateLinkGrid")
       $scope.linkFields = filteredLinks;
       expandGridToContent("Links", $scope.linkFields.length)
       getLinkPagedData($scope.linkPagingOptions.pageSize, $scope.linkPagingOptions.currentPage);
@@ -851,8 +851,9 @@ return;
         response.results.forEach( function (result) {
 
           var auth = "no_auth"
-          var sasl = QDRService.utilities.valFor(response.attributeNames, result, "sasl")
-          if (QDRService.utilities.valFor(response.attributeNames, result, "isAuthenticated")) {
+          var connection = QDRService.utilities.flatten(response.attributeNames, result)
+          var sasl = connection.sasl
+          if (connection.isAuthenticated) {
             auth = sasl
             if (sasl === "ANONYMOUS")
               auth = "anonymous-user"
@@ -861,27 +862,25 @@ return;
                 sasl = "Kerberos"
               if (sasl === "EXTERNAL")
                 sasl = "x.509"
-              auth = QDRService.utilities.valFor(response.attributeNames, result, "user") + "(" +
-                  QDRService.utilities.valFor(response.attributeNames, result, "sslCipher") + ")"
+              auth = connection.user + "(" + connection.sslCipher + ")"
               }
           }
 
           var sec = "no-security"
-          if (QDRService.utilities.valFor(response.attributeNames, result, "isEncrypted")) {
+          if (connection.isEncrypted) {
             if (sasl === "GSSAPI")
               sec = "Kerberos"
             else
-              sec = QDRService.utilities.valFor(response.attributeNames, result, "sslProto") + "(" +
-                  QDRService.utilities.valFor(response.attributeNames, result, "sslCipher") + ")"
+              sec = connection.sslProto + "(" + connection.sslCipher + ")"
           }
 
-          var host = QDRService.utilities.valFor(response.attributeNames, result, "host")
+          var host = connection.host
           var connField = {
             host: host,
             security: sec,
             authentication: auth,
             routerId: nodeName,
-            uid: host + QDRService.utilities.valFor(response.attributeNames, result, "identity")
+            uid: host + connection.container + connection.identity
           }
           response.attributeNames.forEach( function (attribute, i) {
             connField[attribute] = result[i]
@@ -889,7 +888,8 @@ return;
           connectionFields.push(connField)
         })
         if (expected === ++received) {
-          connectionFields.sort ( function (a,b) { return a.host < b.host ? -1 : a.host > b.host ? 1 : 0})
+          connectionFields.sort ( function (a,b) { return a.host+a.container+a.identity < b.host+b.container+b.identity ?
+            -1 : a.host+a.container+a.identity > b.host+b.container+b.identity ? 1 : 0})
           callbacks.forEach( function (cb) {
             cb(connectionFields)
           })
@@ -1060,7 +1060,7 @@ return;
       var currentEntity;
       var active = $("#overtree").fancytree("getActiveNode");
       if (active) {
-        currentEntity = active.data.type;
+        currentEntity = active.type ? active.type : active.data.fields.type
       }
       return currentEntity;
     }
@@ -1141,13 +1141,11 @@ return;
       }
 
       $scope.connectionFields = [];
-      var fields = Object.keys(connection.data.fields)
-      fields.forEach( function (field) {
+      for (var field in connection.data.fields) {
         if (field != "title" && field != "uid")
           $scope.connectionFields.push({attribute: field, value: connection.data.fields[field]})
-      })
+      }
       expandGridToContent("Connection", $scope.connectionFields.length)
-      // this is missing an argument?
       loadColState($scope.connectionGrid);
       callback(null)
     }
@@ -1654,7 +1652,11 @@ return;
 
     updateConnectionTree = function (connectionFields) {
       var worker = function (connection) {
-        var c = new Leaf(connection.host)
+        var host = connection.host
+        if (connection.name === 'connection/' && connection.role === 'inter-router' && connection.host === '')
+          host = connection.container + ':' + connection.identity
+
+        var c = new Leaf(host)
         var isConsole = QDRService.utilities.isAConsole (connection.properties, connection.identity, connection.role, connection.routerId)
         c.type = "Connection"
         c.info = {fn: connectionInfo}
@@ -1787,7 +1789,6 @@ return;
       clearTimeout(updateIntervalHandle)
       $(window).off("resize", resizer);
     });
-
   }]);
 
   return QDR;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org