@@ -1,5 +1,6 @@
import { usbCanSensorUi } from '../../../../plugins/usb-can/frontend/src/plugin' ;
import { vescSensorUi } from '../../../../plugins/vesc/frontend/src/plugin' ;
import { jkBmsSensorUi } from '../../../../plugins/jk-bms/frontend/src/plugin' ;
import { xgridsK1SensorUi } from '../../../../plugins/xgrids-k1/frontend/src/sensors/plugin' ;
import { insta360X4SensorUi } from '../../../../plugins/insta360-x4/frontend/src/plugin' ;
import { createIsolatedRerunHost } from '../../../control-station/src/components/rerun/isolatedRerunHost' ;
@@ -12,4 +13,4 @@ import {createBoardLayoutStore} from '../../../../packages/sensor-ui/src/boardLa
const layout = createBoardLayoutStore ( { read : ( ) = > request ( '/api/presentation/board-layout' ) , patch : ( section , open ) = > request ( '/api/presentation/board-layout' , 'PATCH' , { section , open } ) } ) ;
const configurationArchive :NonNullable < SensorTransport [ 'configurationArchive' ] > = { list : ( device , before ) = > request ( ` /api/device-configurations/ ${ encodeURIComponent ( device ) } ${ before ? '?before=' + encodeURIComponent ( before ) : '' } ` ) , read : ( device , version ) = > request ( ` /api/device-configurations/ ${ encodeURIComponent ( device ) } / ${ encodeURIComponent ( version ) } ` ) } ;
const transport :SensorTransport = { liveTelemetry :signal = > request ( '/api/devices/telemetry' , 'GET' , undefined , signal ) , configurationArchive , localPreview : { open : ( command , signal ) = > fetch ( "/api/devices/preview" , { method : "POST" , credentials : "same-origin" , headers : { "Content-Type" : "application/json" } , body :JSON.stringify ( command ) , signal } ) , read : ( peer , after , signal ) = > fetch ( "/api/devices/preview/read" , { method : "POST" , credentials : "same-origin" , headers : { "Content-Type" : "application/json" } , body :JSON.stringify ( { peer_id :peer , after } ) , signal } ) } , enrollment : { state : ( ) = > request ( "/api/devices/enrollment" ) , submit :value = > request ( "/api/devices/enrollment/operations" , "POST" , value ) , operation :id = > request ( "/api/devices/enrollment/operations/" + encodeURIComponent ( id ) ) } , subscribe : ( receive , unavailable ) = > { const events = new EventSource ( '/api/devices/events' ) ; events . onmessage = e = > { try { receive ( JSON . parse ( e . data ) ) ; } catch { unavailable ( ) ; } } ; events . onerror = unavailable ; return ( ) = > events . close ( ) ; } , inventory :signal = > request ( '/api/devices' , 'GET' , undefined , signal ) , submit :value = > request ( '/api/devices/operations' , 'POST' , value ) , operation :id = > request ( '/api/devices/operations/' + encodeURIComponent ( id ) ) } ;
export function NodeSensors ( { value , openSettings } : { value :Status ; openSettings : ( ) = > void } ) { return < div className = "sensor-content" > < NodeRouters / > < SensorWorkspace board = { { layout , description :value.name , computer : < SettingsCard title = { value . name } description = { value . host . hostname } > < dl className = "node-facts" > < div > < dt > Б о р т о в о й к о м п ь ю т е р < / dt > < dd > { value . node_id } < / dd > < / div > < div > < dt > О п е р а ц и о н н а я с и с т е м а < / dt > < dd > { value . host . os } < / dd > < / div > < div > < dt > А р х и т е к т у р а < / dt > < dd > { value . host . architecture } < / dd > < / div > < div > < dt > П р о ц е с с о р ы < / dt > < dd > { value . host . cpus } < / dd > < / div > < div > < dt > П а м я т ь < / dt > < dd > { value . host . memory_kib ? ` ${ ( value . host . memory_kib / 1048576 ) . toFixed ( 1 ) } ГиБ ` : "Нет сведений" } < / dd > < / div > < div > < dt > Mission Core Node < / dt > < dd > { value . version } < / dd > < / div > < / dl > < Button onClick = { openSettings } > < Icon name = "settings" / > П о д г о т о в к а с р е д ы < / Button > < / SettingsCard > } } contributions = { [ xgridsK1SensorUi , insta360X4SensorUi , vescSensorUi , usbCanSensorUi ] } createRerunHost = { createIsolatedRerunHost } transport = { transport } / > < / div > ; }
export function NodeSensors ( { value , openSettings } : { value :Status ; openSettings : ( ) = > void } ) { return < div className = "sensor-content" > < NodeRouters / > < SensorWorkspace board = { { layout , description :value.name , computer : < SettingsCard title = { value . name } description = { value . host . hostname } > < dl className = "node-facts" > < div > < dt > Б о р т о в о й к о м п ь ю т е р < / dt > < dd > { value . node_id } < / dd > < / div > < div > < dt > О п е р а ц и о н н а я с и с т е м а < / dt > < dd > { value . host . os } < / dd > < / div > < div > < dt > А р х и т е к т у р а < / dt > < dd > { value . host . architecture } < / dd > < / div > < div > < dt > П р о ц е с с о р ы < / dt > < dd > { value . host . cpus } < / dd > < / div > < div > < dt > П а м я т ь < / dt > < dd > { value . host . memory_kib ? ` ${ ( value . host . memory_kib / 1048576 ) . toFixed ( 1 ) } ГиБ ` : "Нет сведений" } < / dd > < / div > < div > < dt > Mission Core Node < / dt > < dd > { value . version } < / dd > < / div > < / dl > < Button onClick = { openSettings } > < Icon name = "settings" / > П о д г о т о в к а с р е д ы < / Button > < / SettingsCard > } } contributions = { [ xgridsK1SensorUi , insta360X4SensorUi , vescSensorUi , usbCanSensorUi , jkBmsSensorUi ] } createRerunHost = { createIsolatedRerunHost } transport = { transport } / > < / div > ; }