refactor: uploading counters vuex state

This commit is contained in:
Ramires Viana
2020-07-07 19:41:13 +00:00
parent d0b359561f
commit b4f131be50
5 changed files with 98 additions and 65 deletions

View File

@@ -3,7 +3,15 @@ const getters = {
isFiles: state => !state.loading && state.route.name === 'Files',
isListing: (state, getters) => getters.isFiles && state.req.isDir,
isEditor: (state, getters) => getters.isFiles && (state.req.type === 'text' || state.req.type === 'textImmutable'),
selectedCount: state => state.selected.length
selectedCount: state => state.selected.length,
progress : state => {
if (state.uploading.progress.length == 0) {
return 0;
}
let sum = state.uploading.progress.reduce((acc, val) => acc + val)
return Math.ceil(sum / state.uploading.size * 100);
}
}
export default getters