subnet selection will not be changed when a new option is added

Change-Id: Ie098ef8bf5a4a92ec7d7de20fee2ee2643a594c9
This commit is contained in:
chi zhang 2014-09-15 12:08:38 -07:00 committed by Chi Zhang
parent bb3c7ca8df
commit f684fc0456
2 changed files with 54 additions and 52 deletions

View File

@ -210,6 +210,10 @@
</tbody>
</table>
</div>
</div>
<div>
<script type="text/ng-template" id="addSubnetModal.html">
<div class="modal-header">
@ -217,12 +221,7 @@
</div>
<div class= "modal-body" >
<alert ng-repeat="alert in alerts" type="danger" close="closeAlert()" >
<span ng-if="alert.message">
{{alert.message}}
</span>
<span ng-if="!alert.message">
Unknown error
</span>
</alert>
<table class="table table-hover nowrap">
<thead>
@ -255,4 +254,4 @@
</div>
</script>
</div>
</div>

View File

@ -614,7 +614,6 @@ angular.module('compass.wizard', [
alert("This interface already exists. Please try another one");
}
})
if (!isExist) {
$scope.interfaces[newInterface.name] = {
"subnet_id": parseInt(newInterface.subnet_id),
@ -745,7 +744,10 @@ angular.module('compass.wizard', [
}
});
modalInstance.result.then(function(subnets) {
$scope.subnetworks = subnets;
$scope.subnetworks = [];
angular.forEach(subnets, function(subnet) {
$scope.subnetworks.push(subnet);
});
}, function() {
console.log("modal dismissed")
})
@ -1530,7 +1532,7 @@ var wizardModalInstanceCtrl = function($scope, $modalInstance, warning) {
};
var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, dataService, $filter) {
$scope.subnetworks = subnets;
$scope.subnetworks = angular.copy(subnets);
$scope.subnetAllValid = true;
angular.forEach($scope.subnetworks, function(subnet) {
@ -1585,7 +1587,9 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
});
$q.all(promises).then(function() {
$scope.subnetworks = subnetworks;
for(var i = 0; i < subnets.length && i < $scope.subnetworks.length; i++) {
$scope.subnetworks[i].$$hashKey = subnets[i].$$hashKey;
}
$modalInstance.close($scope.subnetworks);
}, function(response) {
console.log("promises error", response);
@ -1601,7 +1605,7 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
$scope.subnetworks = $filter('filter')($scope.subnetworks, {
valid: true
}, true);
$modalInstance.close($scope.subnetworks);
$modalInstance.dismiss('cancel');
};
@ -1614,7 +1618,6 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
valid: false
});
allValid();
console.log($scope.subnetworks);
};
$scope.removeSubnetwork = function(index) {