Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tzumainn committed May 18, 2017
1 parent 7ce367d commit 47a2652
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 27 deletions.
Expand Up @@ -63,11 +63,10 @@ ManageIQ.angular.app.controller('cloudNetworkFormController', ['$scope', 'cloudN
API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);

miqService.sparkleOff();
};

function getCloudTenantsByEms(data) {
$scope.available_tenants = data.resources;
miqService.sparkleOff();
}
}]);
Expand Up @@ -49,6 +49,10 @@ ManageIQ.angular.app.controller('floatingIpFormController', ['$http', '$scope',
$http.get('/floating_ip/networks_by_ems/' + id)
.then(getNetworkByEmsFormData)
.catch(miqService.handleFailure);

API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);
};

function getFloatingIpFormData(response) {
Expand All @@ -67,18 +71,8 @@ ManageIQ.angular.app.controller('floatingIpFormController', ['$http', '$scope',
miqService.sparkleOff();
}


$scope.filterNetworkManagerChanged = function(id) {
miqService.sparkleOn();

API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);

miqService.sparkleOff();
};

function getCloudTenantsByEms(data) {
$scope.available_tenants = data.resources;
miqService.sparkleOff();
}
}]);
Expand Up @@ -66,6 +66,10 @@ ManageIQ.angular.app.controller('networkRouterFormController', ['$http', '$scope
$http.get('/network_router/network_router_networks_by_ems/' + id)
.then(getNetworkRouterFormByEmsData)
.catch(miqService.handleFailure);

API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);
};

$scope.filterCloudNetworkChanged = function(id) {
Expand Down Expand Up @@ -106,17 +110,8 @@ ManageIQ.angular.app.controller('networkRouterFormController', ['$http', '$scope
miqService.sparkleOff();
}

$scope.filterNetworkManagerChanged = function(id) {
miqService.sparkleOn();

API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);

miqService.sparkleOff();
};

function getCloudTenantsByEms(data) {
$scope.available_tenants = data.resources;
miqService.sparkleOff();
}
}]);
Expand Up @@ -54,11 +54,10 @@ ManageIQ.angular.app.controller('securityGroupFormController', ['$scope', 'secur
API.get("/api/providers/" + id + "/cloud_tenants?expand=resources&attributes=id,name")
.then(getCloudTenantsByEms)
.catch(miqService.handleFailure);

miqService.sparkleOff();
};

function getCloudTenantsByEms(data) {
$scope.available_tenants = data.resources;
miqService.sparkleOff();
}
}]);
3 changes: 1 addition & 2 deletions app/views/network_router/new.html.haml
Expand Up @@ -22,8 +22,7 @@
%h3
= _('Placement')
.form-horizontal
.form-group{"ng-if" => "networkRouterModel.ems_id"}
.form-group{"ng-class" => "{'has-error': angularForm.cloud_tenant_id.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.cloud_tenant_id.$invalid}", "ng-if" => "networkRouterModel.ems_id"}
%label.col-md-2.control-label
= _('Cloud Tenant')
.col-md-8
Expand Down

0 comments on commit 47a2652

Please sign in to comment.