lint fixes
This commit is contained in:
parent
c680fbd1f9
commit
d29dee3a5e
@ -10,8 +10,12 @@
|
|||||||
<div class="upload-info">
|
<div class="upload-info">
|
||||||
<div class="upload-speed">{{ uploadSpeed.toFixed(2) }} MB/s</div>
|
<div class="upload-speed">{{ uploadSpeed.toFixed(2) }} MB/s</div>
|
||||||
<div class="upload-eta">{{ formattedETA }} remaining</div>
|
<div class="upload-eta">{{ formattedETA }} remaining</div>
|
||||||
<div class="upload-percentage"> {{ getProgressDecimal }}% Completed </div>
|
<div class="upload-percentage">
|
||||||
<div class="upload-fraction"> {{ getTotalProgressBytes }} / {{ getTotalSize }} </div>
|
{{ getProgressDecimal }}% Completed
|
||||||
|
</div>
|
||||||
|
<div class="upload-fraction">
|
||||||
|
{{ getTotalProgressBytes }} / {{ getTotalSize }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
class="action"
|
class="action"
|
||||||
@ -77,7 +81,7 @@ export default {
|
|||||||
"getProgress",
|
"getProgress",
|
||||||
"getProgressDecimal",
|
"getProgressDecimal",
|
||||||
"getTotalProgressBytes",
|
"getTotalProgressBytes",
|
||||||
"getTotalSize"
|
"getTotalSize",
|
||||||
]),
|
]),
|
||||||
...mapWritableState(useFileStore, ["reload"]),
|
...mapWritableState(useFileStore, ["reload"]),
|
||||||
formattedETA() {
|
formattedETA() {
|
||||||
@ -97,7 +101,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useUploadStore, ["reset"]), // Mapping reset action from upload store
|
...mapActions(useUploadStore, ["reset"]), // Mapping reset action from upload store
|
||||||
toggle: function () {
|
toggle: function () {
|
||||||
this.open = !this.open;
|
this.open = !this.open;
|
||||||
},
|
},
|
||||||
@ -106,8 +110,8 @@ export default {
|
|||||||
abortAllUploads();
|
abortAllUploads();
|
||||||
buttons.done("upload");
|
buttons.done("upload");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.reset(); // Resetting the upload store state
|
this.reset(); // Resetting the upload store state
|
||||||
this.reload = true; // Trigger reload in the file store
|
this.reload = true; // Trigger reload in the file store
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,11 +15,11 @@ const beforeUnload = (event: Event) => {
|
|||||||
|
|
||||||
// Utility function to format bytes into a readable string
|
// Utility function to format bytes into a readable string
|
||||||
function formatSize(bytes: number): string {
|
function formatSize(bytes: number): string {
|
||||||
if (bytes === 0) return '0 Bytes';
|
if (bytes === 0) return "0 Bytes";
|
||||||
|
|
||||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||||
return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
|
return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + " " + sizes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUploadStore = defineStore("upload", {
|
export const useUploadStore = defineStore("upload", {
|
||||||
@ -69,14 +69,14 @@ export const useUploadStore = defineStore("upload", {
|
|||||||
},
|
},
|
||||||
getTotalProgressBytes: (state) => {
|
getTotalProgressBytes: (state) => {
|
||||||
if (state.progress.length === 0 || state.sizes.length === 0) {
|
if (state.progress.length === 0 || state.sizes.length === 0) {
|
||||||
return '0 Bytes';
|
return "0 Bytes";
|
||||||
}
|
}
|
||||||
const sum = state.progress.reduce((acc, val) => +acc + +val, 0) as number;
|
const sum = state.progress.reduce((acc, val) => +acc + +val, 0) as number;
|
||||||
return formatSize(sum);
|
return formatSize(sum);
|
||||||
},
|
},
|
||||||
getTotalSize: (state) => {
|
getTotalSize: (state) => {
|
||||||
if (state.sizes.length === 0) {
|
if (state.sizes.length === 0) {
|
||||||
return '0 Bytes';
|
return "0 Bytes";
|
||||||
}
|
}
|
||||||
const totalSize = state.sizes.reduce((a, b) => a + b, 0);
|
const totalSize = state.sizes.reduce((a, b) => a + b, 0);
|
||||||
return formatSize(totalSize);
|
return formatSize(totalSize);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user