Skip to content
Merged
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
14 changes: 8 additions & 6 deletions src/Frontend/src/components/audit/AuditList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { onBeforeMount, onUnmounted, ref, watch } from "vue";
import RefreshConfig from "../RefreshConfig.vue";
import useAutoRefresh from "@/composables/autoRefresh.ts";
import throttle from "lodash/throttle";
import LoadingSpinner from "@/components/LoadingSpinner.vue";

const store = useAuditStore();
const { messages, totalCount, sortBy, messageFilterString, selectedEndpointName, itemsPerPage, dateRange } = storeToRefs(store);
Expand Down Expand Up @@ -87,16 +88,16 @@ function navigateToMessage(message: Message) {
});
}

let firstLoad = true;
const firstLoad = ref(true);

onBeforeMount(() => {
setQuery();

//without setTimeout, this happens before the store is properly initialised, and therefore the query route values aren't applied to the refresh
//TODO: is there a better way to achieve this?
setTimeout(async () => await Promise.all([dataRetriever.executeAndResetTimer(), store.loadEndpoints()]), 0);

firstLoad = false;
setTimeout(async () => {
await Promise.all([dataRetriever.executeAndResetTimer(), store.loadEndpoints()]);
firstLoad.value = false;
}, 0);
});

watch(
Expand All @@ -109,7 +110,7 @@ watch(
);

const watchHandle = watch([() => route.query, itemsPerPage, sortBy, messageFilterString, selectedEndpointName, dateRange], async () => {
if (firstLoad) {
if (firstLoad.value) {
return;
}

Expand Down Expand Up @@ -164,6 +165,7 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
</div>
</div>
<div class="row results-table">
<LoadingSpinner v-if="firstLoad" />
<template v-for="message in messages" :key="message.id">
<div class="item" @click="navigateToMessage(message)">
<div class="status">
Expand Down