Repository: qpid-dispatch
Updated Branches:
  refs/heads/master edf1d8fbe -> a3b271e79


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/console/stand-alone/package.json
----------------------------------------------------------------------
diff --git a/console/stand-alone/package.json b/console/stand-alone/package.json
index aad443e..65212f0 100644
--- a/console/stand-alone/package.json
+++ b/console/stand-alone/package.json
@@ -49,6 +49,7 @@
   "devDependencies": {
     "@types/mocha": "^5.2.2",
     "@types/node": "^10.3.3",
+    "angular-patternfly": "^4.18.3",
     "babel-core": "^6.26.3",
     "babel-preset-env": "^1.7.0",
     "babel-preset-es2015": "^6.24.1",

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/console/stand-alone/plugin/html/qdrOverview.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/html/qdrOverview.html 
b/console/stand-alone/plugin/html/qdrOverview.html
index da75017..e1a1fce 100644
--- a/console/stand-alone/plugin/html/qdrOverview.html
+++ b/console/stand-alone/plugin/html/qdrOverview.html
@@ -71,6 +71,19 @@ span.fancytree-icon {
     }
 }
 
+div.chartContainer {
+    clear: both;
+    width: 100%;
+}
+
+.line-chart-pf .c3-zoom-rect {
+    opacity: 0 !important;
+}
+
+.trend-header-compact-pf {
+    width: 11em;
+}
+
 </style>
 
 <div id="overview-controller" ng-controller="QDR.OverviewController">
