From 2beadb0dc71abb9f97c71f99dfbac3b9a793f154 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 12 Mar 2026 15:02:30 -0500 Subject: [PATCH] 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. --- .../live/org/integrations_live.ex | 13 +++++++++++ .../live/org/integrations_live.html.heex | 22 ++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/towerops_web/live/org/integrations_live.ex b/lib/towerops_web/live/org/integrations_live.ex index 71b754e3..382585f9 100644 --- a/lib/towerops_web/live/org/integrations_live.ex +++ b/lib/towerops_web/live/org/integrations_live.ex @@ -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") diff --git a/lib/towerops_web/live/org/integrations_live.html.heex b/lib/towerops_web/live/org/integrations_live.html.heex index 5acfa4c1..e975ba49 100644 --- a/lib/towerops_web/live/org/integrations_live.html.heex +++ b/lib/towerops_web/live/org/integrations_live.html.heex @@ -102,14 +102,15 @@ <% end %> - <%= if integration.last_synced_at do %> - - · Next sync in ~{next_sync_minutes( + + · 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 - - <% end %> + <% end %> + <%= if active_billing.id == "gaiia" do %> <.link @@ -554,14 +555,15 @@ <% end %> - <%= if integration.last_synced_at do %> - - · Next sync in ~{next_sync_minutes( + + · 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 - - <% end %> + <% end %> + <%= if provider.id == "preseem" do %> <.link