// src/Components/StatusLogTable.jsx import React from 'react'; import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, Chip, Typography } from '@mui/material'; const statusColors = { '0': 'default', '1': 'success', '2': 'warning', '3': 'error' }; const StatusLogTable = ({ logs }) => { return ( Время Устройство Модуль Статус Значение Описание {logs.map((log, index) => ( {new Date(log.timestamp).toLocaleString()} {log.device} {log.source_id?.split('$')[1]} {parseFloat(log.value).toFixed(2)} {log.description || getStatusDescription(log.status)} ))}
); }; // Вспомогательные функции const getStatusText = (status) => { const statusMap = { '0': 'Нет соединения', '1': 'Норма', '2': 'Отклонение', '3': 'Критично' }; return statusMap[status] || 'Неизвестно'; }; const getStatusDescription = (status) => { const descriptions = { '0': 'Устройство не отвечает', '1': 'Параметры в норме', '2': 'Обнаружены отклонения от нормы', '3': 'Критическое состояние системы' }; return descriptions[status] || 'Статус неизвестен'; }; export default StatusLogTable;