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

[GitHub] dangogh closed pull request #2047: [Issue 1050] - adds an optional charts button to the server page. enabled in traffic���

dangogh closed pull request #2047: [Issue 1050] - adds an optional charts button to the server page. enabled in traffic…
URL: https://github.com/apache/incubator-trafficcontrol/pull/2047
 
 
   

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/common/modules/form/server/FormServerController.js b/traffic_portal/app/src/common/modules/form/server/FormServerController.js
index 42381ea0b..5887f1abc 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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[
@@ -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 23a311ed1..e9ecce23d 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 @@
             <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 7dc91a78e..1fd14befd 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": {


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services