fix: disk_usage in sub-directories
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
3f4eeadb6f
commit
b6c2901908
@ -224,11 +224,12 @@ export const mutations: MutationTree<FileState> = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setDiskUsage(state, payload) {
|
setDiskUsage(state, payload) {
|
||||||
let path = payload.path
|
const parentPath = payload.path.substr(0, payload.path.lastIndexOf('/'))
|
||||||
if (path.indexOf('/') !== -1) path = path.substr(0, path.indexOf('/'))
|
const pathName = payload.path.substr(payload.path.lastIndexOf('/') + 1)
|
||||||
|
const parent = findDirectory(state.filetree, parentPath.split('/'))
|
||||||
|
const directory = parent?.find((element) => element.isDirectory && element.filename === pathName)
|
||||||
|
|
||||||
const dir = state.filetree.find(dir => dir.filename === path)
|
if (directory) Vue.set(directory, 'disk_usage', payload.disk_usage)
|
||||||
if (dir && 'disk_usage' in dir) Vue.set(dir, 'disk_usage', payload.disk_usage)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setRootPermissions(state, payload) {
|
setRootPermissions(state, payload) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user