ocket8888 commented on a change in pull request #3998: TP: Ability to manager 
capabilities of servers
URL: https://github.com/apache/trafficcontrol/pull/3998#discussion_r336193616
 
 

 ##########
 File path: 
traffic_portal/app/src/common/modules/table/serverServerCapabilities/TableServerServerCapabilitiesController.js
 ##########
 @@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+var TableServerServerCapabilitiesController = function(server, 
serverCapabilities, $scope, $state, $uibModal, locationUtils, serverService, 
messageModel) {
+
+       $scope.server = server;
+
+       $scope.serverCapabilities = serverCapabilities;
+
+       $scope.contextMenuItems = [
+               {
+                       text: 'Remove Server Capability',
+                       click: function ($itemScope) {
+                               
$scope.confirmRemoveCapability($itemScope.sc.serverCapability);
+                       }
+               }
+       ];
+
+       $scope.addServerCapability = function() {
+               var params = {
+                       title: 'Add Server Capability',
+                       message: "Please select a capability to add to this 
server",
+                       key: "name"
+               };
+               var modalInstance = $uibModal.open({
+                       templateUrl: 
'common/modules/dialog/select/dialog.select.tpl.html',
+                       controller: 'DialogSelectController',
+                       size: 'md',
+                       resolve: {
+                               params: function () {
+                                       return params;
+                               },
+                               collection: function(serverCapabilityService) {
+                                       return 
serverCapabilityService.getServerCapabilities();
+                               }
+                       }
+               });
+               modalInstance.result.then(function(serverCapability) {
+                       serverService.addServerCapability(server.id, 
serverCapability.name)
+                               .then(
+                                       function(result) {
+                                               
messageModel.setMessages(result.data.alerts, false);
+                                               $scope.refresh(); // refresh 
the profile parameters table
+                                       }
+                               );
+               }, function () {
+                       // do nothing
+               });
+       };
+
+       $scope.confirmRemoveCapability = function(serverCapability, $event) {
+               if ($event) {
+                       $event.stopPropagation(); // this kills the click event 
so it doesn't trigger anything else
+               }
+               var params = {
 
 Review comment:
   This is never reassigned - could be `const`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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