From 2c25aeb1fa9cc855d5c38340cb36af0e9f785e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Borov=C5=A1ak?= Date: Wed, 14 Mar 2018 11:43:35 +0100 Subject: [PATCH] Add Redfish provider creation dialog This commit introduces minimal changes that are needed in order to be able to add Redfish provider to ManageIQ. --- app/assets/images/svg/vendor-redfish.svg | 65 +++++++++++++++++++ .../images/svg/vendor-redfish_ph_infra.svg | 1 + app/controllers/ems_common.rb | 1 + app/controllers/mixins/ems_common_angular.rb | 12 ++++ .../_endpoints_angular.html.haml | 10 +++ .../angular/_multi_auth_credentials.html.haml | 1 + 6 files changed, 90 insertions(+) create mode 100644 app/assets/images/svg/vendor-redfish.svg create mode 120000 app/assets/images/svg/vendor-redfish_ph_infra.svg diff --git a/app/assets/images/svg/vendor-redfish.svg b/app/assets/images/svg/vendor-redfish.svg new file mode 100644 index 000000000000..3b2aeab2580a --- /dev/null +++ b/app/assets/images/svg/vendor-redfish.svg @@ -0,0 +1,65 @@ + +image/svg+xml \ No newline at end of file diff --git a/app/assets/images/svg/vendor-redfish_ph_infra.svg b/app/assets/images/svg/vendor-redfish_ph_infra.svg new file mode 120000 index 000000000000..0e3b702eca96 --- /dev/null +++ b/app/assets/images/svg/vendor-redfish_ph_infra.svg @@ -0,0 +1 @@ +vendor-redfish.svg \ No newline at end of file diff --git a/app/controllers/ems_common.rb b/app/controllers/ems_common.rb index 2165e0bf2963..bea60a63e063 100644 --- a/app/controllers/ems_common.rb +++ b/app/controllers/ems_common.rb @@ -478,6 +478,7 @@ def form_instance_vars end @nuage_api_versions = retrieve_nuage_api_versions @hawkular_security_protocols = retrieve_hawkular_security_protocols + @redfish_security_protocols = retrieve_security_protocols end def retrieve_provider_regions diff --git a/app/controllers/mixins/ems_common_angular.rb b/app/controllers/mixins/ems_common_angular.rb index 99bebcdce752..338d3f7a571c 100644 --- a/app/controllers/mixins/ems_common_angular.rb +++ b/app/controllers/mixins/ems_common_angular.rb @@ -180,6 +180,9 @@ def get_task_args(ems) [user, params[:default_password], endpoint_opts] when 'ManageIQ::Providers::Lenovo::PhysicalInfraManager' [user, password, params[:default_hostname], params[:default_api_port], "token", false, true] + when 'ManageIQ::Providers::Redfish::PhysicalInfraManager' + [user, password, params[:default_hostname], params[:default_api_port], + params[:default_security_protocol]] end end @@ -648,6 +651,15 @@ def set_ems_record_vars(ems, mode = nil) default_endpoint = {:role => :default, :hostname => hostname, :port => port} end + if ems.kind_of?(ManageIQ::Providers::Redfish::PhysicalInfraManager) + default_endpoint = { + :role => :default, + :hostname => hostname, + :port => port, + :security_protocol => ems.security_protocol + } + end + new_options = {} if ems.class.respond_to?(:advanced_settings) ems.class.advanced_settings.each do |section_name, section| diff --git a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml index 4c927ca68553..914d00e323d0 100644 --- a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml +++ b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml @@ -15,6 +15,7 @@ "ng-if" => "emsCommonModel.emstype == 'openstack' || " + | "emsCommonModel.emstype == 'openstack_infra' || " + | "emsCommonModel.emstype == 'nuage_network' || " + | + "emsCommonModel.emstype == 'redfish_ph_infra' || " + | "(emsCommonModel.emstype == 'vmware_cloud' && '#{prefix}' === 'amqp') || " | "emsCommonModel.emstype == 'scvmm' || " + | "emsCommonModel.ems_controller == 'ems_container' || " + | @@ -70,6 +71,14 @@ "selectpicker-for-select-tag" => "", "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status") + .col-md-8{"ng-if" => "emsCommonModel.emstype == 'redfish_ph_infra'"} + - security_protocols = @redfish_security_protocols + = select_tag("#{prefix}_security_protocol", + options_for_select([["<#{_('Choose')}>", nil]] + security_protocols, :disabled => ["<#{_('Choose')}>", nil]), + "ng-model" => "#{ng_model}.#{prefix}_security_protocol", + "checkchange" => "", + "required" => defined?(security_protocol_not_required) ? false : true, + "selectpicker-for-select-tag" => "") %div{"ng-if" => defined?(hostname_hide) ? false : true} .form-group{"ng-class" => "{'has-error': angularForm.#{prefix}_hostname.$invalid}"} @@ -161,6 +170,7 @@ "emsCommonModel.emstype == 'vmware_cloud' || " + | "emsCommonModel.emstype == 'hawkular' || " + | "emsCommonModel.emstype == 'lenovo_ph_infra' || " + | + "emsCommonModel.emstype == 'redfish_ph_infra' || " + | "emsCommonModel.ems_controller == 'ems_container'"} | %label.col-md-2.control-label{"for" => "#{prefix}_api_port"} = _('API Port') diff --git a/app/views/layouts/angular/_multi_auth_credentials.html.haml b/app/views/layouts/angular/_multi_auth_credentials.html.haml index 36ea3200114a..d647bfa9aa0b 100644 --- a/app/views/layouts/angular/_multi_auth_credentials.html.haml +++ b/app/views/layouts/angular/_multi_auth_credentials.html.haml @@ -491,6 +491,7 @@ %div{"ng-if" => "#{ng_model}.emstype == 'gce' || " + | "#{ng_model}.emstype == 'scvmm' || " + | "#{ng_model}.emstype == 'lenovo_ph_infra' || " + | + "#{ng_model}.emstype == 'redfish_ph_infra' || " + | "#{ng_model}.emstype == 'hawkular'"} | :javascript miq_tabs_show_hide("#amqp_tab", false);