Tooltip für 'Alle Kennzahlen sind bereits trainiert' hinzugefügt, statischer Text entfernt
parent
5af1d40c08
commit
78e5ce16e2
|
|
@ -8,6 +8,8 @@ import Snackbar from "@mui/material/Snackbar";
|
||||||
import MuiAlert from "@mui/material/Alert";
|
import MuiAlert from "@mui/material/Alert";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -36,9 +38,7 @@ function ConfigPage() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API_HOST}/api/kpi/settings`);
|
const res = await fetch(`${API_HOST}/api/kpi/settings`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
console.log("🔍 GELADENE KPIs:", data);
|
|
||||||
const untrainedExists = data.some((kpi: any) => {
|
const untrainedExists = data.some((kpi: any) => {
|
||||||
console.log("➡️", kpi.name, "is_trained:", kpi.is_trained);
|
|
||||||
return kpi.is_trained === false;
|
return kpi.is_trained === false;
|
||||||
});
|
});
|
||||||
setHasUntrainedKPIs(untrainedExists);
|
setHasUntrainedKPIs(untrainedExists);
|
||||||
|
|
@ -84,7 +84,7 @@ function ConfigPage() {
|
||||||
checkInitialTrainingStatus();
|
checkInitialTrainingStatus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const handleAddNewKPI = () => {
|
const handleAddNewKPI = () => {
|
||||||
navigate({
|
navigate({
|
||||||
to: "/config-add",
|
to: "/config-add",
|
||||||
|
|
@ -137,7 +137,7 @@ function ConfigPage() {
|
||||||
setSnackbarOpen(true);
|
setSnackbarOpen(true);
|
||||||
setTrainingRunning(false);
|
setTrainingRunning(false);
|
||||||
|
|
||||||
fetchKPISettings(); // 👉 hier hinzufügen!
|
fetchKPISettings();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -179,24 +179,43 @@ function ConfigPage() {
|
||||||
</Box>
|
</Box>
|
||||||
<Box display="flex" flexDirection="column" alignItems="flex-end" gap={1}>
|
<Box display="flex" flexDirection="column" alignItems="flex-end" gap={1}>
|
||||||
<Box display="flex" gap={2}>
|
<Box display="flex" gap={2}>
|
||||||
<Button
|
{trainingRunning || !hasUntrainedKPIs ? (
|
||||||
variant="contained"
|
<Tooltip title="Alle Kennzahlen sind bereits trainiert.">
|
||||||
onClick={handleTriggerTraining}
|
<span>
|
||||||
disabled={trainingRunning || !hasUntrainedKPIs}
|
<Button
|
||||||
sx={{
|
variant="contained"
|
||||||
backgroundColor: "#383838",
|
onClick={handleTriggerTraining}
|
||||||
"&:hover": { backgroundColor: "#2e2e2e" },
|
disabled
|
||||||
}}
|
sx={{
|
||||||
>
|
backgroundColor: "#383838",
|
||||||
{trainingRunning ? (
|
"&:hover": { backgroundColor: "#2e2e2e" },
|
||||||
<>
|
}}
|
||||||
<CircularProgress size={20} sx={{ color: "white", mr: 1 }} />
|
>
|
||||||
Wird trainiert...
|
{trainingRunning ? (
|
||||||
</>
|
<>
|
||||||
) : (
|
<CircularProgress size={20} sx={{ color: "white", mr: 1 }} />
|
||||||
"Neu trainieren"
|
Wird trainiert...
|
||||||
)}
|
</>
|
||||||
</Button>
|
) : (
|
||||||
|
"Neu trainieren"
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
onClick={handleTriggerTraining}
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "#383838",
|
||||||
|
"&:hover": { backgroundColor: "#2e2e2e" },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Neu trainieren
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -209,14 +228,7 @@ function ConfigPage() {
|
||||||
Neue Kennzahl hinzufügen
|
Neue Kennzahl hinzufügen
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{!hasUntrainedKPIs && (
|
|
||||||
<Typography variant="body2" color="text.secondary" mt={1}>
|
|
||||||
Alle Kennzahlen sind bereits trainiert.
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* Tabelle */}
|
{/* Tabelle */}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue