Adjusting formatting
This commit is contained in:
parent
05ea73bffe
commit
3f26e93e42
@ -10,7 +10,7 @@
|
||||
<div class="upload-info">
|
||||
<div class="upload-speed">{{ uploadSpeed.toFixed(2) }} MB/s</div>
|
||||
<div class="upload-eta">{{ formattedETA }} remaining</div>
|
||||
<div class="upload-percentage"> {{ getProgress }} % Completed </div>
|
||||
<div class="upload-percentage"> {{ getProgressDecimal }}% Completed </div>
|
||||
<div class="upload-fraction"> {{ getTotalProgressBytes }} / {{ getTotalSize }} </div>
|
||||
</div>
|
||||
<button
|
||||
@ -75,6 +75,7 @@ export default {
|
||||
"uploadSpeed",
|
||||
"getETA",
|
||||
"getProgress",
|
||||
"getProgressDecimal",
|
||||
"getTotalProgressBytes",
|
||||
"getTotalSize"
|
||||
]),
|
||||
|
||||
@ -47,6 +47,17 @@ export const useUploadStore = defineStore("upload", {
|
||||
const sum = state.progress.reduce((acc, val) => +acc + +val) as number;
|
||||
return Math.ceil((sum / totalSize) * 100);
|
||||
},
|
||||
getProgressDecimal: (state) => {
|
||||
if (state.progress.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const totalSize = state.sizes.reduce((a, b) => a + b, 0);
|
||||
|
||||
// TODO: this looks ugly but it works with ts now
|
||||
const sum = state.progress.reduce((acc, val) => +acc + +val) as number;
|
||||
return ((sum / totalSize) * 100).toFixed(2);
|
||||
},
|
||||
getTotalProgressBytes: (state) => {
|
||||
if (state.progress.length === 0 || state.sizes.length === 0) {
|
||||
return '0 Bytes';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user