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_r336191437
 
 

 ##########
 File path: 
traffic_portal/app/src/common/modules/dialog/select/DialogSelectController.js
 ##########
 @@ -23,10 +23,10 @@ var DialogSelectController = function(params, collection, 
$scope, $uibModalInsta
 
        $scope.collection = collection;
 
-       $scope.selectedItemId = null;
+       $scope.selectedItemKeyValue = null;
 
        $scope.select = function() {
-               var selectedItem = _.find(collection, function(item){ return 
parseInt(item.id) == parseInt($scope.selectedItemId) });
+               var selectedItem = _.find(collection, function(item){ return 
item[$scope.key] === $scope.selectedItemKeyValue });
 
 Review comment:
   Instead of `_.find`, consider using [the built-in `Array.prototype.find` 
method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
 like so:
   ```javascript
   const selectedItem = _.find(collection, function(item){return 
item[$scope.key] === $selectedItemKeyValue});
   ```

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