The personal finance app for everyone (by everyone)
Ruby
<%= content_for :page_title, t(".title") %>
<%= render DS::Tabs.new(
active_tab: @active_tab,
url_param_key: "tab",
testid: "system-health-tabs"
) do |tabs| %>
<% tabs.with_nav do |nav| %>
<% nav.with_btn(id: "background_jobs", label: t(".tabs.background_jobs")) %>
<% nav.with_btn(id: "ai", label: t(".tabs.ai")) %>
<% nav.with_btn(id: "configuration", label: t(".tabs.configuration")) %>
<% if @hosted_usage_available %>
<% nav.with_btn(id: "hosted_usage", label: t(".tabs.hosted_usage")) %>
<% end %>
<% end %>
<% tabs.with_panel(tab_id: "background_jobs") do %>
<%= render "background_jobs", health: @health, push_notification_test: @push_notification_test,
push_disabled_reason: @push_disabled_reason, latest_push_test: @latest_push_test,
push_test_results: @push_test_results %>
<% end %>
<% tabs.with_panel(tab_id: "ai") do %>
<%# Loads when the tab is first shown. The buttons inside navigate the page,
so their flash shows. A redirect back to this URL is a morphing refresh,
and `refresh: :morph` makes it reload the frame instead of morphing the
status back into the placeholder. A `?locale=` override only applies to
the request that carries it, so the src passes a valid one on. %>
<%= turbo_frame_tag "ai_status",
src: ai_status_admin_system_health_path(refresh_ai_health: params[:refresh_ai_health].presence_in(%w[1]), locale: locale_from_param),
loading: :lazy, target: "_top", refresh: :morph do %>
<%= render "entries/loading", message: t(".ai.loading") %>
<% end %>
<% end %>
<% tabs.with_panel(tab_id: "configuration") do %>
<%= render "configuration", health: @configuration_health %>
<% end %>
<% if @hosted_usage_available %>
<% tabs.with_panel(tab_id: "hosted_usage") do %>
<%= turbo_frame_tag "hosted_usage",
src: hosted_usage_admin_system_health_path(locale: locale_from_param),
loading: :lazy, target: "_top", refresh: :morph do %>
<%= render "entries/loading", message: t("admin.system_health.hosted_usage.loading") %>
<% end %>
<% end %>
<% end %>
<% end %>