Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,9 @@
"title": "Zellen Zuverlässigkeit Heatmap",
"cell": "Zelle",
"week": "Woche"
}
},
"loadError": "Fehler beim Laden der QRM-Dashboard-Daten",
"noData": "Keine QRM-Daten verfügbar. Bitte stellen Sie sicher, dass Sie aktive Aufträge und Arbeitsgänge haben."
},
"terminal": {
"columns": {
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,9 @@
"title": "Cell Reliability Heatmap",
"cell": "Cell",
"week": "Week"
}
},
"loadError": "Failed to load QRM dashboard data",
"noData": "No QRM data available. Please ensure you have active jobs and operations."
},
"stages": {
"title": "Stage Configuration",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/locales/nl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,9 @@
"title": "Cel Betrouwbaarheid Heatmap",
"cell": "Cel",
"week": "Week"
}
},
"loadError": "Fout bij laden van QRM dashboard gegevens",
"noData": "Geen QRM gegevens beschikbaar. Zorg ervoor dat u actieve orders en bewerkingen heeft."
},
"terminal": {
"columns": {
Expand Down
31 changes: 29 additions & 2 deletions src/pages/admin/analytics/QRMDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,43 @@ const QRMDashboard = () => {
const navigate = useNavigate();
const [dateRange, setDateRange] = useState(30);

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

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

// Show error state
if (isError) {
return (
<div className="flex flex-col items-center justify-center min-h-screen gap-4">
<p className="text-destructive">{t("common.error")}: {error?.message || t("qrm.loadError")}</p>
<Button variant="outline" onClick={() => navigate(ROUTES.ADMIN.ANALYTICS.ROOT)}>
<ArrowLeft className="h-4 w-4 mr-2" />
{t("common.goBack")}
</Button>
</div>
);
}

// Handle case where data is not available (query might be disabled)
if (!metrics) {
return (
<div className="flex flex-col items-center justify-center min-h-screen gap-4">
<p className="text-muted-foreground">{t("qrm.noData")}</p>
<Button variant="outline" onClick={() => navigate(ROUTES.ADMIN.ANALYTICS.ROOT)}>
<ArrowLeft className="h-4 w-4 mr-2" />
{t("common.goBack")}
</Button>
</div>
);
}

return (
<div className="space-y-6 p-6 pb-16 min-h-screen bg-background">
{/* Header */}
Expand Down
Loading