From e50c76664df70f633af604d6f003037adbafee93 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 6 Sep 2022 09:31:54 -0400 Subject: [PATCH] Several visual and functional improvements. Better error handling with setStateError(). Variable cancel button text, depending on query type. Fix query button start/stop transitions. Add loading/complete indicators to query list. Use labels instead of plain divs in some spots. Better mock data. Add queryStartTime to state (at this time, unused). --- src/app.css | 19 +++++++++++ src/lib/QueryInput.svelte | 13 +++---- src/lib/constants.js | 6 ++++ src/lib/header/NavBar.svelte | 7 +++- src/lib/state.js | 60 ++++++++++++++++++++++---------- src/routes/+page.js | 8 ++--- src/routes/+page.svelte | 66 ++++++++++++++++++++++++------------ src/utils.js | 4 ++- 8 files changed, 132 insertions(+), 51 deletions(-) diff --git a/src/app.css b/src/app.css index 050af8c..c72999d 100644 --- a/src/app.css +++ b/src/app.css @@ -70,6 +70,25 @@ button.colored { border-color: var(--accent-color); } +.lds-dual-ring { + display: inline-block; +} +.lds-dual-ring:after { + content: " "; + display: inline-block; + width: 6px; + height: 6px; + margin: 0 0 0 8px; + border-radius: 50%; + border: 2px solid var(--accent-color); + border-color: var(--accent-color) transparent var(--accent-color) transparent; + animation: spin 1.2s linear infinite; +} +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + button.colored:hover { background-color: white; font-weight: bold; diff --git a/src/lib/QueryInput.svelte b/src/lib/QueryInput.svelte index 1892363..3e43f23 100644 --- a/src/lib/QueryInput.svelte +++ b/src/lib/QueryInput.svelte @@ -7,19 +7,20 @@
-
jsFilter = !jsFilter}> +
+
{#if jsFilter}
-
- Allow JavaScript to mutate objects +
+
{/if} @@ -42,7 +43,7 @@ margin-top: 1em; display: flex; flex-direction: column; - /* For some reason, using flex-grow: 1; broke the slide in transition */ + /* For some reason, using flex-grow: 1; broke the slide-in transition */ height: 100%; } diff --git a/src/lib/constants.js b/src/lib/constants.js index df1e712..77cf05b 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -6,6 +6,12 @@ export const queryMode = { KILL: 'kill' } +export const queryState = { + LOADING: 'loading', + DONE: 'done', + IDLE: 'idle', +} + export const backendAddressAndPort = 'localhost:3000' export const backendUrl = `http://${backendAddressAndPort}` diff --git a/src/lib/header/NavBar.svelte b/src/lib/header/NavBar.svelte index b2f0f8e..b08ac3f 100644 --- a/src/lib/header/NavBar.svelte +++ b/src/lib/header/NavBar.svelte @@ -8,8 +8,13 @@