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/11/17 20:54:24 UTC

qpid-dispatch git commit: DISPATCH-1168 Add loading message to topology detail dialog

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 342dc04e7 -> 9b44162b8


DISPATCH-1168 Add loading message to topology detail dialog


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

Branch: refs/heads/master
Commit: 9b44162b8474b7060632330ba22ad4d9c65da284
Parents: 342dc04
Author: Ernest Allen <ea...@redhat.com>
Authored: Sat Nov 17 15:54:10 2018 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Sat Nov 17 15:54:10 2018 -0500

----------------------------------------------------------------------
 .../plugin/html/tmplClientDetail.html           |  8 +--
 .../plugin/js/dlgDetailController.js            | 51 +++++++++++++-------
 .../stand-alone/plugin/js/topology/traffic.js   | 15 +++---
 3 files changed, 47 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9b44162b/console/stand-alone/plugin/html/tmplClientDetail.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/html/tmplClientDetail.html b/console/stand-alone/plugin/html/tmplClientDetail.html
index 1195ab2..b2ef1f9 100644
--- a/console/stand-alone/plugin/html/tmplClientDetail.html
+++ b/console/stand-alone/plugin/html/tmplClientDetail.html
@@ -53,18 +53,20 @@
 -->
 <div>
     <div class="modal-header">
-        <h3 class="modal-title">Detail for {{detail.title}}</h3>
+        <h3 class="modal-title">Detail {{detail.title}}</h3>
     </div>
     <div class="modal-body">
         <h4>{{detail.description}}</h4>
-        <div class="details" ng-include="detail.template">
-        </div>
+        <div class="details" ng-include="detail.template"></div>
     </div>
     <div class="modal-footer">
         <button class="btn btn-primary" type="button" ng-click="okClick()">Close</button>
     </div>
 </div>
 
+<script type="text/ng-template" id="loading.html">
+    loading...
+</script>
 <script type="text/ng-template" id="clients.html">
     <table class="table table-striped table-bordered table-hover dataTable no-footer">
         <thead>

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9b44162b/console/stand-alone/plugin/js/dlgDetailController.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/dlgDetailController.js b/console/stand-alone/plugin/js/dlgDetailController.js
index f95d529..8efff28 100644
--- a/console/stand-alone/plugin/js/dlgDetailController.js
+++ b/console/stand-alone/plugin/js/dlgDetailController.js
@@ -17,15 +17,15 @@ specific language governing permissions and limitations
 under the License.
 */
 
