More efficient flat file list format and various UX improvements #3

Merged
leo merged 19 commits from major-upgrade into main 2023-11-12 23:20:40 +00:00
Showing only changes of commit 2978e0c968 - Show all commits

View File

@ -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