@@ -88,12 +101,24 @@ span.fancytree-icon {
 </div>
 
 <script type="text/ng-template" id="overviewCharts.html">
-    <div ng-controller="QDR.OverviewChartsController" class="clearfix">
-        <div ng-repeat="chart in overviewCharts" class="chartContainer" >
-            <p class="chartLabels">
-            </p><div style="clear:both"></div>
-            <div id="{{chart.chart.id()}}" class="line-chart-pf aChart 
d3Chart"></div>
-        </div>
+    <div ng-controller="QDR.OverviewChartsController" class="clearfix 
chartContainer">
+        <pf-card head-title="Router network statistics (for the past minute)" 
show-top-border="false" style="width: 50%">
+            <div class="trend-card-inline-pf">
+                <div ng-repeat="chart in overviewCharts" class="row trend-row">
+                    <div class="col-sm-1 trend-flat-col">
+                        <div class="trend-compact-details">
+                            <span>
+                                <span 
class="trend-title-compact-big-pf">{{chart.chart.lastValue | truncate | 
pretty}}</span> 
+                            </span>
+                            <span 
class="trend-header-compact-pf">{{chart.chart.userTitle}}</span>
+                        </div>
+                    </div>
+                    <div class="col-sm-11 trend-flat-col">
+                            <div id="{{chart.chart.id()}}" 
class="line-chart-pf d3Chart"></div>
+                        </div>
+                    </div>
+            </div>
+        </pf-card>
     </div>
     <div ng-controller="QDR.TopAddressesController">
         <h1>Most active addresses</h1>

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/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 fc53520..b0cd21e 100644
--- a/console/stand-alone/plugin/js/qdrChartService.js
+++ b/console/stand-alone/plugin/js/qdrChartService.js
@@ -67,12 +67,17 @@ class Chart {
     this.hreq = false; // has this hdash chart been requested
     this.type = opts.type ? opts.type : 'value'; // value or rate
     this.rateWindow = opts.rateWindow ? opts.rateWindow : 1000; // calculate 
the rate of change over this time interval. higher == smother graph
-    this.areaColor = '#32b9f3'; // the chart's area color when not an empty 
string
-    this.lineColor = '#058dc7'; // the chart's line color when not an empty 
string
+    this.areaColor = opts.areaColor || '#32b9f3'; // the chart's area color 
when not an empty string
+    this.lineColor = opts.lineColor || '#058dc7'; // the chart's line color 
when not an empty string
     this.visibleDuration = opts.visibleDuration ? opts.visibleDuration : 
opts.type === 'rate' ? 0.25 : 1; // number of minutes of data to show (<= 
base.duration)
-    this.userTitle = null; // user title overrides title()
+    this.userTitle = opts.userTitle; // user title overrides title()
     this.hideLabel = opts.hideLabel;
     this.hideLegend = opts.hideLegend;
+    this.hideGridLines = opts.hideGridLines;
+    this.hideAxes = opts.hideAxes;
+    this.hideTitle = opts.hideTitle;
+    this.zerobased = opts.zerobased ? true : false;
+    this.curveType = opts.curveType;
     // generate a unique id for this chart
     this.id = function () {
       let name = this.name();
@@ -281,13 +286,14 @@ class AreaChart {
     this.stacked = chart.request().aggregate;
     // the id of the html element that is bound to the chart. The svg will be 
a child of this
     this.htmlId = chartId;
+    this.zeroFill = false;
     this.colorMap = {};
     if (!defer)
       this.generate(width);
   }
 
   // create the svg and bind it to the given div.id
-  generate (width) {
+  generate (width, height) {
     let chart = this.chart;  // for access during chart callbacks
     let self = this;
 
@@ -304,14 +310,18 @@ class AreaChart {
     let c3ChartDefaults = $().c3ChartDefaults();
     let singleAreaChartConfig = c3ChartDefaults.getDefaultSingleAreaConfig();
     singleAreaChartConfig.bindto = '#' + this.htmlId;
-    singleAreaChartConfig.size = {
-      width: width || 400,
-      height: 200
-    };
+
+    if (width || height)
+      singleAreaChartConfig.size = {};
+    if (width)
+      singleAreaChartConfig.size.width = width;
+    if (height)
+      singleAreaChartConfig.size.height = height;
+
     singleAreaChartConfig.data = {
       x: 'x',           // x-axis is named x
       columns: [[]],
-      type: 'area-spline'
+      type: chart.curveType || 'area-spline'
     };
     singleAreaChartConfig.axis = {
       x: {
@@ -336,7 +346,10 @@ class AreaChart {
         }
       }
     };
-
+    if (chart.hideAxes) {
+      singleAreaChartConfig.axis.x.show = false;
+      singleAreaChartConfig.axis.y.show = false;
+    }
     if (!chart.hideLabel) {
       singleAreaChartConfig.axis.x.label = {
         text: chart.name(),
@@ -349,11 +362,14 @@ class AreaChart {
     };
 
     singleAreaChartConfig.area = {
-      zerobased: false
+      zerobased: chart.zerobased
     };
 
     singleAreaChartConfig.tooltip = {
       contents: function (d) {
+        if (d[0].index < 2 && self.zeroFill) {
+          return '';
+        }
         let d3f = ',';
         if (chart.type === 'rate')
           d3f = ',.2f';
@@ -377,18 +393,17 @@ class AreaChart {
       }
     };
 
-    singleAreaChartConfig.title = {
-      text: this.QDRService.utilities.humanify(this.chart.attr())
-    };
+    if (!chart.hideTitle) {
+      singleAreaChartConfig.title = {
+        text: this.QDRService.utilities.humanify(this.chart.attr())
+      };
+    }
 
     singleAreaChartConfig.data.color = (color, d) => {
       let c = this.colorMap[d.id];
       return c ? c : color;
     };
     singleAreaChartConfig.color.pattern[0] = this.chart.areaColor;
-
-    //singleAreaChartConfig.data.colors = {};
-    //nameList.forEach( (name, i) => singleAreaChartConfig.data.colors[name] = 
this.colorMap[name] );
     singleAreaChartConfig.data.colors = this.colormap;
 
     if (!chart.hideLegend) {
@@ -396,6 +411,13 @@ class AreaChart {
         show: true,
       };
     }
+    if (chart.hideGridLines) {
+      singleAreaChartConfig.grid = 
+      {
+        x: { show: false },
+        y: { show: false }
+      };
+    }
 
     if (this.stacked) {
       // create a stacked area chart
@@ -433,6 +455,7 @@ class AreaChart {
       // for non-stacked, there is only one line
       dlines.push([this.aggregate ? 'Total' : this.chart.router()]);
     }
+
     for (let i=0; i<data.length; i++) {
       let d = data[i], elapsed = 1, d1;
       if (d[0] >= visibleDate) {
@@ -453,10 +476,35 @@ class AreaChart {
         }
       }
     }
+
+    // if zeroFill, add an initial point to beginning of data
+    if (this.zeroFill && data[0][0] > visibleDate && !this.stacked) {
+      // get the minimum value
+      let min = 0;
+      if (dlines[0].length) {
+        min = dlines[0][1];
+        for (let i=1; i<dlines[0].length; i++) {
+          min = Math.min(min, dlines[0][i]);
+        }
+      }
+      // insert a point at oldest visible date
+      dlines[0].splice(1, 0, min);
+      dx.splice(1, 0, visibleDate);
+      // insert a point at now
+      dlines[0].splice(1, 0, min);
+      if (data.length) {
+        dx.splice(1, 0, new Date(data[0][0].getTime() - 1));
+      } else {
+        dx.splice(1, 0, now);
+      }
+    }
+
+
     let columns = [dx];
     dlines.forEach( function (line) {
       columns.push(line);
     });
+    this.chart.lastValue = columns[1][columns[1].length-1];
     return columns;
   }
 
@@ -472,11 +520,12 @@ class AreaChart {
 
     // update the chart title
     // since there is no c3 api to get or set the chart title, we change the 
title directly using d3
-    let rate = '';
-    if (this.chart.type === 'rate')
-      rate = ' per second';
-    d3.select('#'+this.htmlId+' svg 
text.c3-title').text(this.QDRService.utilities.humanify(this.chart.attr()) + 
rate);
-
+    if (!this.chart.hideTitle) {
+      let rate = '';
+      if (this.chart.type === 'rate')
+        rate = ' per second';
+      d3.select('#'+this.htmlId+' svg 
text.c3-title').text(this.QDRService.utilities.humanify(this.chart.attr()) + 
rate);
+    }
     let d = this.chartData();
     // load the new data
     // using the c3.flow api causes the x-axis labels to jump around

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/console/stand-alone/plugin/js/qdrOverviewChartsController.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrOverviewChartsController.js 
b/console/stand-alone/plugin/js/qdrOverviewChartsController.js
index a65d74c..2e56855 100644
--- a/console/stand-alone/plugin/js/qdrOverviewChartsController.js
+++ b/console/stand-alone/plugin/js/qdrOverviewChartsController.js
@@ -24,7 +24,8 @@ export class OverviewChartsController {
 
     $scope.overviewCharts = [];
     let updateTimer;
-
+    // milliseconds between updates
+    const updateInterval = 1000;
     // called when it is time to update the chart's data
     var sum = function (request, saveResponse) {
       let attrs = angular.copy(request.overrideAttrs);
@@ -33,10 +34,11 @@ export class OverviewChartsController {
       QDRService.management.topology.fetchAllEntities(attrEntities, function 
(responses) {
         let total = 0;
         let response = {attributeNames: [totalAttr, 'name'], results: [[]]};
+        let chart = charts.find( function (c) { return c.nodeId === 
request.nodeId;});
         // for each router
         for (let router in responses) {
           let record = responses[router][request.entity];
-          let accessor = charts.find( function (chart) { return chart.nodeId 
=== request.nodeId;}).accessor;
+          let accessor = chart.accessor;
           // for each attribute-value (ie each address or each link)
           for (let i=0; i<record.results.length; i++) {
             total += accessor(record.attributeNames, record.results[i]);
@@ -47,19 +49,26 @@ export class OverviewChartsController {
         saveResponse(request.nodeId, request.entity, response);
       });
     };
-    let charts = [
 
+    let charts = [
       {
         nodeId:     '///Throughput/',
         entity:     'router.address',
         name:       'throughput',
         overrideAttrs: ['throughput', 'deliveriesEgress'],
         attr:       'throughput',
+        userTitle:  'Deliveries per second',
         type:       'rate',
         hideLabel:  true,
         hideLegend:  true,
-        rateWindow: 5000,   // update data once every 5 seconds
+        hideGridLines: true,
+        hideAxes: true,
+        hideTitle: true,
+        curveType: 'area',
+        areaColor: '#0088ce',
+        zeroFill:   true,
         visibleDuration: 1, // show data for the last 1 minute
+        interval: updateInterval,
         forceCreate: true,
         accessor: function (attributes, results) {
           return results[attributes.indexOf('deliveriesEgress')];
@@ -72,9 +81,17 @@ export class OverviewChartsController {
         name:         'outstandingDeliveries',
         overrideAttrs:['outstandingDeliveries', 'undeliveredCount', 
'unsettledCount', 'linkType', 'linkDir'],
         attr:         'outstandingDeliveries',
+        userTitle:    'Deleveries in flight',
         hideLabel:  true,
         hideLegend:  true,
+        hideGridLines: true,
+        hideAxes: true,
+        hideTitle: true,
+        curveType: 'area',
+        areaColor: '#33ff33',
+        zeroFill:   true,
         visibleDuration: 1, // show data for the last 1 minute
+        interval: updateInterval,
         forceCreate:  true,
         accessor: function (attributes, results) {
           return results[attributes.indexOf('linkType')] === 'endpoint' && 
results[attributes.indexOf('linkDir')] === 'out'
@@ -87,31 +104,29 @@ export class OverviewChartsController {
     ];
     $scope.overviewCharts = charts.map( function (chart) {
       let c = QDRChartService.registerChart(chart);
-      return QDRChartService.pfAreaChart(c, c.id(), true);
+      let pfChart = QDRChartService.pfAreaChart(c, c.id(), true);
+      pfChart.zeroFill = chart.zeroFill;
+      return pfChart;
     });
 
 
     // redraw the chart every update period
     var updateCharts = function () {
-      $scope.overviewCharts.forEach(function (svgChart) {
-        svgChart.tick(svgChart.chart.id()); // on this page we are using the 
chart.id() as the div id in which to render the chart
+      $timeout( function () {
+        $scope.overviewCharts.forEach(function (svgChart) {
+          svgChart.tick(svgChart.chart.id()); // on this page we are using the 
chart.id() as the div id in which to render the chart
+        });
       });
     };
 
     var createCharts = function () {
-      // ensure the div for our chart is loaded in the dom
-      let div = angular.element('.chartContainer');
-      if (!div.width()) {
-        setTimeout(createCharts, 100);
-        return;
-      }
       // create an svg object for each chart
       $scope.overviewCharts.forEach ( function (c) {
-        // tell c3 to create the svg
-        c.generate(360);
+        // tell c3 to create the svg with undefined width and height of 60
+        c.generate(undefined, 60);
       });
-      // redraw the charts once every second
-      const updateRate = localStorage['updateRate'] ?  
localStorage['updateRate'] : 1000;
+      // redraw the charts once every update interval
+      const updateRate = localStorage['updateRate'] ?  
localStorage['updateRate'] : updateInterval;
       updateTimer = setInterval(updateCharts, updateRate);
     };
     $timeout( function () {
@@ -127,4 +142,4 @@ export class OverviewChartsController {
     });
   }
 }
-OverviewChartsController.$inject = ['QDRService', 'QDRChartService', '$scope', 
'$timeout'];
+OverviewChartsController.$inject = ['QDRService', 'QDRChartService', '$scope', 
'$timeout'];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/console/stand-alone/vendor-css.txt
----------------------------------------------------------------------
diff --git a/console/stand-alone/vendor-css.txt 
b/console/stand-alone/vendor-css.txt
index 333e38c..e48d91f 100644
--- a/console/stand-alone/vendor-css.txt
+++ b/console/stand-alone/vendor-css.txt
@@ -18,8 +18,9 @@
 -- The following files get packaged into a single vendor.min.css
 
 node_modules/jquery-ui-dist/jquery-ui.css
+node_modules/c3/c3.css
+node_modules/angular-patternfly/dist/styles/angular-patternfly.min.css
 node_modules/patternfly/dist/css/patternfly.min.css
 node_modules/patternfly/dist/css/patternfly-additions.min.css
 node_modules/jquery.fancytree/dist/skin-bootstrap-n/ui.fancytree.css
-node_modules/c3/c3.css
 node_modules/angular-ui-grid/ui-grid.css

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a3b271e7/console/stand-alone/vendor-js.txt
----------------------------------------------------------------------
diff --git a/console/stand-alone/vendor-js.txt 
b/console/stand-alone/vendor-js.txt
index 4e11d07..8fca75b 100644
--- a/console/stand-alone/vendor-js.txt
+++ b/console/stand-alone/vendor-js.txt
@@ -40,4 +40,8 @@ node_modules/d3-path/build/d3-path.min.js
 node_modules/c3/c3.min.js
 node_modules/notifyjs-browser/dist/notify.js
 node_modules/patternfly/dist/js/patternfly.min.js
+node_modules/patternfly/dist/js/patternfly-settings.min.js
+node_modules/patternfly/dist/js/patternfly-settings-colors.js
+node_modules/patternfly/dist/js/patternfly-settings-charts.js
+node_modules/angular-patternfly/dist/angular-patternfly.js
 node_modules/rhea/dist/rhea.js


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to