diff --git a/apps/control-station/src/App.tsx b/apps/control-station/src/App.tsx index 4900db88..fc8b9e7a 100644 --- a/apps/control-station/src/App.tsx +++ b/apps/control-station/src/App.tsx @@ -722,9 +722,9 @@ export default function App() { workspace.navigationOpen && activeRoot !== null } contentOpen={workspace.contentOpen && activeDefinition !== null} - contentExpanded={workspace.contentExpanded} + contentExpanded header={header} - stage={ + stage={activeDefinition ? null : @@ -836,7 +835,7 @@ export default function App() { /> ) : activeDefinition.kind === "missions" ? (
- ) : activeDefinition.kind === "vehicles" ?
: activeDefinition.kind === "simulations" ? null : activeDefinition.kind === "datasets" ? ( + ) : activeDefinition.kind === "vehicles" ?
: activeDefinition.kind === "simulations" ?
: activeDefinition.kind === "datasets" ? ( Offline evaluation ) : activeDefinition.kind === "lab-archive" ? ( laboratoryAnnotation.control diff --git a/apps/control-station/src/composition/devicePlugins.ts b/apps/control-station/src/composition/devicePlugins.ts index c242a831..6aa1fb34 100644 --- a/apps/control-station/src/composition/devicePlugins.ts +++ b/apps/control-station/src/composition/devicePlugins.ts @@ -1,3 +1,4 @@ +import {usbCanSensorUi} from '../../../../plugins/usb-can/frontend/src/plugin'; import {vescSensorUi} from '../../../../plugins/vesc/frontend/src/plugin'; import type { DeviceUiPlugin } from "../core/device-plugins/contracts"; import { xgridsK1Plugin } from "@xgrids-k1/frontend/plugin"; @@ -11,4 +12,4 @@ export const installedDevicePlugins: readonly DeviceUiPlugin[] = Object.freeze([ // Node-executed camera controls use the existing sensor contribution contract; // they do not register a desktop capture/AI runtime or a new product workspace. -export const installedNodeSensorContributions = Object.freeze([insta360X4SensorUi,vescSensorUi]); +export const installedNodeSensorContributions = Object.freeze([insta360X4SensorUi,vescSensorUi,usbCanSensorUi]); diff --git a/apps/control-station/src/styles/workspaces.css b/apps/control-station/src/styles/workspaces.css index 9e8c5028..3804b283 100644 --- a/apps/control-station/src/styles/workspaces.css +++ b/apps/control-station/src/styles/workspaces.css @@ -188,24 +188,6 @@ gap: 0.4rem; } -.polygon-rover-scene__toolbar button { - border: 1px solid rgb(255 255 255 / 0.14); - border-radius: 999px; - background: rgb(7 12 18 / 0.76); - color: var(--nodedc-text-secondary); - padding: 0.38rem 0.62rem; - font: inherit; - font-size: 0.54rem; - line-height: 1; - backdrop-filter: blur(16px); - cursor: pointer; -} - -.polygon-rover-scene__toolbar button:hover { - border-color: rgb(var(--nodedc-accent-rgb) / 0.5); - color: var(--nodedc-text-primary); -} - .polygon-rover-scene__help { bottom: 0.75rem; left: 0.75rem; @@ -3685,8 +3667,7 @@ } .lidar-ground-modes button, -.lidar-ground-frame-control button, -.lidar-ground-scene__toolbar button { +.lidar-ground-frame-control button { border: 0; border-radius: 999px; background: transparent; @@ -3699,16 +3680,14 @@ .lidar-ground-modes button:hover, .lidar-ground-modes button[data-active="true"], -.lidar-ground-frame-control button:hover:not(:disabled), -.lidar-ground-scene__toolbar button:hover { +.lidar-ground-frame-control button:hover:not(:disabled) { background: rgb(255 255 255 / 0.11); color: var(--nodedc-text-primary); outline: none; } .lidar-ground-modes button:focus-visible, -.lidar-ground-frame-control button:focus-visible, -.lidar-ground-scene__toolbar button:focus-visible { +.lidar-ground-frame-control button:focus-visible { background: rgb(255 255 255 / 0.14); outline: none; } @@ -3766,10 +3745,6 @@ backdrop-filter: blur(14px); } -.lidar-ground-scene__toolbar button { - background: rgb(255 255 255 / 0.06); -} - .lidar-ground-scene__error { position: absolute; inset: 0; diff --git a/apps/control-station/src/workspaces/Workspaces.tsx b/apps/control-station/src/workspaces/Workspaces.tsx index 7b0fb832..ee3cdae4 100644 --- a/apps/control-station/src/workspaces/Workspaces.tsx +++ b/apps/control-station/src/workspaces/Workspaces.tsx @@ -457,7 +457,7 @@ export function WorkspaceRenderer(props: WorkspaceRendererProps) { /> ); case "simulations": - return ; + return ; case "observatory": return ; case "device": diff --git a/apps/control-station/src/workspaces/fleet/BoardComputer.tsx b/apps/control-station/src/workspaces/fleet/BoardComputer.tsx index bba33c71..0794ce96 100644 --- a/apps/control-station/src/workspaces/fleet/BoardComputer.tsx +++ b/apps/control-station/src/workspaces/fleet/BoardComputer.tsx @@ -1,4 +1,7 @@ -import {Button,Icon,IconButton,ResourceRow,StatusBadge,Window} from '@nodedc/ui-react'; +import {useState} from 'react'; +import {useBoardNetwork} from '../../core/fleet/useBoardNetwork'; +import {BoardNetworkSettings} from './BoardNetworkSettings'; +import {Button,Icon,IconButton,ResourceRow,StatusBadge,FeatureSettingsWindow,WindowFooterActions} from '@nodedc/ui-react'; import type {Vehicle} from '../../core/fleet/useFleet'; export const boardStatus=(item:Vehicle,available=true)=>item.enrollment==='pending'?'Подтверждаем привязку':item.enrollment==='revoked'?'Не привязан':item.enrollment==='failed'?'Привязка не завершена':item.connectivity==='online'?(available?'В сети':'Не в сети'):'Не в сети'; @@ -9,13 +12,19 @@ export function BoardComputerRow({vehicle,enabled,showingSavedDevices,onSettings actions={<>{onAdd&&}}/>; } export function BoardComputerSettings({vehicle,enabled,onClose,onRevoke}:{vehicle:Vehicle;enabled:boolean;onClose:()=>void;onRevoke:()=>void}){ - return + const [section,setSection]=useState('binding'); + const network=useBoardNetwork(vehicle.id); + return {section==='network'&&}}> + {section==='network'?:
{boardStatus(vehicle,enabled)} {vehicle.notice&&

{vehicle.notice}

}
Идентификатор БК
{vehicle.node_id}
Последняя связь
{vehicle.last_seen?new Date(vehicle.last_seen*1000).toLocaleString('ru-RU'):'Соединение ещё не получено'}
{vehicle.host&&<>
Имя БК в системе
{vehicle.host.hostname}
Операционная система
{vehicle.host.os}
Архитектура
{vehicle.host.architecture}
Процессоры
{vehicle.host.cpus}
Память
{vehicle.host.memory_kib?`${(vehicle.host.memory_kib/1048576).toFixed(1)} ГиБ`:'Нет сведений'}
}
{vehicle.enrollment!=='revoked'&&} -
-
; +
} + ; } diff --git a/apps/control-station/src/workspaces/fleet/VehicleEquipment.tsx b/apps/control-station/src/workspaces/fleet/VehicleEquipment.tsx index b9379840..46631fe8 100644 --- a/apps/control-station/src/workspaces/fleet/VehicleEquipment.tsx +++ b/apps/control-station/src/workspaces/fleet/VehicleEquipment.tsx @@ -1,30 +1,22 @@ import {useEffect,useSyncExternalStore} from 'react'; -import {Button,Icon,Inspector,LoadingRegion} from '@nodedc/ui-react'; +import {Button,LoadingRegion} from '@nodedc/ui-react'; import type {BoardLayoutStore} from '../../../../../packages/sensor-ui/src/boardLayout'; import type {SensorBoardContent} from '../../../../../packages/sensor-ui/src/SensorWorkspace'; import type {Vehicle} from '../../core/fleet/useFleet'; -import {VehicleIdentitySettings} from './VehicleIdentitySettings'; import {BoardComputerRow} from './BoardComputer'; import {IndependentEquipment} from './equipment/IndependentEquipment'; -export function VehicleEquipment({vehicle,enabled,layout,content,onAddComputer,onSettings,onMonitor,onUpdated}:{vehicle:Vehicle;enabled:boolean;layout:BoardLayoutStore;content:SensorBoardContent;onAddComputer:()=>void;onSettings:()=>void;onMonitor:()=>void;onUpdated:(vehicle:Vehicle)=>void}){ +export function VehicleEquipment({vehicle,enabled,layout,content,actionsTarget,onAddComputer,onSettings,onMonitor}:{vehicle:Vehicle;enabled:boolean;layout:BoardLayoutStore;content:SensorBoardContent;actionsTarget?:HTMLElement|null;onAddComputer:()=>void;onSettings:()=>void;onMonitor:()=>void}){ const state=useSyncExternalStore(layout.subscribe,layout.getSnapshot); useEffect(()=>{void layout.load();},[layout]); const computerOpen=state.value.open_sections.includes('computer'); - // The former computer-section preference now controls its nested device branch. - const changeSections=(ids:string[])=>layout.change([...ids,...(computerOpen?['computer']:[])]); const toggleComputer=()=>layout.change(computerOpen?state.value.open_sections.filter(id=>id!=='computer'):[...state.value.open_sections,'computer']); return
{state.error&&

{state.error}

} - - id!=='computer')} onOpenSectionsChange={changeSections} sections={[ - {id:'settings',label:'Настройки аппарата',icon:,disabled:!state.ready,content:
{content.settings}
}, - {id:'devices',label:'Оборудование',icon:,disabled:!state.ready,content:
- void content.refresh()} computer={
- {computerOpen&&
{content.devices}
} -
}/> -
}, - ]}/> + + void content.refresh()} computer={
+ {computerOpen&&
{content.devices}
} +
}/>
; } diff --git a/apps/control-station/src/workspaces/fleet/VehicleFleetRow.tsx b/apps/control-station/src/workspaces/fleet/VehicleFleetRow.tsx new file mode 100644 index 00000000..1249c599 --- /dev/null +++ b/apps/control-station/src/workspaces/fleet/VehicleFleetRow.tsx @@ -0,0 +1,25 @@ +import {useId,useState} from 'react'; +import {Icon,IconButton,ResourceRow,StatusBadge,Window} from '@nodedc/ui-react'; +import type {Vehicle} from '../../core/fleet/useFleet'; +import {boardStatus} from './BoardComputer'; +import {platformLabel} from './NodeInvitationForm'; +import {VehicleSensors} from './VehicleSensors'; + +export function VehicleFleetRow({vehicle,available,expanded,onToggle,onObserve,onAddComputer,onBoardSettings,onMonitor,onUpdated}:{vehicle:Vehicle;available:boolean;expanded:boolean;onToggle:()=>void;onObserve:()=>void;onAddComputer:()=>void;onBoardSettings:()=>void;onMonitor:()=>void;onUpdated:(vehicle:Vehicle)=>void}){ + const [settingsOpen,setSettingsOpen]=useState(false); + const [equipmentActionsTarget,setEquipmentActionsTarget]=useState(null); + const branchID=useId(); + const enabled=available&&vehicle.enrollment==='paired'&&vehicle.connectivity==='online'; + const label=available?boardStatus(vehicle):'Нет свежих данных'; + const sensors={vehicle,enabled,onAddComputer,onSettings:onBoardSettings,onMonitor,onUpdated}; + return
  • + } title={vehicle.name} description={platformLabel(vehicle.platform)} metadata={label} statusPlacement="leading" status={} actions={<> + {expanded&&!settingsOpen&&} + setSettingsOpen(true)}> + + + }/> + {expanded&&!settingsOpen&&
    } + {settingsOpen&&setSettingsOpen(false)}>} +
  • ; +} diff --git a/apps/control-station/src/workspaces/fleet/VehicleSensors.tsx b/apps/control-station/src/workspaces/fleet/VehicleSensors.tsx index ee571fe6..c26af4d7 100644 --- a/apps/control-station/src/workspaces/fleet/VehicleSensors.tsx +++ b/apps/control-station/src/workspaces/fleet/VehicleSensors.tsx @@ -6,11 +6,12 @@ import {SensorWorkspace} from '../../../../../packages/sensor-ui/src/SensorWorks import {createFleetSensorTransport} from '../../core/fleet/sensorTransport'; import type {Vehicle} from '../../core/fleet/useFleet'; import {VehicleEquipment} from './VehicleEquipment'; -export function VehicleSensors({vehicle,enabled,onAddComputer,onSettings,onMonitor,onUpdated}:{vehicle:Vehicle;enabled:boolean;onAddComputer:()=>void;onSettings:()=>void;onMonitor:()=>void;onUpdated:(vehicle:Vehicle)=>void}){ +import {VehicleIdentitySettings} from './VehicleIdentitySettings'; +export function VehicleSensors({vehicle,enabled,mode='equipment',equipmentActionsTarget,onAddComputer,onSettings,onMonitor,onUpdated}:{vehicle:Vehicle;enabled:boolean;mode?:'equipment'|'settings';equipmentActionsTarget?:HTMLElement|null;onAddComputer:()=>void;onSettings:()=>void;onMonitor:()=>void;onUpdated:(vehicle:Vehicle)=>void}){ const vehicleID=vehicle.id; const {registry}=useDevicePluginHost(); const sensorContributions=registry.sensorContributions; const layout=useMemo(()=>boardLayout(vehicleID),[vehicleID]); const transport=useMemo(()=>createFleetSensorTransport(vehicleID),[vehicleID]); - return }/>; + return mode==='settings'?
    {content.settings}
    :}/>; } diff --git a/apps/control-station/src/workspaces/fleet/VehiclesWorkspace.tsx b/apps/control-station/src/workspaces/fleet/VehiclesWorkspace.tsx index 41a02afa..379e01ed 100644 --- a/apps/control-station/src/workspaces/fleet/VehiclesWorkspace.tsx +++ b/apps/control-station/src/workspaces/fleet/VehiclesWorkspace.tsx @@ -1,40 +1,38 @@ import {useState} from 'react'; import {createPortal} from 'react-dom'; -import {LoadingRegion,ConfirmationModal,Icon,IconButton,ResourceList,ResourceRow,SettingsCard,StatusBadge,ToastStack,Window,WindowFooterActions} from '@nodedc/ui-react'; -import {WorkspaceBackButton} from '../../components/WorkspaceBackButton'; +import {LoadingRegion,ConfirmationModal,Icon,IconButton,ResourceList,SettingsCard,ToastStack,Window,WindowFooterActions} from '@nodedc/ui-react'; import {fleetRequest,useFleet,type Vehicle} from '../../core/fleet/useFleet'; import {BoardObservationCenter} from './observation/BoardObservationCenter'; import {BoardMonitorView} from './BoardMonitorView'; -import {VehicleSensors} from './VehicleSensors'; -import {BoardComputerSettings,boardStatus} from './BoardComputer'; +import {BoardComputerSettings} from './BoardComputer'; import {NodeInvitationForm,platformLabel} from './NodeInvitationForm'; +import {VehicleFleetRow} from './VehicleFleetRow'; import './fleet.css'; export function VehiclesWorkspace({headerToolsHost,headerTitleHost}:{headerToolsHost?:HTMLElement|null;headerTitleHost?:HTMLElement|null}){ const fleet=useFleet(); - const [selected,setSelected]=useState(null); - const [adding,setAdding]=useState(false),[monitorOpen,setMonitorOpen]=useState(false),[observationOpen,setObservationOpen]=useState(false),[settingsOpen,setSettingsOpen]=useState(false); + const [view,setView]=useState<{vehicleID:string;mode:'observation'|'monitor'}|null>(null); + const [expanded,setExpanded]=useState([]); + const [adding,setAdding]=useState(); + const [boardSettings,setBoardSettings]=useState(null); const [revoking,setRevoking]=useState(null),[error,setError]=useState(''); - const detail=fleet.items?.find(item=>item.id===selected); - const enabled=!!detail&&!fleet.error&&detail.enrollment==='paired'&&detail.connectivity==='online'; + const detail=fleet.items?.find(item=>item.id===view?.vehicleID); + const settingsVehicle=fleet.items?.find(item=>item.id===boardSettings); + const enabled=(item:Vehicle)=>!fleet.error&&item.enrollment==='paired'&&item.connectivity==='online'; const refresh=()=>{void fleet.refresh().catch(()=>setError('Не удалось обновить аппарат. Повторите получение сведений.'));}; - const complete=(item:Vehicle)=>{setSelected(item.id);setAdding(false);refresh();}; - const addButton=setAdding(true)}>; + const showEquipment=(id:string)=>{setExpanded(current=>current.includes(id)?current:[...current,id]);setView(null);}; + const complete=(item:Vehicle)=>{setAdding(undefined);showEquipment(item.id);refresh();}; + const addButton=setAdding(null)}>; const headerAdd=!detail&&(headerToolsHost?createPortal(addButton,headerToolsHost):addButton); const titleSuffix=detail?` — ${detail.name} / ${platformLabel(detail.platform)}`:''; - const observationButton=setObservationOpen(true)}>; - const headerObservation=detail&&!observationOpen&&!monitorOpen&&(headerToolsHost?createPortal(observationButton,headerToolsHost):observationButton); - const content=detail&&observationOpen?{setObservationOpen(false);setSelected(null);}} configure={()=>setObservationOpen(false)} headerToolsHost={headerToolsHost}/> - :detail&&monitorOpen?setMonitorOpen(false)} headerToolsHost={headerToolsHost}/> + const content=detail&&view?.mode==='observation'?setView(null)} configure={()=>showEquipment(detail.id)} headerToolsHost={headerToolsHost}/> + :detail&&view?.mode==='monitor'?showEquipment(detail.id)} headerToolsHost={headerToolsHost}/> :
    - {detail?<> - setSelected(null)} host={headerToolsHost}/> - setAdding(true)} onSettings={()=>setSettingsOpen(true)} onMonitor={()=>setMonitorOpen(true)}/> - :!fleet.items?:fleet.items.length===0?:{fleet.items.map(item=>
  • } title={item.name} description={platformLabel(item.platform)} status={{fleet.error?'Нет свежих данных':`БК: ${boardStatus(item)}`}} actions={<>setSelected(item.id)}>{setSelected(item.id);setObservationOpen(true);}}>}/>
  • )}
    } + {!fleet.items?:fleet.items.length===0?:{fleet.items.map(item=>setExpanded(current=>current.includes(item.id)?current.filter(id=>id!==item.id):[...current,item.id])} onObserve={()=>setView({vehicleID:item.id,mode:'observation'})} onAddComputer={()=>setAdding(item)} onBoardSettings={()=>setBoardSettings(item.id)} onMonitor={()=>setView({vehicleID:item.id,mode:'monitor'})} onUpdated={fleet.acceptVehicle}/>)}}
    ; - return <>{headerTitleHost&&createPortal(titleSuffix,headerTitleHost)}{headerAdd}{headerObservation}{content} - {adding&&setAdding(false)} onComplete={complete} renderWindow={({content,actions,busy})=>{if(!busy)setAdding(false);}} footer={{actions}}>{content}}/>} - {settingsOpen&&detail&&setSettingsOpen(false)} onRevoke={()=>{setSettingsOpen(false);setRevoking(detail);}}/>} + return <>{headerTitleHost&&createPortal(titleSuffix,headerTitleHost)}{headerAdd}{content} + {adding!==undefined&&setAdding(undefined)} onComplete={complete} renderWindow={({content,actions,busy})=>{if(!busy)setAdding(undefined);}} footer={{actions}}>{content}}/>} + {settingsVehicle&&setBoardSettings(null)} onRevoke={()=>{setBoardSettings(null);setRevoking(settingsVehicle);}}/>} setRevoking(null)} onConfirm={async()=>{if(!revoking)return;try{await fleetRequest(`/${encodeURIComponent(revoking.id)}`,'DELETE');await fleet.refresh();setRevoking(null);}catch(e){setError(e instanceof Error?e.message:'Не удалось отозвать привязку.');throw e;}}}/> setError('')}/> ; diff --git a/apps/control-station/src/workspaces/fleet/equipment/IndependentEquipment.tsx b/apps/control-station/src/workspaces/fleet/equipment/IndependentEquipment.tsx index ed1417eb..3c0a7b32 100644 --- a/apps/control-station/src/workspaces/fleet/equipment/IndependentEquipment.tsx +++ b/apps/control-station/src/workspaces/fleet/equipment/IndependentEquipment.tsx @@ -1,4 +1,5 @@ import {useCallback,useEffect,useState,type ReactNode} from 'react'; +import {createPortal} from 'react-dom'; import {Button,Icon,IconButton,LoadingRegion,ResourceList,ResourceRow,StatusBadge,ToastStack} from '@nodedc/ui-react'; import {equipmentRequest,type EquipmentModel,type EquipmentProfile,type IndependentDevice} from '../../../core/fleet/equipment'; import {fleetRequest,type Vehicle} from '../../../core/fleet/useFleet'; @@ -7,9 +8,10 @@ import {EquipmentSettings} from './EquipmentSettings'; import {EquipmentCommandWindow} from './EquipmentCommandWindow'; import {hostOnline,telemetryLabel,useTrackerTelemetry,vpsRequest,type VPSHost} from '../../../core/fleet/vps'; import {VPSHostSettings} from './VPSHostSettings'; +import {VehicleRouter} from '../router/VehicleRouter'; import './equipment.css'; -export function IndependentEquipment({vehicle,computer,onRefresh}:{vehicle:Vehicle;computer:ReactNode;onComputer:()=>void;onRefresh:()=>void}){ +export function IndependentEquipment({vehicle,computer,onRefresh,actionsTarget}:{vehicle:Vehicle;computer:ReactNode;onComputer:()=>void;onRefresh:()=>void;actionsTarget?:HTMLElement|null}){ const [devices,setDevices]=useState(null),[models,setModels]=useState([]),[profiles,setProfiles]=useState([]),[vehicles,setVehicles]=useState([]); const [hosts,setHosts]=useState([]),[vpsOpen,setVpsOpen]=useState(false),[selectedHost,setSelectedHost]=useState(); const telemetry=useTrackerTelemetry(vehicle.id); @@ -25,16 +27,19 @@ export function IndependentEquipment({vehicle,computer,onRefresh}:{vehicle:Vehic const [commandDevice,setCommandDevice]=useState(null); const model=selected&&models.find(m=>m.id===selected.model_id); const selectedTelemetry=telemetry.items.find(t=>t.instance_id===selected?.id); - return <> -
    Бортовой компьютер и независимые устройства
    setAdding(true)}>{reload();onRefresh();}}>
    + const vehicleHosts=hosts.filter(h=>h.vehicle_ids.includes(vehicle.id)); + const actions=<>setAdding(true)}>{reload();onRefresh();}}>; + return
    + {actionsTarget===undefined?
    Бортовой компьютер и независимые устройства
    {actions}
    :actionsTarget?createPortal(actions,actionsTarget):null} {computer} - {!devices?:{devices.map(device=>
  • } title={device.name} description={`${models.find(m=>m.id===device.model_id)?.label??device.model_id} · IMEI …${device.observed.imei_suffix}`} metadata={telemetry.unavailable?'Связь с сервером не проверена':telemetryLabel(telemetry.items.find(t=>t.instance_id===device.id))} statusPlacement="leading" status={t.instance_id===device.id)?.online?'success':'neutral'} aria-label={telemetryLabel(telemetry.items.find(t=>t.instance_id===device.id))}/>} actions={<>setCommandDevice(device)}>setSelected(device)}>}/>
  • )}
    } - {hosts.filter(h=>h.vehicle_ids.includes(vehicle.id)).map(host=>
  • } title={host.name} description="VPS Host ARNavi" metadata={`${host.endpoint} · Аппаратов: ${host.vehicle_ids.length}`} statusPlacement="leading" status={} actions={{setSelectedHost(host);setVpsOpen(true);}}>}/>
  • )}
    + + {!devices?:devices.length>0?{devices.map(device=>
  • } title={device.name} description={`${models.find(m=>m.id===device.model_id)?.label??device.model_id} · IMEI …${device.observed.imei_suffix}`} metadata={telemetry.unavailable?'Связь с сервером не проверена':telemetryLabel(telemetry.items.find(t=>t.instance_id===device.id))} statusPlacement="leading" status={t.instance_id===device.id)?.online?'success':'neutral'} aria-label={telemetryLabel(telemetry.items.find(t=>t.instance_id===device.id))}/>} actions={<>setCommandDevice(device)}>setSelected(device)}>}/>
  • )}
    :null} + {vehicleHosts.length>0&&{vehicleHosts.map(host=>
  • } title={host.name} description="VPS Host ARNavi" metadata={`${host.endpoint} · Аппаратов: ${host.vehicle_ids.length}`} statusPlacement="leading" status={} actions={{setSelectedHost(host);setVpsOpen(true);}}>}/>
  • )}
    } {vpsOpen&&h.id===selectedHost?.id)} hosts={hosts} vehicle={vehicle} vehicles={vehicles} onClose={()=>setVpsOpen(false)} onSaved={()=>{setVpsOpen(false);reload();}}/>} {error&&!devices&&} {adding&&setAdding(false)} onComputer={()=>{setAdding(false);onRefresh();}} onVPS={()=>{setAdding(false);reload();}} onAdded={item=>{setAdding(false);if(item.vehicle_id===vehicle.id)setSelected(item);reload();}}/>} {selected&&model&&setSelected(null)} onObserved={observe} onProfile={reload} onCommands={()=>{setCommandDevice(selected);setSelected(null);}}/>} {commandDevice&&t.instance_id===commandDevice.id)} onClose={()=>{setCommandDevice(null);reload();}}/>} setError('')}/> - ; +
    ; } diff --git a/apps/control-station/src/workspaces/fleet/equipment/InstallerCard.tsx b/apps/control-station/src/workspaces/fleet/equipment/InstallerCard.tsx index ef88624f..0b0bdb14 100644 --- a/apps/control-station/src/workspaces/fleet/equipment/InstallerCard.tsx +++ b/apps/control-station/src/workspaces/fleet/equipment/InstallerCard.tsx @@ -2,7 +2,7 @@ import {Fragment,useEffect,useState} from 'react'; import {Button,Icon,SettingsCard} from '@nodedc/ui-react'; type Installer={id:string;label:string;version:string;os:string;filename:string;download_url:string;instructions:string[]}; -export function InstallerCard({kind}:{kind:'node'|'vps-arnavi'}){ +export function InstallerCard({kind}:{kind:'node'|'vps-arnavi'|'vps-wireguard'}){ const [item,setItem]=useState(null),[failed,setFailed]=useState(false); useEffect(()=>{let active=true;void fetch('/api/v1/fleet/installers',{cache:'no-store'}).then(async r=>{if(!r.ok)throw Error();return r.json() as Promise<{items:Installer[]}>;}).then(v=>{if(active){setItem(v.items.find(i=>i.id===kind)??null);setFailed(!v.items.some(i=>i.id===kind));}}).catch(()=>{if(active)setFailed(true);});return()=>{active=false;};},[kind]); return {`${item.label} ${item.version} · Только ${item.os}`}

    {item.instructions.map((step,index)=>{index>0&&
    }{index+1}. {step}
    )}:failed?'Установщик пока недоступен в этом Mission Core.':'Получение установщика…'}> diff --git a/apps/control-station/src/workspaces/fleet/fleet.css b/apps/control-station/src/workspaces/fleet/fleet.css index b0b21afc..8debf541 100644 --- a/apps/control-station/src/workspaces/fleet/fleet.css +++ b/apps/control-station/src/workspaces/fleet/fleet.css @@ -13,5 +13,9 @@ .fleet-board-actions { display:flex; gap:var(--nodedc-space-3); } .fleet-board-actions > * { flex:1; } .fleet-computer-devices { padding-block-start:var(--nodedc-space-4); padding-inline-start:var(--nodedc-space-4); display:grid; gap:var(--nodedc-space-4); } +.fleet-vehicle-equipment { padding-block-start:var(--nodedc-space-4); padding-inline-start:var(--nodedc-space-4); } +.fleet-equipment-tree { display:grid; gap:var(--nodedc-space-4); min-width:0; } +.fleet-equipment-actions { display:contents; } +.fleet-vehicle-equipment .nodedc-resource-list { gap:var(--nodedc-space-4); } .fleet-form p { font-size:var(--nodedc-font-size-sm); line-height:1.5; color:var(--nodedc-text-secondary); } @media(max-width:600px) { .fleet-board-actions { flex-wrap:wrap; } } diff --git a/apps/control-station/test/workspaceLaunch.test.mjs b/apps/control-station/test/workspaceLaunch.test.mjs index 80504be9..d0bc9399 100644 --- a/apps/control-station/test/workspaceLaunch.test.mjs +++ b/apps/control-station/test/workspaceLaunch.test.mjs @@ -3,7 +3,7 @@ import React, {createElement} from 'react'; import {renderToStaticMarkup} from 'react-dom/server'; import {readFileSync} from 'node:fs'; import {before, after, test} from 'node:test'; -import {createServer} from 'vite'; +import {createServer} from './support/vite-server.mjs'; let server, resolve, awaitsCapture, Guard, Provider, Device, Host; before(async () => { @@ -104,3 +104,32 @@ test('composition owns explicit profile propagation; server polling cannot resto assert.match(source('workspaces/missions/MissionPlannerWorkspace.tsx'),/openView\('local-device','planning'\)/); assert.match(source('workspaces/missions/MissionPlannerWorkspace.tsx'),/if\(await live.select\(project.id\)\)openView/); }); + + +test('global planning poll requests compact status and still updates capture ownership', async () => { + const effects = [], writes = [], requests = []; + const originalFetch = globalThis.fetch; + const status = {schema_version:'missioncore.planning-live-status/v1', state:'waiting', query_session_id:null}; + const cleanups = []; + try { + globalThis.fetch = async url => { + requests.push(url); + return new Response(JSON.stringify(url.endsWith('/status') ? status : {items:[]})); + }; + withHooks({ + useState:initial=>[typeof initial==='function'?initial():initial,value=>writes.push(value)], + useRef:value=>({current:value}), useCallback:fn=>fn, useEffect:fn=>effects.push(fn), + }, () => Provider({children:null})); + for (const effect of effects) cleanups.push(effect()); + await new Promise(resolve=>setImmediate(resolve)); + assert.ok(requests.includes('/api/v1/mission-planner/live-tests/status')); + assert.ok(!requests.some(url=>url.endsWith('/active'))); + const received=writes.find(value=>value?.schema_version===status.schema_version); + assert.ok(received); + assert.equal(awaitsCapture(received),true); + assert.equal(awaitsCapture({...received,state:'completed'}),false); + } finally { + for (const cleanup of cleanups) cleanup?.(); + globalThis.fetch=originalFetch; + } +}); diff --git a/docs/17_PRODUCT_UI_AND_LAB_PRESENTATION_CANON.md b/docs/17_PRODUCT_UI_AND_LAB_PRESENTATION_CANON.md index e13153c3..99540ba7 100644 --- a/docs/17_PRODUCT_UI_AND_LAB_PRESENTATION_CANON.md +++ b/docs/17_PRODUCT_UI_AND_LAB_PRESENTATION_CANON.md @@ -352,3 +352,23 @@ uses success. Missing/stale data or failure must say so, never imply endless active synchronization. Status follows real lifecycle responses, not a timer that pretends completion. This is an application-wide interaction requirement; other equipment workflows need their own lifecycle verification. + +## Viewport control canon — owner revision, 2026-10-16 + +All viewer action groups consume Design Guideline `nodedc-viewport-controls` +(or its opaque imagery variant `nodedc-scene-controls`). The shared scale is +70% of standard controls; local control heights, fonts and compact/dense +variants must not create different viewport sizes. Settings and application +navigation retain normal density. Vertical clipping rails use the shared +half-width RangeControl with independently moving lower and upper bounds. + +Mission Core content panels always use the full available workspace width. +There is no content-panel expand/collapse toggle and no landing-page video +mounted behind an active workspace. Closing the workspace still returns to +the landing page. True viewer fullscreen and its Escape action remain. + +The shared vertical RangeControl accepts a [lower, upper] band. Both boundaries +filter display geometry independently; endpoint positions disable the corresponding +plane. Gaussian, collision picking, infrastructure, saved overview and live +planning use the same band semantics. This never edits source geometry, tracking +inputs, simulation results or route authority.