theforeman/puppetdb_foreman

View on GitHub
app/views/puppetdb_foreman/nodes/index.html.erb

Summary

Maintainability
Test Coverage
<% title _('PuppetDB Nodes') %>

<div class="col-md-12">
  <div class="row">
    <div class="container-fluid container-cards-pf">
      <div class="row row-cards-pf">
        <div class="col-xs-6 col-sm-4 col-md-4">
          <div class="card-pf card-pf-accented card-pf-aggregate-status">
            <h2 class="card-pf-title">
              <span class="fa fa-database"></span><span class="card-pf-aggregate-status-count"><%= @puppetdb_hosts.count %></span> <%= _('Hosts in PuppetDB') %>
            </h2>
            <div class="card-pf-body">
              <p class="card-pf-aggregate-status-notifications">
              <span class="card-pf-aggregate-status-notification"><span class="pficon pficon-ok"></span></span>
              </p>
            </div>
          </div>
        </div>
        <div class="col-xs-6 col-sm-4 col-md-4">
          <div class="card-pf card-pf-accented card-pf-aggregate-status">
            <h2 class="card-pf-title">
              <span class="pficon pficon-server"></span><span class="card-pf-aggregate-status-count"><%= @foreman_hosts.count %></span> <%= _('Hosts in Foreman') %>
            </h2>
            <div class="card-pf-body">
              <p class="card-pf-aggregate-status-notifications">
              <span class="card-pf-aggregate-status-notification"><span class="pficon pficon-ok"></span></span>
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-7">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><%= _('PuppetDB Nodes without Host in Foreman') %></h3>
          </div>
          <div class="panel-body">
            <table class="<%= table_css_classes 'table-fixed' %>">
              <% if @unknown_hosts.any? %>
                <thead>
                  <tr>
                    <th class="col-md-5"><%= _('Name') %></th>
                    <th class="col-md-2"><%= _('Actions') %></th>
                  </tr>
                </thead>
                <tbody>
                  <% @unknown_hosts.each do |node| %>
                    <tr>
                      <td class="ellipsis"><%= node %></td>
                      <td>
                        <%= action_buttons(
                          (display_link_if_authorized(_("Puppet Classes"), hash_for_puppetdb_foreman_node_path(:id => node), :method => :get)),
                          (display_link_if_authorized(_("Import"), hash_for_import_puppetdb_foreman_node_path(:id => node), :method => :put)),
                          (display_delete_if_authorized(hash_for_puppetdb_foreman_node_path(:id => node), :class => 'delete', :text => _('Deactivate')))
                        ) %>
                    </td>
                    </tr>
                  <% end %>
                </tbody>
              <% else %>
                <tbody>
                  <tr>
                    <td class="blank-slate-pf" style="width: auto;">
                      <div class="blank-slate-pf-icon">
                        <%= icon_text("ok", "", :kind => "pficon") %>
                      </div>
                      <h1><%= _('PuppetDB in Sync') %></h1>
                      <p>
                        <%= _("For every node in PuppetDB a host in Foreman could be found. Both systems are in sync.") %>
                      </p>
                    </td>
                  </tr>
                </tbody>
              <% end %>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>