diff --git a/.gitignore b/.gitignore
index e7fea06..0afc875 100755
--- a/.gitignore
+++ b/.gitignore
@@ -31,4 +31,10 @@ node_modules
.env.local
.env.development
.env.production
-.env.test
\ No newline at end of file
+.env.test
+
+# Local configs
+vite.config.js
+vite.config.local.js
+.env.local
+*.local.*
\ No newline at end of file
diff --git a/src/Components/Layout/SettingsComponents/FormulaEditor.jsx b/src/Components/Layout/SettingsComponents/FormulaEditor.jsx
index 206a843..830863d 100644
--- a/src/Components/Layout/SettingsComponents/FormulaEditor.jsx
+++ b/src/Components/Layout/SettingsComponents/FormulaEditor.jsx
@@ -3,117 +3,168 @@ import {
TextField, Box, Typography, IconButton, Divider,
CircularProgress, Alert, Collapse, Tooltip, Button,
Card, CardContent, Chip, Dialog, DialogTitle,
- DialogContent, DialogActions, Snackbar
+ DialogContent, DialogActions, Snackbar, Table,
+ TableBody, TableCell, TableContainer, TableHead,
+ TableRow, Paper, Badge
} from '@mui/material';
import RefreshIcon from '@mui/icons-material/Refresh';
import SearchIcon from '@mui/icons-material/Search';
import EditIcon from '@mui/icons-material/Edit';
import SaveIcon from '@mui/icons-material/Save';
+import WarningIcon from '@mui/icons-material/Warning';
+import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import axios from 'axios';
-const FormulaItem = React.memo(({ data, onEdit }) => {
- const formatValue = (value) => {
- if (typeof value === 'object' && value !== null) {
- return JSON.stringify(value, null, 2);
- }
- return String(value);
+const FormulaItem = React.memo(({ formula, onEdit }) => {
+ const getMetricStatusColor = (found) => {
+ return found ? 'success' : 'error';
};
- const getValueColor = (value) => {
- if (typeof value === 'boolean') return 'primary';
- if (typeof value === 'number') return 'secondary';
- if (value === null) return 'default';
- return 'info';
+ const formatValue = (value) => {
+ if (value === undefined) return 'N/A';
+ return value.toFixed(2);
};
return (
+ {/* Заголовок с ID и статусом метрик */}
-
- ID: {data.id || 'Без ID'}
-
- }
- onClick={() => onEdit(data)}
- variant="outlined"
- size="small"
- >
- Редактировать
-
+
+
+ {formula.name}
+
+
+ ID: {formula.id}
+
+
+
+
+
+
+ }
+ onClick={() => onEdit(formula)}
+ variant="outlined"
+ size="small"
+ >
+ Редактировать
+
+
-
- {data.data.name}
-
-
+ {/* Описание */}
- {data.data.desription}
+ {formula.description}
+ {/* Метрики */}
+
+
+ Метрики в формуле:
+ {formula.metadata?.missingMetrics > 0 && (
+
+ )}
+
+
+
+
+
+
+ Метрика
+ Описание
+ Значение
+ Статус
+
+
+
+ {formula.enrichedMetrics?.map((metric, index) => (
+
+
+
+
+ {metric.originalName}
+
+
+ {metric.prometheusName}
+
+
+
+
+
+ {metric.description}
+
+
+
+
+ {formatValue(metric.currentValue)}
+
+
+
+ : }
+ label={metric.found ? 'Найдена' : 'Не найдена'}
+ color={getMetricStatusColor(metric.found)}
+ size="small"
+ variant={metric.found ? "filled" : "outlined"}
+ />
+
+
+ ))}
+
+
+
+
+
+ {/* Формула */}
- Параметры:
+ Формула с описанием метрик:
-
+
-
-
- {JSON.stringify(data.data.values?.statusarr, null, 2)}
-
-
-
-
-
-
- {JSON.stringify(data.data.values?.warr, null, 2)}
-
-
-
-
-
-
- {data.data.formula}
+ {formula.humanReadableFormula}
-
-
-
+ {/* Веса */}
+
+
+ Веса (warr):
+
+
+ {formula.values?.warr?.map((weight, index) => (
+
+ ))}
+
@@ -125,7 +176,7 @@ const EditFormulaDialog = ({ open, formula, onClose, onSave }) => {
useEffect(() => {
if (formula) {
- setEditedFormula(formula.data.formula || '');
+ setEditedFormula(formula.formula || '');
}
}, [formula]);
@@ -138,11 +189,11 @@ const EditFormulaDialog = ({ open, formula, onClose, onSave }) => {
return (