You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
feat: add upload file list with progress (#1825)
This commit is contained in:
@@ -8,8 +8,36 @@ const getters = {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let totalSize = state.upload.sizes.reduce((a, b) => a + b, 0);
|
||||
|
||||
let sum = state.upload.progress.reduce((acc, val) => acc + val);
|
||||
return Math.ceil((sum / state.upload.size) * 100);
|
||||
return Math.ceil((sum / totalSize) * 100);
|
||||
},
|
||||
filesInUploadCount: (state) => {
|
||||
let total =
|
||||
Object.keys(state.upload.uploads).length + state.upload.queue.length;
|
||||
return total;
|
||||
},
|
||||
filesInUpload: (state) => {
|
||||
let files = [];
|
||||
|
||||
for (let index in state.upload.uploads) {
|
||||
let upload = state.upload.uploads[index];
|
||||
let id = upload.id;
|
||||
let type = upload.type;
|
||||
let name = decodeURIComponent(upload.path.replace(/^.*[\\/]/, ""));
|
||||
let progress = state.upload.progress[id];
|
||||
let size = state.upload.sizes[id];
|
||||
|
||||
files.push({
|
||||
id,
|
||||
name,
|
||||
progress: Math.ceil((progress / size) * 100),
|
||||
type,
|
||||
});
|
||||
}
|
||||
|
||||
return files.sort((a, b) => a.progress - b.progress);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user