Skip to content

Commit 614fa5b

Browse files
Merge pull request #15 from PKA-OpenDynamics/develop
Update(dashboard): summary data for reports on dashboard
2 parents 2612a5b + 2c151a3 commit 614fa5b

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

web-dashboard/.env.production

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Backend API URL (Cloudflare Tunnel)
33
NEXT_PUBLIC_API_BASE_URL=https://whats-inflation-signing-take.trycloudflare.com/api/v1
44

5-
# Fuseki SPARQL Endpoint (Cloudflare Tunnel)
6-
NEXT_PUBLIC_FUSEKI_URL=https://whats-inflation-signing-take.trycloudflare.com/fuseki
5+
# Fuseki SPARQL Endpoint (Cloudflare Tunnel - Separate tunnel for Fuseki)
6+
NEXT_PUBLIC_FUSEKI_URL=https://carol-select-sending-independent.trycloudflare.com
77

88
# MongoDB Atlas Connection (if needed in frontend)
99
# NEXT_PUBLIC_MONGODB_ATLAS_URI=your_atlas_uri_here

web-dashboard/src/app/(dashboard)/dashboard/page.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,20 @@ export default function DashboardPage() {
174174
setApiStatus('offline');
175175
}
176176

177-
// Fetch MongoDB Atlas reports stats
177+
// Fetch MongoDB Atlas reports stats using the stats endpoint
178178
try {
179-
const appReportsResponse = await fetch('http://localhost:8000/api/v1/app/reports?limit=1000');
179+
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000/api/v1';
180+
const appReportsResponse = await fetch(`${apiBaseUrl}/app/reports/stats/summary`);
180181
if (appReportsResponse.ok) {
181182
const appReportsData = await appReportsResponse.json();
182-
const reports = appReportsData.reports || [];
183-
setAppReports({
184-
total: reports.length,
185-
pending: reports.filter((r: any) => r.status === 'pending').length,
186-
processing: reports.filter((r: any) => r.status === 'processing').length,
187-
resolved: reports.filter((r: any) => r.status === 'resolved').length,
188-
});
183+
if (appReportsData.success && appReportsData.data) {
184+
setAppReports({
185+
total: appReportsData.data.total || 0,
186+
pending: appReportsData.data.pending || 0,
187+
processing: appReportsData.data.processing || 0,
188+
resolved: appReportsData.data.resolved || 0,
189+
});
190+
}
189191
}
190192
} catch (error) {
191193
console.error('Failed to fetch app reports:', error);

0 commit comments

Comments
 (0)