Переделана навигация к датчикам, добавлена работа поиска тултипов на модели, добавлен функционал перехода из дашборда и истории тревог к датчику с тревогой на 3д модели
This commit is contained in:
@@ -35,13 +35,22 @@ interface MonitoringProps {
|
||||
}
|
||||
|
||||
const Monitoring: React.FC<MonitoringProps> = ({ onClose, onSelectModel }) => {
|
||||
const { currentObject, currentZones, zonesLoading, zonesError, loadZones } = useNavigationStore();
|
||||
const { currentObject, currentZones, zonesLoading, zonesError, loadZones, currentModelPath } = useNavigationStore();
|
||||
const [autoSelectedRef, setAutoSelectedRef] = React.useState(false);
|
||||
|
||||
const handleSelectModel = useCallback((modelPath: string) => {
|
||||
console.log(`[Monitoring] Model selected: ${modelPath}`);
|
||||
console.log(`[Monitoring] onSelectModel callback:`, onSelectModel);
|
||||
onSelectModel?.(modelPath);
|
||||
}, [onSelectModel]);
|
||||
|
||||
// Автоматически закрываем панель после выбора модели
|
||||
if (onClose) {
|
||||
setTimeout(() => {
|
||||
console.log('[Monitoring] Auto-closing after model selection');
|
||||
onClose();
|
||||
}, 100);
|
||||
}
|
||||
}, [onSelectModel, onClose]);
|
||||
|
||||
// Загрузка зон при изменении объекта
|
||||
useEffect(() => {
|
||||
@@ -51,7 +60,19 @@ const Monitoring: React.FC<MonitoringProps> = ({ onClose, onSelectModel }) => {
|
||||
loadZones(objId);
|
||||
}, [currentObject?.id, loadZones]);
|
||||
|
||||
// Автоматический выбор первой зоны ОТКЛЮЧЕН - пользователь должен выбрать модель вручную
|
||||
// Автоматический выбор модели, если currentModelPath установлен (переход из таблицы)
|
||||
useEffect(() => {
|
||||
if (!currentModelPath || autoSelectedRef || !onSelectModel) return;
|
||||
|
||||
console.log('[Monitoring] Auto-selecting model from currentModelPath:', currentModelPath);
|
||||
setAutoSelectedRef(true);
|
||||
onSelectModel(currentModelPath);
|
||||
}, [currentModelPath, autoSelectedRef, onSelectModel]);
|
||||
|
||||
// Сброс флага при изменении объекта
|
||||
useEffect(() => {
|
||||
setAutoSelectedRef(false);
|
||||
}, [currentObject?.id])
|
||||
|
||||
const sortedZones: Zone[] = React.useMemo(() => {
|
||||
const sorted = (currentZones || []).slice().sort((a: Zone, b: Zone) => {
|
||||
|
||||
Reference in New Issue
Block a user