Frontend created and rewritten a few times, with some backend fixes #1

Merged
leo merged 110 commits from plaintable into main 2023-11-08 20:38:40 +00:00
Showing only changes of commit d27cb2133a - Show all commits

View File

@ -45,21 +45,28 @@ export const useDocumentStore = defineStore({
actions: { actions: {
setActualDocument(location: string){ setActualDocument(location: string){
this.loading = true; location = decodeURIComponent(location)
this.loading = true
let data = this.root let data = this.root
const dataMapped = []; const actualDirArr = []
const locations = location.split('/').slice(1) try {
// Get data target location // Navigate to target folder
locations.forEach(location => { for (const dirname of location.split('/').slice(1)) {
location = decodeURIComponent(location) if (!dirname) continue
if(data && data.dir){ actualDirArr.push(dirname)
for (const key in data.dir) { data = data.dir[dirname]
if(key === location) data = data.dir[key]
}
} }
}) } catch (error) {
console.error("Cannot show requested folder", location, actualDirArr.join('/'), error)
}
if (data.dir === undefined) {
// Target folder not available
this.document = []
this.loading = false // ???
return
}
// Transform data // Transform data
const dataMapped = []
for (const [name, attr] of Object.entries(data.dir)) { for (const [name, attr] of Object.entries(data.dir)) {
const {id, size, mtime, dir} = attr const {id, size, mtime, dir} = attr
const element: Document = { const element: Document = {