From 6ee34bd41d4dbd6b2773d7c14d9bf08c4bb225f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josejulio=20Mart=C3=ADnez?= Date: Tue, 21 Mar 2017 13:15:15 -0600 Subject: [PATCH 1/2] Change Security Protocol field Port value is affected by Security Protocol, when one protocol is selected it sets the default port value (on some providers) of the protocol. --- .../_endpoints_angular.html.haml | 115 +++++++++--------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml index fba05fe0d2b..3156b982442 100644 --- a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml +++ b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml @@ -3,6 +3,64 @@ - ng_reqd_hostname ||= true - ng_reqd_api_port ||= true +%div{"ng-if" => defined?(security_protocol_hide) ? false : true} + .form-group{"ng-class" => "{'has-error': angularForm.#{prefix}_security_protocol.$invalid}", + "ng-if" => "emsCommonModel.emstype == 'openstack' || " + | + "emsCommonModel.emstype == 'openstack_infra' || " + | + "emsCommonModel.emstype == 'nuage_network' || " + | + "(emsCommonModel.emstype == 'vmware_cloud' && '#{prefix}' === 'amqp') || " | + "emsCommonModel.emstype == 'scvmm' || " + | + "emsCommonModel.ems_controller == 'ems_container' || " + | + "emsCommonModel.emstype == 'hawkular'"} | + %label.col-md-2.control-label{"for" => "#{prefix}_security_protocol"} + = _('Security Protocol') + .col-md-8{"ng-if" => "emsCommonModel.emstype == 'openstack' || emsCommonModel.emstype == 'openstack_infra' || emsCommonModel.emstype == 'vmware_cloud'"} + - prefix == "amqp" ? security_protocols = @amqp_security_protocols : security_protocols = @openstack_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" => "", + "ng-required" => true, + "ng-change" => "openstackSecurityProtocolChanged()", + "selectpicker-for-select-tag" => "", + "prefix" => "#{prefix}", + "reset-validation-status" => "#{prefix}_auth_status") + .col-md-8{"ng-if" => "emsCommonModel.emstype == 'nuage_network'"} + = select_tag("#{prefix}_security_protocol", + options_for_select([["<#{_('Choose')}>", nil]] + @nuage_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" => "") + .col-md-8{"ng-if" => "emsCommonModel.emstype == 'scvmm'"} + = select_tag("#{prefix}_security_protocol", + options_for_select([["<#{_('Choose')}>", nil]] + @scvmm_security_protocols, disabled: ["<#{_('Choose')}>", nil]), + "ng-model" => "#{ng_model}.#{prefix}_security_protocol", + "checkchange" => "", + "required" => "", + "selectpicker-for-select-tag" => "", + "prefix" => "#{prefix}", + "reset-validation-status" => "#{prefix}_auth_status") + .col-md-8{"ng-if" => "emsCommonModel.ems_controller == 'ems_container'"} + = select_tag("#{prefix}_security_protocol", + options_for_select([["<#{_('Choose')}>", nil]] + @container_security_protocols, disabled: ["<#{_('Choose')}>", nil]), + "ng-model" => "#{ng_model}.#{prefix}_security_protocol", + "checkchange" => "", + "required" => "", + "selectpicker-for-select-tag" => "", + "prefix" => "#{prefix}", + "reset-validation-status" => "#{prefix}_auth_status") + .col-md-8{"ng-if" => "emsCommonModel.emstype == 'hawkular'"} + = select_tag("#{prefix}_security_protocol", + options_for_select([["<#{_('Choose')}>", nil]] + @hawkular_security_protocols, "disabled" => ["<#{_('Choose')}>", nil]), + "ng-model" => "#{ng_model}.#{prefix}_security_protocol", + "checkchange" => "", + "required" => "", + "ng-change" => "hawkularSecurityProtocolChanged()", + "selectpicker-for-select-tag" => "", + "prefix" => prefix.to_s, + "reset-validation-status" => "#{prefix}_auth_status") + %div{"ng-if" => defined?(hostname_hide) ? false : true} .form-group{"ng-class" => "{'has-error': angularForm.#{prefix}_hostname.$invalid}"} %label.col-md-2.control-label{"for" => "#{prefix}_hostname"} @@ -78,63 +136,6 @@ %span.help-block{"ng-show" => "angularForm.#{prefix}_database_name.$error.detectedSpaces"} = _("Spaces are prohibited") -%div{"ng-if" => defined?(security_protocol_hide) ? false : true} - .form-group{"ng-class" => "{'has-error': angularForm.#{prefix}_security_protocol.$invalid}", - "ng-if" => "emsCommonModel.emstype == 'openstack' || " + | - "emsCommonModel.emstype == 'openstack_infra' || " + | - "emsCommonModel.emstype == 'nuage_network' || " + | - "(emsCommonModel.emstype == 'vmware_cloud' && '#{prefix}' === 'amqp') || " | - "emsCommonModel.emstype == 'scvmm' || " + | - "emsCommonModel.ems_controller == 'ems_container' || " + | - "emsCommonModel.emstype == 'hawkular'"} | - %label.col-md-2.control-label{"for" => "#{prefix}_security_protocol"} - = _('Security Protocol') - .col-md-8{"ng-if" => "emsCommonModel.emstype == 'openstack' || emsCommonModel.emstype == 'openstack_infra' || emsCommonModel.emstype == 'vmware_cloud'"} - - prefix == "amqp" ? security_protocols = @amqp_security_protocols : security_protocols = @openstack_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" => "", - "ng-required" => true, - "ng-change" => "openstackSecurityProtocolChanged()", - "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", - "reset-validation-status" => "#{prefix}_auth_status") - .col-md-8{"ng-if" => "emsCommonModel.emstype == 'nuage_network'"} - = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @nuage_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" => "") - .col-md-8{"ng-if" => "emsCommonModel.emstype == 'scvmm'"} - = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @scvmm_security_protocols, disabled: ["<#{_('Choose')}>", nil]), - "ng-model" => "#{ng_model}.#{prefix}_security_protocol", - "checkchange" => "", - "required" => "", - "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", - "reset-validation-status" => "#{prefix}_auth_status") - .col-md-8{"ng-if" => "emsCommonModel.ems_controller == 'ems_container'"} - = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @container_security_protocols, disabled: ["<#{_('Choose')}>", nil]), - "ng-model" => "#{ng_model}.#{prefix}_security_protocol", - "checkchange" => "", - "required" => "", - "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", - "reset-validation-status" => "#{prefix}_auth_status") - .col-md-8{"ng-if" => "emsCommonModel.emstype == 'hawkular'"} - = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @hawkular_security_protocols, "disabled" => ["<#{_('Choose')}>", nil]), - "ng-model" => "#{ng_model}.#{prefix}_security_protocol", - "checkchange" => "", - "required" => "", - "ng-change" => "hawkularSecurityProtocolChanged()", - "selectpicker-for-select-tag" => "", - "prefix" => prefix.to_s, - "reset-validation-status" => "#{prefix}_auth_status") %div{"ng-if" => defined?(tls_verify_hide) ? false : true} .form-group{"ng-if"=> "emsCommonModel.emstype == 'rhevm'"} From 81b93e22abf56df6a27ae6d4aa9db59783ebd602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josejulio=20Mart=C3=ADnez?= Date: Tue, 21 Mar 2017 13:18:41 -0600 Subject: [PATCH 2/2] Fix haml-lint warnings --- .../_endpoints_angular.html.haml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml index 3156b982442..6903921ee97 100644 --- a/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml +++ b/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml @@ -17,38 +17,38 @@ .col-md-8{"ng-if" => "emsCommonModel.emstype == 'openstack' || emsCommonModel.emstype == 'openstack_infra' || emsCommonModel.emstype == 'vmware_cloud'"} - prefix == "amqp" ? security_protocols = @amqp_security_protocols : security_protocols = @openstack_security_protocols = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + security_protocols, disabled: ["<#{_('Choose')}>", nil]), + options_for_select([["<#{_('Choose')}>", nil]] + security_protocols, :disabled => ["<#{_('Choose')}>", nil]), "ng-model" => "#{ng_model}.#{prefix}_security_protocol", "checkchange" => "", "ng-required" => true, "ng-change" => "openstackSecurityProtocolChanged()", "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status") .col-md-8{"ng-if" => "emsCommonModel.emstype == 'nuage_network'"} = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @nuage_security_protocols, disabled: ["<#{_('Choose')}>", nil]), + options_for_select([["<#{_('Choose')}>", nil]] + @nuage_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" => "") .col-md-8{"ng-if" => "emsCommonModel.emstype == 'scvmm'"} = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @scvmm_security_protocols, disabled: ["<#{_('Choose')}>", nil]), + options_for_select([["<#{_('Choose')}>", nil]] + @scvmm_security_protocols, :disabled => ["<#{_('Choose')}>", nil]), "ng-model" => "#{ng_model}.#{prefix}_security_protocol", "checkchange" => "", "required" => "", "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status") .col-md-8{"ng-if" => "emsCommonModel.ems_controller == 'ems_container'"} = select_tag("#{prefix}_security_protocol", - options_for_select([["<#{_('Choose')}>", nil]] + @container_security_protocols, disabled: ["<#{_('Choose')}>", nil]), + options_for_select([["<#{_('Choose')}>", nil]] + @container_security_protocols, :disabled => ["<#{_('Choose')}>", nil]), "ng-model" => "#{ng_model}.#{prefix}_security_protocol", "checkchange" => "", "required" => "", "selectpicker-for-select-tag" => "", - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status") .col-md-8{"ng-if" => "emsCommonModel.emstype == 'hawkular'"} = select_tag("#{prefix}_security_protocol", @@ -70,12 +70,12 @@ "id" => "#{prefix}_hostname", "name" => "#{prefix}_hostname", "ng-model" => "#{ng_model}.#{prefix}_hostname", - "maxlength" => "#{MAX_NAME_LEN}", - "ng-required" => "#{ng_reqd_hostname}", + "maxlength" => MAX_NAME_LEN.to_s, + "ng-required" => ng_reqd_hostname.to_s, "ng-trim" => false, "detect-spaces" => "", "checkchange" => "", - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status"} %span.help-block{"ng-show" => "angularForm.#{prefix}_hostname.$error.required"} = _("Required") @@ -101,11 +101,11 @@ "name" => "#{prefix}_api_port", "ng-model" => "#{ng_model}.#{prefix}_api_port", "maxlength" => 15, - "ng-required" => "#{ng_reqd_api_port}", + "ng-required" => ng_reqd_api_port.to_s, "checkchange" => "", "ng-trim" => false, "detect-spaces" => "", - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-depends-on" => %w(hawkular metrics).include?(prefix) ? "#{prefix}_hostname" : "", "reset-validation-status" => "#{prefix}_auth_status", "pattern" => "^[1-9]\\d*$"} @@ -151,7 +151,7 @@ "ng-true-value" => "true", "ng-false-value" => "false", "ng-model" => "#{ng_model}.#{prefix}_tls_verify", - "prefix" => "#{prefix}"} + "prefix" => prefix.to_s} %div{"ng-if" => defined?(tls_ca_certs_hide) ? false : true} .form-group{"ng-if"=> "emsCommonModel.emstype == 'rhevm' || " + | @@ -168,7 +168,7 @@ "ng-disabled" => "emsCommonModel.emstype == 'rhevm' && !#{ng_model}.#{prefix}_tls_verify", "ng-required" => false, "ng-trim" => false, - "prefix" => "#{prefix}", + "prefix" => prefix.to_s, "reset-validation-status" => "#{prefix}_auth_status"} %span.help-block = _("Paste here the trusted CA certificates, in PEM format.") @@ -182,7 +182,7 @@ "id" => "realm", "name" => "realm", "ng-model" => "emsCommonModel.realm", - "maxlength" => "#{MAX_NAME_LEN}", + "maxlength" => MAX_NAME_LEN.to_s, "required" => "", "checkchange" => "", "auto-focus" => "",