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

fix: cleans up storage to use only one key (#2360)

This commit is contained in:
Amir Raminfar
2023-08-21 10:04:16 -07:00
committed by GitHub
parent 69676c7aaa
commit d041767455

View File

@@ -58,6 +58,7 @@
<script setup lang="ts">
import { Container } from "@/models/Container";
import { toRefs } from "@vueuse/core";
const fields = {
name: {
@@ -92,8 +93,12 @@ const { containers, perPage = 15 } = defineProps<{
perPage?: number;
}>();
type keys = keyof typeof fields;
const sortField = useStorage<keys>("DOZZLE_TABLE_CONTAINERS_SORT", "created");
const direction = useStorage<1 | -1>("DOZZLE_TABLE_CONTAINERS_DIRECTION", -1);
const storage = useStorage<{ column: keys; direction: 1 | -1 }>("DOZZLE_TABLE_CONTAINERS_SORT", {
column: "created",
direction: -1,
});
const { column: sortField, direction } = toRefs(storage);
const sortedContainers = computedWithControl(
() => [containers.length, sortField.value, direction.value],
() => {