From 2978e0c9681ab1f3088cc8f37ce644f5c6d82634 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 12 Nov 2023 20:09:29 +0000 Subject: [PATCH] Better special handling for root Document. Restore live updates of relative modified times. --- frontend/src/stores/documents.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/stores/documents.ts b/frontend/src/stores/documents.ts index 985d5fd..0d40d75 100644 --- a/frontend/src/stores/documents.ts +++ b/frontend/src/stores/documents.ts @@ -4,6 +4,7 @@ import { defineStore } from 'pinia' import { collator } from '@/utils' import { logoutUser } from '@/repositories/User' import { watchConnect } from '@/repositories/WS' +import { format } from 'path' type FileData = { id: string; mtime: number; size: number; dir: DirectoryData } type DirectoryData = { @@ -39,11 +40,10 @@ export const useDocumentStore = defineStore({ const docs = [] let loc = [] as string[] for (const [level, name, key, mtime, size, isfile] of root) { - if (level === 0) continue loc = loc.slice(0, level - 1) docs.push({ name, - loc: loc.join('/'), + loc: level ? loc.join('/') : '/', key, size, sizedisp: formatSize(size), @@ -57,6 +57,9 @@ export const useDocumentStore = defineStore({ console.log("Documents", docs) this.document = docs as Document[] }, + updateModified() { + for (const doc of this.document) doc.modified = formatUnixDate(doc.mtime) + }, login(username: string, privileged: boolean) { this.user.username = username this.user.privileged = privileged