Skip to content

Commit 06e903e

Browse files
committed
updated initial load logic
1 parent 16a1936 commit 06e903e

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/Frontend/src/components/failedmessages/DeletedMessageGroups.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { faClock } from "@fortawesome/free-regular-svg-icons";
1616
import { useDeletedMessageGroupsStore, statusesForRestoreOperation, ExtendedFailureGroupView, Status } from "@/stores/DeletedMessageGroupsStore";
1717
import { useStoreAutoRefresh } from "@/composables/useAutoRefresh";
1818
import { storeToRefs } from "pinia";
19+
import LoadingSpinner from "../LoadingSpinner.vue";
1920
2021
let pollingFaster = false;
2122
const { autoRefresh, isRefreshing, updateInterval } = useStoreAutoRefresh("deletedMessageGroups", useDeletedMessageGroupsStore, 5000);
@@ -130,6 +131,7 @@ watch(isRefreshing, () => {
130131
<div class="row">
131132
<div class="col-sm-12">
132133
<no-data v-if="archiveGroups.length === 0 && !isRefreshing" title="message groups" message="There are currently no grouped message failures"></no-data>
134+
<LoadingSpinner v-if="archiveGroups.length === 0 && isRefreshing" />
133135
</div>
134136
</div>
135137

src/Frontend/src/composables/autoRefresh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function useFetchWithAutoRefresh(name: string, fetch: () => Promi
6262
if (interval.value === newIntervalMs) return;
6363

6464
interval.value = newIntervalMs;
65-
console.debug(`updated polling ${name} to ${newIntervalMs}ms`);
65+
console.debug(`[AutoRefresh] updated polling ${name} to ${newIntervalMs}ms`);
6666
pause();
6767
if (newIntervalMs > 0) {
6868
resume();

src/Frontend/src/stores/DeletedMessageGroupsStore.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { acceptHMRUpdate, defineStore, storeToRefs } from "pinia";
2-
import { readonly, ref, watch } from "vue";
1+
import { acceptHMRUpdate, defineStore } from "pinia";
2+
import { readonly, ref } from "vue";
33
import { useServiceControlStore } from "./ServiceControlStore";
44
import { useCookies } from "vue3-cookies";
55
import FailureGroupView from "@/resources/FailureGroupView";
@@ -32,14 +32,17 @@ export const useDeletedMessageGroupsStore = defineStore("DeletedMessageGroupsSto
3232
let undismissedRestoreGroups: ExtendedFailureGroupView[] = [];
3333

3434
const serviceControlStore = useServiceControlStore();
35-
const { serviceControlUrl } = storeToRefs(serviceControlStore);
3635
const messageGroupClient = new MessageGroupClient(serviceControlStore);
3736

3837
const cookies = useCookies();
3938

4039
async function refresh() {
40+
if (!selectedClassifier.value) {
41+
await getGroupingClassifiers();
42+
selectedClassifier.value = getGrouping() ?? classifiers.value[0];
43+
}
4144
//get all deleted message groups
42-
const [, result] = await serviceControlStore.fetchTypedFromServiceControl<FailureGroupView[]>(`errors/groups/${selectedClassifier.value}`);
45+
const [, result] = await serviceControlStore.fetchTypedFromServiceControl<FailureGroupView[]>(`errors/groups/${selectedClassifier.value ?? getGrouping()}`);
4346

4447
if (result.length === 0 && undismissedRestoreGroups.length > 0) {
4548
undismissedRestoreGroups.forEach((deletedGroup) => {
@@ -120,18 +123,11 @@ export const useDeletedMessageGroupsStore = defineStore("DeletedMessageGroupsSto
120123
archiveGroups.value = archiveGroups.value.filter((group) => group.id !== dismissedGroup.id);
121124
}
122125

123-
async function initialise() {
124-
await Promise.all([getGroupingClassifiers()]);
125-
selectedClassifier.value = getGrouping() ?? classifiers.value[0];
126-
}
127-
128-
watch(serviceControlUrl, initialise, { immediate: true });
129-
130126
return {
131127
refresh,
132128
classifiers: readonly(classifiers),
133129
selectedClassifier,
134-
archiveGroups: archiveGroups,
130+
archiveGroups,
135131
getGrouping,
136132
setGrouping,
137133
restoreGroup,

0 commit comments

Comments
 (0)