- Users: one card per person on every screen size, status and MFA as icon plus word, server reasons (e.g. "more rights than you") shown. - Audit log: names instead of user ids, area as a choice instead of a free-text type, optional record id, filter reset, cards instead of a 5-column table, empty and error states with a next step. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
const AUDIT_ACTION_LABELS: Record<string, string> = {
|
|
CREATE: "Erstellt",
|
|
UPDATE: "Aktualisiert",
|
|
DEACTIVATE: "Deaktiviert",
|
|
DELETE: "Gelöscht",
|
|
LOGIN: "Angemeldet",
|
|
LOGIN_FAILED: "Anmeldung fehlgeschlagen",
|
|
LOGOUT: "Abgemeldet",
|
|
TOKEN_REFRESHED: "Token erneuert",
|
|
MFA_ENABLED: "MFA aktiviert",
|
|
MFA_DISABLED: "MFA deaktiviert",
|
|
ACCOUNT_LOCKED: "Konto vorübergehend gesperrt",
|
|
};
|
|
|
|
export function auditActionLabel(action: string): string {
|
|
return AUDIT_ACTION_LABELS[action] ?? action;
|
|
}
|
|
|
|
const AUDIT_ENTITY_TYPE_LABELS: Record<string, string> = {
|
|
Apiary: "Bienenstand",
|
|
AuthSession: "Sitzung",
|
|
AutomationRule: "Automatisierungsregel",
|
|
BottlingBatch: "Abfüllung",
|
|
Colony: "Volk",
|
|
COLONY: "Volk",
|
|
Document: "Dokument",
|
|
Equipment: "Ausrüstung",
|
|
Extraction: "Schleuderung",
|
|
Feeding: "Fütterung",
|
|
Harvest: "Ernte",
|
|
HoneyBatch: "Honigcharge",
|
|
HoneyBatchRelocation: "Honigcharge-Umlagerung",
|
|
HoneyMeasurement: "Honigmessung",
|
|
Import: "Import",
|
|
Inspection: "Durchsicht",
|
|
Product: "Produkt",
|
|
Queen: "Königin",
|
|
QueenEvaluation: "Königinnenbewertung",
|
|
Role: "Rolle",
|
|
StockItem: "Lagerartikel",
|
|
StockMovement: "Bestandsbewegung",
|
|
StorageContainer: "Lagerbehälter",
|
|
SwarmControlCheck: "Schwarmkontrolle",
|
|
Task: "Aufgabe",
|
|
TaskTemplate: "Aufgabenvorlage",
|
|
Treatment: "Behandlung",
|
|
User: "Benutzer",
|
|
VarroaMeasurement: "Varroamessung",
|
|
WebhookSubscription: "Webhook",
|
|
};
|
|
|
|
/** Filter choices: one entry per area (duplicate spellings collapsed), A-Z. */
|
|
export const AUDIT_ENTITY_TYPE_OPTIONS: { value: string; label: string }[] = Object.entries(
|
|
AUDIT_ENTITY_TYPE_LABELS,
|
|
)
|
|
.filter(([value]) => value !== value.toUpperCase())
|
|
.map(([value, label]) => ({ value, label }))
|
|
.sort((a, b) => a.label.localeCompare(b.label, "de"));
|
|
|
|
export function auditEntityTypeLabel(entityType: string): string {
|
|
return AUDIT_ENTITY_TYPE_LABELS[entityType] ?? entityType;
|
|
}
|