qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eal...@apache.org
Subject [qpid-dispatch] branch master updated: DISPATCH-1341 Add table of delayed deliveries to console's overview page
Date Wed, 05 Jun 2019 16:36:23 GMT
This is an automated email from the ASF dual-hosted git repository.

eallen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new 89c1f1c  DISPATCH-1341 Add table of delayed deliveries to console's overview page
89c1f1c is described below

commit 89c1f1ceac942a44c9584e8da7168e60c4a62122
Author: Ernest Allen <eallen@redhat.com>
AuthorDate: Wed Jun 5 12:36:05 2019 -0400

    DISPATCH-1341 Add table of delayed deliveries to console's overview page
---
 console/stand-alone/main.js                        | 480 ++++++++++++---------
 console/stand-alone/plugin/js/amqp/utilities.js    | 221 +++++-----
 .../stand-alone/plugin/js/dlgDetailController.js   |   6 +-
 .../plugin/js/qdrDelayedDeliveriesController.js    | 172 ++++++++
 4 files changed, 569 insertions(+), 310 deletions(-)

diff --git a/console/stand-alone/main.js b/console/stand-alone/main.js
index 8ad5e37..ce9759d 100644
--- a/console/stand-alone/main.js
+++ b/console/stand-alone/main.js
@@ -27,279 +27,369 @@ under the License.
  */
 
 //import angular from 'angular';
-import { QDRLogger, QDRTemplatePath, QDR_LAST_LOCATION } from './plugin/js/qdrGlobals.js';
-import { QDRService } from './plugin/js/qdrService.js';
-import { QDRChartService } from './plugin/js/qdrChartService.js';
-import { NavBarController } from './plugin/js/navbar.js';
-import { OverviewController } from './plugin/js/qdrOverview.js';
-import { OverviewChartsController } from './plugin/js/qdrOverviewChartsController.js';
-import { OverviewLogsController } from './plugin/js/qdrOverviewLogsController.js';
-import { OverviewKillController } from './plugin/js/qdrOverviewKillController.js';
-import { TopologyController } from './plugin/js/topology/qdrTopology.js';
-import { ChordController } from './plugin/js/chord/qdrChord.js';
-import { ListController } from './plugin/js/qdrList.js';
-import { TopAddressesController } from './plugin/js/qdrTopAddressesController.js';
-import { ChartDialogController } from './plugin/js/dlgChartController.js';
-import { DetailDialogController, SubTable } from './plugin/js/dlgDetailController.js';
-import { RouterDialogController } from './plugin/js/dlgRouterController.js';
-import { SettingsController } from './plugin/js/qdrSettings.js';
-import { SchemaController } from './plugin/js/qdrSchema.js';
-import { ChartsController } from './plugin/js/qdrCharts.js';
-import { AboutController } from './plugin/js/qdrAbout.js';
-import { posint } from './plugin/js/posintDirective.js';
-
-(function (QDR) {
+import {
+  QDRLogger,
+  QDRTemplatePath,
+  QDR_LAST_LOCATION
+} from "./plugin/js/qdrGlobals.js";
+import { QDRService } from "./plugin/js/qdrService.js";
+import { QDRChartService } from "./plugin/js/qdrChartService.js";
+import { NavBarController } from "./plugin/js/navbar.js";
+import { OverviewController } from "./plugin/js/qdrOverview.js";
+import { OverviewChartsController } from "./plugin/js/qdrOverviewChartsController.js";
+import { OverviewLogsController } from "./plugin/js/qdrOverviewLogsController.js";
+import { OverviewKillController } from "./plugin/js/qdrOverviewKillController.js";
+import { TopologyController } from "./plugin/js/topology/qdrTopology.js";
+import { ChordController } from "./plugin/js/chord/qdrChord.js";
+import { ListController } from "./plugin/js/qdrList.js";
+import { TopAddressesController } from "./plugin/js/qdrTopAddressesController.js";
+import { DelayedDeliveriesController } from "./plugin/js/qdrDelayedDeliveriesController.js";
+import { ChartDialogController } from "./plugin/js/dlgChartController.js";
+import {
+  DetailDialogController,
+  SubTable
+} from "./plugin/js/dlgDetailController.js";
+import { RouterDialogController } from "./plugin/js/dlgRouterController.js";
+import { SettingsController } from "./plugin/js/qdrSettings.js";
+import { SchemaController } from "./plugin/js/qdrSchema.js";
+import { ChartsController } from "./plugin/js/qdrCharts.js";
+import { AboutController } from "./plugin/js/qdrAbout.js";
+import { posint } from "./plugin/js/posintDirective.js";
 
+(function(QDR) {
   /**
    * This plugin's angularjs module instance
    */
-  QDR.module = angular.module('QDR', ['ngRoute', 'ngSanitize', 'ngResource', 'ui.bootstrap',
-    'ui.grid', 'ui.grid.selection', 'ui.grid.autoResize', 'ui.grid.resizeColumns', 'ui.grid.saveState',
-    'ui.slider', 'ui.checkbox', 'patternfly.charts', 'patternfly.card', 'patternfly.modals']);
+  QDR.module = angular.module("QDR", [
+    "ngRoute",
+    "ngSanitize",
+    "ngResource",
+    "ui.bootstrap",
+    "ui.grid",
+    "ui.grid.selection",
+    "ui.grid.autoResize",
+    "ui.grid.resizeColumns",
+    "ui.grid.saveState",
+    "ui.slider",
+    "ui.checkbox",
+    "patternfly.charts",
+    "patternfly.card",
+    "patternfly.modals"
+  ]);
 
   // set up the routing for this plugin
-  QDR.module.config(function ($routeProvider) {
+  QDR.module.config(function($routeProvider) {
     $routeProvider
-      .when('/', {
-        templateUrl: QDRTemplatePath + 'qdrOverview.html'
+      .when("/", {
+        templateUrl: QDRTemplatePath + "qdrOverview.html"
       })
-      .when('/overview', {
-        templateUrl: QDRTemplatePath + 'qdrOverview.html'
+      .when("/overview", {
+        templateUrl: QDRTemplatePath + "qdrOverview.html"
       })
-      .when('/topology', {
-        templateUrl: QDRTemplatePath + 'qdrTopology.html'
+      .when("/topology", {
+        templateUrl: QDRTemplatePath + "qdrTopology.html"
       })
-      .when('/list', {
-        templateUrl: QDRTemplatePath + 'qdrList.html'
+      .when("/list", {
+        templateUrl: QDRTemplatePath + "qdrList.html"
       })
-      .when('/schema', {
-        templateUrl: QDRTemplatePath + 'qdrSchema.html'
+      .when("/schema", {
+        templateUrl: QDRTemplatePath + "qdrSchema.html"
       })
-      .when('/charts', {
-        templateUrl: QDRTemplatePath + 'qdrCharts.html'
+      .when("/charts", {
+        templateUrl: QDRTemplatePath + "qdrCharts.html"
       })
-      .when('/chord', {
-        templateUrl: QDRTemplatePath + 'qdrChord.html'
+      .when("/chord", {
+        templateUrl: QDRTemplatePath + "qdrChord.html"
       })
-      .when('/connect', {
-        templateUrl: QDRTemplatePath + 'qdrConnect.html'
+      .when("/connect", {
+        templateUrl: QDRTemplatePath + "qdrConnect.html"
       });
   });
 
-  QDR.module.config(function ($compileProvider) {
-    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|file|blob):/);
-    $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
+  QDR.module.config(function($compileProvider) {
+    $compileProvider.aHrefSanitizationWhitelist(
+      /^\s*(https?|ftp|mailto|chrome-extension|file|blob):/
+    );
+    $compileProvider.imgSrcSanitizationWhitelist(
+      /^\s*(https?|ftp|mailto|chrome-extension):/
+    );
   });
 
-  QDR.module.filter('to_trusted', ['$sce', function ($sce) {
-    return function (text) {
-      return $sce.trustAsHtml(text + '');
-    };
-  }]);
+  QDR.module.filter("to_trusted", [
+    "$sce",
+    function($sce) {
+      return function(text) {
+        return $sce.trustAsHtml(text + "");
+      };
+    }
+  ]);
 
-  QDR.module.filter('humanify', ['QDRService', function (QDRService) {
-    return function (input) {
-      return QDRService.utilities.humanify(input);
-    };
-  }]);
+  QDR.module.filter("humanify", [
+    "QDRService",
+    function(QDRService) {
+      return function(input) {
+        return QDRService.utilities.humanify(input);
+      };
+    }
+  ]);
 
-  QDR.module.filter('Pascalcase', function () {
-    return function (str) {
-      if (!str)
-        return '';
-      return str.replace(/(\w)(\w*)/g,
-        function (g0, g1, g2) { return g1.toUpperCase() + g2.toLowerCase(); });
+  QDR.module.filter("Pascalcase", function() {
+    return function(str) {
+      if (!str) return "";
+      return str.replace(/(\w)(\w*)/g, function(g0, g1, g2) {
+        return g1.toUpperCase() + g2.toLowerCase();
+      });
     };
   });
 
-  QDR.module.filter('safePlural', function () {
-    return function (str) {
-      var es = ['x', 'ch', 'ss', 'sh'];
+  QDR.module.filter("safePlural", function() {
+    return function(str) {
+      var es = ["x", "ch", "ss", "sh"];
       for (var i = 0; i < es.length; ++i) {
-        if (str.endsWith(es[i]))
-          return str + 'es';
+        if (str.endsWith(es[i])) return str + "es";
       }
-      if (str.endsWith('y'))
-        return str.substr(0, str.length - 2) + 'ies';
-      if (str.endsWith('s'))
-        return str;
-      return str + 's';
+      if (str.endsWith("y")) return str.substr(0, str.length - 2) + "ies";
+      if (str.endsWith("s")) return str;
+      return str + "s";
     };
   });
 
-  QDR.module.filter('pretty', function () {
-    return function (str) {
-      var formatComma = d3.format(',');
-      if (!isNaN(parseFloat(str)) && isFinite(str))
-        return formatComma(str);
+  QDR.module.filter("pretty", function() {
+    return function(str) {
+      var formatComma = d3.format(",");
+      if (!isNaN(parseFloat(str)) && isFinite(str)) return formatComma(str);
       return str;
     };
   });
 
-  QDR.module.filter('truncate', function () {
-    return function (str) {
-      if (!isNaN(parseFloat(str)) && isFinite(str))
-        return Math.round(str);
+  QDR.module.filter("truncate", function() {
+    return function(str) {
+      if (!isNaN(parseFloat(str)) && isFinite(str)) return Math.round(str);
       return str;
     };
   });
   // one-time initialization happens in the run function
   // of our module
-  QDR.module.run(['$rootScope', '$route', '$timeout', '$location', '$log', 'QDRService',
'QDRChartService', function ($rootScope, $route, $timeout, $location, $log, QDRService, QDRChartService)
{
-    let QDRLog = new QDRLogger($log, 'main');
-    QDRLog.info('************* creating Dispatch Console ************');
+  QDR.module.run([
+    "$rootScope",
+    "$route",
+    "$timeout",
+    "$location",
+    "$log",
+    "QDRService",
+    "QDRChartService",
+    function(
+      $rootScope,
+      $route,
+      $timeout,
+      $location,
+      $log,
+      QDRService,
+      QDRChartService
+    ) {
+      let QDRLog = new QDRLogger($log, "main");
+      QDRLog.info("************* creating Dispatch Console ************");
 
-    var curPath = $location.path();
-    var org = curPath.substr(1);
-    if (org && org.length > 0 && org !== 'connect') {
-      $location.search('org', org);
-    } else {
-      $location.search('org', null);
-    }
-    QDR.queue = d3.queue;
-
-    if (!QDRService.management.connection.is_connected()) {
-      // attempt to connect to the host:port that served this page
-      var host = $location.host();
-      var port = $location.port();
-      var search = $location.search();
-      if (search.org) {
-        if (search.org === 'connect')
-          $location.search('org', 'overview');
+      var curPath = $location.path();
+      var org = curPath.substr(1);
+      if (org && org.length > 0 && org !== "connect") {
+        $location.search("org", org);
+      } else {
+        $location.search("org", null);
       }
-      var connectOptions = { address: host, port: port };
-      QDRLog.info('Attempting AMQP over websockets connection using address:port of browser
(' + host + ':' + port + ')');
-      QDRService.management.connection.testConnect(connectOptions)
-        .then(function () {
-          // We didn't connect with reconnect: true flag.
-          // The reason being that if we used reconnect:true and the connection failed, rhea
would keep trying. There
-          // doesn't appear to be a way to tell it to stop trying to reconnect.
-          QDRService.disconnect();
-          QDRLog.info('Connect succeeded. Using address:port of browser');
-          connectOptions.reconnect = true;
-          // complete the connection (create the sender/receiver)
-          QDRService.connect(connectOptions)
-            .then(function () {
+      QDR.queue = d3.queue;
+
+      if (!QDRService.management.connection.is_connected()) {
+        // attempt to connect to the host:port that served this page
+        var host = $location.host();
+        var port = $location.port();
+        var search = $location.search();
+        if (search.org) {
+          if (search.org === "connect") $location.search("org", "overview");
+        }
+        var connectOptions = { address: host, port: port };
+        QDRLog.info(
+          "Attempting AMQP over websockets connection using address:port of browser (" +
+            host +
+            ":" +
+            port +
+            ")"
+        );
+        QDRService.management.connection.testConnect(connectOptions).then(
+          function() {
+            // We didn't connect with reconnect: true flag.
+            // The reason being that if we used reconnect:true and the connection failed,
rhea would keep trying. There
+            // doesn't appear to be a way to tell it to stop trying to reconnect.
+            QDRService.disconnect();
+            QDRLog.info("Connect succeeded. Using address:port of browser");
+            connectOptions.reconnect = true;
+            // complete the connection (create the sender/receiver)
+            QDRService.connect(connectOptions).then(function() {
               // register a callback for when the node list is available (needed for loading
saved charts)
-              QDRService.management.topology.addUpdatedAction('initChartService', function
() {
-                QDRService.management.topology.delUpdatedAction('initChartService');
-                QDRChartService.init(); // initialize charting service after we are connected
-              });
+              QDRService.management.topology.addUpdatedAction(
+                "initChartService",
+                function() {
+                  QDRService.management.topology.delUpdatedAction(
+                    "initChartService"
+                  );
+                  QDRChartService.init(); // initialize charting service after we are connected
+                }
+              );
               // get the list of nodes
               QDRService.management.topology.startUpdating(false);
             });
-        }, function () {
-          QDRLog.info('failed to auto-connect to ' + host + ':' + port);
-          QDRLog.info('redirecting to connect page');
-          $timeout(function () {
-            $location.path('/connect');
-            $location.search('org', org);
-            $location.replace();
-          });
-        });
-    }
-
-    $rootScope.$on('$routeChangeSuccess', function () {
-      var path = $location.path();
-      if (path !== '/connect') {
-        localStorage[QDR_LAST_LOCATION] = path;
+          },
+          function() {
+            QDRLog.info("failed to auto-connect to " + host + ":" + port);
+            QDRLog.info("redirecting to connect page");
+            $timeout(function() {
+              $location.path("/connect");
+              $location.search("org", org);
+              $location.replace();
+            });
+          }
+        );
       }
-    });
-  }]);
 
-  QDR.module.controller('QDR.MainController', ['$scope', '$log', '$location', function ($scope,
$log, $location) {
-    let QDRLog = new QDRLogger($log, 'MainController');
-    QDRLog.debug('started QDR.MainController with location.url: ' + $location.url());
-    QDRLog.debug('started QDR.MainController with window.location.pathname : ' + window.location.pathname);
-    $scope.topLevelTabs = [];
-    $scope.topLevelTabs.push({
-      id: 'qdr',
-      content: 'Qpid Dispatch Router Console',
-      title: 'Dispatch Router Console',
-      isValid: function () { return true; },
-      href: function () { return '#connect'; },
-      isActive: function () { return true; }
-    });
-  }]);
+      $rootScope.$on("$routeChangeSuccess", function() {
+        var path = $location.path();
+        if (path !== "/connect") {
+          localStorage[QDR_LAST_LOCATION] = path;
+        }
+      });
+    }
+  ]);
 
-  QDR.module.controller('QDR.Core', function ($scope, $rootScope, $timeout, QDRService) {
+  QDR.module.controller("QDR.MainController", [
+    "$scope",
+    "$log",
+    "$location",
+    function($scope, $log, $location) {
+      let QDRLog = new QDRLogger($log, "MainController");
+      QDRLog.debug(
+        "started QDR.MainController with location.url: " + $location.url()
+      );
+      QDRLog.debug(
+        "started QDR.MainController with window.location.pathname : " +
+          window.location.pathname
+      );
+      $scope.topLevelTabs = [];
+      $scope.topLevelTabs.push({
+        id: "qdr",
+        content: "Qpid Dispatch Router Console",
+        title: "Dispatch Router Console",
+        isValid: function() {
+          return true;
+        },
+        href: function() {
+          return "#connect";
+        },
+        isActive: function() {
+          return true;
+        }
+      });
+    }
+  ]);
+
+  QDR.module.controller("QDR.Core", function(
+    $scope,
+    $rootScope,
+    $timeout,
+    QDRService
+  ) {
     $scope.alerts = [];
     $scope.breadcrumb = {};
-    $scope.closeAlert = function (index) {
+    $scope.closeAlert = function(index) {
       $scope.alerts.splice(index, 1);
     };
-    $scope.$on('setCrumb', function (event, data) {
+    $scope.$on("setCrumb", function(event, data) {
       $scope.breadcrumb = data;
     });
-    $scope.$on('newAlert', function (event, data) {
+    $scope.$on("newAlert", function(event, data) {
       $scope.alerts.push(data);
       $scope.$apply();
     });
-    $scope.$on('clearAlerts', function () {
+    $scope.$on("clearAlerts", function() {
       $scope.alerts = [];
       $scope.$apply();
     });
-    $scope.pageMenuClicked = function () {
-      $rootScope.$broadcast('pageMenuClicked');
+    $scope.pageMenuClicked = function() {
+      $rootScope.$broadcast("pageMenuClicked");
     };
-    $scope.logout = function () {
+    $scope.logout = function() {
       QDRService.disconnect();
       location.href = "#/connect";
     };
-    $scope.user = '';
-    let onConnected = function () {
+    $scope.user = "";
+    let onConnected = function() {
       if (!QDRService.management.connection.is_connected()) {
         setTimeout(onConnected, 1000);
         return;
       }
       QDRService.management.connection.addDisconnectAction(onDisconnect);
-      let parts = QDRService.management.connection.getReceiverAddress().split("/");
+      let parts = QDRService.management.connection
+        .getReceiverAddress()
+        .split("/");
       parts[parts.length - 1] = "$management";
-      let router = parts.join('/');
-      QDRService.management.topology.fetchEntity(router, "connection", [], function (nodeId,
entity, response) {
-        $timeout(function () {
-          response.results.some(result => {
-            let c = QDRService.utilities.flatten(response.attributeNames, result);
-            if (QDRService.utilities.isConsole(c)) {
-              $scope.user = c.user;
-              return true;
-            }
-            return false;
+      let router = parts.join("/");
+      QDRService.management.topology.fetchEntity(
+        router,
+        "connection",
+        [],
+        function(nodeId, entity, response) {
+          $timeout(function() {
+            response.results.some(result => {
+              let c = QDRService.utilities.flatten(
+                response.attributeNames,
+                result
+              );
+              if (QDRService.utilities.isConsole(c)) {
+                $scope.user = c.user;
+                return true;
+              }
+              return false;
+            });
           });
-        });
-      });
+        }
+      );
     };
 
-    let onDisconnect = function () {
+    let onDisconnect = function() {
       QDRService.management.connection.addConnectAction(onConnected);
       $timeout(() => {
-        $scope.user = '';
+        $scope.user = "";
       });
     };
     onDisconnect();
   });
 
-  QDR.module.controller('QDR.NavBarController', NavBarController);
-  QDR.module.controller('QDR.OverviewController', OverviewController);
-  QDR.module.controller('QDR.OverviewChartsController', OverviewChartsController);
-  QDR.module.controller('QDR.OverviewLogsController', OverviewLogsController);
-  QDR.module.controller('QDR.OverviewKillController', OverviewKillController);
-  QDR.module.controller('QDR.TopAddressesController', TopAddressesController);
-  QDR.module.controller('QDR.ChartDialogController', ChartDialogController);
-  QDR.module.controller('QDR.DetailDialogController', DetailDialogController);
-  QDR.module.controller('QDR.RouterDialogController', RouterDialogController);
-  QDR.module.controller('QDR.SettingsController', SettingsController);
-  QDR.module.controller('QDR.TopologyController', TopologyController);
-  QDR.module.controller('QDR.ChordController', ChordController);
-  QDR.module.controller('QDR.ListController', ListController);
-  QDR.module.controller('QDR.SchemaController', SchemaController);
-  QDR.module.controller('QDR.ChartsController', ChartsController);
-  QDR.module.controller('QDR.AboutController', AboutController);
+  QDR.module.controller("QDR.NavBarController", NavBarController);
+  QDR.module.controller("QDR.OverviewController", OverviewController);
+  QDR.module.controller(
+    "QDR.OverviewChartsController",
+    OverviewChartsController
+  );
+  QDR.module.controller("QDR.OverviewLogsController", OverviewLogsController);
+  QDR.module.controller("QDR.OverviewKillController", OverviewKillController);
+  QDR.module.controller("QDR.TopAddressesController", TopAddressesController);
+  QDR.module.controller(
+    "QDR.DelayedDeliveriesController",
+    DelayedDeliveriesController
+  );
+  QDR.module.controller("QDR.ChartDialogController", ChartDialogController);
+  QDR.module.controller("QDR.DetailDialogController", DetailDialogController);
+  QDR.module.controller("QDR.RouterDialogController", RouterDialogController);
+  QDR.module.controller("QDR.SettingsController", SettingsController);
+  QDR.module.controller("QDR.TopologyController", TopologyController);
+  QDR.module.controller("QDR.ChordController", ChordController);
+  QDR.module.controller("QDR.ListController", ListController);
+  QDR.module.controller("QDR.SchemaController", SchemaController);
+  QDR.module.controller("QDR.ChartsController", ChartsController);
+  QDR.module.controller("QDR.AboutController", AboutController);
 
-  QDR.module.service('QDRService', QDRService);
-  QDR.module.service('QDRChartService', QDRChartService);
-  QDR.module.directive('posint', posint);
-  QDR.module.directive('subTable', SubTable.create);
+  QDR.module.service("QDRService", QDRService);
+  QDR.module.service("QDRChartService", QDRChartService);
+  QDR.module.directive("posint", posint);
+  QDR.module.directive("subTable", SubTable.create);
   //  .directive('exampleDirective', () => new ExampleDirective);
-}({}));
-
+})({});
diff --git a/console/stand-alone/plugin/js/amqp/utilities.js b/console/stand-alone/plugin/js/amqp/utilities.js
index ba603de..058fe5f 100644
--- a/console/stand-alone/plugin/js/amqp/utilities.js
+++ b/console/stand-alone/plugin/js/amqp/utilities.js
@@ -15,10 +15,10 @@
  */
 
 /* global d3 Uint8Array */
-var ddd = typeof window === 'undefined' ? require('d3') : d3;
+var ddd = typeof window === "undefined" ? require("d3") : d3;
 
 var utils = {
-  isAConsole: function (properties, connectionId, nodeType, key) {
+  isAConsole: function(properties, connectionId, nodeType, key) {
     return this.isConsole({
       properties: properties,
       connectionId: connectionId,
@@ -26,144 +26,151 @@ var utils = {
       key: key
     });
   },
-  isConsole: function (d) {
-    return (d && d.properties && d.properties.console_identifier === 'Dispatch
console');
+  isConsole: function(d) {
+    return (
+      d &&
+      d.properties &&
+      d.properties.console_identifier === "Dispatch console"
+    );
   },
-  isArtemis: function (d) {
-    return (d.nodeType === 'route-container' || d.nodeType === 'on-demand') && (d.properties
&& d.properties.product === 'apache-activemq-artemis');
+  isArtemis: function(d) {
+    return (
+      (d.nodeType === "route-container" || d.nodeType === "on-demand") &&
+      (d.properties && d.properties.product === "apache-activemq-artemis")
+    );
   },
 
-  isQpid: function (d) {
-    return (d.nodeType === 'route-container' || d.nodeType === 'on-demand') && (d.properties
&& d.properties.product === 'qpid-cpp');
+  isQpid: function(d) {
+    return (
+      (d.nodeType === "route-container" || d.nodeType === "on-demand") &&
+      (d.properties && d.properties.product === "qpid-cpp")
+    );
   },
-  flatten: function (attributes, result) {
-    if (!attributes || !result)
-      return {};
+
+  clientName: function(d) {
+    let name = "client";
+    if (d.container) name = d.container;
+    if (d.properties) {
+      if (d.properties.product) name = d.properties.product;
+      else if (d.properties.console_identifier)
+        name = d.properties.console_identifier;
+      else if (d.properties.name) name = d.properties.name;
+    }
+    return name;
+  },
+  flatten: function(attributes, result) {
+    if (!attributes || !result) return {};
     var flat = {};
-    attributes.forEach(function (attr, i) {
-      if (result && result.length > i)
-        flat[attr] = result[i];
+    attributes.forEach(function(attr, i) {
+      if (result && result.length > i) flat[attr] = result[i];
     });
     return flat;
   },
-  flattenAll: function (entity, filter) {
+  flattenAll: function(entity, filter) {
     if (!filter)
-      filter = function (e) {
+      filter = function(e) {
         return e;
       };
     let results = [];
     for (let i = 0; i < entity.results.length; i++) {
       let f = filter(this.flatten(entity.attributeNames, entity.results[i]));
-      if (f)
-        results.push(f);
+      if (f) results.push(f);
     }
     return results;
   },
-  copy: function (obj) {
-    if (obj)
-      return JSON.parse(JSON.stringify(obj));
+  copy: function(obj) {
+    if (obj) return JSON.parse(JSON.stringify(obj));
   },
-  identity_clean: function (identity) {
-    if (!identity)
-      return '-';
-    var pos = identity.indexOf('/');
-    if (pos >= 0)
-      return identity.substring(pos + 1);
+  identity_clean: function(identity) {
+    if (!identity) return "-";
+    var pos = identity.indexOf("/");
+    if (pos >= 0) return identity.substring(pos + 1);
     return identity;
   },
-  addr_text: function (addr) {
-    if (!addr)
-      return '-';
-    if (addr[0] === addr[0].toLowerCase())
-      return addr;
-    if (addr[0] == 'M')
-      return addr.substring(2);
-    else
-      return addr.substring(1);
-  },
-  addr_class: function (addr) {
-    if (!addr) return '-';
-    if (addr[0] == 'M') return 'mobile';
-    if (addr[0] == 'R') return 'router';
-    if (addr[0] == 'A') return 'area';
-    if (addr[0] == 'L') return 'local';
-    if (addr[0] == 'H') return 'edge';
-    if (addr[0] == 'C') return 'link-incoming';
-    if (addr[0] == 'E') return 'link-incoming';
-    if (addr[0] == 'D') return 'link-outgoing';
-    if (addr[0] == 'F') return 'link-outgoing';
-    if (addr[0] == 'T') return 'topo';
-    if (addr === 'queue.waypoint') return 'mobile';
-    if (addr === 'link') return 'link';
-    return 'unknown: ' + addr[0];
-  },
-  humanify: function (s) {
-    if (!s || s.length === 0)
-      return s;
-    var t = s.charAt(0).toUpperCase() + s.substr(1).replace(/[A-Z]/g, ' $&');
-    return t.replace('.', ' ');
-  },
-  pretty: function (v, format = ',') {
+  addr_text: function(addr) {
+    if (!addr) return "-";
+    if (addr[0] === addr[0].toLowerCase()) return addr;
+    if (addr[0] == "M") return addr.substring(2);
+    else return addr.substring(1);
+  },
+  addr_class: function(addr) {
+    if (!addr) return "-";
+    if (addr[0] == "M") return "mobile";
+    if (addr[0] == "R") return "router";
+    if (addr[0] == "A") return "area";
+    if (addr[0] == "L") return "local";
+    if (addr[0] == "H") return "edge";
+    if (addr[0] == "C") return "link-incoming";
+    if (addr[0] == "E") return "link-incoming";
+    if (addr[0] == "D") return "link-outgoing";
+    if (addr[0] == "F") return "link-outgoing";
+    if (addr[0] == "T") return "topo";
+    if (addr === "queue.waypoint") return "mobile";
+    if (addr === "link") return "link";
+    return "unknown: " + addr[0];
+  },
+  humanify: function(s) {
+    if (!s || s.length === 0) return s;
+    var t = s.charAt(0).toUpperCase() + s.substr(1).replace(/[A-Z]/g, " $&");
+    return t.replace(".", " ");
+  },
+  pretty: function(v, format = ",") {
     var formatComma = ddd.format(format);
-    if (!isNaN(parseFloat(v)) && isFinite(v))
-      return formatComma(v);
+    if (!isNaN(parseFloat(v)) && isFinite(v)) return formatComma(v);
     return v;
   },
-  isMSIE: function () {
-    return (document.documentMode || /Edge/.test(navigator.userAgent));
+  isMSIE: function() {
+    return document.documentMode || /Edge/.test(navigator.userAgent);
   },
   // return the value for a field
-  valFor: function (aAr, vAr, key) {
+  valFor: function(aAr, vAr, key) {
     var idx = aAr.indexOf(key);
-    if ((idx > -1) && (idx < vAr.length)) {
+    if (idx > -1 && idx < vAr.length) {
       return vAr[idx];
     }
     return null;
   },
   // return a map with unique values and their counts for a field
-  countsFor: function (aAr, vAr, key) {
+  countsFor: function(aAr, vAr, key) {
     let counts = {};
     let idx = aAr.indexOf(key);
     for (let i = 0; i < vAr.length; i++) {
-      if (!counts[vAr[i][idx]])
-        counts[vAr[i][idx]] = 0;
+      if (!counts[vAr[i][idx]]) counts[vAr[i][idx]] = 0;
       counts[vAr[i][idx]]++;
     }
     return counts;
   },
   // extract the name of the router from the router id
-  nameFromId: function (id) {
+  nameFromId: function(id) {
     // the router id looks like
     //  amqp:/_topo/0/routerName/$management'
     //  amqp:/_topo/0/router/Name/$management'
     //  amqp:/_edge/routerName/$management'
     //  amqp:/_edge/router/Name/$management'
 
-    var parts = id.split('/');
+    var parts = id.split("/");
     // remove $management
     parts.pop();
 
     // remove the area if present
-    if (parts[2] === '0')
-      parts.splice(2, 1);
+    if (parts[2] === "0") parts.splice(2, 1);
 
     // remove amqp/(_topo or _edge)
     parts.splice(0, 2);
-    return parts.join('/');
+    return parts.join("/");
   },
 
   // construct a router id given a router name and type (_topo or _edge)
-  idFromName: function (name, type) {
-    let parts = ['amqp:', type, name, '$management'];
-    if (type === '_topo')
-      parts.splice(2, 0, '0');
-    return parts.join('/');
+  idFromName: function(name, type) {
+    let parts = ["amqp:", type, name, "$management"];
+    if (type === "_topo") parts.splice(2, 0, "0");
+    return parts.join("/");
   },
 
   // calculate the average rate of change per second for a list of fields on the given obj
   // store the historical raw values in storage[key] for future rate calcs
   // keep 'history' number of historical values
-  rates: function (obj, fields, storage, key, history = 1) {
+  rates: function(obj, fields, storage, key, history = 1) {
     let list = storage[key];
     if (!list) {
       list = storage[key] = [];
@@ -184,49 +191,39 @@ var utils = {
       for (let j = 0; j < list.length - 1; j++) {
         let elapsed = list[j + 1].date - list[j].date;
         let diff = list[j + 1].val[field] - list[j].val[field];
-        if (elapsed > 100)
-          cumulative += diff / (elapsed / 1000);
+        if (elapsed > 100) cumulative += diff / (elapsed / 1000);
       }
       rates[field] = list.length > 1 ? cumulative / (list.length - 1) : 0;
     }
     return rates;
   },
-  connSecurity: function (conn) {
-    if (!conn.isEncrypted)
-      return 'no-security';
-    if (conn.sasl === 'GSSAPI')
-      return 'Kerberos';
-    return conn.sslProto + '(' + conn.sslCipher + ')';
+  connSecurity: function(conn) {
+    if (!conn.isEncrypted) return "no-security";
+    if (conn.sasl === "GSSAPI") return "Kerberos";
+    return conn.sslProto + "(" + conn.sslCipher + ")";
   },
-  connAuth: function (conn) {
-    if (!conn.isAuthenticated)
-      return 'no-auth';
+  connAuth: function(conn) {
+    if (!conn.isAuthenticated) return "no-auth";
     let sasl = conn.sasl;
-    if (sasl === 'GSSAPI')
-      sasl = 'Kerberos';
-    else if (sasl === 'EXTERNAL')
-      sasl = 'x.509';
-    else if (sasl === 'ANONYMOUS')
-      return 'anonymous-user';
-    if (!conn.user)
-      return sasl;
-    return conn.user + '(' + sasl + ')';
-  },
-  connTenant: function (conn) {
+    if (sasl === "GSSAPI") sasl = "Kerberos";
+    else if (sasl === "EXTERNAL") sasl = "x.509";
+    else if (sasl === "ANONYMOUS") return "anonymous-user";
+    if (!conn.user) return sasl;
+    return conn.user + "(" + sasl + ")";
+  },
+  connTenant: function(conn) {
     if (!conn.tenant) {
-      return '';
+      return "";
     }
-    if (conn.tenant.length > 1)
-      return conn.tenant.replace(/\/$/, '');
+    if (conn.tenant.length > 1) return conn.tenant.replace(/\/$/, "");
   },
-  uuidv4: function () {
+  uuidv4: function() {
     return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
-      (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
+      (
+        c ^
+        (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
+      ).toString(16)
     );
   }
-
-
 };
-export {
-  utils
-};
\ No newline at end of file
+export { utils };
diff --git a/console/stand-alone/plugin/js/dlgDetailController.js b/console/stand-alone/plugin/js/dlgDetailController.js
index 6bb2d1a..a6cc6ed 100644
--- a/console/stand-alone/plugin/js/dlgDetailController.js
+++ b/console/stand-alone/plugin/js/dlgDetailController.js
@@ -72,7 +72,7 @@ export class DetailDialogController {
           "settleRate",
           "delayed1",
           "delayed10",
-          "capacity"
+          "usage"
         ],
         calc: {
           addr: function(link) {
@@ -84,7 +84,7 @@ export class DetailDialogController {
           delayed10: function(link) {
             return link.deliveriesDelayed10Sec;
           },
-          capacity: function(link) {
+          usage: function(link) {
             return link.unsettledCount / link.capacity;
           }
         }
@@ -378,7 +378,7 @@ export class SubTable {
   link(scope) {
     scope.fieldWidth = function(val, sizes) {
       if (!sizes) return "10%";
-      return `${Math.round((sizes[val] * 100) / sizes.total)}%`;
+      return `${Math.floor((sizes[val] * 100) / sizes.total)}%`;
     };
   }
   static create() {
diff --git a/console/stand-alone/plugin/js/qdrDelayedDeliveriesController.js b/console/stand-alone/plugin/js/qdrDelayedDeliveriesController.js
new file mode 100644
index 0000000..62dada6
--- /dev/null
+++ b/console/stand-alone/plugin/js/qdrDelayedDeliveriesController.js
@@ -0,0 +1,172 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+/* global angular */
+
+export class DelayedDeliveriesController {
+  constructor(QDRService, $scope, $timeout) {
+    this.controllerName = "QDR.DelayedDeliveriesController";
+
+    let rates = {};
+    $scope.deliveriesData = [];
+    $scope.delayedDeliverisGrid = {
+      data: "deliveriesData",
+      columnDefs: [
+        {
+          field: "router",
+          displayName: "Router"
+        },
+        {
+          field: "connection",
+          displayName: "Connection"
+        },
+        {
+          field: "deliveriesDelayed1SecRate",
+          displayName: "1 sec rate",
+          cellClass: "grid-align-value"
+        },
+        {
+          field: "deliveriesDelayed10SecRate",
+          displayName: "10 sec rate",
+          cellClass: "grid-align-value"
+        },
+        {
+          field: "capacity",
+          displayName: "Capacity",
+          cellClass: "grid-align-value"
+        },
+        {
+          field: "unsettledCount",
+          displayName: "Unsettled",
+          cellClass: "grid-align-value"
+        },
+        {
+          field: "Close",
+          width: "4%",
+          cellTemplate:
+            '<div><button class="btn btn-danger" ng-click="grid.appScope.killConnection(row,
$event)">Close</button></div>'
+        }
+      ],
+      enableColumnResize: true,
+      enableHorizontalScrollbar: 0,
+      enableVerticalScrollbar: 0,
+      multiSelect: false,
+      enableSelectAll: false,
+      enableSelectionBatchEvent: false,
+      enableRowHeaderSelection: false,
+      noUnselect: true
+    };
+
+    // get info for all addresses
+    var allLinkInfo = function(link, callback) {
+      let nodes = {};
+      // gets called each node/entity response
+      var gotNode = function(nodeName, entity, response) {
+        if (!nodes[nodeName]) nodes[nodeName] = {};
+        nodes[nodeName][entity] = angular.copy(response);
+      };
+      let links = [];
+      // send the requests for all connection and router info for all routers
+      QDRService.management.topology.fetchAllEntities(
+        [{ entity: "router.link" }, { entity: "connection" }],
+        function() {
+          for (let node in nodes) {
+            let response = nodes[node]["router.link"];
+            response.results.forEach(function(result) {
+              let link = QDRService.utilities.flatten(
+                response.attributeNames,
+                result
+              );
+              if (link.linkType === "endpoint") {
+                link.router = QDRService.utilities.nameFromId(node);
+                let connections = nodes[node]["connection"];
+                connections.results.some(function(connection) {
+                  let conn = QDRService.utilities.flatten(
+                    connections.attributeNames,
+                    connection
+                  );
+                  if (link.connectionId === conn.identity) {
+                    link.connection = QDRService.utilities.clientName(conn);
+                    return true;
+                  }
+                  return false;
+                });
+                let delayedRates = QDRService.utilities.rates(
+                  link,
+                  ["deliveriesDelayed1Sec", "deliveriesDelayed10Sec"],
+                  rates,
+                  "delayed",
+                  10
+                );
+                link.deliveriesDelayed1SecRate = Math.max(
+                  delayedRates.deliveriesDelayed1Sec,
+                  0
+                );
+                link.deliveriesDelayed10SecRate = Math.max(
+                  delayedRates.deliveriesDelayed10Sec,
+                  0
+                );
+                links.push(link);
+              }
+            });
+          }
+          if (links.length === 0) return;
+          // update the grid's data
+          /*
+          links = links.filter(function(link) {
+            return (
+              link.deliveriesDelayed1SecRate > 0 ||
+              link.deliveriesDelayed10SecRate > 0
+            );
+          });
+          */
+          // take top 5 records
+          links.splice(5);
+
+          $scope.deliveriesData = links;
+          callback(null);
+        },
+        gotNode
+      );
+    };
+    let timer;
+    var updateGrid = function() {
+      $timeout(function() {
+        allLinkInfo(null, function() {});
+        expandGridToContent($scope.deliveriesData.length);
+      });
+    };
+    timer = setInterval(updateGrid, 5000);
+    updateGrid();
+
+    var expandGridToContent = function(rows) {
+      let height = (rows + 1) * 30 + 40; // header is 40px
+      let gridDetails = $("#overview-controller .grid");
+      gridDetails.css("height", height + "px");
+    };
+
+    $scope.anyLinks = function() {
+      return $scope.deliveriesData.length > 0;
+    };
+
+    $scope.$on("$destroy", function() {
+      if (timer) clearInterval(timer);
+    });
+  }
+}
+DelayedDeliveriesController.$inject = ["QDRService", "$scope", "$timeout"];


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


Mime
View raw message