Skip to content

Commit 9ee51f6

Browse files
Merge pull request #204 from SheetMetalConnect/claude/debug-qrm-dashboard-018fvhohPdyLYrAgMSEYRtMY
Debug QRM dashboard rendering issues
2 parents 8baf3eb + 276d993 commit 9ee51f6

File tree

4 files changed

+38
-5
lines changed

4 files changed

+38
-5
lines changed

src/i18n/locales/de/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,9 @@
14571457
"title": "Zellen Zuverlässigkeit Heatmap",
14581458
"cell": "Zelle",
14591459
"week": "Woche"
1460-
}
1460+
},
1461+
"loadError": "Fehler beim Laden der QRM-Dashboard-Daten",
1462+
"noData": "Keine QRM-Daten verfügbar. Bitte stellen Sie sicher, dass Sie aktive Aufträge und Arbeitsgänge haben."
14611463
},
14621464
"terminal": {
14631465
"columns": {

src/i18n/locales/en/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,9 @@
859859
"title": "Cell Reliability Heatmap",
860860
"cell": "Cell",
861861
"week": "Week"
862-
}
862+
},
863+
"loadError": "Failed to load QRM dashboard data",
864+
"noData": "No QRM data available. Please ensure you have active jobs and operations."
863865
},
864866
"stages": {
865867
"title": "Stage Configuration",

src/i18n/locales/nl/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,9 @@
17271727
"title": "Cel Betrouwbaarheid Heatmap",
17281728
"cell": "Cel",
17291729
"week": "Week"
1730-
}
1730+
},
1731+
"loadError": "Fout bij laden van QRM dashboard gegevens",
1732+
"noData": "Geen QRM gegevens beschikbaar. Zorg ervoor dat u actieve orders en bewerkingen heeft."
17311733
},
17321734
"terminal": {
17331735
"columns": {

src/pages/admin/analytics/QRMDashboard.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,43 @@ const QRMDashboard = () => {
2323
const navigate = useNavigate();
2424
const [dateRange, setDateRange] = useState(30);
2525

26-
const { data: metrics, isLoading, refetch } = useQRMDashboardMetrics(dateRange);
26+
const { data: metrics, isLoading, isError, error, isFetching, refetch } = useQRMDashboardMetrics(dateRange);
2727

28-
if (isLoading || !metrics) {
28+
// Show loading only when actually fetching
29+
if (isLoading || isFetching) {
2930
return (
3031
<div className="flex items-center justify-center min-h-screen">
3132
<Loader2 className="h-8 w-8 animate-spin text-primary" />
3233
</div>
3334
);
3435
}
3536

37+
// Show error state
38+
if (isError) {
39+
return (
40+
<div className="flex flex-col items-center justify-center min-h-screen gap-4">
41+
<p className="text-destructive">{t("common.error")}: {error?.message || t("qrm.loadError")}</p>
42+
<Button variant="outline" onClick={() => navigate(ROUTES.ADMIN.ANALYTICS.ROOT)}>
43+
<ArrowLeft className="h-4 w-4 mr-2" />
44+
{t("common.goBack")}
45+
</Button>
46+
</div>
47+
);
48+
}
49+
50+
// Handle case where data is not available (query might be disabled)
51+
if (!metrics) {
52+
return (
53+
<div className="flex flex-col items-center justify-center min-h-screen gap-4">
54+
<p className="text-muted-foreground">{t("qrm.noData")}</p>
55+
<Button variant="outline" onClick={() => navigate(ROUTES.ADMIN.ANALYTICS.ROOT)}>
56+
<ArrowLeft className="h-4 w-4 mr-2" />
57+
{t("common.goBack")}
58+
</Button>
59+
</div>
60+
);
61+
}
62+
3663
return (
3764
<div className="space-y-6 p-6 pb-16 min-h-screen bg-background">
3865
{/* Header */}

0 commit comments

Comments
 (0)