dice-cyfronet/atmosphere

View on GitHub
app/views/atmosphere/admin/appliance_types/_appliances.html.haml

Summary

Maintainability
Test Coverage
%p.description
  Currently started appliances from this appliance type

%table.table.table-hover
  %thead
    %tr
      %th Author
      %th Appliance Set Type
      %th Configuration
      %th State
      %th Billing state
  %tbody

    - @appliance_type.appliances.each do |appliance|
      %tr
        %td= appliance.appliance_set.user.login
        %td= appliance.appliance_set.appliance_set_type
        %td= (appliance.appliance_configuration_instance.payload if appliance.appliance_configuration_instance)

        - label_map = {new: :primary, satisfied: :success, unsatisfied: :danger}
        %td
          %span(class="label label-#{label_map[appliance.state.to_sym]}")
            = appliance.state

        - label_map = {initial: :primary, prepaid: :success, expired: :danger, error: :danger}
        %td
          %span(class="label label-#{label_map[appliance.billing_state.to_sym]}")
            = appliance.billing_state

    - unless @appliance_type.appliances.present?
      %tr
        %td(colspan='5')
          .alert.alert-warning No Appliances of this Appliance Type.