Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files busy signal #3973

Merged
merged 7 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/dashboard/app/javascript/files/data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const EVENTNAME = {
};

const CONTENTID = '#directory-contents';
const SPINNERID = '#tloading_spinner';

let table = null;

Expand Down Expand Up @@ -269,6 +270,8 @@ class DataTable {
async reloadTable(url) {
var request_url = url || history.state.currentDirectoryUrl;

this.toggleSpinner();

try {
const response = await fetch(request_url, { headers: { 'Accept': 'application/json' }, cache: 'no-store' });
const data = await this.dataFromJsonResponse(response);
Expand Down Expand Up @@ -297,7 +300,10 @@ class DataTable {
table.getTable().row(this.closest('tr')).deselect();
}
}
})
});

this.toggleSpinner();

return result;
} catch (e) {
const eventData = {
Expand All @@ -308,12 +314,19 @@ class DataTable {
$(CONTENTID).trigger(SWAL_EVENTNAME.showError, eventData);

$('#open-in-terminal-btn').addClass('disabled');

this.toggleSpinner()

// Removed this as it was causing a JS Error and there is no reprocution from removing it.
// return await Promise.reject(e);
}
}

toggleSpinner() {
document.querySelector(SPINNERID).classList.toggle('d-none');
document.querySelector(CONTENTID).classList.toggle('d-none');
}

updateDotFileVisibility() {
this.reloadTable();
}
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/app/views/files/_files_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<tbody>
</tbody>
</table>
<%= render partial: "spinner" %>
</div>
</div>

Expand Down
5 changes: 5 additions & 0 deletions apps/dashboard/app/views/files/_spinner.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="text-center text-primary d-none p-5" id="tloading_spinner">
<div class="spinner-border">
<span class="sr-only">Loading...</span>
</div>
</div>
3 changes: 3 additions & 0 deletions apps/dashboard/test/system/remote_files_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ def setup
find('#delete-btn').click
find('button.swal2-confirm').click

# Allow time for file to be removed
sleep 1

# verify app dir deleted according to UI
assert_no_selector 'tbody a', exact_text: 'app', wait: 10
assert_no_selector 'tbody a', exact_text: 'foo.txt', wait: 10
Expand Down
Loading