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/12/11 17:57:29 UTC

qpid-dispatch git commit: DISPATCH-1195 Batch requests for large lists of edge routers.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 716214b2d -> be2b26505


DISPATCH-1195 Batch requests for large lists of edge routers.


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

Branch: refs/heads/master
Commit: be2b265056180bcde38430fb878ff3f2984c2e4f
Parents: 716214b
Author: Ernest Allen <ea...@redhat.com>
Authored: Tue Dec 11 12:57:15 2018 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Tue Dec 11 12:57:15 2018 -0500

----------------------------------------------------------------------
 .../plugin/html/tmplClientDetail.html           |  1 +
 .../plugin/js/dlgDetailController.js            | 84 ++++++++++++--------
 2 files changed, 53 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/be2b2650/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 3b9aa3d..169b5ed 100644
--- a/console/stand-alone/plugin/html/tmplClientDetail.html
+++ b/console/stand-alone/plugin/html/tmplClientDetail.html
@@ -216,6 +216,7 @@
         <tr ng-repeat-end
             ng-class="{hiddenRow: !expanded(info.name)}"
             ng-click="expandClicked(info.name)"
+            ng-if="expanded(info.name)"
         >
             <td colspan="7">
                 <h4>Details for edge router {{info.name}}</h4>

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/be2b2650/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 dba5d3b..8d295e4 100644
--- a/console/stand-alone/plugin/js/dlgDetailController.js
+++ b/console/stand-alone/plugin/js/dlgDetailController.js
@@ -93,7 +93,7 @@ export class DetailDialogController {
 
     // close button clicked
     $scope.okClick = function () {
-      clearInterval(updateTimer);
+      clearTimeout(updateTimer);
       $uibModalInstance.close(true);
     };
     // a row was expanded/collapsed. add/remove it to/from the Set
@@ -159,31 +159,34 @@ export class DetailDialogController {
               function (results) {
                 $timeout(function () {
                   // save the results (and sizes) for each entity requested
-                  infoPerId[id].linkRouteSizes = {};
-                  infoPerId[id].linkRoutes = utils.flattenAll(results[nodeId].linkRoute,
-                    function (route) {
-                      updateSizes($scope.fields.linkRouteFields.cols, infoPerId[id].linkRouteSizes, route);
-                      return route;
-                    });
-                  infoPerId[id].autoLinkSizes = {};
-                  infoPerId[id].autoLinks = utils.flattenAll(results[nodeId].autoLink,
-                    function (link) {
-                      updateSizes($scope.fields.autoLinkFields.cols, infoPerId[id].autoLinkSizes, link);
-                      return link;
-                    });
-                  infoPerId[id].addressSizes = {};
-                  infoPerId[id].addresses = utils.flattenAll(results[nodeId].address,
-                    function (addr) {
-                      updateSizes($scope.fields.addressFields.cols, infoPerId[id].addressSizes, addr);
-                      return addr;
-                    });
+                  if (infoPerId[id]) {
+                    infoPerId[id].linkRouteSizes = {};
+                    infoPerId[id].linkRoutes = utils.flattenAll(results[nodeId].linkRoute,
+                      function (route) {
+                        updateSizes($scope.fields.linkRouteFields.cols, infoPerId[id].linkRouteSizes, route);
+                        return route;
+                      });
+                    infoPerId[id].autoLinkSizes = {};
+                    infoPerId[id].autoLinks = utils.flattenAll(results[nodeId].autoLink,
+                      function (link) {
+                        updateSizes($scope.fields.autoLinkFields.cols, infoPerId[id].autoLinkSizes, link);
+                        return link;
+                      });
+                    infoPerId[id].addressSizes = {};
+                    infoPerId[id].addresses = utils.flattenAll(results[nodeId].address,
+                      function (addr) {
+                        updateSizes($scope.fields.addressFields.cols, infoPerId[id].addressSizes, addr);
+                        return addr;
+                      });
+                  }
                 });
               });
           };
 
           // async send up to 10 requests
           let q = d3.queue(10);
-          for (let n = 0; n < d.normals.length; n++) {
+          console.log(`getting info for normals ${dStart} - ${dStop}`);
+          for (let n = dStart; n < dStop; n++) {
             q.defer(q_getEdgeInfo, d.normals[n], infoPerId);
             if (expandedRows.has(d.normals[n].container)) {
               $scope.detail.moreInfo(d.normals[n].container);
@@ -244,23 +247,40 @@ export class DetailDialogController {
       }));
     };
 
+    let dStart = 0;
+    let dStop = Math.min(d.normals.length, 10);
+    let cachedInfo = [];
+    let updateTimer;
+    let doUpdateDetail = function () {
+      console.log('-----------');
+      cachedInfo = [];
+      updateDetail.call(this);
+    };
     let updateDetail = function () {
       groupDetail.call(this)
         .then(function (det) {
-          $timeout(function () {
-            $scope.detail.title = `for ${d.normals.length} ${$scope.detail.title}${d.normals.length > 1 ? 's' : ''}`;
-            $scope.detail.description = det.description;
-            $scope.detail.infoPerId = Object.keys(det.infoPerId).map(function (id) {
-              return det.infoPerId[id];
-            }).sort(function (a, b) {
-              return a.name > b.name ? 1 : -1;
-            });
+          Object.keys(det.infoPerId).forEach(function (id) {
+            cachedInfo.push(det.infoPerId[id]);
           });
-        });
+          if (dStop < d.normals.length) {
+            dStart = dStop;
+            dStop = Math.min(d.normals.length, dStart + 10);
+            setTimeout(updateDetail.bind(this), 1);
+          } else {
+            $timeout(function () {
+              $scope.detail.title = `for ${d.normals.length} ${$scope.detail.title}${d.normals.length > 1 ? 's' : ''}`;
+              $scope.detail.description = det.description;
+              $scope.detail.infoPerId = cachedInfo.sort(function (a, b) {
+                return a.name > b.name ? 1 : -1;
+              });
+              dStart = 0;
+              dStop = Math.min(d.normals.length, 10);
+              updateTimer = setTimeout(doUpdateDetail.bind(this), 2000);
+            }.bind(this));
+          }
+        }.bind(this));
     };
-    let updateTimer = setInterval(updateDetail.bind(this), 2000);
-    updateDetail.call(this);
-
+    doUpdateDetail.call(this);
   }
 }
 DetailDialogController.$inject = ['QDRService', '$scope', '$timeout', '$uibModalInstance', 'd'];


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