Skip to content

Commit 1486ffa

Browse files
committed
Fixed missing watchers
1 parent 7e92df4 commit 1486ffa

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

src/Frontend/src/components/FilterInput.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const debounceUpdateModel = debounce((value: string) => {
1010
model.value = value;
1111
}, 600);
1212
13+
watch(model, (newValue) => {
14+
localInput.value = newValue;
15+
});
16+
1317
watch(localInput, (newValue) => {
1418
debounceUpdateModel(newValue);
1519
});

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

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,37 +83,60 @@ function navigateToMessage(message: Message) {
8383
}
8484
}
8585
86-
let firstLoad = true;
87-
88-
onBeforeMount(async () => {
86+
function setQuery() {
8987
const query = router.currentRoute.value.query;
9088
9189
watchHandle.pause();
9290
9391
if (query.filter) {
9492
messageFilterString.value = query.filter as string;
93+
} else {
94+
messageFilterString.value = "";
9595
}
9696
if (query.sortBy && query.sortDir) {
9797
sortBy.value = { isAscending: query.sortDir === "asc", property: query.sortBy as string };
98+
} else {
99+
sortBy.value = { isAscending: false, property: "time_sent" };
98100
}
99101
if (query.pageSize) {
100-
itemsPerPage.value = Number(query.pageSize as string);
102+
itemsPerPage.value = parseInt(query.pageSize as string, 10);
103+
} else {
104+
itemsPerPage.value = 100;
101105
}
102106
if (query.from && query.to) {
103107
dateRange.value = [new Date(query.from as string), new Date(query.to as string)];
108+
} else {
109+
dateRange.value = [];
104110
}
105111
if (query.endpoint) {
106112
selectedEndpointName.value = query.endpoint as string;
113+
} else {
114+
selectedEndpointName.value = "";
107115
}
108116
109117
watchHandle.resume();
118+
}
119+
120+
let firstLoad = true;
121+
122+
onBeforeMount(async () => {
123+
setQuery();
110124
111125
await Promise.all([store.refresh(), store.loadEndpoints()]);
112126
113127
firstLoad = false;
114128
});
115129
116-
const watchHandle = watch([itemsPerPage, sortBy, messageFilterString, selectedEndpointName, dateRange], async () => {
130+
watch(
131+
() => router.currentRoute.value.query,
132+
async () => {
133+
setQuery();
134+
await store.refresh();
135+
},
136+
{ deep: true }
137+
);
138+
139+
const watchHandle = watch([() => route.query, itemsPerPage, sortBy, messageFilterString, selectedEndpointName, dateRange], async () => {
117140
if (firstLoad) {
118141
return;
119142
}
@@ -124,6 +147,7 @@ const watchHandle = watch([itemsPerPage, sortBy, messageFilterString, selectedEn
124147
from = dateRange.value[0].toISOString();
125148
to = dateRange.value[1].toISOString();
126149
}
150+
127151
await router.push({
128152
query: {
129153
sortBy: sortBy.value.property,

src/Frontend/src/components/audit/DatePickerRange.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ watch(internalModel, () => {
1818
}
1919
});
2020
21+
watch(model, () => {
22+
internalModel.value = model.value;
23+
});
24+
2125
function clearCurrentDate() {
2226
internalModel.value = [];
2327
datePicker.value?.closeMenu();

src/Frontend/src/components/audit/FiltersPanel.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ function findKeyByValue(searchValue: string) {
3232
return "";
3333
}
3434
35+
watch(itemsPerPage, (newValue) => {
36+
selectedItemsPerPage.value = newValue.toString();
37+
});
38+
39+
watch(sortBy, (newValue) => {
40+
selectedSortByItem.value = findKeyByValue(`${newValue.property},${newValue.isAscending ? "asc" : "desc"}`);
41+
});
42+
3543
watch(selectedItemsPerPage, (newValue) => {
36-
itemsPerPage.value = Number(newValue);
44+
itemsPerPage.value = parseInt(newValue, 10);
3745
});
3846
3947
watch(selectedSortByItem, (newValue) => {

0 commit comments

Comments
 (0)