ManageIQ/manageiq-ui-classic

View on GitHub
app/views/ops/_settings_server_tab.html.haml

Summary

Maintainability
Test Coverage
- if @sb[:active_tab] == "settings_server"
  - url = url_for_only_path(:action => 'settings_form_field_changed', :id => @sb[:active_tab].split('_').last)
  %h3
    = _("Basic Information")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Hostname")
      .col-md-8
        %p.form-control-static
          = @selected_server.hostname
    .form-group
      %label.col-md-2.control-label
        = _("IP Address")
      .col-md-8
        %p.form-control-static
          = @selected_server.ipaddress
    .form-group
      %label.col-md-2.control-label
        = _("Resides on VM")
      .col-md-8
        - vm = @selected_server.vm
        - if vm
          %i.fa.fa-desktop.pointer{:onclick => "DoNav('/vm/show/#{vm.id}')",
                                      :title   => _("Click to view this VM")}
          = h(vm.name)
        - else
          %i.fa.fa-desktop
          = _("Not Available")
    .form-group
      %label.col-md-2.control-label
        = _("Company Name")
      .col-md-8
        = text_field_tag("server_company",
                          @edit[:new][:server][:company],
                          :maxlength => 20,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Appliance Name")
      .col-md-8
        = text_field_tag("server_name",
                          @edit[:new][:server][:name],
                          :maxlength => 20,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Zone*")
      .col-md-8
        - if !MiqServer.zone_is_modifiable?
          = text_field_tag("server_zone",
                            @edit[:new][:server][:zone],
                            :maxlength => 15,
                            :disabled => true,
                            :class => "form-control",
                            :title => server_zone_title_text,
                            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
        - else
          = select_tag('server_zone',
                        options_for_select(server_zones.sort, @edit[:new][:server][:zone]),
                        :class    => "selectpicker")
    :javascript
      miqInitSelectPicker();
      miqSelectPickerEvent('server_zone', "#{url}")

    .form-group
      %label.col-md-2.control-label
        = _("Appliance Time Zone")
      .col-md-8
        = select_tag('server_timezone',
                      options_for_select(ViewHelper::ALL_TIMEZONES, @edit[:new][:server][:timezone]),
                      "data-live-search" => "true",
                      "data-container"   => "body",
                      :class             => "selectpicker")
    :javascript
      miqSelectPickerEvent('server_timezone', "#{url}")

    .form-group
      %label.col-md-2.control-label
        = _("Default Locale")
      .col-md-8
        = select_tag('locale',
                      options_for_select([[_('Client Browser Setting'), 'default']] + FastGettext.human_available_locales,
                                         @edit[:new][:server][:locale]),
                      :class    => "selectpicker")
    :javascript
      miqSelectPickerEvent('locale', "#{url}")

  .note
    = _("* Changing the Zone will reset all of this Server's priorities to secondary.")
  %hr
  %h3
    = _("Server Control")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Server Roles")
      .col-md-8
        - session[:server_roles].sort_by { |_name, desc| desc }.each do |name, desc|
          - checked = !session[:selected_roles].nil? && session[:selected_roles].include?(name)
          = check_box_tag("server_roles_#{name}", "1", checked,
                           :data => {:on_text => _('On'), :off_text => _('Off'), :size => 'mini'})
          :javascript
            miqInitBootstrapSwitch("server_roles_#{name}", "#{url}")
          = h(desc)
          %br/
    .form-group
      %label.col-md-2.control-label
        = _("Default Repository SmartProxy")
      .col-md-8{:style => "width: 350px"}
        - if @smartproxy_choices.blank?
          = _("None Available")
        - else
          = select_tag('repository_scanning_defaultsmartproxy',
                      options_for_select(@smartproxy_choices.sort, @edit[:new][:repository_scanning][:defaultsmartproxy].to_i),
                      :include_blank => true,
                      :class    => "selectpicker")
      :javascript
        miqSelectPickerEvent('repository_scanning_defaultsmartproxy', "#{url}")
  %hr
  %h3
    = _("Outgoing SMTP E-mail Server")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Host")
      .col-md-8
        = text_field_tag("smtp_host",
                          @edit[:new][:smtp][:host],
                          :maxlength => 255,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Port")
      .col-md-8{:colspan => "2"}
        = text_field_tag("smtp_port",
                          @edit[:new][:smtp][:port],
                          :maxlength => 6,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Domain")
      .col-md-8
        = text_field_tag("smtp_domain",
                          @edit[:new][:smtp][:domain],
                          :maxlength => 255,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Start TLS Automatically")
      .col-md-8
        = check_box_tag("smtp_enable_starttls_auto",
                        GenericMailer.default_for_enable_starttls_auto,
                        @edit[:new][:smtp][:enable_starttls_auto], :data => {:on_text => _('Yes'), :off_text => _('No')})
      :javascript
        miqInitBootstrapSwitch('smtp_enable_starttls_auto', "#{url}")

    .form-group
      %label.col-md-2.control-label
        = _("SSL Verify Mode")
      .col-md-8
        = select_tag('smtp_openssl_verify_mode',
                      options_for_select(GenericMailer.openssl_verify_modes, @edit[:new][:smtp][:openssl_verify_mode]),
                      :class    => "selectpicker")
      :javascript
        miqSelectPickerEvent('smtp_openssl_verify_mode', "#{url}")
    .form-group
      %label.col-md-2.control-label
        = _("Authentication")
      .col-md-8
        = select_tag('smtp_authentication',
                      options_for_select(GenericMailer.authentication_modes, @edit[:new][:smtp][:authentication]),
                      :class    => "selectpicker")
      :javascript
        miqSelectPickerEvent('smtp_authentication', "#{url}")
    - chk = @edit[:new][:smtp][:authentication] == "none"
    .form-group
      %label.col-md-2.control-label
        = _("User Name")
      .col-md-8
        = text_field_tag("smtp_user_name",
                          @edit[:new][:smtp][:user_name],
                          :maxlength => ViewHelper::MAX_NAME_LEN,
                          :disabled => chk,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Password")
      .col-md-8
        = password_field_tag("smtp_password", '',
                              :maxlength         => ViewHelper::MAX_NAME_LEN,
                              :placeholder       => placeholder_if_present(@edit[:new][:smtp][:password]),
                              :disabled          => chk,
                              :class => "form-control",
                              "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("From E-mail Address")
      .col-md-8
        = text_field_tag("smtp_from",
                          @edit[:new][:smtp][:from],
                          :maxlength => ViewHelper::MAX_DESC_LEN,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Test E-mail Address")
      .col-md-8
        .input-group
          = text_field_tag("smtp_test_to",
                            @sb[:new_to],
                            :maxlength => ViewHelper::MAX_DESC_LEN,
                            :class => "form-control",
                            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
          %span.input-group-btn
            = render :partial => 'email_verify_button', :locals => {:id => "#{@sb[:active_tab].split('_').last}"}
  %hr
  %h3
    = _("Web Services")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Mode")
      .col-md-8
        = select_tag('webservices_mode',
                      options_for_select([[_("invoke"), "invoke"], [_("disable"), "disable"]], @edit[:new][:webservices][:mode]),
                      :class    => "selectpicker")
    :javascript
      miqSelectPickerEvent('webservices_mode', "#{url}")
    .form-group
      %label.col-md-2.control-label
        = _("Security")
      .col-md-8
        = select_tag('webservices_security',
                      options_for_select([[_("none"), "none"], [_("ws-security"), "ws-security"]], @edit[:new][:webservices][:security]),
                      :class    => "selectpicker")
    :javascript
      miqSelectPickerEvent('webservices_security', "#{url}")
  %hr
  %h3
    = _("Logging")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Log Level")
      .col-md-8
        = select_tag('log_level',
                      options_for_select([[_("fatal"), "fatal"], [_("error"), "error"], [_("warn"), "warn"], [_("info"), "info"], [_("debug"), "debug"]], @edit[:new][:log][:level]),
                      :class    => "selectpicker")
    :javascript
      miqSelectPickerEvent('log_level', "#{url}")
  %hr
  %h3
    = _("Custom Support URL")
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("URL (i.e. www.mypage.com)")
      .col-md-8
        = text_field_tag("custom_support_url",
                          @edit[:new][:server][:custom_support_url],
                          :maxlength => ViewHelper::MAX_NAME_LEN,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
    .form-group
      %label.col-md-2.control-label
        = _("Description")
      .col-md-8
        = text_field_tag("custom_support_url_description",
                          @edit[:new][:server][:custom_support_url_description],
                          :maxlength => ViewHelper::MAX_DESC_LEN,
                          :class => "form-control",
                          "data-miq_observe" => {:interval => '.5', :url => url}.to_json)