fix(container-creation): fix missing capabilities on duplicate (#2635)

pull/2659/head
baron_l 2019-01-22 21:28:44 +01:00 committed by Anthony Lapenna
parent 54163e3b92
commit c1f2d90997
1 changed files with 13 additions and 0 deletions

View File

@ -493,6 +493,19 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
$scope.formValues.capabilities.push(new ContainerCapability(cap, false));
});
}
function hasCapability(item) {
return item.capability === cap.capability;
}
var capabilities = new ContainerCapabilities();
for (var i = 0; i < capabilities.length; i++) {
var cap = capabilities[i];
if (!_.find($scope.formValues.capabilities, hasCapability)) {
$scope.formValues.capabilities.push(cap);
}
}
$scope.formValues.capabilities.sort(function(a, b) {
return a.capability < b.capability ? -1 : 1;
});