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

Add busy animation to Explorer #3588

Merged
merged 2 commits into from
Nov 3, 2023
Merged

Add busy animation to Explorer #3588

merged 2 commits into from
Nov 3, 2023

Conversation

jpellizzari
Copy link
Contributor

@jpellizzari jpellizzari commented Nov 2, 2023

Closes #3565

Adds a loading spinner and table animation for indicating a busy state. Notice the opacity getting reduced when filters/sorting gets changed:

screen-capture.46.webm

When responding to a query, we want to indicate to a user that the request is in progress. In environments with high Explorer request latency, we need to indicate that things are happening. Most environments respond in a matter of milliseconds, so we never needed this before.

Test with this to inject some fake latency:

---
 ui/src/hooks/query.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ui/src/hooks/query.ts b/ui/src/hooks/query.ts
index 77c0d8a6..5a0f64b8 100644
--- a/ui/src/hooks/query.ts
+++ b/ui/src/hooks/query.ts
@@ -66,7 +66,11 @@ export function useQueryService({
 
   return useQuery<QueryResponse, Error>(
     ['query', { terms, filters, limit, offset, orderBy, ascending }],
-    () => {
+    async () => {
+      await new Promise(accept => {
+        setTimeout(accept, 3000);
+      });
+
       return api.DoQuery({
         terms,
         filters: formatted,
-- 

@jpellizzari jpellizzari added the enhancement New feature or request label Nov 2, 2023
@jpellizzari jpellizzari force-pushed the 3565-exp-loading branch 2 times, most recently from 08a55cd to 1b7d3e5 Compare November 2, 2023 19:45
@jpellizzari jpellizzari marked this pull request as ready for review November 2, 2023 20:26
@jpellizzari jpellizzari requested review from ahussein3, opudrovs, enekofb and joshri and removed request for ahussein3 November 2, 2023 20:26
Copy link
Contributor

@enekofb enekofb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after testing the expected behaviour: do not trust my UI review as always.

When responding to a query, we want to indicate to a user that the request is in progress. In environments with high Explorer request latency, we need to indicate that things are happening. Most environments respond in a matter of milliseconds, so we never needed this before.
@jpellizzari jpellizzari merged commit 7187149 into main Nov 3, 2023
10 checks passed
@jpellizzari jpellizzari deleted the 3565-exp-loading branch November 3, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show "busy" indicator when doing Explorer queries
3 participants