Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): report an audit log export whose search matches nothing

Yudhi Armyndharisf25a07f34d72
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index 4419e0a31..5d31f24b4 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -697,7 +697,9 @@
},
"exportFailed": "تعذّر تصدير سجل التدقيق",
"exportTruncated": "يغطي التصدير أحدث {{rows}} إدخال فقط. ضيّق مرشح الخطورة لتصدير الإدخالات الأقدم.",
- "exportThrottled": "يغطي التصدير أحدث {{rows}} إدخال فقط لأن البوابة تحدّ من قراءات سجل التدقيق. انتظر دقيقة ثم أعد التصدير."
+ "exportThrottled": "يغطي التصدير أحدث {{rows}} إدخال فقط لأن البوابة تحدّ من قراءات سجل التدقيق. انتظر دقيقة ثم أعد التصدير.",
+ "exportNoMatches": "لا توجد إدخالات في سجل التدقيق تطابق البحث، لذا لم يُصدَّر شيء.",
+ "exportNoMatchesTruncated": "لا يطابق البحث أيًّا من أحدث {{rows}} إدخال تم فحصها، لذا لم يُصدَّر شيء. لم يشمل البحث الإدخالات الأقدم."
},
"messageTester": {
"title": "اختبار الرسائل",
diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.json
index 11218b943..18a124f73 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -680,7 +680,9 @@
},
"exportFailed": "Audit-Protokoll konnte nicht exportiert werden",
"exportTruncated": "Der Export umfasst nur die neuesten {{rows}} Einträge. Grenze den Severity-Filter ein, um ältere Einträge zu exportieren.",
- "exportThrottled": "Der Export umfasst nur die neuesten {{rows}} Einträge, weil das Gateway Abfragen des Audit-Logs drosselt. Warte eine Minute und exportiere erneut."
+ "exportThrottled": "Der Export umfasst nur die neuesten {{rows}} Einträge, weil das Gateway Abfragen des Audit-Logs drosselt. Warte eine Minute und exportiere erneut.",
+ "exportNoMatches": "Keine Einträge im Audit-Protokoll passen zur Suche, daher wurde nichts exportiert.",
+ "exportNoMatchesTruncated": "Keiner der neuesten {{rows}} durchsuchten Einträge passt zur Suche, daher wurde nichts exportiert. Ältere Einträge wurden nicht durchsucht."
},
"messageTester": {
"title": "Nachrichtentester",
diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.json
index 08cb07641..d61275242 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -680,7 +680,9 @@
},
"exportFailed": "Couldn't export the audit log",
"exportTruncated": "The export covers only the newest {{rows}} entries. Narrow the severity filter to export older ones.",
- "exportThrottled": "The export covers only the newest {{rows}} entries because the gateway is rate-limiting audit log reads. Wait a minute and export again."
+ "exportThrottled": "The export covers only the newest {{rows}} entries because the gateway is rate-limiting audit log reads. Wait a minute and export again.",
+ "exportNoMatches": "No audit log entries match the search, so nothing was exported.",
+ "exportNoMatchesTruncated": "None of the newest {{rows}} entries scanned match the search, so nothing was exported. Older entries were not searched."
},
"messageTester": {
"title": "Message Tester",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 500ff5806..06b1b17e0 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -635,7 +635,9 @@
},
"exportFailed": "No se pudo exportar el registro de auditoría",
"exportTruncated": "La exportación solo abarca las {{rows}} entradas más recientes. Restringe el filtro de severidad para exportar las más antiguas.",
- "exportThrottled": "La exportación solo abarca las {{rows}} entradas más recientes porque la puerta de enlace está limitando las lecturas del registro de auditoría. Espera un minuto y vuelve a exportar."
+ "exportThrottled": "La exportación solo abarca las {{rows}} entradas más recientes porque la puerta de enlace está limitando las lecturas del registro de auditoría. Espera un minuto y vuelve a exportar.",
+ "exportNoMatches": "Ninguna entrada del registro de auditoría coincide con la búsqueda, así que no se exportó nada.",
+ "exportNoMatchesTruncated": "Ninguna de las {{rows}} entradas más recientes revisadas coincide con la búsqueda, así que no se exportó nada. Las entradas más antiguas no se revisaron."
},
"messageTester": {
"title": "Probador de mensajes",
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index dab86fdc9..40fa376eb 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -684,7 +684,9 @@
},
"exportFailed": "Impossible d'exporter le journal d'audit",
"exportTruncated": "L'export ne couvre que les {{rows}} entrées les plus récentes. Affinez le filtre de gravité pour exporter les plus anciennes.",
- "exportThrottled": "L'export ne couvre que les {{rows}} entrées les plus récentes, car la passerelle limite les lectures du journal d'audit. Attendez une minute, puis relancez l'export."
+ "exportThrottled": "L'export ne couvre que les {{rows}} entrées les plus récentes, car la passerelle limite les lectures du journal d'audit. Attendez une minute, puis relancez l'export.",
+ "exportNoMatches": "Aucune entrée du journal d'audit ne correspond à la recherche : rien n'a été exporté.",
+ "exportNoMatchesTruncated": "Aucune des {{rows}} entrées les plus récentes parcourues ne correspond à la recherche : rien n'a été exporté. Les entrées plus anciennes n'ont pas été parcourues."
},
"messageTester": {
"title": "Testeur de messages",
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index 31e3c1c24..a756d4a74 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -689,7 +689,9 @@
},
"exportFailed": "לא ניתן לייצא את יומן הביקורת",
"exportTruncated": "הייצוא כולל רק את {{rows}} הרשומות האחרונות. צמצמו את מסנן החומרה כדי לייצא רשומות ישנות יותר.",
- "exportThrottled": "הייצוא כולל רק את {{rows}} הרשומות האחרונות, כי השער מגביל קריאות של יומן הביקורת. המתינו דקה וייצאו שוב."
+ "exportThrottled": "הייצוא כולל רק את {{rows}} הרשומות האחרונות, כי השער מגביל קריאות של יומן הביקורת. המתינו דקה וייצאו שוב.",
+ "exportNoMatches": "אין רשומות ביומן הביקורת התואמות לחיפוש, ולכן לא יוצא דבר.",
+ "exportNoMatchesTruncated": "אף אחת מ-{{rows}} הרשומות האחרונות שנסרקו אינה תואמת לחיפוש, ולכן לא יוצא דבר. רשומות ישנות יותר לא נסרקו."
},
"messageTester": {
"title": "בדיקת הודעות",
diff --git a/dashboard/src/i18n/locales/hi.json b/dashboard/src/i18n/locales/hi.json
index a0df40f49..414972d76 100644
--- a/dashboard/src/i18n/locales/hi.json
+++ b/dashboard/src/i18n/locales/hi.json
@@ -680,7 +680,9 @@
},
"exportFailed": "ऑडिट लॉग निर्यात नहीं किया जा सका",
"exportTruncated": "निर्यात में केवल नवीनतम {{rows}} प्रविष्टियाँ शामिल हैं। पुरानी प्रविष्टियाँ निर्यात करने के लिए गंभीरता फ़िल्टर को सीमित करें।",
- "exportThrottled": "गेटवे ऑडिट लॉग पढ़ने की दर सीमित कर रहा है, इसलिए निर्यात में केवल नवीनतम {{rows}} प्रविष्टियाँ शामिल हैं। एक मिनट रुकें और फिर से निर्यात करें।"
+ "exportThrottled": "गेटवे ऑडिट लॉग पढ़ने की दर सीमित कर रहा है, इसलिए निर्यात में केवल नवीनतम {{rows}} प्रविष्टियाँ शामिल हैं। एक मिनट रुकें और फिर से निर्यात करें।",
+ "exportNoMatches": "ऑडिट लॉग की कोई प्रविष्टि खोज से मेल नहीं खाती, इसलिए कुछ भी निर्यात नहीं किया गया।",
+ "exportNoMatchesTruncated": "जाँची गई नवीनतम {{rows}} प्रविष्टियों में से कोई भी खोज से मेल नहीं खाती, इसलिए कुछ भी निर्यात नहीं किया गया। पुरानी प्रविष्टियाँ खोजी नहीं गईं।"
},
"messageTester": {
"title": "संदेश परीक्षक",
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index 101e5b175..67180a83a 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -684,7 +684,9 @@
},
"exportFailed": "Impossibile esportare il log di controllo",
"exportTruncated": "L'esportazione copre solo le {{rows}} voci più recenti. Restringi il filtro severità per esportare quelle più vecchie.",
- "exportThrottled": "L'esportazione copre solo le {{rows}} voci più recenti perché il gateway sta limitando le letture del registro di audit. Attendi un minuto ed esporta di nuovo."
+ "exportThrottled": "L'esportazione copre solo le {{rows}} voci più recenti perché il gateway sta limitando le letture del registro di audit. Attendi un minuto ed esporta di nuovo.",
+ "exportNoMatches": "Nessuna voce del registro di audit corrisponde alla ricerca, quindi non è stato esportato nulla.",
+ "exportNoMatchesTruncated": "Nessuna delle {{rows}} voci più recenti esaminate corrisponde alla ricerca, quindi non è stato esportato nulla. Le voci più vecchie non sono state esaminate."
},
"messageTester": {
"title": "Messaggio di prova",
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index 282bbfbfb..ad1ef236a 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -680,7 +680,9 @@
},
"exportFailed": "감사 로그를 내보내지 못했습니다",
"exportTruncated": "내보내기에는 최신 항목 {{rows}}개만 포함됩니다. 이전 항목을 내보내려면 심각도 필터를 좁히세요.",
- "exportThrottled": "게이트웨이가 감사 로그 조회를 제한하고 있어 내보내기에는 최신 항목 {{rows}}개만 포함됩니다. 1분 후 다시 내보내세요."
+ "exportThrottled": "게이트웨이가 감사 로그 조회를 제한하고 있어 내보내기에는 최신 항목 {{rows}}개만 포함됩니다. 1분 후 다시 내보내세요.",
+ "exportNoMatches": "검색과 일치하는 감사 로그 항목이 없어 아무것도 내보내지 않았습니다.",
+ "exportNoMatchesTruncated": "검사한 최신 항목 {{rows}}개 중 검색과 일치하는 항목이 없어 아무것도 내보내지 않았습니다. 이전 항목은 검색하지 않았습니다."
},
"messageTester": {
"title": "메시지 테스터",
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index abd066f91..2f725dcb3 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -635,7 +635,9 @@
},
"exportFailed": "Não foi possível exportar o registro de auditoria",
"exportTruncated": "A exportação cobre apenas as {{rows}} entradas mais recentes. Restrinja o filtro de severidade para exportar as mais antigas.",
- "exportThrottled": "A exportação cobre apenas as {{rows}} entradas mais recentes porque o gateway está limitando as leituras do log de auditoria. Aguarde um minuto e exporte novamente."
+ "exportThrottled": "A exportação cobre apenas as {{rows}} entradas mais recentes porque o gateway está limitando as leituras do log de auditoria. Aguarde um minuto e exporte novamente.",
+ "exportNoMatches": "Nenhuma entrada do log de auditoria corresponde à busca, então nada foi exportado.",
+ "exportNoMatchesTruncated": "Nenhuma das {{rows}} entradas mais recentes verificadas corresponde à busca, então nada foi exportado. As entradas mais antigas não foram verificadas."
},
"messageTester": {
"title": "Testador de mensagens",
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index eac8b3a39..7aa037ab6 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -680,7 +680,9 @@
},
"exportFailed": "ఆడిట్ లాగ్‌ను ఎక్స్‌పోర్ట్ చేయలేకపోయాం",
"exportTruncated": "ఎక్స్‌పోర్ట్ తాజా {{rows}} ఎంట్రీలను మాత్రమే కవర్ చేస్తుంది. పాత ఎంట్రీలను ఎక్స్‌పోర్ట్ చేయడానికి తీవ్రత ఫిల్టర్‌ను కుదించండి.",
- "exportThrottled": "గేట్‌వే ఆడిట్ లాగ్ రీడ్‌లను పరిమితం చేస్తున్నందున ఎక్స్‌పోర్ట్ తాజా {{rows}} ఎంట్రీలను మాత్రమే కవర్ చేస్తుంది. ఒక నిమిషం ఆగి మళ్లీ ఎక్స్‌పోర్ట్ చేయండి."
+ "exportThrottled": "గేట్‌వే ఆడిట్ లాగ్ రీడ్‌లను పరిమితం చేస్తున్నందున ఎక్స్‌పోర్ట్ తాజా {{rows}} ఎంట్రీలను మాత్రమే కవర్ చేస్తుంది. ఒక నిమిషం ఆగి మళ్లీ ఎక్స్‌పోర్ట్ చేయండి.",
+ "exportNoMatches": "శోధనకు సరిపోయే ఆడిట్ లాగ్ ఎంట్రీలు ఏవీ లేవు, కాబట్టి ఏదీ ఎక్స్‌పోర్ట్ చేయబడలేదు.",
+ "exportNoMatchesTruncated": "పరిశీలించిన తాజా {{rows}} ఎంట్రీలలో ఏదీ శోధనకు సరిపోలలేదు, కాబట్టి ఏదీ ఎక్స్‌పోర్ట్ చేయబడలేదు. పాత ఎంట్రీలు శోధించబడలేదు."
},
"messageTester": {
"title": "మెసేజ్ టెస్టర్",
diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.json
index 51a4774e1..f843dc4b1 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -680,7 +680,9 @@
},
"exportFailed": "Denetim kaydı dışa aktarılamadı",
"exportTruncated": "Dışa aktarma yalnızca en yeni {{rows}} kaydı kapsar. Daha eski kayıtları dışa aktarmak için önem filtresini daraltın.",
- "exportThrottled": "Ağ geçidi denetim günlüğü okumalarını sınırladığı için dışa aktarma yalnızca en yeni {{rows}} kaydı kapsar. Bir dakika bekleyip yeniden dışa aktarın."
+ "exportThrottled": "Ağ geçidi denetim günlüğü okumalarını sınırladığı için dışa aktarma yalnızca en yeni {{rows}} kaydı kapsar. Bir dakika bekleyip yeniden dışa aktarın.",
+ "exportNoMatches": "Aramayla eşleşen denetim kaydı yok, bu yüzden hiçbir şey dışa aktarılmadı.",
+ "exportNoMatchesTruncated": "Taranan en yeni {{rows}} kaydın hiçbiri aramayla eşleşmiyor, bu yüzden hiçbir şey dışa aktarılmadı. Daha eski kayıtlar taranmadı."
},
"messageTester": {
"title": "Mesaj Test Aracı",
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index 0fbcd5842..93a6258f7 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -680,7 +680,9 @@
},
"exportFailed": "无法导出审计日志",
"exportTruncated": "导出仅涵盖最新的 {{rows}} 条记录。请缩小严重级别筛选范围以导出更早的条目。",
- "exportThrottled": "网关正在限制审计日志的读取频率,导出仅涵盖最新的 {{rows}} 条记录。请等待一分钟后重新导出。"
+ "exportThrottled": "网关正在限制审计日志的读取频率,导出仅涵盖最新的 {{rows}} 条记录。请等待一分钟后重新导出。",
+ "exportNoMatches": "没有与搜索匹配的审计日志记录,因此未导出任何内容。",
+ "exportNoMatchesTruncated": "已扫描的最新 {{rows}} 条记录中没有与搜索匹配的条目,因此未导出任何内容。更早的条目未被搜索。"
},
"messageTester": {
"title": "消息测试器",
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index ccb93780c..eb47c1232 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -680,7 +680,9 @@
},
"exportFailed": "無法匯出審計記錄",
"exportTruncated": "匯出僅涵蓋最新的 {{rows}} 條記錄。請收窄嚴重程度篩選範圍以匯出較早的項目。",
- "exportThrottled": "閘道正在限制審計記錄的讀取頻率,匯出僅涵蓋最新的 {{rows}} 條記錄。請等待一分鐘後重新匯出。"
+ "exportThrottled": "閘道正在限制審計記錄的讀取頻率,匯出僅涵蓋最新的 {{rows}} 條記錄。請等待一分鐘後重新匯出。",
+ "exportNoMatches": "沒有與搜尋相符的審計記錄,因此未有匯出任何內容。",
+ "exportNoMatchesTruncated": "已掃描的最新 {{rows}} 條記錄中沒有與搜尋相符的項目,因此未有匯出任何內容。較早的項目未被搜尋。"
},
"messageTester": {
"title": "訊息測試器",
diff --git a/dashboard/src/pages/Logs.test.ts b/dashboard/src/pages/Logs.test.ts
index 02cd21f3b..bd32190d2 100644
--- a/dashboard/src/pages/Logs.test.ts
+++ b/dashboard/src/pages/Logs.test.ts
@@ -190,3 +190,36 @@ test('an export stopped by the throttle says to wait, not to narrow the filter',
restore();
}
});
+
+test('an export whose search matches no entry says so and downloads nothing', async () => {
+ const { screen, fireEvent } = rtl;
+ const { downloads, restore } = recordDownloads();
+ try {
+ renderLogs();
+ await screen.findByText('infra.restart');
+ fireEvent.change(screen.getByPlaceholderText('Search logs...'), { target: { value: 'no-such-action' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Export CSV' }));
+ await screen.findByText('No audit log entries match the search, so nothing was exported.');
+ assert.equal(downloads.length, 0, 'an empty export was downloaded');
+ } finally {
+ restore();
+ }
+});
+
+test('a truncated export whose search matches nothing names the entries it scanned', async () => {
+ const { screen, fireEvent } = rtl;
+ const { downloads, restore } = recordDownloads();
+ exportTotal = 60_000;
+ try {
+ renderLogs();
+ await screen.findByText('infra.restart');
+ fireEvent.change(screen.getByPlaceholderText('Search logs...'), { target: { value: 'no-such-action' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Export CSV' }));
+ await screen.findByText(/None of the newest 10,000 entries scanned match the search/, {}, { timeout: 10_000 });
+ assert.equal(screen.queryByText(/The export covers only/), null, 'the warning reads as if a file was produced');
+ assert.equal(downloads.length, 0, 'an empty export was downloaded');
+ } finally {
+ exportTotal = null;
+ restore();
+ }
+});
diff --git a/dashboard/src/pages/Logs.tsx b/dashboard/src/pages/Logs.tsx
index 64e6bab87..560ea986b 100644
--- a/dashboard/src/pages/Logs.tsx
+++ b/dashboard/src/pages/Logs.tsx
@@ -104,12 +104,19 @@ export function Logs() {
const rows = q
? all.filter(l => l.action.toLowerCase().includes(q) || (l.errorMessage || '').toLowerCase().includes(q))
: all;
- if (rows.length > 0) download(buildCsv(rows));
// Either stop keeps the newest rows (the API orders newest first); older ones are missing. A
// narrower filter gets past the cap, only waiting gets past the throttle. The count follows the UI
// language, not the browser's locale, so it reads right inside the sentence.
+ const rowCount = all.length.toLocaleString(i18n.resolvedLanguage);
+ if (rows.length === 0) {
+ // After a truncated walk the older rows were never searched, so the message must not read as
+ // a verdict on the whole history.
+ if (truncated) toast.warning(t('logs.exportNoMatchesTruncated', { rows: rowCount }));
+ else toast.info(t('logs.exportNoMatches'));
+ return;
+ }
+ download(buildCsv(rows));
if (truncated) {
- const rowCount = all.length.toLocaleString(i18n.resolvedLanguage);
toast.warning(t(throttled ? 'logs.exportThrottled' : 'logs.exportTruncated', { rows: rowCount }));
}
} catch (err) {