1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

feat: sorts homepage every 10 seconds (#2929)

This commit is contained in:
Amir Raminfar
2024-05-02 10:20:13 -07:00
committed by GitHub
parent 88f0a227e7
commit deaeff73cb

View File

@@ -116,13 +116,10 @@ const storage = useStorage<{ column: keys; direction: 1 | -1 }>("DOZZLE_TABLE_CO
direction: -1,
});
const { column: sortField, direction } = toRefs(storage);
const counter = useInterval(10000);
const sortedContainers = computedWithControl(
() => [containers.length, sortField.value, direction.value],
() => {
return containers.sort((a, b) => {
return fields[sortField.value].sortFunc(a, b);
});
},
() => [containers.length, sortField.value, direction.value, counter.value],
() => containers.sort((a, b) => fields[sortField.value].sortFunc(a, b)),
);
const totalPages = computed(() => Math.ceil(sortedContainers.value.length / perPage.value));