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 2017/10/23 21:47:38 UTC

[36/45] qpid-dispatch git commit: DISPATCH-834 Added 'apply to all routers' option to logs. Added log icon

DISPATCH-834 Added 'apply to all routers' option to logs. Added log icon


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

Branch: refs/heads/master
Commit: f163d38eebf8a0da0b085383096a32253c6cca87
Parents: 2baae19
Author: Ernest Allen <ea...@redhat.com>
Authored: Mon Oct 2 12:51:58 2017 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Mon Oct 2 12:51:58 2017 -0400

----------------------------------------------------------------------
 console/config/css/dispatch.css      |  5 +++
 console/config/html/qdrTopology.html |  5 ++-
 console/config/js/qdrNewNode.js      | 26 ++++++++++-
 console/config/js/qdrTopology.js     | 74 ++++++++++++++++++++++---------
 4 files changed, 86 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f163d38e/console/config/css/dispatch.css
----------------------------------------------------------------------
diff --git a/console/config/css/dispatch.css b/console/config/css/dispatch.css
index c56b4ce..f018be1 100644
--- a/console/config/css/dispatch.css
+++ b/console/config/css/dispatch.css
@@ -164,6 +164,11 @@ text.id {
   font-weight: bold;
 }
 
+text.id.log {
+  text-anchor: middle;
+  font-weight: normal;
+}
+
 text.label {
   text-anchor: start;
   font-weight: bold;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f163d38e/console/config/html/qdrTopology.html
----------------------------------------------------------------------
diff --git a/console/config/html/qdrTopology.html b/console/config/html/qdrTopology.html
index 0f605bd..5dc9d5b 100644
--- a/console/config/html/qdrTopology.html
+++ b/console/config/html/qdrTopology.html
@@ -147,6 +147,9 @@ under the License.
                             <label><input type="radio" ng-model="attribute.value" value="true"> True</label>
                             <label><input type="radio" ng-model="attribute.value" value="false"> False</label>
                         </div>
+                        <div ng-if="attribute.input == 'checkbox'" class="boolean">
+                            <label><input id="attribute.name" type="checkbox" ng-model="attribute.value"></label>
+                        </div>
                     </div>
                 </div>
             </fieldset>
@@ -205,7 +208,7 @@ under the License.
         <div class="description">
             Set the host of all listeners on this router. Also ensure that all internal connectors to this router use this host.
         </div>
-            <label for="host" class="entity-description">Enter a new topology directory name</label>
+            <label for="host" class="entity-description">Enter a machine name or IP address</label>
             <fieldset>
                 <input type="text" name="host" id="host" ng-model="host" ng-required="true" class="ui-widget-content ui-corner-all"/>
             </fieldset>

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f163d38e/console/config/js/qdrNewNode.js
----------------------------------------------------------------------
diff --git a/console/config/js/qdrNewNode.js b/console/config/js/qdrNewNode.js
index 39cafdf..e000727 100644
--- a/console/config/js/qdrNewNode.js
+++ b/console/config/js/qdrNewNode.js
@@ -27,7 +27,7 @@ var QDR = (function(QDR) {
     if (!angular.isDefined(context))
       $scope.context = 'new'
     var newContext = {"new":maxPort+1, "artemis":61616, "qpid":5672, 'log':'', 'sslProfile':''}
-    $scope.title = ((context && context in newContext) ? "Edit " : "Add ") + entityType + " section"
+    $scope.title = ((context && context in newContext) ? "Add " : "Edit ") + entityType + " section"
     if (context === 'artemis')
       $scope.title += " to an Artemis broker"
     if (context === 'qpid')
@@ -223,6 +223,22 @@ var QDR = (function(QDR) {
             }
           })
         }
+        // add checkbox to apply this log module/enable to all routers
+        $scope.applyLog = {isChecked: false}
+        ediv.attributes.push( {
+          sort: 'last',
+          name: 'apply',
+          humanName: 'Apply to all routers',
+          description: 'Apply this to all routers',
+          type: 'checkbox',
+          rawtype: 'boolean',
+          input: 'checkbox',
+          selected: undefined,
+          'default': false,
+          value: $scope.applyLog.isChecked,
+          required: false,
+          unique: false
+        })
       }
       // sort ediv.attributes on name
       var allNames = ediv.attributes.map( function (attr) {
@@ -245,6 +261,14 @@ var QDR = (function(QDR) {
       if (keyIndex > 0) {
         allNames.move(keyIndex, 0)
       }
+      // move any entities with sort: last to end
+      for (var i=0; i<ediv.attributes.length; i++) {
+        var attr = ediv.attributes[i]
+        if (attr.sort && attr.sort === 'last') {
+          allNames.move(allNames.indexOf(attr.name), allNames.length-1)
+        }
+      }
+
       // now order the entity attributes by allNames
       ediv.attributes.sort(function(attr1, attr2){
           return allNames.indexOf(attr1['name']) - allNames.indexOf(attr2['name'])

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f163d38e/console/config/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/config/js/qdrTopology.js b/console/config/js/qdrTopology.js
index 152bf4d..e8b7df8 100644
--- a/console/config/js/qdrTopology.js
+++ b/console/config/js/qdrTopology.js
@@ -87,7 +87,7 @@ var QDR = (function(QDR) {
               x = savedPositions[node.name].x
               y = savedPositions[node.name].y
             }
-            var anode = aNode(node.key, node.name, node.nodeType, undefined, nodes.length, x, y, undefined, false)
+            var anode = aNode(node.key, node.name, node.nodeType, 'router', nodes.length, x, y, undefined, false)
             if (node['host'])
               anode['host'] = node['host']
             sections.forEach( function (section) {
@@ -105,7 +105,7 @@ var QDR = (function(QDR) {
           for (var i=0; i<nodes.length; ++i) {
             var node = nodes[i]
             sections.forEach( function (section) {
-              if (node[section+'s'] && section !== 'log') {
+              if (node[section+'s']) {
                 for (var key in node[section+'s']) {
                   var type = section
                   if (section === 'listener' && key == settings.http_port)
@@ -223,7 +223,7 @@ var QDR = (function(QDR) {
           properties = {product: 'qpid-cpp'}
           nodeType = "route-container"
         }
-        var node = aNode(id, name, nodeType, undefined, nodes.length, contextNode.x, contextNode.y - radius - radiusNormal,
+        var node = aNode(id, name, nodeType, type, nodes.length, contextNode.x, contextNode.y - radius - radiusNormal,
                              contextNode.id, false, properties)
         var entity = type === 'console' ? 'listener' : type
         entity = (type === 'artemis' || type === 'qpid') ? 'connector' : entity
@@ -347,7 +347,7 @@ var QDR = (function(QDR) {
         var name = genNewName()
         var nextId = nodes.length //maxNodeIndex() + 1
         var id = "amqp:/_topo/0/" + name + "/$management";
-        var node = aNode(id, name, "inter-router", undefined, nextId, x, y, undefined, false)
+        var node = aNode(id, name, "inter-router", 'router', nextId, x, y, undefined, false)
         node.host = settings.default_host
         nodes.push(node);
         $scope.selected_node = node
@@ -551,7 +551,7 @@ var QDR = (function(QDR) {
           id: nodeIndex,
           host: '0.0.0.0',
           resultIndex: resultIndex,
-          cls: ''
+          cls: nodeInfo
         };
       };
 
@@ -888,9 +888,6 @@ var QDR = (function(QDR) {
           .classed('highlighted', function(d) {
             return d.highlighted;
           })
-          .classed('temp', function(d) {
-            return d.cls == 'temp';
-          })
           .attr('marker-start', function(d) {
             var sel = d === selected_link ? '-selected' : (d.cls === 'small' ? '-small' : '');
             if (d.highlighted)
@@ -916,9 +913,6 @@ var QDR = (function(QDR) {
             var sel = d === selected_link ? '-selected' : (d.cls === 'small' ? '-small' : '');
             return d.right ? 'url(#end-arrow' + sel + ')' : '';
           })
-          .classed('temp', function(d) {
-            return d.cls == 'temp';
-          })
           .classed('small', function(d) {
             return d.cls == 'small';
           })
@@ -979,6 +973,9 @@ var QDR = (function(QDR) {
             if (QDRService.isArtemis(d)) {
               return 'Broker - Artemis'
             }
+            if (d.cls === 'log') {
+              return 'Log' + (d.entityKey ? (': ' + d.entityKey) : '')
+            }
             if (d.cdir === 'in')
               return 'Listener on port ' + d.entityKey
             if (d.cdir === 'out')
@@ -1030,6 +1027,12 @@ var QDR = (function(QDR) {
             .classed('out', function(d) {
               return d.cdir == 'out'
             })
+            .classed('connector', function(d) {
+              return d.cls == 'connector'
+            })
+            .classed('listener', function(d) {
+              return d.cls == 'listener'
+            })
             .classed('selected', function (d) {
               return $scope.selected_node === d
             })
@@ -1042,6 +1045,9 @@ var QDR = (function(QDR) {
             .classed('on-demand', function(d) {
               return d.nodeType == 'route-container'
             })
+            .classed('log', function(d) {
+              return d.cls === 'log'
+            })
             .classed('console', function(d) {
               return QDRService.isConsole(d)
             })
@@ -1187,6 +1193,9 @@ var QDR = (function(QDR) {
               return y;
             })
             .attr('class', 'id')
+            .classed('log', function(d) {
+              return d.cls === 'log'
+            })
             .classed('console', function(d) {
               return QDRService.isConsole(d)
             })
@@ -1209,6 +1218,8 @@ var QDR = (function(QDR) {
                 return '\ue900'
               } else if (QDRService.isQpid(d)) {
                 return '\ue901';
+              } else if (d.cls === 'log') {
+                return '\uf036';
               } else if (d.nodeType === 'route-container') {
                 return d.properties.product ? d.properties.product[0].toUpperCase() : 'S'
               } else if (d.nodeType === 'normal' && d.cdir === "in") // listener
@@ -1223,7 +1234,7 @@ var QDR = (function(QDR) {
             // rotatie the listener icon 180 degrees to use as the connector icon
            .attr("transform", function (d) {
               var nAngle = 0
-              if (d.nodeType === 'normal' && d.cdir === "out")
+              if (d.nodeType === 'normal' && d.cdir === "out" && d.cls === 'connector')
                 nAngle = 180
               return "rotate("+nAngle+")"
             });
@@ -1253,28 +1264,31 @@ var QDR = (function(QDR) {
           .attr('transform', 'translate(' + (radii['inter-router'] + 2) + ',' + (radii['inter-router'] + 2) + ')')
           .selectAll('g');
         var legendNodes = [];
-        legendNodes.push(aNode("Router", "", "inter-router", undefined, 0, 0, 0, 0, false, {}))
+        legendNodes.push(aNode("Router", "", "inter-router", 'router', 0, 0, 0, 0, false, {}))
 
         if (!svg.selectAll('circle.console').empty()) {
-          legendNodes.push(aNode("Console", "", "normal", undefined, 1, 0, 0, 0, false, {
+          legendNodes.push(aNode("Console", "", "normal", 'console', 1, 0, 0, 0, false, {
             console_identifier: 'Dispatch console'
           }))
         }
-        if (!svg.selectAll('circle.client.in').empty()) {
-          var node = aNode("Listener", "", "normal", undefined, 2, 0, 0, 0, false, {})
+        if (!svg.selectAll('circle.listener').empty()) {
+          var node = aNode("Listener", "", "normal", 'listener', 2, 0, 0, 0, false, {})
           node.cdir = "in"
           legendNodes.push(node)
         }
-        if (!svg.selectAll('circle.client.out').empty()) {
-          var node = aNode("Connector", "", "normal", undefined, 3, 0, 0, 0, false, {})
+        if (!svg.selectAll('circle.connector').empty()) {
+          var node = aNode("Connector", "", "normal", 'connector', 3, 0, 0, 0, false, {})
           node.cdir = "out"
           legendNodes.push(node)
         }
-        if (!svg.selectAll('circle.client.inout').empty()) {
-          var node = aNode("sslProfile", "", "normal", undefined, 4, 0, 0, 0, false, {})
+        if (!svg.selectAll('circle.sslProfile').empty()) {
+          var node = aNode("sslProfile", "", "normal", 'sslProfile', 4, 0, 0, 0, false, {})
           node.cdir = "both"
           legendNodes.push(node)
         }
+        if (!svg.selectAll('circle.log').empty()) {
+          legendNodes.push(aNode("Logs", "", "normal", 'log', 5, 0, 0, 0, false, {}))
+        }
         if (!svg.selectAll('circle.qpid-cpp').empty()) {
           legendNodes.push(genNodeToAdd({key:'Qpid broker', name:'legend', x:0, y:0, id:'legend'}, 'qpid', ''))
         }
@@ -1282,7 +1296,7 @@ var QDR = (function(QDR) {
           legendNodes.push(genNodeToAdd({key:'Artemis broker', name:'legend', x:0, y:0, id:'legend'}, 'artemis', ''))
         }
         if (!svg.selectAll('circle.route-container').empty()) {
-          legendNodes.push(aNode("Service", "", "route-container", 'external-service', undefined, 7, 0, 0, 0, false,
+          legendNodes.push(aNode("Service", "", "route-container", 'service', 8, 0, 0, 0, false,
           {product: ' External Service'}))
         }
         lsvg = lsvg.data(legendNodes, function(d) {
@@ -1543,8 +1557,24 @@ var QDR = (function(QDR) {
                     else if (o.node[key] !== context && (context !== 'new' && context !== 'artemis' && context != 'qpid')) {
                       delete nodeObj[context]
                     }
+                    if (entity === 'log') {
+                      if (o.node.apply) {
+                        // apply this log module/enable to all routers
+                        for (var i=0; i<nodes.length; i++) {
+                          if (nodes[i].nodeType === 'inter-router') {
+                            var logs = nodes[i]['logs']
+                            if (!logs)
+                              nodes[i]['logs'] = {}
+                            if (!nodes[i].logs[o.node[key]])
+                              addToNode(nodes[i], 'log', o.node[key])
+                            nodes[i].logs[o.node[key]] = o.node
+                          }
+                        }
+                        return
+                      }
+                    }
                     nodeObj[o.node[key]] = o.node
-                    if (entity === 'log' || entity === 'sslProfile')
+                    if (entity === 'sslProfile')
                       return
                     if (context === 'new' || context === 'artemis' || context === 'qpid') {
                       if (context !== 'new')


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