@@ -7,61 +7,11 @@ import { TopAppBar } from '../components/TopAppBar'
77import { Select } from '../components/Select'
88import { BackButton } from '../components/BackButton'
99import { useLocation , useSearchParams } from 'react-router-dom'
10- import { z } from 'zod'
1110import { Toggle } from '../components/Toggle'
1211import { FILE_INFO } from '../components/RouteFiles'
12+ import { capitalize } from '../utils/helpers'
13+ import { Service } from '../types'
1314
14- const LogEvent = z . enum ( [
15- 'Sentinel' ,
16- 'AndroidLog' ,
17- 'Can' ,
18- 'DeviceState' ,
19- 'ErrorLogMessage' ,
20- 'LogMessage' ,
21- 'ManagerState' ,
22- 'PandaStates' ,
23- 'PeripheralState' ,
24- 'ProcLog' ,
25- 'UiDebug' ,
26- 'Accelerometer' ,
27- 'Gyroscope' ,
28- 'Magnetometer' ,
29- 'TemperatureSensor' ,
30- 'Clocks' ,
31- 'SoundPressure' ,
32- 'DriverCameraState' ,
33- 'WideRoadCameraState' ,
34- 'RoadCameraState' ,
35- 'DriverEncodeIdx' ,
36- 'RoadEncodeIdx' ,
37- 'WideRoadEncodeIdx' ,
38- 'QcomGnss' ,
39- 'CarOutput' ,
40- 'CarParams' ,
41- 'CarState' ,
42- 'SelfdriveState' ,
43- 'LiveCalibration' ,
44- 'OnroadEvents' ,
45- 'LiveTracks' ,
46- 'CarControl' ,
47- 'ControlsState' ,
48- 'LiveTorqueParameters' ,
49- 'LiveDelay' ,
50- 'RadarState' ,
51- 'ModelV2' ,
52- 'CameraOdometry' ,
53- 'DrivingModelData' ,
54- 'LivePose' ,
55- 'LongitudinalPlan' ,
56- 'DriverAssistance' ,
57- 'LiveParameters' ,
58- 'DriverStateV2' ,
59- 'DriverMonitoringState' ,
60- 'Sendcan' ,
61- 'Thumbnail' ,
62- 'GpsLocation' ,
63- ] )
64- type LogEvent = z . infer < typeof LogEvent >
6515
6616const SyntaxHighlightedJson = ( { json } : { json : string } ) => {
6717 if ( ! json ) return null
@@ -115,7 +65,7 @@ export const Component = () => {
11565 const type : 'qlogs' | 'logs' = location . pathname . includes ( 'qlogs' ) ? 'qlogs' : 'logs'
11666
11767 const segment = Number ( params . get ( 'segment' ) ) || 0
118- const eventName = ( params . get ( 'eventName' ) as LogEvent ) || 'CarState '
68+ const eventName : Service = ( params . get ( 'eventName' ) as Service ) || 'carState '
11969 const limit = Number ( params . get ( 'limit' ) ) || 10
12070 const prettify = params . get ( 'prettify' ) !== 'false'
12171
@@ -136,11 +86,11 @@ export const Component = () => {
13686 let count = 0
13787 const data = [ ]
13888 for await ( const event of reader ) {
139- if ( ! ( eventName in event ) ) continue
89+ if ( ! ( capitalize ( eventName ) in event ) ) continue
14090 if ( count >= limit ) break
14191 console . log ( )
14292 const LogMonoTime = Number ( new BigUint64Array ( event . LogMonoTime . buffer . buffer ) . at ( 0 ) ! / 1_000_000n )
143- data . push ( { LogMonoTime, ...event [ eventName ] } )
93+ data . push ( { LogMonoTime, ...event [ capitalize ( eventName ) ] } )
14494
14595 count ++
14696 }
@@ -177,7 +127,7 @@ export const Component = () => {
177127 < Select
178128 value = { eventName }
179129 onChange = { ( value ) => updateParam ( 'eventName' , value ) }
180- options = { LogEvent . options . map ( ( x ) => ( { value : x , label : x } ) ) }
130+ options = { Service . options . map ( ( x ) => ( { value : x , label : x } ) ) }
181131 className = "min-w-[200px]"
182132 />
183133
0 commit comments