mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 10:10:01 -03:30
don't be looping if there ain't nothing to loop on
This commit is contained in:
@@ -38,31 +38,34 @@ export function CredentialsList($scope, $rootScope, $location, $log,
|
|||||||
|
|
||||||
$scope.$on(`${list.iterator}_options`, function(event, data){
|
$scope.$on(`${list.iterator}_options`, function(event, data){
|
||||||
$scope.options = data.data.actions.GET;
|
$scope.options = data.data.actions.GET;
|
||||||
|
console.log($scope.options);
|
||||||
optionsRequestDataProcessing();
|
optionsRequestDataProcessing();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watchCollection(`${$scope.list.name}`, function() {
|
$scope.$watchCollection(`${$scope.list.name}`, function() {
|
||||||
optionsRequestDataProcessing();
|
optionsRequestDataProcessing();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
// iterate over the list and add fields like type label, after the
|
// iterate over the list and add fields like type label, after the
|
||||||
// OPTIONS request returns, or the list is sorted/paginated/searched
|
// OPTIONS request returns, or the list is sorted/paginated/searched
|
||||||
function optionsRequestDataProcessing(){
|
function optionsRequestDataProcessing(){
|
||||||
$scope[list.name].forEach(function(item, item_idx) {
|
if ($scope[list.name] !== undefined) {
|
||||||
var itm = $scope[list.name][item_idx];
|
$scope[list.name].forEach(function(item, item_idx) {
|
||||||
|
var itm = $scope[list.name][item_idx];
|
||||||
|
|
||||||
// Set the item type label
|
// Set the item type label
|
||||||
if (list.fields.kind && $scope.options &&
|
if (list.fields.kind && $scope.options &&
|
||||||
$scope.options.hasOwnProperty('kind')) {
|
$scope.options.hasOwnProperty('kind')) {
|
||||||
$scope.options.kind.choices.every(function(choice) {
|
$scope.options.kind.choices.every(function(choice) {
|
||||||
if (choice[0] === item.kind) {
|
if (choice[0] === item.kind) {
|
||||||
itm.kind_label = choice[1];
|
itm.kind_label = choice[1];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.addCredential = function() {
|
$scope.addCredential = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user