adjust timestamps to be relative

This commit is contained in:
Graham McIntire 2026-01-25 14:52:13 -06:00
parent 9c5b4096f9
commit 21802eede4
No known key found for this signature in database
4 changed files with 23 additions and 25 deletions

View file

@ -113,7 +113,7 @@
</div>
<%= if agent.last_seen_at do %>
<div class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
{format_datetime(agent.last_seen_at, @timezone)}
<.timestamp datetime={agent.last_seen_at} timezone={@timezone} />
</div>
<% end %>
<%= if agent.last_ip do %>
@ -205,7 +205,7 @@
</div>
<%= if agent.last_seen_at do %>
<div class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
{format_datetime(agent.last_seen_at, @timezone)}
<.timestamp datetime={agent.last_seen_at} timezone={@timezone} />
</div>
<% end %>
<%= if agent.last_ip do %>

View file

@ -72,7 +72,10 @@
</p>
<%= if @agent_token.last_seen_at do %>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
{format_datetime(@agent_token.last_seen_at, @timezone)}
<.timestamp
datetime={@agent_token.last_seen_at}
timezone={@timezone}
/>
</p>
<% end %>
<%= if @agent_token.last_ip do %>
@ -141,19 +144,13 @@
<div>
<dt class="text-sm font-medium text-gray-600 dark:text-gray-400">Created</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-white">
{format_datetime(@agent_token.inserted_at, @timezone)}
</dd>
<dd class="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
<.timestamp datetime={@agent_token.inserted_at} timezone={@timezone} /> (created)
<.timestamp datetime={@agent_token.inserted_at} timezone={@timezone} />
</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-600 dark:text-gray-400">Last Updated</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-white">
{format_datetime(@agent_token.updated_at, @timezone)}
</dd>
<dd class="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
<.timestamp datetime={@agent_token.updated_at} timezone={@timezone} />
</dd>
</div>
@ -163,13 +160,8 @@
Last Seen (Heartbeat)
</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-white">
{format_datetime(@agent_token.last_seen_at, @timezone)}
<.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />
</dd>
<%= if @agent_token.last_seen_at do %>
<dd class="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
<.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />
</dd>
<% end %>
</div>
<%= if @agent_token.last_ip do %>

View file

@ -163,9 +163,11 @@
</h3>
<p class="mt-0.5 text-sm text-gray-700 dark:text-gray-300">{alert.message}</p>
</div>
<span class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap">
{ToweropsWeb.TimeHelpers.format_datetime(alert.triggered_at, @timezone)}
</span>
<.timestamp
datetime={alert.triggered_at}
timezone={@timezone}
class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap"
/>
</div>
<% end %>

View file

@ -143,9 +143,11 @@
</span>
</:col>
<:col :let={eq} label="Last Checked">
<span class="text-sm text-gray-600 dark:text-gray-400">
{ToweropsWeb.TimeHelpers.format_datetime(eq.last_checked_at, @timezone)}
</span>
<.timestamp
datetime={eq.last_checked_at}
timezone={@timezone}
class="text-sm text-gray-600 dark:text-gray-400"
/>
</:col>
</.table>
<% end %>
@ -249,9 +251,11 @@
</:col>
<:col :let={discovered} label="Last Seen">
<span class="text-sm text-gray-600 dark:text-gray-400">
{ToweropsWeb.TimeHelpers.format_datetime(discovered.last_seen, @timezone)}
</span>
<.timestamp
datetime={discovered.last_seen}
timezone={@timezone}
class="text-sm text-gray-600 dark:text-gray-400"
/>
</:col>
<:col :let={discovered} label="Actions">