1.3 KiB · text History 9c0fc16
<div class="overflow-x-auto">
  <div class="my-2 flex flex-wrap items-center gap-2">
    <.link patch={~p"/cfg/devices"} class="btn btn-ghost normal-case">
      <i class="fa-solid fa-chevron-left"></i> All devices
    </.link>
    <button class="btn btn-primary normal-case" phx-click="refresh">
      <i class="fa-solid fa-arrows-rotate"></i> Re-probe
    </button>
    <span class="text-sm opacity-60">
      Firmware versions as reported by the 7777-flex discovery endpoint. The sweep
      picks up a change on its own every few minutes; this asks right now.
    </span>
  </div>
  <table class="table table-zebra w-full">
    <thead>
      <tr>
        <th>MAC</th>
        <th>IP</th>
        <th>Version</th>
      </tr>
    </thead>
    <tbody>
      <%= if Enum.empty?(versioned(@devices)) do %>
        <tr>
          <th colspan="3">No 7777-flex devices detected, yet.</th>
        </tr>
      <% end %>
      <%= for {k,v} <- versioned(@devices) do %>
        <tr>
          <th><%= k %></th>
          <td><%= v |> pip %></td>
          <td>
            <%= if v["ver"] do %>
              <span class="badge badge-secondary"><%= v["ver"] %></span>
            <% else %>
              <span class="badge opacity-60">unknown</span>
            <% end %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>