Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): translate the Logs severity badge

Yudhi Armyndharis72c42d5f6cb1
diff --git a/dashboard/src/pages/Logs.test.ts b/dashboard/src/pages/Logs.test.ts
index 7dfea2436..b15736621 100644
--- a/dashboard/src/pages/Logs.test.ts
+++ b/dashboard/src/pages/Logs.test.ts
@@ -314,3 +314,10 @@ test('a severity filter that matches nothing says no logs exist, not that this p
await screen.findByText('No logs match these filters. Adjust the severity filter to widen the search.');
assert.ok(screen.getByRole('heading', { name: 'No logs found' }));
});
+
+test('the severity badge shows the translated severity', async () => {
+ const container = renderLogs();
+ await rtl.screen.findByText('infra.restart');
+ const badges = [...container.querySelectorAll('.severity-badge')].map(badge => badge.textContent);
+ assert.deepEqual(badges, ['Info', 'Error']);
+});
diff --git a/dashboard/src/pages/Logs.tsx b/dashboard/src/pages/Logs.tsx
index 5b587ada3..84bceda99 100644
--- a/dashboard/src/pages/Logs.tsx
+++ b/dashboard/src/pages/Logs.tsx
@@ -225,7 +225,7 @@ export function Logs() {
<span className="api-key">{log.apiKeyName || '—'}</span>
<span className="ip">{log.ipAddress || '—'}</span>
<span>
- <span className={`severity-badge ${log.severity}`}>{log.severity.toUpperCase()}</span>
+ <span className={`severity-badge ${log.severity}`}>{t(`logs.severity.${log.severity}`)}</span>
</span>
</div>
))