Skip to content

Commit

Permalink
Disable kubevirt in 'Add Infra Provider' dialog
Browse files Browse the repository at this point in the history
The kubevirt provider should be added as a sub-manager of the
openshift/kubernetes provider, and as such we should block the option to
add it from the UI as infrastructure manager.
  • Loading branch information
masayag committed Jan 22, 2018
1 parent 308c341 commit a995e23
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,6 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
$scope.emsCommonModel.metrics_api_port = "5432";
$scope.emsCommonModel.default_api_port = $scope.getDefaultApiPort($scope.emsCommonModel.emstype);
$scope.emsCommonModel.metrics_database_name = "ovirt_engine_history";
} else if ($scope.emsCommonModel.emstype === 'kubevirt') {
$scope.emsCommonModel.default_api_port = "8443";
} else if ($scope.emsCommonModel.emstype === 'vmware_cloud') {
$scope.emsCommonModel.default_api_port = "443";
$scope.emsCommonModel.event_stream_selection = "none";
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/ems_infra_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def index
redirect_to :action => 'show_list'
end

def new
@disabled_ems_infra_types = ['Kubevirt', 'kubevirt']
super
end

def scaling
assert_privileges("ems_infra_scale")

Expand Down
7 changes: 3 additions & 4 deletions app/controllers/mixins/ems_common_angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ def ems_form_fields
:kubevirt_auth_status => kubevirt_auth_status,
:kubevirt_password => kubevirt_password,
:kubevirt_password_exists => @ems.authentication_token(:kubevirt).nil? ? false : true,
:provider_options => provider_options,
:virtualization_selection => retrieve_virtualization_selection}
end

Expand Down Expand Up @@ -575,9 +574,9 @@ def set_ems_record_vars(ems, mode = nil)

if ems.kind_of?(ManageIQ::Providers::Kubevirt::InfraManager)
kubevirt_endpoint = {
:role => :kubevirt,
:hostname => kubevirt_hostname,
:port => kubevirt_api_port,
:role => :kubevirt,
:hostname => kubevirt_hostname,
:port => kubevirt_api_port,
}

kubevirt_endpoint.merge!(endpoint_security_options(kubevirt_security_protocol, kubevirt_tls_ca_certs))
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 @@ -24,7 +24,7 @@
= _('Type')
.col-md-8
= select_tag('emstype',
options_for_select([["<#{_('Choose')}>", nil]] + @ems_types, disabled: ["<#{_('Choose')}>", nil]),
options_for_select([["<#{_('Choose')}>", nil]] + @ems_types, disabled: ["<#{_('Choose')}>", nil].concat(@disabled_ems_infra_types || [])),
"ng-if" => "newRecord",
"ng-model" => "emsCommonModel.emstype",
"ng-change" => "providerTypeChanged()",
Expand Down

0 comments on commit a995e23

Please sign in to comment.