From 9c3fa60551eac1a35877dc159ebeb31f858de0ca Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Thu, 7 Jul 2022 19:51:32 +1000 Subject: Adapt loading-modal to show other messages Was intending to add 'Arranging tiles' and 'Rendering tiles' messages, but they wouldn't trigger during 'uncontrived' test cases, including with throttled CPU --- src/App.vue | 28 +++++++++++++--------------- src/components/LoadingModal.vue | 3 ++- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/App.vue b/src/App.vue index 29df31b..f8c986e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,7 +51,7 @@ + @net-wait="primeLoadInd('Loading data')" @net-get="endLoadInd" class="z-10" ref="searchModal"/> - +
0){ - this.relayoutWithCollapse(false); // Second pass for regularity + success = this.relayoutWithCollapse(false); // Second pass for regularity } else { - await this.onLeafClick(layoutNode, true); + success = await this.onLeafClick(layoutNode, true); } } else { success = await this.onNonleafClick(layoutNode, true); // For reducing tile-flashing on-screen @@ -799,23 +799,21 @@ export default defineComponent({ }, // For the loading-indicator async loadFromServer(urlParams: URLSearchParams){ // Like queryServer(), but enables the loading indicator - this.primeLoadInd(); + this.primeLoadInd('Loading data'); let responseObj = await queryServer(urlParams); this.endLoadInd(); return responseObj; }, - primeLoadInd(){ - if (this.pendingLoadingRevealHdlr == 0){ - this.pendingLoadingRevealHdlr = setTimeout(() => { - this.loadingOpen = true; - }, 300); - } + primeLoadInd(msg: string){ + this.pendingLoadingRevealHdlr = setTimeout(() => { + this.loadingMsg = msg; + }, 300); }, endLoadInd(){ clearTimeout(this.pendingLoadingRevealHdlr); this.pendingLoadingRevealHdlr = 0; - if (this.loadingOpen){ - this.loadingOpen = false; + if (this.loadingMsg != null){ + this.loadingMsg = null; } }, // For other events diff --git a/src/components/LoadingModal.vue b/src/components/LoadingModal.vue index a338670..506abf4 100644 --- a/src/components/LoadingModal.vue +++ b/src/components/LoadingModal.vue @@ -3,7 +3,7 @@
-
Querying server ...
+
{{msg}}
@@ -15,6 +15,7 @@ import {UiOptions} from '../lib'; export default defineComponent({ props: { + msg: {type: String, required: true}, uiOpts: {type: Object as PropType, required: true}, }, computed: { -- cgit v1.2.3