ocket8888 commented on code in PR #7079:
URL: https://github.com/apache/trafficcontrol/pull/7079#discussion_r983027503


##########
docs/source/api/v4/multiple_servers_per_capability.rst:
##########
@@ -0,0 +1,83 @@
+..
+..
+.. Licensed 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.
+..
+
+.. _to-api-v4-multiple_servers_per_capability:
+
+***********************************
+``multiple_servers_per_capability``
+***********************************
+
+.. versionadded:: 4.1
+
+``PUT``
+========
+Associates a list of :term:`Servers` to a server capability. The API call 
replaces all the servers assigned to a server capability with the ones 
specified in the servers field.

Review Comment:
   "Servers" isn't a glossary term, so this is a broken link.



##########
docs/source/api/v4/multiple_servers_per_capability.rst:
##########
@@ -0,0 +1,83 @@
+..
+..
+.. Licensed 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.
+..
+
+.. _to-api-v4-multiple_servers_per_capability:
+
+***********************************
+``multiple_servers_per_capability``
+***********************************
+
+.. versionadded:: 4.1
+
+``PUT``
+========
+Associates a list of :term:`Servers` to a server capability. The API call 
replaces all the servers assigned to a server capability with the ones 
specified in the servers field.
+
+:Auth. Required: Yes
+:Roles Required: "admin" or "operations"
+:Permissions Required: SERVER:READ, SERVER-CAPABILITY:READ, 
SERVER-CAPABILITY:UPDATE
+:Response Type:  Object
+
+Request Structure
+-----------------
+:serverCapability:  The unique identifier of a server capability to be 
associated with a :term:`Server`
+:serverIds:         List of :term:`Server` ids associated with a server 
capability
+
+.. code-block:: http
+       :caption: Request Example
+
+       PUT /api/4.1/multiple_server_capabilities/ HTTP/1.1
+       Host: trafficops.infra.ciab.test
+       User-Agent: curl/7.47.0
+       Accept: */*
+       Cookie: mojolicious=...
+       Content-Length: 84
+       Content-Type: application/json
+
+       {
+               "serverCapability": "eas",
+               "serverIds": [2, 3]
+       }
+
+Response Structure
+------------------
+:serverCapability:   The unique identifier of a server capability to be 
associated with a :term:`Server`
+:serverIds:          List of :term:`Server` ids associated with a server 
capability

Review Comment:
   same as above



##########
docs/source/api/v4/multiple_servers_per_capability.rst:
##########
@@ -0,0 +1,83 @@
+..
+..
+.. Licensed 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.
+..
+
+.. _to-api-v4-multiple_servers_per_capability:
+
+***********************************
+``multiple_servers_per_capability``
+***********************************
+
+.. versionadded:: 4.1
+
+``PUT``
+========
+Associates a list of :term:`Servers` to a server capability. The API call 
replaces all the servers assigned to a server capability with the ones 
specified in the servers field.
+
+:Auth. Required: Yes
+:Roles Required: "admin" or "operations"
+:Permissions Required: SERVER:READ, SERVER-CAPABILITY:READ, 
SERVER-CAPABILITY:UPDATE
+:Response Type:  Object
+
+Request Structure
+-----------------
+:serverCapability:  The unique identifier of a server capability to be 
associated with a :term:`Server`
+:serverIds:         List of :term:`Server` ids associated with a server 
capability
+
+.. code-block:: http
+       :caption: Request Example
+
+       PUT /api/4.1/multiple_server_capabilities/ HTTP/1.1
+       Host: trafficops.infra.ciab.test
+       User-Agent: curl/7.47.0
+       Accept: */*
+       Cookie: mojolicious=...
+       Content-Length: 84
+       Content-Type: application/json
+
+       {
+               "serverCapability": "eas",
+               "serverIds": [2, 3]
+       }
+
+Response Structure
+------------------
+:serverCapability:   The unique identifier of a server capability to be 
associated with a :term:`Server`
+:serverIds:          List of :term:`Server` ids associated with a server 
capability
+
+.. code-block:: http
+       :caption: Response Example
+
+       HTTP/1.1 200 OK
+       Access-Control-Allow-Credentials: true
+       Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, 
Accept, Set-Cookie, Cookie
+       Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
+       Access-Control-Allow-Origin: *
+       Content-Type: application/json
+       Set-Cookie: mojolicious=...; Path=/; Expires=Sat, 24 Sep 2022 22:40:54 
GMT; Max-Age=3600; HttpOnly
+       Whole-Content-Sha512: 
eQrl48zWids0kDpfCYmmtYMpegjnFxfOVvlBYxxLSfp7P7p6oWX4uiC+/Cfh2X9i3G+MQ36eH95gukJqOBOGbQ==
+       X-Server-Name: traffic_ops_golang/
+       Date: Tues, 20 Sep 2022 16:15:11 GMT
+       Content-Length: 157
+
+       {
+       "alerts": [{
+                       "text": "Multiple Servers assigned to a capability",
+                       "level": "success"
+               }],
+               "response": {
+                       "serverCapability": "eas",
+                       "serverIds": [2, 3]
+               }
+       }

