refactor(quota): canonical <entity>_<action> taxonomy for quota events

The quota-attribution action keys were inconsistent (mixed verbs, ad-hoc names,
English-only labels). Introduce a QuotaAction constants holder (one source of
truth), rename every attribution call site to it, and add migration 0020 to
rename historical quota_events.action values. The display label now resolves
from i18n (quotaActions.<key>, EN/HU/DE) instead of a hard-coded English map.
Scheduler job ids and progress phase labels are a separate namespace and are
left untouched.
This commit is contained in:
npeter83 2026-06-19 11:48:11 +02:00
parent 1ce035ca9e
commit b23f805533
12 changed files with 151 additions and 33 deletions

View file

@ -0,0 +1,16 @@
{
"subscriptions_pull": "Abonnements einlesen",
"subscriptions_resync": "Automatische Abo-Resynchronisierung",
"playlists_pull": "Playlists einlesen",
"playlists_push": "Playlists hochladen",
"playlists_delete": "Playlist löschen",
"videos_backfill_recent": "Aktuelle Uploads laden",
"videos_backfill_full": "Vollständigen Verlauf laden",
"videos_enrich": "Video-Anreicherung",
"videos_lookup": "Video-Abfrage",
"channels_discover": "Kanal-Entdeckung",
"channels_subscribe": "Abonnieren",
"channels_unsubscribe": "Abo beenden",
"maintenance_revalidate": "Wartungs-Neuvalidierung",
"other": "Sonstiges"
}

View file

@ -0,0 +1,16 @@
{
"subscriptions_pull": "Read subscriptions",
"subscriptions_resync": "Auto subscription resync",
"playlists_pull": "Read playlists",
"playlists_push": "Push playlists",
"playlists_delete": "Delete playlist",
"videos_backfill_recent": "Recent backfill",
"videos_backfill_full": "Full-history backfill",
"videos_enrich": "Video enrichment",
"videos_lookup": "Video lookup",
"channels_discover": "Channel discovery",
"channels_subscribe": "Subscribe",
"channels_unsubscribe": "Unsubscribe",
"maintenance_revalidate": "Maintenance re-validation",
"other": "Other"
}

View file

@ -0,0 +1,16 @@
{
"subscriptions_pull": "Feliratkozások beolvasása",
"subscriptions_resync": "Automatikus feliratkozás-újraszinkron",
"playlists_pull": "Lejátszási listák beolvasása",
"playlists_push": "Lejátszási listák feltöltése",
"playlists_delete": "Lejátszási lista törlése",
"videos_backfill_recent": "Friss feltöltések betöltése",
"videos_backfill_full": "Teljes előzmény betöltése",
"videos_enrich": "Videó-gazdagítás",
"videos_lookup": "Videó-lekérdezés",
"channels_discover": "Csatorna-felfedezés",
"channels_subscribe": "Feliratkozás",
"channels_unsubscribe": "Leiratkozás",
"maintenance_revalidate": "Karbantartó újraellenőrzés",
"other": "Egyéb"
}

View file

@ -44,18 +44,11 @@ export function formatDuration(sec: number | null): string {
return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${m}:${pad(s)}`;
}
const QUOTA_ACTION_LABELS: Record<string, string> = {
sync_subscriptions: "Sync subscriptions",
backfill_recent: "Recent backfill",
backfill_deep: "Full-history backfill",
enrich: "Enrichment",
unsubscribe: "Unsubscribe",
subscription_resync: "Auto subscription resync",
api: "Other",
};
// Human label for a canonical quota-action key (see backend app.quota.QuotaAction). Resolved
// from i18n (quotaActions.<key>) so it's translated in all UI languages; falls back to the raw
// key for any unmapped/legacy value.
export function quotaActionLabel(action: string): string {
return QUOTA_ACTION_LABELS[action] ?? action;
return i18n.t(`quotaActions.${action}`, { defaultValue: action });
}
/** Coarse, human ETA for a remaining duration in seconds ("~3 hours", "~2 days"). */