Merge "Fix subnet_id null bug for newly added subnets"
This commit is contained in:
commit
1e7b4d7a77
@ -124,6 +124,9 @@ select {
|
|||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
height: 33px;
|
height: 33px;
|
||||||
}
|
}
|
||||||
|
select option[value=""], select.form-control option[value=""] {
|
||||||
|
padding: 3px 4px;
|
||||||
|
}
|
||||||
.opacity-zero {
|
.opacity-zero {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ compassAppDev.run(function($httpBackend, settings, $http) {
|
|||||||
console.log(method, url, data);
|
console.log(method, url, data);
|
||||||
|
|
||||||
var subnetConfig = JSON.parse(data);
|
var subnetConfig = JSON.parse(data);
|
||||||
subnetConfig.subnet_id = Math.floor((Math.random() * 100) + 1);
|
subnetConfig.id = Math.floor((Math.random() * 100) + 1);
|
||||||
|
|
||||||
console.log(subnetConfig);
|
console.log(subnetConfig);
|
||||||
return [200, subnetConfig, {}];
|
return [200, subnetConfig, {}];
|
||||||
|
@ -1756,7 +1756,7 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.ok = function() {
|
$scope.ok = function() {
|
||||||
var subnetworks = [];
|
var newsubnetworks = [];
|
||||||
var promises = [];
|
var promises = [];
|
||||||
angular.forEach($scope.subnetworks, function(subnet) {
|
angular.forEach($scope.subnetworks, function(subnet) {
|
||||||
var requestData = {
|
var requestData = {
|
||||||
@ -1765,7 +1765,7 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
|
|||||||
if (subnet.id === undefined) {
|
if (subnet.id === undefined) {
|
||||||
// post subnetworks
|
// post subnetworks
|
||||||
var updateSubnetConfig = dataService.postSubnetConfig(requestData).then(function(subnetData) {
|
var updateSubnetConfig = dataService.postSubnetConfig(requestData).then(function(subnetData) {
|
||||||
subnetworks.push(subnetData.data);
|
newsubnetworks.push(subnetData.data);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
return $q.reject(response);
|
return $q.reject(response);
|
||||||
});
|
});
|
||||||
@ -1773,7 +1773,7 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
|
|||||||
} else {
|
} else {
|
||||||
// put subnetworks
|
// put subnetworks
|
||||||
var updateSubnetConfig = dataService.putSubnetConfig(subnet.id, requestData).then(function(subnetData) {
|
var updateSubnetConfig = dataService.putSubnetConfig(subnet.id, requestData).then(function(subnetData) {
|
||||||
subnetworks.push(subnetData.data);
|
newsubnetworks.push(subnetData.data);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
return $q.reject(response);
|
return $q.reject(response);
|
||||||
});
|
});
|
||||||
@ -1782,6 +1782,7 @@ var addSubnetModalInstanceCtrl = function($scope, $modalInstance, $q, subnets, d
|
|||||||
});
|
});
|
||||||
|
|
||||||
$q.all(promises).then(function() {
|
$q.all(promises).then(function() {
|
||||||
|
$scope.subnetworks = newsubnetworks;
|
||||||
for (var i = 0; i < subnets.length && i < $scope.subnetworks.length; i++) {
|
for (var i = 0; i < subnets.length && i < $scope.subnetworks.length; i++) {
|
||||||
$scope.subnetworks[i].$$hashKey = subnets[i].$$hashKey;
|
$scope.subnetworks[i].$$hashKey = subnets[i].$$hashKey;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user