Review Comment:
   according to these docs this endpoint is identical to 
`/multiple_servers_per_capability`, which I don't think is true



##########
traffic_portal/app/src/common/modules/table/serverCapabilityServers/table.serverCapabilityServers.tpl.html:
##########
@@ -20,11 +20,12 @@
 <div class="x_panel">
     <div class="x_title">
         <ol class="breadcrumb pull-left">
-            <li><a href="#!/server-capabilities">Server Capabilities</a></li>
-            <li><a 
ng-href="#!/server-capabilities/{{serverCapability.name}}">{{::serverCapability.name}}</a></li>
+            <li><a ng-click="navigateToPath('/server-capabilities')">Server 
Capabilities</a></li>
+            <li><a ng-click="navigateToPath('/server-capabilities/edit?name=' 
+ serverCapability.name)">{{::serverCapability.name}}</a></li>

Review Comment:
   Anchor elements should not have `click` event handlers. They should use 
their `href` properties (or `ng-href` as appropriate) so that they properly act 
as links.



##########
docs/source/api/v4/multiple_servers_per_capability.rst:
##########
@@ -0,0 +1,83 @@
+..
+..
+.. Licensed 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.
+..
+
+.. _to-api-v4-multiple_servers_per_capability:
+
+***********************************
+``multiple_servers_per_capability``
+***********************************
+
+.. versionadded:: 4.1
+
+``PUT``
+========
+Associates a list of :term:`Servers` to a server capability. The API call 
replaces all the servers assigned to a server capability with the ones 
specified in the servers field.
+
+:Auth. Required: Yes
+:Roles Required: "admin" or "operations"
+:Permissions Required: SERVER:READ, SERVER-CAPABILITY:READ, 
SERVER-CAPABILITY:UPDATE
+:Response Type:  Object
+
+Request Structure
+-----------------
+:serverCapability:  The unique identifier of a server capability to be 
associated with a :term:`Server`
+:serverIds:         List of :term:`Server` ids associated with a server 
capability

Review Comment:
   same as above



##########
traffic_portal/app/src/common/modules/table/serverCapabilityServers/table.assignServersPerCapability.tpl.html:
##########
@@ -0,0 +1,31 @@
+<!--
+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.
+-->
+
+<div class="modal-header">
+    <button type="button" class="close" ng-click="cancel()"><span 
aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+    <h3 class="modal-title">Assign Servers to {{::serverCapability.name}}</h3>
+</div>
+<div class="modal-body">
+    <common-grid-controller table-name="serversUnassigned" 
options="gridOptions"
+                            data="servers" columns="columns" 
selected-data="selectedServers"></common-grid-controller>
+</div>
+<div class="modal-footer">
+    <button class="btn btn-link" ng-click="cancel()">cancel</button>
+    <button class="btn btn-primary" ng-click="submit()">Submit</button>

Review Comment:
   These buttons should have `type="button"` because they don't submit a form 
(which is the default behavior if you don't specify).
   
   Also "cancel" has different casing than "Submit" - it should probably be 
capitalized as well.



##########
traffic_portal/app/src/common/modules/table/serverCapabilityServers/TableServerCapabilityServersController.js:
##########
@@ -66,6 +66,35 @@ var TableServerCapabilityServersController = 
function(serverCapability, servers,
                locationUtils.navigateToPath('/servers/' + id);
        };
 
+       $scope.selectServers = function () {
+               var modalInstance = $uibModal.open({

Review Comment:
   this should be using `let` or `const` instead of hoisting the declaration 
with `var` - and really it should be `const` because it's never reassigned.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to