ux: show sync interval on each integration card
Display "Syncs every Xmin" (or "Xh") alongside the next sync countdown so users can see the cadence at a glance without opening the configure panel.
This commit is contained in:
parent
da5cd4054b
commit
2beadb0dc7
2 changed files with 25 additions and 10 deletions
|
|
@ -364,6 +364,19 @@ defmodule ToweropsWeb.Org.IntegrationsLive do
|
|||
max(0, div(diff, 60))
|
||||
end
|
||||
|
||||
defp humanize_interval(minutes) when minutes >= 60 do
|
||||
hours = div(minutes, 60)
|
||||
rem_min = rem(minutes, 60)
|
||||
|
||||
if rem_min == 0 do
|
||||
"#{hours}h"
|
||||
else
|
||||
"#{hours}h #{rem_min}min"
|
||||
end
|
||||
end
|
||||
|
||||
defp humanize_interval(minutes), do: "#{minutes}min"
|
||||
|
||||
defp normalize_params(provider, params, existing_integration) do
|
||||
sync_interval = Map.get(params, "sync_interval_minutes")
|
||||
|
||||
|
|
|
|||
|
|
@ -102,14 +102,15 @@
|
|||
</span>
|
||||
<% end %>
|
||||
|
||||
<%= if integration.last_synced_at do %>
|
||||
<span class="text-xs text-gray-400 dark:text-gray-500">
|
||||
· Next sync in ~{next_sync_minutes(
|
||||
<span class="text-xs text-gray-400 dark:text-gray-500">
|
||||
· Syncs every {humanize_interval(integration.sync_interval_minutes)}
|
||||
<%= if integration.last_synced_at do %>
|
||||
· Next in ~{next_sync_minutes(
|
||||
integration.last_synced_at,
|
||||
integration.sync_interval_minutes
|
||||
)}m
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
<%= if active_billing.id == "gaiia" do %>
|
||||
<.link
|
||||
|
|
@ -554,14 +555,15 @@
|
|||
</span>
|
||||
<% end %>
|
||||
|
||||
<%= if integration.last_synced_at do %>
|
||||
<span class="text-xs text-gray-400 dark:text-gray-500">
|
||||
· Next sync in ~{next_sync_minutes(
|
||||
<span class="text-xs text-gray-400 dark:text-gray-500">
|
||||
· Syncs every {humanize_interval(integration.sync_interval_minutes)}
|
||||
<%= if integration.last_synced_at do %>
|
||||
· Next in ~{next_sync_minutes(
|
||||
integration.last_synced_at,
|
||||
integration.sync_interval_minutes
|
||||
)}m
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
<%= if provider.id == "preseem" do %>
|
||||
<.link
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue