tidy restart workers button handler to lambda

master
unknown 2024-02-29 05:25:22 -06:00
parent d84fc5cf9c
commit f1850e8d23
No known key found for this signature in database
GPG Key ID: CA376082283AF69A
2 changed files with 4 additions and 8 deletions

View File

@ -1,4 +1,4 @@
function confirm_restart_workers() {
function confirm_restart_workers(_) {
return confirm('Restart remote workers?')
}

View File

@ -192,10 +192,6 @@ class UI:
worker.eta_percent_error = []
self.world.save_config()
def restart_workers_btn(self, confirmed: bool):
if confirmed:
self.world.restart_all()
# end handlers
def create_ui(self):
@ -253,10 +249,10 @@ class UI:
restart_workers_btn = gradio.Button(value="🔁 Restart All", variant='stop')
restart_workers_btn.click(
_js="confirm_restart_workers",
fn=self.restart_workers_btn, inputs=[restart_workers_btn],
outputs=[restart_workers_btn]
fn=lambda confirmed: self.world.restart_all() if confirmed else None,
inputs=[restart_workers_btn],
outputs=[]
)
components += [refresh_checkpoints_btn, run_usr_btn, reload_config_btn, reconnect_lost_workers_btn, restart_workers_btn]
with gradio.Row():