-/* global Promise d3 */
+/* global Promise d3 Set */
 export class DetailDialogController {
-  constructor(QDRService, $scope, $timeout, $uibModalInstance, $sce, d) {
+  constructor(QDRService, $scope, $timeout, $uibModalInstance, d) {
     this.controllerName = 'QDR.DetailDialogController';
 
     let expandedRows = new Set();
     $scope.d = d;  // the node object
     $scope.detail = {
-      template: 'edgeRouters.html'
+      template: 'loading.html',
     };
     $scope.detailFields = [
       'version',
@@ -72,6 +72,7 @@ export class DetailDialogController {
         expandedRows.delete(id);
       } else {
         expandedRows.add(id);
+        $scope.detail.moreInfo(id);
       }
     };
     $scope.expanded = function (id) {
@@ -83,30 +84,43 @@ export class DetailDialogController {
         let nodeId = QDRService.utilities.idFromName(n.container, '_edge');
         QDRService.management.topology.fetchEntities(nodeId, 
           [{entity: 'router', attrs: []},
-            {entity: 'router.link', attrs: []},
-            {entity: 'linkRoute', attrs: $scope.linkRouteFields},
-            {entity: 'autoLink', attrs: $scope.autoLinkFields},
-            {entity: 'address', attrs: []},
           ],
           function (results) {
             let r = results[nodeId].router;
             infoPerId[n.container] = QDRService.utilities.flatten(r.attributeNames, r.results[0]);
-            infoPerId[n.container].linkRoutes = QDRService.utilities.flattenAll(results[nodeId].linkRoute);
-            infoPerId[n.container].autoLinks = QDRService.utilities.flattenAll(results[nodeId].autoLink);
-            infoPerId[n.container].addresses = QDRService.utilities.flattenAll(results[nodeId].address);
+            infoPerId[n.container].linkRoutes = [];
+            infoPerId[n.container].autoLinks = [];
+            infoPerId[n.container].addresses = [];
             callback(null);
           });
       };
       return new Promise( (function (resolve) {
         let infoPerId = {};
         if (d.nodeType === 'edge') {
-          $scope.detail.template = 'edgeRouters.html';
-          $scope.detail.title = 'edge router';
+          $scope.detail.moreInfo = function (id) {
+            let nodeId = QDRService.utilities.idFromName(id, '_edge');
+            QDRService.management.topology.fetchEntities(nodeId, 
+              [{entity: 'router.link', attrs: []},
+                {entity: 'linkRoute', attrs: $scope.linkRouteFields},
+                {entity: 'autoLink', attrs: $scope.autoLinkFields},
+                {entity: 'address', attrs: []},
+              ],
+              function (results) {
+                $timeout( function () {
+                  infoPerId[id].linkRoutes = QDRService.utilities.flattenAll(results[nodeId].linkRoute);
+                  infoPerId[id].autoLinks = QDRService.utilities.flattenAll(results[nodeId].autoLink);
+                  infoPerId[id].addresses = QDRService.utilities.flattenAll(results[nodeId].address);
+                });
+              });
+          };
+
           let q = d3.queue(10);
           for (let n=0; n<d.normals.length; n++) {
             q.defer(q_getEdgeInfo, d.normals[n], infoPerId);
           }
           q.await(function () {
+            $scope.detail.template = 'edgeRouters.html';
+            $scope.detail.title = 'for edge router';
             resolve({
               description: 'Expand an edge router to see more info',
               infoPerId: infoPerId
@@ -114,13 +128,12 @@ export class DetailDialogController {
           });
         } else if (d.isConsole) {
           $scope.detail.template = 'consoles.html';
-          $scope.detail.title = 'console';
+          $scope.detail.title = 'for console';
           resolve({
             description: ''
           });
         } else {
-          $scope.detail.template = 'clients.html';
-          $scope.detail.title = 'client';
+          $scope.detail.moreInfo = function () {};
           QDRService.management.topology.fetchEntities(d.key, 
             [{entity: 'router.link', attrs: []}],
             function (results) {
@@ -148,6 +161,8 @@ export class DetailDialogController {
               let verb = count > 1 ? 'are' : 'is';
               let preposition = d.cdir === 'in' ? 'to' : d.cdir === 'both' ? 'for' : 'from';
               let plural = count > 1 ? 's': '';
+              $scope.detail.template = 'clients.html';
+              $scope.detail.title = 'for client';
               resolve({
                 description: `There ${verb} ${count} ${dir} connection${plural} ${preposition} ${d.routerId} with role ${d.nodeType}`,
                 infoPerId: infoPerId
@@ -160,11 +175,11 @@ export class DetailDialogController {
     groupDetail()
       .then( function (det) {
         $timeout( function () {
-          $scope.detail.title = `${d.normals.length} ${$scope.detail.title}${d.normals.length > 1 ? 's' : ''}`;
+          $scope.detail.title = `for ${d.normals.length} ${$scope.detail.title}${d.normals.length > 1 ? 's' : ''}`;
           $scope.detail.description = det.description;
           $scope.detail.infoPerId = det.infoPerId;
-        });
+        }, 10);
       });
   }
 }
-DetailDialogController.$inject = ['QDRService', '$scope', '$timeout', '$uibModalInstance', '$sce', 'd'];
+DetailDialogController.$inject = ['QDRService', '$scope', '$timeout', '$uibModalInstance', 'd'];

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9b44162b/console/stand-alone/plugin/js/topology/traffic.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/traffic.js b/console/stand-alone/plugin/js/topology/traffic.js
index 9727f3f..1db4689 100644
--- a/console/stand-alone/plugin/js/topology/traffic.js
+++ b/console/stand-alone/plugin/js/topology/traffic.js
@@ -143,11 +143,13 @@ class Congestion extends TrafficAnimation{
               let t = self.nodeIndexFor(nodes, connection.container);
               let little = Math.min(f, t);
               let big = Math.max(f, t);
-              let key = ['#path', nodes[little].uid(srv), 
-                nodes[big].uid(srv)].join('-');
-              if (!links[key])
-                links[key] = [];
-              links[key].push(link);
+              if (little >= 0) {
+                let key = ['#path', nodes[little].uid(srv), 
+                  nodes[big].uid(srv)].join('-');
+                if (!links[key])
+                  links[key] = [];
+                links[key].push(link);
+              }
             }
           }
         }
@@ -156,7 +158,8 @@ class Congestion extends TrafficAnimation{
       let colors = {};
       for (let key in links) {
         let congestion = self.congestion(links[key]);
-        let path = d3.select(key);
+        let pathId = key.replace(/\./g, '\\.').replace(/ /g, '\\ ');
+        let path = d3.select(pathId);
         if (path && !path.empty()) {
           let dir = path.attr('marker-end') === '' ? 'start' : 'end';
           let small = path.attr('class').indexOf('small') > -1;


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