mirror of
https://github.com/we-promise/sure.git
synced 2026-05-27 22:44:55 +00:00
revert(settings/providers): drop the slim health strip
Per-row status pills already carry the at-a-glance signal (connected / action needed) at the scale this app sees (1–4 connections per family). The strip was redundant chrome for almost every user; only worth bringing back if the catalog grows to a point where the row list itself stops fitting on a single screen. - Delete _health_strip.html.erb partial. - Drop @health controller assignment + provider_health_strip helper. - Drop unused settings.providers.health_strip.* locale keys. - concise_time_ago helper stays — still used by per-row meta text.
This commit is contained in:
committed by
Guillem Arias
parent
8a2f16a621
commit
41cd6418dd
@@ -261,8 +261,6 @@ class Settings::ProvidersController < ApplicationController
|
||||
@connected = entries.select { |e| e[:summary][:status] == :ok }
|
||||
@needs_attention = entries.select { |e| [ :warn, :err ].include?(e[:summary][:status]) }
|
||||
@available = entries.select { |e| e[:summary][:status] == :off }
|
||||
|
||||
@health = view_context.provider_health_strip(connected: @connected, needs_attention: @needs_attention)
|
||||
end
|
||||
|
||||
# Returns a hash mapping provider key → { error:, last_synced_at:, stale: }
|
||||
|
||||
@@ -128,23 +128,6 @@ module SettingsHelper
|
||||
end
|
||||
end
|
||||
|
||||
# Slim health-strip data for the providers index. Pulls counts from the
|
||||
# already-resolved entry summaries plus the family's distinct synced-account
|
||||
# count for the trailing stat. Returns a hash consumed by the
|
||||
# `settings/providers/_health_strip` partial.
|
||||
def provider_health_strip(connected:, needs_attention:)
|
||||
active_entries = connected + needs_attention
|
||||
last_synced_at = active_entries.map { |e| e[:summary][:last_synced_at] }.compact.max
|
||||
accounts_count = Current.family.accounts.joins(:account_providers).distinct.count
|
||||
|
||||
{
|
||||
connected: active_entries.size,
|
||||
needs_attention: needs_attention.size,
|
||||
accounts_syncing: accounts_count,
|
||||
last_synced_at: last_synced_at
|
||||
}
|
||||
end
|
||||
|
||||
# Strips the leading "about " from `time_ago_in_words` so copy reads as
|
||||
# "Synced 6 hours ago" instead of "Synced about 6 hours ago".
|
||||
def concise_time_ago(time)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<%# locals: (connected:, needs_attention:, accounts_syncing:, last_synced_at:) %>
|
||||
<div class="bg-container shadow-border-xs rounded-xl flex items-center gap-5 px-3.5 py-2.5 text-sm mt-4 mb-5">
|
||||
<span class="inline-flex items-center gap-2">
|
||||
<%= icon "check", size: "sm", class: "!w-3.5 !h-3.5 text-success" %>
|
||||
<span class="font-medium tabular-nums"><%= connected %></span>
|
||||
<span class="text-secondary"><%= t("settings.providers.health_strip.connected") %></span>
|
||||
</span>
|
||||
<% if needs_attention.positive? %>
|
||||
<span class="w-px h-3.5 bg-alpha-black-100"></span>
|
||||
<span class="inline-flex items-center gap-2">
|
||||
<%= icon "circle-alert", size: "sm", class: "!w-3.5 !h-3.5 text-warning" %>
|
||||
<span class="font-medium tabular-nums"><%= needs_attention %></span>
|
||||
<span class="text-secondary"><%= t("settings.providers.health_strip.needs_attention") %></span>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if accounts_syncing.positive? %>
|
||||
<span class="w-px h-3.5 bg-alpha-black-100"></span>
|
||||
<span class="inline-flex items-center gap-2 text-secondary">
|
||||
<span class="font-medium tabular-nums"><%= accounts_syncing %></span>
|
||||
<span><%= t("settings.providers.health_strip.accounts_syncing") %></span>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if last_synced_at %>
|
||||
<span class="ml-auto text-xs text-subdued">
|
||||
<%= t("settings.providers.health_strip.last_synced", time: concise_time_ago(last_synced_at)) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -32,12 +32,6 @@
|
||||
<% all_connections = @needs_attention + @connected %>
|
||||
|
||||
<% if all_connections.any? %>
|
||||
<%= render "settings/providers/health_strip",
|
||||
connected: @health[:connected],
|
||||
needs_attention: @health[:needs_attention],
|
||||
accounts_syncing: @health[:accounts_syncing],
|
||||
last_synced_at: @health[:last_synced_at] %>
|
||||
|
||||
<%= render "settings/providers/group_heading",
|
||||
title: t("settings.providers.groups.your_connections"),
|
||||
count: all_connections.size %>
|
||||
|
||||
@@ -204,11 +204,6 @@ en:
|
||||
your_connections: Your connections
|
||||
available: Available
|
||||
empty_available: All available providers are connected.
|
||||
health_strip:
|
||||
connected: connected
|
||||
needs_attention: needs attention
|
||||
accounts_syncing: accounts syncing
|
||||
last_synced: Last synced %{time} ago
|
||||
meta:
|
||||
sync_error: Sync error
|
||||
no_recent_sync: Sync overdue
|
||||
|
||||
Reference in New Issue
Block a user