Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): drop the empty-log copy when the audit read fails

Yudhi Armyndharis8869da2d02e1
diff --git a/dashboard/src/pages/Logs.test.ts b/dashboard/src/pages/Logs.test.ts
index 95588e52d..e1214264e 100644
--- a/dashboard/src/pages/Logs.test.ts
+++ b/dashboard/src/pages/Logs.test.ts
@@ -363,3 +363,19 @@ test('a search padded with spaces still matches', async () => {
await waitFor(() => assert.ok(!screen.queryByText('infra.restart'), 'the search did not filter'));
assert.ok(screen.queryByText('session.stop'), 'the padded query matched nothing');
});
+
+test('a failed read does not say that no logs exist', async () => {
+ const { screen } = rtl;
+ listFailure = 502;
+ try {
+ renderLogs();
+ await screen.findByRole('alert');
+ assert.ok(!screen.queryByText('No logs found'), 'a read that failed was reported as an empty history');
+ assert.ok(
+ !screen.queryByText(/Audit logs will appear here/),
+ 'a read that failed was reported as an empty history',
+ );
+ } finally {
+ listFailure = null;
+ }
+});
diff --git a/dashboard/src/pages/Logs.tsx b/dashboard/src/pages/Logs.tsx
index 56403bd02..d1b567d87 100644
--- a/dashboard/src/pages/Logs.tsx
+++ b/dashboard/src/pages/Logs.tsx
@@ -192,6 +192,11 @@ export function Logs() {
<div className="empty-table-state">
<Loader2 className="animate-spin" size={32} />
</div>
+ ) : logsError && logs.length === 0 ? (
+ // Nothing was read, so no "no logs" copy: the banner above reports the failure on its own.
+ <div className="empty-table-state">
+ <AlertCircle size={32} />
+ </div>
) : filteredLogs.length === 0 ? (
<div className="empty-table-state">
<FileText size={48} strokeWidth={1} />