Skip to content

Commit

Permalink
Hide the zone in the provider edit form if the provider is suspended
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Dec 19, 2018
1 parent 243b3fe commit 6665066
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
$scope.emsCommonModel.name = data.name;
$scope.emsCommonModel.emstype = data.emstype;
$scope.emsCommonModel.zone = data.zone;
$scope.emsCommonModel.zone_hidden = data.zone_hidden;
$scope.emsCommonModel.tenant_mapping_enabled = data.tenant_mapping_enabled;
$scope.emsCommonModel.hostname = data.hostname;
$scope.emsCommonModel.default_hostname = data.default_hostname;
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/mixins/ems_common_angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ def ems_form_fields
render :json => {:name => @ems.name,
:emstype => @ems.emstype,
:zone => zone,
:zone_hidden => zone == MiqRegion.my_region.maintenance_zone.name,
:tenant_mapping_enabled => @ems.tenant_mapping_enabled == true,
:provider_id => @ems.provider_id || "",
:hostname => @ems.hostname,
Expand Down Expand Up @@ -410,6 +411,7 @@ def ems_form_fields
render :json => { :name => @ems.name,
:emstype => @ems.emstype,
:zone => zone,
:zone_hidden => zone == MiqRegion.my_region.maintenance_zone.name,
:provider_id => @ems.provider_id || "",
:default_hostname => @ems.connection_configurations.default.endpoint.hostname,
:amqp_hostname => amqp_hostname,
Expand Down Expand Up @@ -455,6 +457,7 @@ def ems_form_fields
render :json => {:name => @ems.name,
:emstype => @ems.emstype,
:zone => zone,
:zone_hidden => zone == MiqRegion.my_region.maintenance_zone.name,
:hostname => @ems.hostname,
:default_hostname => @ems.connection_configurations.default.endpoint.hostname,
:default_api_port => @ems.connection_configurations.default.endpoint.port,
Expand Down
2 changes: 1 addition & 1 deletion app/views/configuration_manager/_shared_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"auto-focus" => ""}
%span.help-block{"ng-show" => "angularForm.name.$error.required"}
= _("Required")
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}", "ng-if" => "!emsCommonModel.zone_hidden"}
%label.col-md-2.control-label{"for" => "prov_zone"}
= _("Zone")
.col-md-8
Expand Down
2 changes: 1 addition & 1 deletion app/views/ems_container/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"style" => "color: black; font-weight: normal;"}
= @emstype_display
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}", "ng-if" => "!emsCommonModel.zone_hidden"}
%label.col-md-2.control-label{"for" => "ems_zone"}
= _("Zone")
.col-md-4
Expand Down
2 changes: 1 addition & 1 deletion app/views/ems_infra/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"checkchange" => "",
"selectpicker-for-select-tag" => "")
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}", "ng-if" => "!emsCommonModel.zone_hidden"}
%label.col-md-2.control-label{"for" => "ems_zone"}
= _("Zone")
.col-md-4
Expand Down
2 changes: 1 addition & 1 deletion app/views/ems_physical_infra/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"style" => "color: black; font-weight: normal;"}
= @emstype_display
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}", "ng-if" => "!emsCommonModel.zone_hidden"}
%label.col-md-2.control-label{"for" => "ems_zone"}
= _("Zone")
.col-md-8
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/views/ems_common/angular/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"checkchange" => "",
"selectpicker-for-select-tag" => "")
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}"}
.form-group{"ng-class" => "{'has-error': angularForm.zone.$invalid}", "ng-if" => "!emsCommonModel.zone_hidden"}
%label.col-md-2.control-label{"for" => "ems_zone"}
= _("Zone")
.col-md-4
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/ems_cloud_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
end

it 'gets the ems cloud form fields on a get' do
Zone.seed
post :create, :params => {
"button" => "add",
"default_hostname" => "openstack.example.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

describe "#ems_network_form_fields" do
it "renders ems_network_form_fields json" do
Zone.seed
get :ems_network_form_fields, :params => {:id => @ems.id}
expect(response.status).to eq(200)
expect(response.body).to_not be_empty
Expand Down

0 comments on commit 6665066

Please sign in to comment.