<div class="row justify-content-md-center">
  <div class="col-md-auto">
    <h1 class="display-3">Published Messages
    </h1>
    <table class="table table-responsive pt-3 table-hover">
      <thead>
        <tr>
          <th>Actions</th>
          <th>Message Type</th>
          <th>UUID</th>
          <th>Correlation ID</th>
          <th>User UUID</th>
          <th>Queue</th>
          <th>Exchange</th>
          <th>Encoded Message</th>
        </tr>
      </thead>
      <tbody>
        <%= for message <- @messages do %>
          <tr>
            <%= if message.message_type != "LearnIpc::Commands::RepublishMessage" do %>
              <td><%= link "republish", to: Routes.published_message_path(@conn, :republish, %{uuid: message.uuid}), method: :post, class: "btn btn-info" %></td>
            <% else %>
              <td> <button type="button" name="button" class="btn btn-info" disabled>republish</button>  </td>
            <% end %>
            <td><%= message.message_type %></td>
            <td><%= message.uuid %></td>
            <td><%= message.correlation_id %></td>
            <td><%= message.user_uuid %></td>
            <td><%= message.queue %></td>
            <td><%= message.exchange %></td>
            <td><%= decode_message_body(message.encoded_message) %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>
