From db29f8329923e4e68c1bbae9bc70b63bef8ed5ed Mon Sep 17 00:00:00 2001 From: oxyplay Date: Tue, 1 Aug 2023 09:10:55 +0100 Subject: [PATCH] ui issues fixes (#65) * when adding large repo, files count is hidden * default SVG for fine tuning * fix deleting last file in sources --- self_hosting_machinery/webgui/static/style.css | 1 + self_hosting_machinery/webgui/static/tab-upload.html | 2 +- self_hosting_machinery/webgui/static/tab-upload.js | 12 ++++++++++-- self_hosting_machinery/webgui/tab_finetune.py | 12 +++++++++--- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/self_hosting_machinery/webgui/static/style.css b/self_hosting_machinery/webgui/static/style.css index 2ba26daa..fa9ec23a 100644 --- a/self_hosting_machinery/webgui/static/style.css +++ b/self_hosting_machinery/webgui/static/style.css @@ -195,6 +195,7 @@ h3 { display: inline-flex; align-items: center; justify-content: center; + margin-right: 5px; } .upload-tab-table-files td:nth-child(2), .upload-tab-table-files th:nth-child(2) { diff --git a/self_hosting_machinery/webgui/static/tab-upload.html b/self_hosting_machinery/webgui/static/tab-upload.html index ad7c4a2a..d78cb8ea 100644 --- a/self_hosting_machinery/webgui/static/tab-upload.html +++ b/self_hosting_machinery/webgui/static/tab-upload.html @@ -13,7 +13,7 @@

Code and Text Sources

- No sources added. + No sources added.
diff --git a/self_hosting_machinery/webgui/static/tab-upload.js b/self_hosting_machinery/webgui/static/tab-upload.js index 3dc8c18e..90aee5c7 100644 --- a/self_hosting_machinery/webgui/static/tab-upload.js +++ b/self_hosting_machinery/webgui/static/tab-upload.js @@ -164,9 +164,12 @@ function reset_ftf_progress() { function render_tab_files(data) { const files = document.getElementById("upload-tab-table-body-files"); let i = 0; - if(Object.keys(data.uploaded_files).length > 0) { + if(Object.keys(data.uploaded_files).length >= 0) { files.innerHTML = ""; } + if(Object.keys(data.uploaded_files).length === 0) { + files.innerHTML = `No sources added.`; + } for(let item in data.uploaded_files) { const row = document.createElement('tr'); row.setAttribute('data-file', item); @@ -257,9 +260,14 @@ function render_tab_files(data) { event.target.nextElementSibling.style.display = 'none'; }); } else { - target_cell.innerHTML = `${current_status}`; + target_cell.innerHTML = `${current_status}`; } if (current_status == "working" || current_status == "starting") { + if(item_object.files === undefined) { + target_cell.innerHTML = `${current_status}`; + } else { + target_cell.innerHTML = `${current_status}${item_object.files} files`; + } any_working = true; } break; diff --git a/self_hosting_machinery/webgui/tab_finetune.py b/self_hosting_machinery/webgui/tab_finetune.py index 440c013d..18d910dd 100644 --- a/self_hosting_machinery/webgui/tab_finetune.py +++ b/self_hosting_machinery/webgui/tab_finetune.py @@ -222,9 +222,15 @@ async def _tab_funetune_progress_svg(self, run_id: str): if os.path.exists(svg_path): svg = open(svg_path, "r").read() else: - svg = "" - svg += '' - svg += "" + svg = '' + svg += '' + svg += '' + svg += '' + svg += '' + svg += '' + svg += '' + svg += '' + svg += '' return Response(svg, media_type="image/svg+xml") async def _tab_finetune_schedule_save(self, config: TabFinetuneConfig):