You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2018/04/05 15:35:14 UTC

[incubator-trafficcontrol] branch master updated: tp cache checks table is now dynamic based on the configuration of cacheChecks found in traffic_portal_properties.json

This is an automated email from the ASF dual-hosted git repository.

neuman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 45512b0  tp cache checks table is now dynamic based on the configuration of cacheChecks found in traffic_portal_properties.json
45512b0 is described below

commit 45512b0cea6fdc38173654f6a1cf68cb8dbbf7f2
Author: Jeremy Mitchell <mi...@gmail.com>
AuthorDate: Wed Mar 28 14:24:57 2018 -0600

    tp cache checks table is now dynamic based on the configuration of cacheChecks found in traffic_portal_properties.json
---
 .../private/cacheChecks/CacheChecksController.js   | 19 ++++--
 .../private/cacheChecks/cacheChecks.tpl.html       | 48 +++------------
 .../app/src/modules/private/cacheChecks/index.js   |  4 --
 .../app/src/traffic_portal_properties.json         | 72 +++++++++++++++++-----
 4 files changed, 81 insertions(+), 62 deletions(-)

diff --git a/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js b/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js
index 3fd4583..4c31bd4 100644
--- a/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js
+++ b/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-var CacheChecksController = function(cacheChecks, showReval, $scope, $state, $interval, locationUtils, serverUtils, propertiesModel) {
+var CacheChecksController = function(cacheChecks, $scope, $state, $interval, locationUtils, serverUtils, propertiesModel) {
 
 	var cacheChecksInterval,
 		autoRefresh = false,
@@ -37,9 +37,7 @@ var CacheChecksController = function(cacheChecks, showReval, $scope, $state, $in
 
 	$scope.cacheChecks = cacheChecks;
 
-	$scope.showReval = (showReval[0]) ? showReval[0].value : 0;
-
-	$scope.ccDescriptions = propertiesModel.properties.cacheChecks.descriptions;
+	$scope.config = propertiesModel.properties.cacheChecks;
 
 	$scope.ssh = serverUtils.ssh;
 
@@ -51,6 +49,17 @@ var CacheChecksController = function(cacheChecks, showReval, $scope, $state, $in
 		$state.reload(); // reloads all the resolves for the view
 	};
 
+	$scope.searchTerm = function(extension, value) {
+		if (extension.type == 'bool') {
+			if (value == 1) {
+				return extension.key;
+			} else {
+				return '';
+			}
+		}
+		return value;
+	};
+
 	$scope.$on("$destroy", function() {
 		killInterval();
 	});
@@ -71,5 +80,5 @@ var CacheChecksController = function(cacheChecks, showReval, $scope, $state, $in
 
 };
 
-CacheChecksController.$inject = ['cacheChecks', 'showReval', '$scope', '$state', '$interval', 'locationUtils', 'serverUtils', 'propertiesModel'];
+CacheChecksController.$inject = ['cacheChecks', '$scope', '$state', '$interval', 'locationUtils', 'serverUtils', 'propertiesModel'];
 module.exports = CacheChecksController;
diff --git a/traffic_portal/app/src/modules/private/cacheChecks/cacheChecks.tpl.html b/traffic_portal/app/src/modules/private/cacheChecks/cacheChecks.tpl.html
index 12bc786..a2ead7a 100644
--- a/traffic_portal/app/src/modules/private/cacheChecks/cacheChecks.tpl.html
+++ b/traffic_portal/app/src/modules/private/cacheChecks/cacheChecks.tpl.html
@@ -35,17 +35,9 @@ under the License.
                 <th>Hostname</th>
                 <th>Profile</th>
                 <th>Status</th>
-                <th uib-popover="{{ccDescriptions['UPD']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">UPD</th>
-                <th ng-if="showReval == 1" uib-popover="{{ccDescriptions['RVL']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">RVL</th>
-                <th uib-popover="{{ccDescriptions['ILO']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">ILO</th>
-                <th uib-popover="{{ccDescriptions['10G']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">10G</th>
-                <th uib-popover="{{ccDescriptions['FQDN']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">FQDN</th>
-                <th uib-popover="{{ccDescriptions['DSCP']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">DSCP</th>
-                <th uib-popover="{{ccDescriptions['10G6']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">10G6</th>
-                <th uib-popover="{{ccDescriptions['MTU']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">MTU</th>
-                <th uib-popover="{{ccDescriptions['CHR']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">CHR</th>
-                <th uib-popover="{{ccDescriptions['CDU']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">CDU</th>
-                <th uib-popover="{{ccDescriptions['ORT']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">ORT</th>
+                <th ng-if="::config.updatePending.show" uib-popover="{{::config.updatePending.desc}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">{{::config.updatePending.key}}</th>
+                <th ng-if="::config.revalPending.show" uib-popover="{{::config.revalPending.desc}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">{{::config.revalPending.key}}</th>
+                <th ng-repeat="e in ::config.extensions" uib-popover="{{::e['desc']}}" popover-trigger="mouseenter" popover-placement="top" popover-append-to-body="true" popover-class="popover-class">{{::e['key']}}</th>
             </tr>
             </thead>
             <tbody>
@@ -53,40 +45,18 @@ under the License.
                 <td>{{::cc.hostName}}</td>
                 <td>{{::cc.profile}}</td>
                 <td>{{::cc.adminState}}</td>
-                <td data-order="{{::cc.updPending}}" data-search="{{(cc.updPending) ? 'UPD' : ''}}">
+                <td ng-if="::config.updatePending.show" data-order="{{::cc.updPending}}" data-search="{{(cc.updPending) ? config.updatePending.key : ''}}">
                     <i title="Updates Pending" ng-show="cc.updPending" class="fa fa-clock-o fa-lg" aria-hidden="true"></i>
                     <i title="Updates Applied" ng-show="!cc.updPending" class="fa fa-check fa-lg" aria-hidden="true"></i>
                 </td>
-                <td ng-if="showReval == 1" data-order="{{::cc.revalPending}}" data-search="{{(cc.revalPending) ? 'RVL' : ''}}">
+                <td ng-if="::config.revalPending.show" data-order="{{::cc.revalPending}}" data-search="{{(cc.revalPending) ? config.revalPending.key : ''}}">
                     <i ng-show="cc.revalPending" class="fa fa-clock-o fa-lg" aria-hidden="true"></i>
                 </td>
-                <td data-order="{{::cc.checks['ILO']}}" data-search="{{(cc.checks['ILO'] == 1) ? 'ILO' : ''}}">
-                    <i ng-show="cc.checks['ILO'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['ILO'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
+                <td ng-repeat="e in ::config.extensions" data-order="{{::cc.checks[e.key]}}" data-search="{{searchTerm(e, cc.checks[e.key])}}">
+                    <i ng-if="e.type == 'bool' && cc.checks[e.key] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
+                    <i ng-if="e.type == 'bool' && cc.checks[e.key] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
+                    <span ng-if="e.type != 'bool'">{{::cc.checks[e.key]}}</span>
                 </td>
-                <td data-order="{{::cc.checks['10G']}}" data-search="{{(cc.checks['10G'] == 1) ? '10G' : ''}}">
-                    <i ng-show="cc.checks['10G'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['10G'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
-                </td>
-                <td data-order="{{::cc.checks['FQDN']}}" data-search="{{(cc.checks['FQDN'] == 1) ? 'FQDN' : ''}}">
-                    <i ng-show="cc.checks['FQDN'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['FQDN'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
-                </td>
-                <td data-order="{{::cc.checks['DSCP']}}" data-search="{{(cc.checks['DSCP'] == 1) ? 'DSCP' : ''}}">
-                    <i ng-show="cc.checks['DSCP'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['DSCP'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
-                </td>
-                <td data-order="{{::cc.checks['10G6']}}" data-search="{{(cc.checks['10G6'] == 1) ? '10G6' : ''}}">
-                    <i ng-show="cc.checks['10G6'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['10G6'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
-                </td>
-                <td data-order="{{::cc.checks['MTU']}}" data-search="{{(cc.checks['MTU'] == 1) ? 'MTU' : ''}}">
-                    <i ng-show="cc.checks['MTU'] == 1" class="fa fa-check fa-lg" aria-hidden="true"></i>
-                    <i ng-show="cc.checks['MTU'] == 0" class="fa fa-times fa-lg" aria-hidden="true"></i>
-                </td>
-                <td>{{::cc.checks['CHR']}}</td>
-                <td>{{::cc.checks['CDU']}}</td>
-                <td>{{::cc.checks['ORT']}}</td>
             </tr>
             </tbody>
         </table>
diff --git a/traffic_portal/app/src/modules/private/cacheChecks/index.js b/traffic_portal/app/src/modules/private/cacheChecks/index.js
index 848e4b9..7c8951d 100644
--- a/traffic_portal/app/src/modules/private/cacheChecks/index.js
+++ b/traffic_portal/app/src/modules/private/cacheChecks/index.js
@@ -30,12 +30,8 @@ module.exports = angular.module('trafficPortal.private.cacheChecks', [])
 						resolve: {
 							cacheChecks: function(serverService) {
 								return serverService.getCacheChecks();
-							},
-							showReval: function(parameterService) {
-								return parameterService.getParameters({ name: 'use_reval_pending', configFile: 'global' });
 							}
 						}
-
 					}
 				}
 			})
