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:
parent
1ce035ca9e
commit
b23f805533
12 changed files with 151 additions and 33 deletions
|
|
@ -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"). */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue