18F/identity-dashboard

View on GitHub
app/views/env/index.html.erb

Summary

Maintainability
Test Coverage
<h1 class="usa-display">Environments status</h1>
<% @deploy_statuses.each do |environment| %>

  <h2>
  <% case environment.env
     when 'prod' %>
       Production
  <% when 'staging' %>
       Staging
  <% when 'int' %>
       Agency integration
  <% when 'dev' %>
       Development
  <% when 'dm' %>
       Data Migration
  <% end %>
  </h2>

  <% environment.statuses.each do |status| %>
    <div>
      <% if status.status_class == 'deploy-success' %>

        <%= image_tag 'alerts/success.svg', alt: 'success', height: '16', width: '16', :class =>'margin-bottom-neg-05', role: 'img' %>

      <% elsif status.status_class == 'deploy-error' %>

        <%= image_tag 'alerts/error.svg', alt: 'error', height: '16', width: '16', :class =>'margin-bottom-neg-05', role: 'img' %>

      <% elsif status.status_class == 'disabled' %>

       <%= image_tag 'alerts/warning.svg', alt: 'disabled', height: '16', width: '16',  :class =>'margin-bottom-neg-05', role: img %>
      <% end %>

      <% if status.host %>
        <%= link_to status.short_name, status.host %> —
      <% else %>
        <%= status.short_name %> —
      <% end %>

      <% if status.error %>
        <%= status.error %>
      <% else %>
        <%= status.branch %> @ <%= link_to status.short_sha, status.commit_url %> —
        <%= t 'home.deployed_by_html',
            time: time_ago_in_words(status.timestamp),
            href: link_to(t('links.pending_changes'), status.pending_url) %>
      <% end %>
    </div>
  <% end %>

<% end %>