2018-02-01 12:17:04 +00:00
|
|
|
const getters = {
|
2021-03-21 11:51:58 +00:00
|
|
|
isLogged: (state) => state.user !== null,
|
|
|
|
isFiles: (state) => !state.loading && state.route.name === "Files",
|
2019-01-05 16:12:09 +00:00
|
|
|
isListing: (state, getters) => getters.isFiles && state.req.isDir,
|
2021-03-21 11:51:58 +00:00
|
|
|
selectedCount: (state) => state.selected.length,
|
|
|
|
progress: (state) => {
|
2020-07-08 14:12:33 +00:00
|
|
|
if (state.upload.progress.length == 0) {
|
2020-07-07 19:41:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-03-21 11:51:58 +00:00
|
|
|
let sum = state.upload.progress.reduce((acc, val) => acc + val);
|
|
|
|
return Math.ceil((sum / state.upload.size) * 100);
|
|
|
|
},
|
|
|
|
};
|
2018-02-01 12:17:04 +00:00
|
|
|
|
2021-03-21 11:51:58 +00:00
|
|
|
export default getters;
|