Skip to content

Commit

Permalink
Merge pull request #2904 from juliancheal/disable_aws_region_change
Browse files Browse the repository at this point in the history
Disable editing Region on Cloud Edit Screen
(cherry picked from commit 79b0816)

https://bugzilla.redhat.com/show_bug.cgi?id=1520615
  • Loading branch information
himdel authored and simaishi committed Dec 4, 2017
1 parent 1bd1a91 commit 341d665
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/controllers/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ def form_instance_vars
@openstack_api_versions = retrieve_openstack_api_versions
@vmware_cloud_api_versions = retrieve_vmware_cloud_api_versions
@emstype_display = model.supported_types_and_descriptions_hash[@ems.emstype]
if @ems.respond_to?(:description)
@ems_region_display = @ems.description
end
@nuage_api_versions = retrieve_nuage_api_versions
@hawkular_security_protocols = retrieve_hawkular_security_protocols
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/mixins/ems_common_angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def no_blank(thing)

def set_ems_record_vars(ems, mode = nil)
ems.name = params[:name].strip if params[:name]
ems.provider_region = params[:provider_region]
ems.provider_region = params[:provider_region] if params[:provider_region]
ems.api_version = params[:api_version].strip if params[:api_version]
ems.provider_id = params[:provider_id]
ems.zone = Zone.find_by_name(params[:zone])
Expand Down
26 changes: 17 additions & 9 deletions app/views/shared/views/ems_common/angular/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@
= _('Region')
.col-md-8
- @provider_regions.each do |name, regions|
= select_tag('provider_region',
options_for_select([["<#{_('Choose')}>", nil]] + regions, disabled: ["<#{_('Choose')}>", nil]),
"ng-model" => "emsCommonModel.provider_region",
"ng-switch-when" => name,
"required" => "",
"checkchange" => "",
"selectpicker-for-select-tag" => "",
"prefix" => "default",
"reset-validation-status" => "default_auth_status")
%div{"ng-switch-when" => name}
= select_tag('provider_region',
options_for_select([["<#{_('Choose')}>", nil]] + regions, disabled: ["<#{_('Choose')}>", nil]),
"ng-model" => "emsCommonModel.provider_region",
"required" => "",
"checkchange" => "",
"selectpicker-for-select-tag" => "",
"prefix" => "default",
"reset-validation-status" => "default_auth_status",
"ng-if" => "newRecord")
%label.form-control{"type" => "text",
"id" => "provider_region",
"name" => "provider_region",
"readonly" => true,
"style" => "color: black; font-weight: normal;",
"ng-if" => "!newRecord"}
= @ems_region_display
.form-group{"ng-class" => "{'has-error': angularForm.project.$invalid}", "ng-if" => "emsCommonModel.emstype == 'gce'"}
%label.col-md-2.control-label{"for" => "ems_project"}
Expand Down

0 comments on commit 341d665

Please sign in to comment.