You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/03/26 15:53:58 UTC

[incubator-trafficcontrol] branch master updated: adds an optional charts button to the server page. enabled in traffic_portal_properties.json

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

dangogh 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 0e38be4  adds an optional charts button to the server page. enabled in traffic_portal_properties.json
0e38be4 is described below

commit 0e38be4690f34e1b72deff3f45dd04a62328805a
Author: Jeremy Mitchell <mi...@gmail.com>
AuthorDate: Thu Mar 22 15:58:42 2018 -0600

    adds an optional charts button to the server page. enabled in traffic_portal_properties.json
---
 .../common/modules/form/server/FormServerController.js    | 15 +++++++++++----
 .../src/common/modules/form/server/form.server.tpl.html   | 10 +++-------
 traffic_portal/app/src/traffic_portal_properties.json     |  9 +++++++++
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/traffic_portal/app/src/common/modules/form/server/FormServerController.js b/traffic_portal/app/src/common/modules/form/server/FormServerController.js
index 42381ea..5887f1a 100644
--- a/traffic_portal/app/src/common/modules/form/server/FormServerController.js
+++ b/traffic_portal/app/src/common/modules/form/server/FormServerController.js
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-var FormServerController = function(server, $scope, $location, $state, $uibModal, formUtils, locationUtils, serverUtils, serverService, cacheGroupService, cdnService, physLocationService, profileService, typeService, messageModel) {
+var FormServerController = function(server, $scope, $location, $state, $uibModal, $window, formUtils, locationUtils, serverUtils, serverService, cacheGroupService, cdnService, physLocationService, profileService, typeService, messageModel, propertiesModel) {
 
     var getPhysLocations = function() {
         physLocationService.getPhysLocations()
@@ -73,13 +73,11 @@ var FormServerController = function(server, $scope, $location, $state, $uibModal
         $state.reload(); // reloads all the resolves for the view
     };
 
-
     // supposedly matches IPv4 and IPv6 formats. but actually need one that matches each. todo.
     $scope.validations = {
         ipRegex: new RegExp(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\. [...]
     };
 
-
     $scope.server = server;
 
     $scope.falseTrue = [
@@ -91,6 +89,15 @@ var FormServerController = function(server, $scope, $location, $state, $uibModal
 
     $scope.isEdge = serverUtils.isEdge;
 
+    $scope.showChartsButton = propertiesModel.properties.servers.charts.show;
+
+    $scope.openCharts = function(server) {
+        $window.open(
+            propertiesModel.properties.servers.charts.baseUrl + server.hostName,
+            '_blank'
+        );
+    };
+
     $scope.onCDNChange = function() {
         $scope.server.profileId = null; // the cdn of the server changed, so we need to blank out the selected server profile (if any)
         getProfiles($scope.server.cdnId); // and get a new list of profiles (for the selected cdn)
@@ -160,5 +167,5 @@ var FormServerController = function(server, $scope, $location, $state, $uibModal
 
 };
 
-FormServerController.$inject = ['server', '$scope', '$location', '$state', '$uibModal', 'formUtils', 'locationUtils', 'serverUtils', 'serverService', 'cacheGroupService', 'cdnService', 'physLocationService', 'profileService', 'typeService', 'messageModel'];
+FormServerController.$inject = ['server', '$scope', '$location', '$state', '$uibModal', '$window', 'formUtils', 'locationUtils', 'serverUtils', 'serverService', 'cacheGroupService', 'cdnService', 'physLocationService', 'profileService', 'typeService', 'messageModel', 'propertiesModel'];
 module.exports = FormServerController;
diff --git a/traffic_portal/app/src/common/modules/form/server/form.server.tpl.html b/traffic_portal/app/src/common/modules/form/server/form.server.tpl.html
index 23a311e..e9ecce2 100644
--- a/traffic_portal/app/src/common/modules/form/server/form.server.tpl.html
+++ b/traffic_portal/app/src/common/modules/form/server/form.server.tpl.html
@@ -24,20 +24,16 @@ under the License.
             <li class="active">{{serverName}}</li>
         </ol>
         <div class="pull-right" role="group" ng-show="!settings.isNew">
-            <button class="btn btn-primary" ng-click="confirmStatusUpdate()">Update Status</button>
-            <!--<button class="btn btn-success" ng-click="onlineServer()">Online Server</button>-->
-            <button class="btn btn-primary" title="Queue Server Updates" ng-show="!server.updPending" ng-click="queueServerUpdates(server)"><i class="fa fa-flag"></i></button>
-            <button class="btn btn-primary" title="Clear Server Updates" ng-show="server.updPending" ng-click="clearServerUpdates(server)"><i class="fa fa-ban"></i></button>
+            <button type="button" class="btn btn-primary" title="Cache Charts" ng-if="showChartsButton && isCache" ng-click="openCharts(server)"><i class="fa fa-bar-chart fa-fw"></i></button>
             <div class="btn-group" role="group" uib-dropdown is-open="more.isopen">
                 <button type="button" class="btn btn-default dropdown-toggle" uib-dropdown-toggle aria-haspopup="true" aria-expanded="false">
                     More&nbsp;
                     <span class="caret"></span>
                 </button>
                 <ul class="dropdown-menu-right dropdown-menu" uib-dropdown-menu>
-                    <li ng-show="!server.updPending"><a ng-click="queueServerUpdates(server)">Queue Server Updates</a></li>
-                    <li ng-show="server.updPending"><a ng-click="clearServerUpdates(server)">Clear Server Updates</a></li>
-                    <li class="divider"></li>
                     <li><a ng-click="confirmStatusUpdate()">Update Status</a></li>
+                    <li ng-show="isCache(server) && !server.updPending"><a ng-click="queueServerUpdates(server)">Queue Server Updates</a></li>
+                    <li ng-show="isCache(server) && server.updPending"><a ng-click="clearServerUpdates(server)">Clear Server Updates</a></li>
                     <li ng-show="isEdge(server) || isCache(server)" class="divider"></li>
                     <li><a ng-show="isEdge(server)" ng-click="viewDeliveryServices()">View Delivery Services</a></li>
                     <li ng-show="isCache(server)"><a ng-click="viewConfigFiles()">View Config Files</a></li>
diff --git a/traffic_portal/app/src/traffic_portal_properties.json b/traffic_portal/app/src/traffic_portal_properties.json
index 7dc91a7..1fd14be 100644
--- a/traffic_portal/app/src/traffic_portal_properties.json
+++ b/traffic_portal/app/src/traffic_portal_properties.json
@@ -34,6 +34,7 @@
     "snapshot": {
       "_comments": "These are configurable properties for a cdn snapshot",
       "diff": {
+        "_comments": "The number of lines of context provided before and after a addition or removal",
         "context": 1000
       }
     },
@@ -66,6 +67,14 @@
         "baseUrl": "https://trafficstats.domain.com/dashboard/script/traffic_ops_deliveryservice.js?which="
       }
     },
+    "servers": {
+      "_comment": "Server settings",
+      "charts": {
+        "_comment": "Do you want to show a charts button for each server? If so, where can the charts be found? xml id will be appended to the provided url.",
+        "show": false,
+        "baseUrl": "https://trafficstats.domain.com/dashboard/script/traffic_ops_server.js?which="
+      }
+    },
     "defaults": {
       "_comments": "These are default values used when creating resources",
       "deliveryservices": {

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