@@ -24,21 +24,16 @@ import { readableBytes } from "./utils"
2424export default function SelectFlightLog ( { getLogSummary } ) {
2525 const dispatch = useDispatch ( )
2626 const connected = useSelector ( selectConnectedToDrone )
27- const [ recentFgcsLogs , setRecentFgcsLogs ] = useState ( null )
27+ const [ recentLogs , setRecentLogs ] = useState ( null )
2828 const [ loadingFile , setLoadingFile ] = useState ( false )
2929 const [ loadingFileProgress , setLoadingFileProgress ] = useState ( 0 )
3030 const [
3131 downloadModalOpened ,
3232 { open : openDownloadModal , close : closeDownloadModal } ,
3333 ] = useDisclosure ( false )
3434
35- async function getFgcsLogs ( ) {
36- setRecentFgcsLogs ( await window . ipcRenderer . invoke ( "fla:get-recent-logs" ) )
37- }
38-
39- async function clearFgcsLogs ( ) {
40- await window . ipcRenderer . invoke ( "fla:clear-recent-logs" )
41- getFgcsLogs ( )
35+ async function getRecentLogs ( ) {
36+ setRecentLogs ( await window . ipcRenderer . invoke ( "fla:get-recent-logs" ) )
4237 }
4338
4439 const selectFile = async ( ) => {
@@ -101,15 +96,15 @@ export default function SelectFlightLog({ getLogSummary }) {
10196 const onProgress = ( _event , message ) =>
10297 setLoadingFileProgress ( message . percent )
10398 window . ipcRenderer . on ( "fla:log-parse-progress" , onProgress )
104- getFgcsLogs ( )
99+ getRecentLogs ( )
105100 return ( ) => {
106101 window . ipcRenderer . removeAllListeners ( "fla:log-parse-progress" )
107102 }
108103 } , [ ] )
109104
110105 const recentLogItems = useMemo ( ( ) => {
111- if ( ! recentFgcsLogs ) return null
112- return recentFgcsLogs . map ( ( log , idx ) => (
106+ if ( ! recentLogs ) return null
107+ return recentLogs . map ( ( log , idx ) => (
113108 < div
114109 key = { idx }
115110 className = "flex flex-col px-4 py-2 hover:cursor-pointer hover:bg-falcongrey-600 hover:rounded-sm"
@@ -127,14 +122,14 @@ export default function SelectFlightLog({ getLogSummary }) {
127122 </ div >
128123 </ div >
129124 ) )
130- } , [ recentFgcsLogs , handleFile ] )
125+ } , [ recentLogs , handleFile ] )
131126
132127 const logsExist = useMemo ( ( ) => {
133128 return (
134129 recentLogItems === null ||
135- ( recentFgcsLogs !== null && recentLogItems . length === 0 )
130+ ( recentLogs !== null && recentLogItems . length === 0 )
136131 )
137- } , [ recentLogItems , recentFgcsLogs ] )
132+ } , [ recentLogItems , recentLogs ] )
138133
139134 return (
140135 < div className = "flex flex-col items-center justify-center h-full mx-auto" >
@@ -148,20 +143,12 @@ export default function SelectFlightLog({ getLogSummary }) {
148143 Download from Drone
149144 </ Button >
150145 ) }
151- < Button
152- disabled = { logsExist }
153- color = "red"
154- variant = "filled"
155- onClick = { clearFgcsLogs }
156- >
157- Clear Logs
158- </ Button >
159146 </ div >
160147 < Divider size = "xs" orientation = "vertical" />
161148 < div className = "relative" >
162- < LoadingOverlay visible = { recentFgcsLogs === null || loadingFile } />
149+ < LoadingOverlay visible = { recentLogs === null || loadingFile } />
163150 < div className = "flex flex-col items-center gap-2" >
164- < p className = "font-bold" > Recent FGCS telemetry logs</ p >
151+ < p className = "font-bold" > Recent logs</ p >
165152 < ScrollArea . Autosize
166153 className = "relative"
167154 type = "always"
0 commit comments