@@ -5,6 +5,7 @@ import { ApiServiceContext } from '../../services/ApiService.js';
55import { downloadJson } from '../../utils/download.js' ;
66import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
77import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck' ;
8+ import { machine } from '../../services/ApiService.js' ;
89
910const imageUrlToBase64 = async blob => {
1011 return new Promise ( ( onSuccess , onError ) => {
@@ -27,6 +28,7 @@ export function OTA() {
2728 const [ formData , setFormData ] = useState ( { } ) ;
2829 const [ phase , setPhase ] = useState ( 0 ) ;
2930 const [ progress , setProgress ] = useState ( 0 ) ;
31+ const rssi = machine . value . status . rssi ;
3032
3133 const downloadSupportData = useCallback ( async ( ) => {
3234 const settingsResponse = await fetch ( `/api/settings` ) ;
@@ -63,15 +65,15 @@ export function OTA() {
6365 apiService . off ( 'evt:ota-progress' , listenerId ) ;
6466 } ;
6567 } , [ apiService ] ) ;
66-
68+
6769 useEffect ( ( ) => {
6870 const listenerId = apiService . on ( 'evt:history-rebuild-progress' , msg => {
6971 setRebuildProgress ( {
7072 total : msg . total || 0 ,
7173 current : msg . current || 0 ,
72- status : msg . status || ''
74+ status : msg . status || '' ,
7375 } ) ;
74-
76+
7577 if ( msg . status === 'completed' || msg . status === 'error' ) {
7678 setRebuilding ( false ) ;
7779 setRebuilt ( msg . status === 'completed' ) ;
@@ -159,7 +161,7 @@ export function OTA() {
159161 < div className = 'grid grid-cols-1 gap-4 lg:grid-cols-12' >
160162 < Card sm = { 12 } title = 'System Information' >
161163 < div className = 'flex flex-col space-y-4' >
162- < label htmlFor = 'channel' className = 'text-sm font-medium' >
164+ < label htmlFor = 'channel' className = 'mb-2 block text-sm font-medium' >
163165 Update Channel
164166 </ label >
165167 < select id = 'channel' name = 'channel' className = 'select select-bordered w-full' >
@@ -173,15 +175,13 @@ export function OTA() {
173175 </ div >
174176
175177 < div className = 'flex flex-col space-y-4' >
176- < label className = 'text-sm font-medium' > Hardware</ label >
177- < div className = 'input input-bordered bg-base-200 cursor-default break-words whitespace-normal' >
178- { formData . hardware }
179- </ div >
178+ < label className = 'mb-2 block text-sm font-medium' > Hardware</ label >
179+ < span className = 'font-light' > { formData . hardware } </ span >
180180 </ div >
181181
182182 < div className = 'flex flex-col space-y-4' >
183- < label className = 'text-sm font-medium' > Controller Version</ label >
184- < div className = 'input input-bordered bg-base-200 cursor-default break-words whitespace-normal ' >
183+ < label className = 'mb-2 block text-sm font-medium' > Controller Version</ label >
184+ < div className = 'flex flex-row gap-2 font-light ' >
185185 < span className = 'break-all' > { formData . controllerVersion } </ span >
186186 { formData . controllerUpdateAvailable && (
187187 < span className = 'text-primary font-bold break-all' >
@@ -192,8 +192,8 @@ export function OTA() {
192192 </ div >
193193
194194 < div className = 'flex flex-col space-y-4' >
195- < label className = 'text-sm font-medium' > Display Version</ label >
196- < div className = 'input input-bordered bg-base-200 cursor-default break-words whitespace-normal ' >
195+ < label className = 'mb-2 block text-sm font-medium' > Display Version</ label >
196+ < div className = 'flex flex-row gap-2 font-light ' >
197197 < span className = 'break-all' > { formData . displayVersion } </ span >
198198 { formData . displayUpdateAvailable && (
199199 < span className = 'text-primary font-bold break-all' >
@@ -203,9 +203,19 @@ export function OTA() {
203203 </ div >
204204 </ div >
205205
206+ < div className = 'flex flex-col space-y-4' >
207+ < label className = 'mb-2 block text-sm font-medium' > Controller Signal Strength</ label >
208+ < span className = 'font-light' >
209+ { rssi } dB{ ' ' }
210+ < span
211+ className = { `indicator-item status ml-2 ${ rssi < - 90 ? 'status-error' : rssi < - 80 ? 'status-warning' : 'status-success' } ` }
212+ > </ span >
213+ </ span >
214+ </ div >
215+
206216 { formData . spiffsTotal !== undefined && (
207217 < div className = 'flex flex-col space-y-2' >
208- < label className = 'text-sm font-medium' > Storage (SPIFFS)</ label >
218+ < label className = 'mb-2 block text-sm font-medium' > Storage (SPIFFS)</ label >
209219 < div className = 'flex flex-col gap-1' >
210220 < div className = 'bg-base-300 h-3 w-full overflow-hidden rounded' >
211221 < div
@@ -298,25 +308,26 @@ export function OTA() {
298308 ) }
299309 </ button >
300310 </ div >
301-
311+
302312 { rebuilding && (
303313 < div className = 'mt-3' >
304- < div className = 'text-sm text- base-content/70 mb-1' >
305- { rebuildProgress . status === 'starting' || rebuildProgress . status === 'scanning' || rebuildProgress . total === 0 ? (
306- 'Scanning shot history files...'
307- ) : (
308- `Processing shot history files ( ${ rebuildProgress . current } / ${ rebuildProgress . total } )`
309- ) }
314+ < div className = 'text-base-content/70 mb-1 text-sm ' >
315+ { rebuildProgress . status === 'starting' ||
316+ rebuildProgress . status === 'scanning' ||
317+ rebuildProgress . total === 0
318+ ? 'Scanning shot history files...'
319+ : `Processing shot history files ( ${ rebuildProgress . current } / ${ rebuildProgress . total } )` }
310320 </ div >
311321 < div className = 'bg-base-300 h-2 w-full overflow-hidden rounded' >
312322 < div
313323 className = { `h-full transition-all duration-300 ${
314324 rebuildProgress . total === 0 ? 'bg-primary animate-pulse' : 'bg-primary'
315325 } `}
316- style = { {
317- width : rebuildProgress . total > 0
318- ? `${ ( rebuildProgress . current / rebuildProgress . total ) * 100 } %`
319- : '30%'
326+ style = { {
327+ width :
328+ rebuildProgress . total > 0
329+ ? `${ ( rebuildProgress . current / rebuildProgress . total ) * 100 } %`
330+ : '30%' ,
320331 } }
321332 />
322333 </ div >
0 commit comments