From b2118c8cae580a1790a66903a17d5a7d026014fc Mon Sep 17 00:00:00 2001 From: papuSpartan Date: Mon, 16 Sep 2024 22:55:42 -0500 Subject: [PATCH] remove refresh button, updates will be automatic --- javascript/distributed.js | 15 ++++++++++++++- scripts/spartan/ui.py | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/javascript/distributed.js b/javascript/distributed.js index 5827386..e72f81f 100644 --- a/javascript/distributed.js +++ b/javascript/distributed.js @@ -1,4 +1,17 @@ function confirm_restart_workers(_) { return confirm('Restart remote workers?') -} \ No newline at end of file +} + +// live updates +function update() { + try { + let refresh_button = document.getElementById('distributed-refresh-status') + refresh_button.click() + } catch (e) { + if (!(e instanceof TypeError)) { + throw e + } + } +} +setInterval(update, 1500) \ No newline at end of file diff --git a/scripts/spartan/ui.py b/scripts/spartan/ui.py index 5aac350..88b03e4 100644 --- a/scripts/spartan/ui.py +++ b/scripts/spartan/ui.py @@ -236,8 +236,8 @@ class UI: info='top-most message is newest' ) - refresh_status_btn = gradio.Button(value='Refresh 🔄', size='sm') - refresh_status_btn.click(self.status_btn, inputs=[], outputs=[jobs, status, logs]) + refresh_status_btn = gradio.Button(value='Refresh 🔄', size='sm', elem_id='distributed-refresh-status', visible=False) + refresh_status_btn.click(self.status_btn, inputs=[], outputs=[jobs, status, logs], show_progress=False) status_tab.select(fn=self.status_btn, inputs=[], outputs=[jobs, status, logs]) components += [status, jobs, logs, refresh_status_btn]