Skip to content

Commit

Permalink
Adds loading icon to path selector UI on table refresh (#3144)
Browse files Browse the repository at this point in the history
* Adds loading icon to path selector UI on table refresh

* Removes lastVisted reset, which was a development tool

* Hides table on table refresh; uses bootstrap spinner instead of fa

* Ensure table is still navigatable if there's an error on refresh

* Removes development cruft

* Removes #loading-icon css specification, adds classes to center loading spinner

* Adds style to increase size of loading spinner on table refresh

Recommended course of action to change size by bootstrap :/

* Removes spinner-grow class & adds .5-rem class

* Fixes css selector class
  • Loading branch information
HazelGrant authored Oct 31, 2023
1 parent e583601 commit f3fe839
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
6 changes: 5 additions & 1 deletion apps/dashboard/app/assets/stylesheets/common.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.clickable {
cursor: pointer;
}
Expand All @@ -21,3 +20,8 @@
z-index: 1100;
background-color: inherit;
}

.rem-5 {
width: 5rem;
height: 5rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,20 @@ export class PathSelectorTable {

async reloadTable(url) {
try {
$(`#${this.tableId}_wrapper`).hide();
$('#loading-icon').show();
const response = await fetch(url, { headers: { 'Accept': 'application/json' }, cache: 'no-store' });
const data = await this.dataFromJsonResponse(response);
$(`#${this.breadcrumbId}`).html(data.path_selector_breadcrumbs_html);
this._table.clear();
this._table.rows.add(data.files);
this._table.draw();
this.setLastVisited(data.path);
this._table.draw();
$('#loading-icon').hide();
$(`#${this.tableId}_wrapper`).show();
} catch (err) {
$('#loading-icon').hide();
$(`#${this.tableId}_wrapper`).show();
console.log(err);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,25 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="modal-body">
<div>
<ol id="<%= breadcrumb_id %>" class="breadcrumb breadcrumb-no-delimiter">
</ol>
<table class="table table-hover table-condensed d-table w-100" id="<%= table_id %>">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<ol id="<%= breadcrumb_id %>" class="breadcrumb breadcrumb-no-delimiter">
</ol>
<div class="d-flex justify-content-center">
<div id="loading-icon" class="spinner-border rem-5" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<table class="table table-hover table-condensed d-table w-100" id="<%= table_id %>">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="modal-footer sticky-footer">
Expand Down

0 comments on commit f3fe839

Please sign in to comment.