fix: silence RODA dashboard proxy logs

This commit is contained in:
Raditya_Indra_Putranto
2026-06-04 19:12:21 +07:00
parent 3b749e4c99
commit 56c34eddc3
+5 -5
View File
@@ -74,6 +74,7 @@
</script> </script>
<script> <script>
window.APP_CONFIG = window.APP_CONFIG || { window.APP_CONFIG = window.APP_CONFIG || {
debugLogs: false,
dashboardTargetUrl: 'https://dashboard.informatika.untan.ac.id/index.php?penelitian', dashboardTargetUrl: 'https://dashboard.informatika.untan.ac.id/index.php?penelitian',
dashboardProxyTemplates: [ dashboardProxyTemplates: [
'https://api.allorigins.win/get?url={{url}}&ts={{ts}}', 'https://api.allorigins.win/get?url={{url}}&ts={{ts}}',
@@ -1471,6 +1472,7 @@
} }
function logAppError(scope, error, extra = {}) { function logAppError(scope, error, extra = {}) {
if (window.APP_CONFIG?.debugLogs !== true) return;
console.error(`[${scope}]`, error, extra); console.error(`[${scope}]`, error, extra);
} }
@@ -1481,6 +1483,7 @@
if (error.message === 'INVALID_RESPONSE') return 'Respons dari proxy tidak valid dan tidak bisa diproses.'; if (error.message === 'INVALID_RESPONSE') return 'Respons dari proxy tidak valid dan tidak bisa diproses.';
if (error.message === 'EMPTY_RESPONSE') return 'Dashboard mengembalikan data kosong atau struktur halaman berubah.'; if (error.message === 'EMPTY_RESPONSE') return 'Dashboard mengembalikan data kosong atau struktur halaman berubah.';
if (error.message === 'NO_ROWS_FOUND') return 'Data penelitian tidak ditemukan pada halaman dashboard.'; if (error.message === 'NO_ROWS_FOUND') return 'Data penelitian tidak ditemukan pada halaman dashboard.';
if (error.message === 'DASHBOARD_PROXY_NOT_CONFIGURED') return 'Proxy dashboard belum dikonfigurasi.';
if (error.message?.startsWith('HTTP_ERROR_')) return `Proxy merespons gagal (${error.message.replace('HTTP_ERROR_', 'HTTP ')}).`; if (error.message?.startsWith('HTTP_ERROR_')) return `Proxy merespons gagal (${error.message.replace('HTTP_ERROR_', 'HTTP ')}).`;
return 'Gagal mengambil data. Server dashboard mungkin sedang sibuk atau memblokir akses.'; return 'Gagal mengambil data. Server dashboard mungkin sedang sibuk atau memblokir akses.';
} }
@@ -1576,7 +1579,8 @@
} }
if (!proxyServers.length) { if (!proxyServers.length) {
throw new Error('DASHBOARD_PROXY_NOT_CONFIGURED'); renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(new Error('DASHBOARD_PROXY_NOT_CONFIGURED')), 'Coba Lagi', 'fetchDashboardData()');
return;
} }
let lastError = null; let lastError = null;
@@ -1587,7 +1591,6 @@
try { try {
const proxyUrl = getProxyUrl(targetUrl); const proxyUrl = getProxyUrl(targetUrl);
console.log(`Trying proxy: ${proxyUrl}`);
const response = await fetch(proxyUrl, { signal: controller.signal }); const response = await fetch(proxyUrl, { signal: controller.signal });
clearTimeout(timeoutId); clearTimeout(timeoutId);
@@ -1651,14 +1654,12 @@
throw new Error('NO_ROWS_FOUND'); throw new Error('NO_ROWS_FOUND');
} catch (error) { } catch (error) {
clearTimeout(timeoutId); clearTimeout(timeoutId);
logAppError('dashboard-proxy', error, { targetUrl });
lastError = error; lastError = error;
// Lanjut ke proxy berikutnya... // Lanjut ke proxy berikutnya...
} }
} }
// Jika semua proxy gagal // Jika semua proxy gagal
logAppError('fetchDashboardData', lastError);
renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(lastError), 'Coba Lagi', 'fetchDashboardData()'); renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(lastError), 'Coba Lagi', 'fetchDashboardData()');
} }
@@ -2018,7 +2019,6 @@
filterRiset(currentFilter); filterRiset(currentFilter);
searchRiset(''); searchRiset('');
fetchDashboardData().catch((error) => { fetchDashboardData().catch((error) => {
logAppError('DOMContentLoaded.fetchDashboardData', error);
renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(error), 'Coba Lagi', 'fetchDashboardData()'); renderRisetFeedback('Pemuatan Data Gagal', getDashboardErrorMessage(error), 'Coba Lagi', 'fetchDashboardData()');
}); });
} catch (error) { } catch (error) {