@@ -63,6 +63,8 @@ export default function Administration() {
6363 const connected = ! ! serverUrl && ! ! info && ! statusLoading && ! statusError ;
6464 const [ reindexing , setReindexing ] = useState ( false ) ;
6565 const [ reindexError , setReindexError ] = useState < string | null > ( null ) ;
66+ const [ restarting , setRestarting ] = useState ( false ) ;
67+ const [ restartError , setRestartError ] = useState < string | null > ( null ) ;
6668
6769 // State: show deleted users toggle
6870 const [ showDeleted , setShowDeleted ] = useState ( false ) ;
@@ -166,9 +168,42 @@ export default function Administration() {
166168 >
167169 { reindexing ? "Reindexing…" : "Reindex Games" }
168170 </ Button >
169- { reindexError && (
171+ < Button
172+ color = "red"
173+ disabled = { restarting }
174+ onClick = { async ( ) => {
175+ if ( restarting ) return ;
176+ try {
177+ setRestartError ( null ) ;
178+ setRestarting ( true ) ;
179+ const base = serverUrl . replace ( / \/ + $ / , "" ) ;
180+
181+ const res = await authFetch (
182+ `${ base } /api/admin/web-ui/restart` ,
183+ {
184+ method : "POST" ,
185+ } ,
186+ ) ;
187+ if ( ! res . ok ) {
188+ const txt = await res . text ( ) ;
189+ throw new Error ( txt || `Restart failed (${ res . status } )` ) ;
190+ } else {
191+ window . location . reload ( ) ;
192+ }
193+ } catch ( e : any ) {
194+ setRestartError ( e . message || String ( e ) ) ;
195+ } finally {
196+ setRestarting ( false ) ;
197+ }
198+ } }
199+ title = "Restart Web UI"
200+ className = "items-center"
201+ >
202+ { restarting ? "Restarting..." : "Restart Web UI" }
203+ </ Button >
204+ { restartError && (
170205 < div className = "col-span-full text-xs text-red-500 bg-red-500/10 rounded-md px-3 py-2" >
171- { reindexError }
206+ { restartError }
172207 </ div >
173208 ) }
174209 </ Card >
0 commit comments