Изменения в логике получения данных по датчикам из бэкенда, изменение тултипа сенсора для исправления получения данных на реальные

This commit is contained in:
2026-02-04 00:02:37 +03:00
parent 79e4845870
commit f275db88c9
15 changed files with 2644 additions and 83 deletions

View File

@@ -115,6 +115,7 @@ const NavigationPage: React.FC = () => {
const [focusedSensorId, setFocusedSensorId] = useState<string | null>(null)
const [highlightAllSensors, setHighlightAllSensors] = useState(false)
const sensorStatusMap = React.useMemo(() => {
// Создаём карту статусов всегда для отображения цветов датчиков
const map: Record<string, string> = {}
Object.values(detectorsData.detectors).forEach(d => {
if (d.serial_number && d.status) {
@@ -347,27 +348,8 @@ const NavigationPage: React.FC = () => {
);
if (detector) {
if (showFloorNavigation || showListOfDetectors) {
handleDetectorMenuClick(detector);
} else if (detector.notifications && detector.notifications.length > 0) {
const sortedNotifications = [...detector.notifications].sort((a, b) => {
const priorityOrder: { [key: string]: number } = { critical: 0, warning: 1, info: 2 };
return priorityOrder[a.priority.toLowerCase()] - priorityOrder[b.priority.toLowerCase()];
});
const notification = sortedNotifications[0];
const alert: AlertType = {
...notification,
detector_id: detector.detector_id,
detector_name: detector.name,
location: detector.location,
object: detector.object,
status: detector.status,
type: notification.type || 'info',
};
handleAlertClick(alert);
} else {
handleDetectorMenuClick(detector);
}
// Всегда показываем меню детектора для всех датчиков
handleDetectorMenuClick(detector);
} else {
setFocusedSensorId(null);
closeDetectorMenu();