theforeman/foreman-docker

View on GitHub
app/views/containers/_list.html.erb

Summary

Maintainability
Test Coverage
<table class="table table-bordered table-striped table-condensed" data-table="inline">
  <thead>
  <tr>
    <th class="text-center"><%= _("Name") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Status") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Image") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Command") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Uptime") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Running on") %></th>
    <th class="hidden-tablet hidden-xs text-center"><%= _("Managed") %></th>
    <th class="col-md-1 text-center"><%= _('Action') %></th>
  </tr>
  </thead>

  <tbody>
  <% containers.each do |container| %>
    <tr>
      <td class="ellipsis text-center" id="<%= container.name[1..-1] %>"><%= link_to_container(container, resource) %></td>
      <td class="hidden-tablet hidden-xs text-center">
        <span <%= vm_power_class(container.ready?) %>><%= vm_state(container) %></span></td>
      <td class="hidden-tablet hidden-xs text-center"><%= trunc_with_tooltip(container.image_friendly_name) %></td>
      <td class="hidden-tablet hidden-xs text-center"><%= trunc_with_tooltip(container.command) %></td>
      <td class="hidden-tablet hidden-xs text-center">
        <span class="glyphicon glyphicon-time"></span> <%= container.ready? ? time_ago_in_words(container.started_at) : "N/A" %>
      </td>
      <td class="hidden-tablet hidden-xs text-center"><%= link_to resource, compute_resource_path(resource) %> </td>
      <td class="hidden-tablet hidden-xs text-center"><%= managed?(container, resource) ? _('Yes') : _('No') %></td>
      <% @compute_resource = resource %>
      <td class="text-center">
        <%= action_buttons(container_power_action(container),
                           display_delete_if_authorized(hash_for_container_path(
                             :compute_resource_id => resource,
                             :id => container.id).
                             merge(:auth_object => resource, :auth_action => 'destroy',
                                   :authorizer => authorizer),
                                   :confirm => _("Delete %s?") % container.name)) %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>