Skip to content

Commit

Permalink
ui issues fixes (#65)
Browse files Browse the repository at this point in the history
* when adding large repo, files count is hidden

* default SVG for fine tuning

* fix deleting last file in sources
  • Loading branch information
oxyplay authored Aug 1, 2023
1 parent 73eeffd commit db29f83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions self_hosting_machinery/webgui/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion self_hosting_machinery/webgui/static/tab-upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3>Code and Text Sources</h3>
</tr>
</thead>
<tbody id="upload-tab-table-body-files">
<tr><td>No sources added.</td></tr>
<tr><td>No sources added.</td><td></td><td></td><td></td><td></td></tr>
</tbody>
</table>
<div class="sources-buttons">
Expand Down
12 changes: 10 additions & 2 deletions self_hosting_machinery/webgui/static/tab-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<tr><td>No sources added.</td><td></td><td></td><td></td><td></td></tr>`;
}
for(let item in data.uploaded_files) {
const row = document.createElement('tr');
row.setAttribute('data-file', item);
Expand Down Expand Up @@ -257,9 +260,14 @@ function render_tab_files(data) {
event.target.nextElementSibling.style.display = 'none';
});
} else {
target_cell.innerHTML = `<span class="file-status badge rounded-pill ${status_color}">${current_status}`;
target_cell.innerHTML = `<span class="file-status badge rounded-pill ${status_color}">${current_status}</span>`;
}
if (current_status == "working" || current_status == "starting") {
if(item_object.files === undefined) {
target_cell.innerHTML = `<span class="file-status badge rounded-pill ${status_color}">${current_status}</span>`;
} else {
target_cell.innerHTML = `<span class="file-status badge rounded-pill ${status_color}">${current_status}</span><span>${item_object.files} files</span>`;
}
any_working = true;
}
break;
Expand Down
12 changes: 9 additions & 3 deletions self_hosting_machinery/webgui/tab_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 width=\"432\" height=\"216\" xmlns=\"http://www.w3.org/2000/svg\">"
svg += '<path d="M 50 10 L 140 110 L 350 200 L 50 200 L 50 10" stroke="#AAA" stroke-width="2" fill="#DDD" />'
svg += "</svg>"
svg = '<svg width="432" height="217" viewBox="0 0 432 217" fill="none" xmlns="http://www.w3.org/2000/svg">'
svg += '<line x1="50" y1="10.496" x2="350" y2="10.496" stroke="#EFEFEF"/>'
svg += '<line x1="50" y1="200.496" x2="350" y2="200.496" stroke="#EFEFEF"/>'
svg += '<line x1="50" y1="162.496" x2="350" y2="162.496" stroke="#EFEFEF"/>'
svg += '<line x1="50" y1="124.496" x2="350" y2="124.496" stroke="#EFEFEF"/>'
svg += '<line x1="50" y1="86.496" x2="350" y2="86.496" stroke="#EFEFEF"/>'
svg += '<line x1="50" y1="48.496" x2="350" y2="48.496" stroke="#EFEFEF"/>'
svg += '<path d="M50 10.996L140 110.996L200.98 89.6939L350 200.996" stroke="#CDCDCD" stroke-width="2"/>'
svg += '</svg>'
return Response(svg, media_type="image/svg+xml")

async def _tab_finetune_schedule_save(self, config: TabFinetuneConfig):
Expand Down

0 comments on commit db29f83

Please sign in to comment.