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 2017/04/12 21:08:37 UTC

[2/4] incubator-trafficcontrol git commit: adds queue updates btns to servers table

adds queue updates btns to servers table


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/3e6baf3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/3e6baf3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/3e6baf3b

Branch: refs/heads/master
Commit: 3e6baf3b46400c11354a8c108f2f1ef3ef2a3a41
Parents: 89b0b64
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Apr 11 14:43:01 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Wed Apr 12 15:07:35 2017 -0600

----------------------------------------------------------------------
 .../table/servers/TableServersController.js     | 73 +++++++++++++++++++-
 .../table/servers/table.servers.tpl.html        |  2 +
 2 files changed, 73 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3e6baf3b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/TableServersController.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/servers/TableServersController.js b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/TableServersController.js
index bb98d28..591bb10 100644
--- a/traffic_ops/experimental/ui/app/src/common/modules/table/servers/TableServersController.js
+++ b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/TableServersController.js
@@ -17,10 +17,28 @@
  * under the License.
  */
 
-var TableServersController = function(servers, $scope, $state, locationUtils, serverUtils) {
+var TableServersController = function(servers, $scope, $state, $uibModal, locationUtils, serverUtils, cdnService) {
 
     $scope.servers = servers;
 
+    var queueServerUpdates = function(cdnId) {
+        cdnService.queueServerUpdates(cdnId)
+            .then(
+                function() {
+                    $scope.refresh();
+                }
+            );
+    };
+
+    var clearServerUpdates = function(cdnId) {
+        cdnService.clearServerUpdates(cdnId)
+            .then(
+                function() {
+                    $scope.refresh();
+                }
+            );
+    };
+
     $scope.editServer = function(id) {
         locationUtils.navigateToPath('/configure/servers/' + id);
     };
@@ -29,6 +47,57 @@ var TableServersController = function(servers, $scope, $state, locationUtils, se
         locationUtils.navigateToPath('/configure/servers/new');
     };
 
+    $scope.confirmQueueServerUpdates = function() {
+        var params = {
+            title: 'Queue Server Updates',
+            message: "Please select a CDN"
+        };
+        var modalInstance = $uibModal.open({
+            templateUrl: 'common/modules/dialog/select/dialog.select.tpl.html',
+            controller: 'DialogSelectController',
+            size: 'md',
+            resolve: {
+                params: function () {
+                    return params;
+                },
+                collection: function(cdnService) {
+                    return cdnService.getCDNs();
+                }
+            }
+        });
+        modalInstance.result.then(function(cdnId) {
+            queueServerUpdates(cdnId);
+        }, function () {
+            // do nothing
+        });
+    };
+
+    $scope.confirmClearServerUpdates = function() {
+        var params = {
+            title: 'Clear Server Updates',
+            message: "Please select a CDN"
+        };
+        var modalInstance = $uibModal.open({
+            templateUrl: 'common/modules/dialog/select/dialog.select.tpl.html',
+            controller: 'DialogSelectController',
+            size: 'md',
+            resolve: {
+                params: function () {
+                    return params;
+                },
+                collection: function(cdnService) {
+                    return cdnService.getCDNs();
+                }
+            }
+        });
+        modalInstance.result.then(function(cdnId) {
+            clearServerUpdates(cdnId);
+        }, function () {
+            // do nothing
+        });
+    };
+
+
     $scope.uploadServerCSV = function() {
         alert('not hooked up yet: uploadServerCSV');
     };
@@ -50,5 +119,5 @@ var TableServersController = function(servers, $scope, $state, locationUtils, se
 
 };
 
-TableServersController.$inject = ['servers', '$scope', '$state', 'locationUtils', 'serverUtils'];
+TableServersController.$inject = ['servers', '$scope', '$state', '$uibModal', 'locationUtils', 'serverUtils', 'cdnService'];
 module.exports = TableServersController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3e6baf3b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/table.servers.tpl.html
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/servers/table.servers.tpl.html b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/table.servers.tpl.html
index c8d793e..34211fe 100644
--- a/traffic_ops/experimental/ui/app/src/common/modules/table/servers/table.servers.tpl.html
+++ b/traffic_ops/experimental/ui/app/src/common/modules/table/servers/table.servers.tpl.html
@@ -24,6 +24,8 @@ under the License.
         </ol>
         <div class="pull-right">
             <button class="btn btn-primary" title="Create Server" ng-click="createServer()"><i class="fa fa-plus"></i></button>
+            <button class="btn btn-primary" title="Queue server updates" ng-click="confirmQueueServerUpdates()"><i class="fa fa-flag"></i></button>
+            <button class="btn btn-primary" title="Clear server updates" ng-click="confirmClearServerUpdates()"><i class="fa fa-ban"></i></button>
             <button class="btn btn-default" title="Refresh" ng-click="refresh()"><i class="fa fa-refresh"></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">