diff --git a/traffic_portal/app/src/traffic_portal_properties.json b/traffic_portal/app/src/traffic_portal_properties.json
index 1fd14be..452d724 100644
--- a/traffic_portal/app/src/traffic_portal_properties.json
+++ b/traffic_portal/app/src/traffic_portal_properties.json
@@ -43,21 +43,65 @@
       "enabled": false
     },
     "cacheChecks": {
-      "_comments": "These are configurable properties for the cache checks view. The data for the cache checks view is derived from TO extensions.",
+      "_comments": "These are configurable properties for the cache checks view. The data for the cache checks view is derived from TO extensions. The extensions array should include an entry for each of your extensions or you can check GET api/1.3/servers/checks to see which checks you have configured.",
       "show": true,
-      "descriptions": {
-        "10G": "Ping the IPv4 address of the EDGE or MID servers",
-        "10G6": "Ping the IPv6 address of the EDGE or MID servers",
-        "CDU": "Cache Disk Utilization %",
-        "CHR": "Cache Hit Ratio %",
-        "DSCP": "Checks the DSCP value of packets from the edge server to the Traffic Ops server",
-        "FQDN": "DNS check that matches what the DNS servers responds with compared to what Traffic Ops has",
-        "ILO": "Ping the iLO interface for EDGE or MID servers",
-        "MTU": "Ping the EDGE or MID using the configured MTU from Traffic Ops",
-        "ORT": "Number of configuration differences as determined by ORT found between Traffic Ops and the cache",
-        "RVL": "Content invalidation request(s) are pending for the EDGE or MID",
-        "UPD": "Configuration file updates have been applied or are pending for the EDGE or MID"
-      }
+      "updatePending": {
+        "show": true,
+        "key": "UPD",
+        "desc": "Configuration file updates have been applied or are pending for the EDGE or MID"
+      },
+      "revalPending": {
+        "show": true,
+        "key": "RVL",
+        "desc": "Content invalidation request(s) are pending for the EDGE or MID"
+      },
+      "extensions": [
+        {
+          "key": "ILO",
+          "desc": "Ping the iLO interface for EDGE or MID servers",
+          "type": "bool"
+        },
+        {
+          "key": "10G",
+          "desc": "Ping the IPv4 address of the EDGE or MID servers",
+          "type": "bool"
+        },
+        {
+          "key": "FQDN",
+          "desc": "DNS check that matches what the DNS servers responds with compared to what Traffic Ops has",
+          "type": "bool"
+        },
+        {
+          "key": "DSCP",
+          "desc": "Checks the DSCP value of packets from the edge server to the Traffic Ops server",
+          "type": "bool"
+        },
+        {
+          "key": "10G6",
+          "desc": "Ping the IPv6 address of the EDGE or MID servers",
+          "type": "bool"
+        },
+        {
+          "key": "MTU",
+          "desc": "Ping the EDGE or MID using the configured MTU from Traffic Ops",
+          "type": "bool"
+        },
+        {
+          "key": "CHR",
+          "desc": "Cache Hit Ratio %",
+          "type": "number"
+        },
+        {
+          "key": "CDU",
+          "desc": "Cache Disk Utilization %",
+          "type": "number"
+        },
+        {
+          "key": "ORT",
+          "desc": "Number of configuration differences as determined by ORT found between Traffic Ops and the cache",
+          "type": "number"
+        }
+      ]
     },
     "deliveryServices": {
       "_comment": "Delivery service settings",

-- 
To stop receiving notification emails like this one, please contact
neuman@apache.org.