mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-24 06:28:42 +01:00
fix: cleans up storage to use only one key (#2360)
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Container } from "@/models/Container";
|
import { Container } from "@/models/Container";
|
||||||
|
import { toRefs } from "@vueuse/core";
|
||||||
|
|
||||||
const fields = {
|
const fields = {
|
||||||
name: {
|
name: {
|
||||||
@@ -92,8 +93,12 @@ const { containers, perPage = 15 } = defineProps<{
|
|||||||
perPage?: number;
|
perPage?: number;
|
||||||
}>();
|
}>();
|
||||||
type keys = keyof typeof fields;
|
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(
|
const sortedContainers = computedWithControl(
|
||||||
() => [containers.length, sortField.value, direction.value],
|
() => [containers.length, sortField.value, direction.value],
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user