dneuman64 closed pull request #2066: tp cache checks table is now dynamic based 
on the configuration of ca…
URL: https://github.com/apache/incubator-trafficcontrol/pull/2066
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js 
b/traffic_portal/app/src/modules/private/cacheChecks/CacheChecksController.js
index 3fd45835d..4c31bd409 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 12bc7861f..a2ead7ae5 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 @@
                 <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 @@
                 <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 848e4b9bb..7c8951d34 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 1fd14befd..452d724e0 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",


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to