Skip to content

Commit bc5159b

Browse files
authored
Merge pull request #2400 from Particular/spinner-all-messages
add loading spinner in all messages list page
2 parents fd4fca4 + 0217225 commit bc5159b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Frontend/src/components/audit/AuditList.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { onBeforeMount, onUnmounted, ref, watch } from "vue";
1111
import RefreshConfig from "../RefreshConfig.vue";
1212
import useAutoRefresh from "@/composables/autoRefresh.ts";
1313
import throttle from "lodash/throttle";
14+
import LoadingSpinner from "@/components/LoadingSpinner.vue";
1415
1516
const store = useAuditStore();
1617
const { messages, totalCount, sortBy, messageFilterString, selectedEndpointName, itemsPerPage, dateRange } = storeToRefs(store);
@@ -87,16 +88,16 @@ function navigateToMessage(message: Message) {
8788
});
8889
}
8990
90-
let firstLoad = true;
91+
const firstLoad = ref(true);
9192
9293
onBeforeMount(() => {
9394
setQuery();
9495
9596
//without setTimeout, this happens before the store is properly initialised, and therefore the query route values aren't applied to the refresh
96-
//TODO: is there a better way to achieve this?
97-
setTimeout(async () => await Promise.all([dataRetriever.executeAndResetTimer(), store.loadEndpoints()]), 0);
98-
99-
firstLoad = false;
97+
setTimeout(async () => {
98+
await Promise.all([dataRetriever.executeAndResetTimer(), store.loadEndpoints()]);
99+
firstLoad.value = false;
100+
}, 0);
100101
});
101102
102103
watch(
@@ -109,7 +110,7 @@ watch(
109110
);
110111
111112
const watchHandle = watch([() => route.query, itemsPerPage, sortBy, messageFilterString, selectedEndpointName, dateRange], async () => {
112-
if (firstLoad) {
113+
if (firstLoad.value) {
113114
return;
114115
}
115116
@@ -164,6 +165,7 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
164165
</div>
165166
</div>
166167
<div class="row results-table">
168+
<LoadingSpinner v-if="firstLoad" />
167169
<template v-for="message in messages" :key="message.id">
168170
<div class="item" @click="navigateToMessage(message)">
169171
<div class="status">

0 commit comments

Comments
 (0)