@@ -75,27 +75,34 @@ def _render_buttons(node_id: NodeID, service: TrackedServiceModel) -> None:
7575 if service .current_state != SchedulerServiceState .RUNNING :
7676 return
7777
78- with ui .dialog () as confirm_dialog , ui .card ():
79-
80- async def stop_process_task ():
81- confirm_dialog .submit ("Stop" )
82-
83- await httpx .AsyncClient (timeout = 10 ).get (
84- f"http://localhost:{ DEFAULT_FASTAPI_PORT } /service/{ node_id } :stop"
85- )
86-
87- ui .notify (
88- f"Submitted stop request for { node_id } . Please give the service some time to stop!"
89- )
90-
91- ui .markdown (f"Stop service **{ node_id } **?" )
92- ui .label ("The service will be stopped and its data will be saved." )
93- with ui .row ():
94- ui .button ("Stop" , color = "red" , on_click = stop_process_task )
95- ui .button ("No" , on_click = lambda : confirm_dialog .submit ("No" ))
96-
9778 async def display_confirm_dialog ():
98- await confirm_dialog
79+ with ui .dialog () as confirm_dialog , ui .card ():
80+ confirm_dialog .mark (marker_tags .INDEX_SERVICE_CARD_STOP_CONFIRM_DIALOG )
81+
82+ ui .markdown (f"Stop service **{ node_id } **?" )
83+ ui .label ("The service will be stopped and its data will be saved." )
84+ with ui .row ():
85+ ui .button (
86+ "Stop" ,
87+ color = "red" ,
88+ on_click = lambda : confirm_dialog .submit ("Stop" ),
89+ )
90+ ui .button ("No" , on_click = lambda : confirm_dialog .submit ("No" )).mark (
91+ marker_tags .INDEX_SERVICE_CARD_STOP_CONFIRM_DIALOG_NO_BUTTON
92+ )
93+
94+ click_result = await confirm_dialog
95+
96+ if click_result != "Stop" :
97+ return
98+
99+ await httpx .AsyncClient (timeout = 10 ).get (
100+ f"http://localhost:{ DEFAULT_FASTAPI_PORT } /service/{ node_id } :stop"
101+ )
102+
103+ ui .notify (
104+ f"Submitted stop request for { node_id } . Please give the service some time to stop!"
105+ )
99106
100107 ui .button (
101108 "Stop service" , icon = "stop" , color = "orange" , on_click = display_confirm_dialog
0 commit comments