ManageIQ/manageiq-ui-classic

View on GitHub
app/views/miq_request/_request.html.haml

Summary

Maintainability
Test Coverage
- if @edit && @edit[:stamp_typ]
  - url = url_for_only_path(:action => 'stamp_field_changed', :id => @edit[:request].id)
  #request_div
    %h3
      = _("Request Details")

    .form-horizontal
      .form-group
        %label.control-label.col-md-2
          = _("Request ID")
        .col-md-8
          = h(@miq_request.id)
      .form-group
        %label.control-label.col-md-2
          = _("Status")
        .col-md-8
          = h(_(@miq_request.status))
      .form-group
        %label.control-label.col-md-2
          = _("Request State")
        .col-md-8
          = h(_(@miq_request.state.titleize))
      - if @miq_request.requester
        .form-group
          %label.control-label.col-md-2
            = _("Requester")
          .col-md-8
            = h(@miq_request.requester_name)
      .form-group
        %label.control-label.col-md-2
          = _("Request Type")
        .col-md-8
          = h(_(@miq_request.request_type_display))
      .form-group
        %label.control-label.col-md-2
          = _("Description")
        .col-md-8
          = h(@miq_request.description)
      .form-group
        %label.control-label.col-md-2
          = _("Last Message")
        .col-md-8
          = h(@miq_request.message)
      .form-group
        %label.control-label.col-md-2
          = _("Created On")
        .col-md-8
          = h(format_timezone(@miq_request.created_on))
      .form-group
        %label.control-label.col-md-2
          = _("Last Update")
        .col-md-8
          = h(format_timezone(@miq_request.updated_on))
      - if @miq_request.parent_id
        .form-group
          %label.control-label.col-md-2
            = _("Parent Request")
          .col-md-8
            = h(link_to(@miq_request.parent_id, :controller => "miq_request", :action => "show", :id => @miq_request.parent_id))
      - if @miq_request.fulfilled_on
        .form-group
          %label.control-label.col-md-2
            = _("Completed")
          .col-md-8
            = h(format_timezone(@miq_request.fulfilled_on))
      .form-group
        %label.control-label.col-md-2
          = _("Approval State")
        .col-md-8
          = h(_(@miq_request.approval_state.titleize))
      - if @miq_request.stamped_by
        .form-group
          %label.control-label.col-md-2
            = _("Approved/Denied by")
          .col-md-8
            = h(@miq_request.stamped_by + (@user && " (#{@user.name})"))
      .form-group
        %label.control-label.col-md-2
          = _("Approved/Denied on")
        .col-md-8
          = h(format_timezone(@miq_request.stamped_on))
      .form-group
        %label.control-label.col-md-2
          = _("Reason")
        .col-md-8
          = text_field_tag("reason", _(@edit[:reason]),
            :class             => "form-control",
            :maxlength         => ViewHelper::MAX_NAME_LEN,
            "data-miq_focus"   => true,
            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
          = h(_(@miq_request.reason))
    %table{:width => "100%"}
      %tr
        %td{:align => 'left'}
          %b
            - if @edit[:stamp_typ] == "approve"
              = _("* Enter a reason for this approval and press Submit")
            - else
              = _("* Enter a reason for this denial and press Submit")
        %td{:align => 'right'}
          %span#buttons_on{:style => 'display:none'}
            = link_to(t = _('Submit'),
                {:action  => 'stamp', :button  => "submit", :disabled => true},
                :class                 => "btn btn-primary",
                :alt                   => t,
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                :remote                => true,
                "data-method"          => :post,
                :title                 => t)
          %span#buttons_off
            = button_tag(t, :class => "btn btn-primary disabled")
- else
  = request_details_summary(@miq_request, @user)
- if role_allows?(:feature => 'miq_request_show_logs') && @miq_request.request_logs.any?
  %h3
    = _("Request Logs")
    = react('RequestsTable', {:initialData => @miq_request.request_logs})
  %br
- if @miq_request.workflow_class
  = render :partial => "prov_wf", :locals => {:wf => @miq_request.workflow_class.new({:src_vm_id => @miq_request.source_id}, current_user), :show => true}
- elsif @miq_request.type == 'ServiceTemplateProvisionRequest'
  = render :partial => "st_prov_show"
- elsif @miq_request.type == 'ServiceReconfigureRequest'
  = render :partial => "service_reconfigure_show"
- elsif @miq_request.type == "ServiceRetireRequest"
  = render :partial => "service_retire_show"
- elsif @miq_request.type == "AutomationRequest"
  = render :partial => "ae_prov_show"
- elsif %w[PhysicalServerProvisionRequest PhysicalServerFirmwareUpdateRequest].include?(@miq_request.type)
  = render :partial => "physical_server_provision_show"
- elsif @miq_request.type == "PhysicalServerFirmwareUpdateRequest"
  = render :partial => "physical_server_firmware_update_show"
- else
  = render :partial => "reconfigure_show"