Fix mobile Gaiia entity mapping + redirect / to /dashboard
- Entity mapping table: hide Gaiia ID and Linked columns on mobile, show Gaiia ID inline under name on small screens - Allow text wrapping in name column for long names - Add overflow-x-auto to table container for safety - Redirect authenticated users from / to /dashboard instead of /orgs
This commit is contained in:
parent
6be3910fc4
commit
635d89d774
3 changed files with 13 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ defmodule ToweropsWeb.PageController do
|
|||
def home(conn, _params) do
|
||||
# If user is authenticated, redirect to organization list
|
||||
if conn.assigns.current_scope && conn.assigns.current_scope.user do
|
||||
redirect(conn, to: ~p"/orgs")
|
||||
redirect(conn, to: ~p"/dashboard")
|
||||
else
|
||||
render(conn, :home, layout: false)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="overflow-hidden rounded-lg border border-gray-200 dark:border-white/10">
|
||||
<div class="overflow-x-auto rounded-lg border border-gray-200 dark:border-white/10">
|
||||
<table class="min-w-full divide-y divide-gray-200 dark:divide-white/10">
|
||||
<thead class="bg-gray-50 dark:bg-white/5">
|
||||
<tr>
|
||||
|
|
@ -141,7 +141,7 @@
|
|||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400"
|
||||
class="hidden px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400 sm:table-cell"
|
||||
>
|
||||
{t("Gaiia ID")}
|
||||
</th>
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
<% end %>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400"
|
||||
class="hidden px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400 md:table-cell"
|
||||
>
|
||||
{if @tab == "sites", do: "Linked Site", else: "Linked Device"}
|
||||
</th>
|
||||
|
|
@ -170,17 +170,20 @@
|
|||
<tbody class="divide-y divide-gray-200 bg-white dark:divide-white/5 dark:bg-transparent">
|
||||
<%= for item <- @items do %>
|
||||
<tr id={"row-#{item.id}"} class="hover:bg-gray-50 dark:hover:bg-white/5">
|
||||
<td class="whitespace-nowrap px-4 py-4 text-sm font-medium text-gray-900 dark:text-white">
|
||||
<div class="flex items-center gap-2">
|
||||
{item.name || "Unnamed"}
|
||||
<td class="px-4 py-4 text-sm font-medium text-gray-900 dark:text-white">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="break-all">{item.name || "Unnamed"}</span>
|
||||
<%= if Map.has_key?(@suggestions, item.gaiia_id) do %>
|
||||
<span class="inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-900/30 dark:text-amber-400">
|
||||
<.icon name="hero-light-bulb-mini" class="mr-0.5 h-3 w-3" /> Suggestion
|
||||
</span>
|
||||
<% end %>
|
||||
<span class="block text-xs text-gray-400 dark:text-gray-500 sm:hidden">
|
||||
{item.gaiia_id}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
<td class="hidden whitespace-nowrap px-4 py-4 text-sm text-gray-500 dark:text-gray-400 sm:table-cell">
|
||||
{item.gaiia_id}
|
||||
</td>
|
||||
<%= if @tab == "devices" do %>
|
||||
|
|
@ -188,7 +191,7 @@
|
|||
{item.ip_address || "-"}
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="whitespace-nowrap px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
<td class="hidden whitespace-nowrap px-4 py-4 text-sm text-gray-500 dark:text-gray-400 md:table-cell">
|
||||
<%= if @tab == "sites" and item.site do %>
|
||||
<span class="font-medium text-gray-900 dark:text-white">
|
||||
{item.site.name}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ defmodule ToweropsWeb.PageControllerTest do
|
|||
conn = log_in_user(conn, user)
|
||||
|
||||
conn = get(conn, ~p"/")
|
||||
assert redirected_to(conn) == ~p"/orgs"
|
||||
assert redirected_to(conn) == ~p"/dashboard"
|
||||
end
|
||||
|
||||
test "GET /privacy renders privacy policy page", %{conn: conn} do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue