Remove duplicate (and also wrong byte conversion)

This commit is contained in:
Finn Dittmar 2025-10-09 08:49:13 +02:00
parent 9ce6de3100
commit 4224f44259
No known key found for this signature in database
GPG Key ID: A630219F715A1D1E

View File

@ -143,19 +143,12 @@ export default {
return Math.min(100, Math.round((this.uploadProgress.loaded / this.uploadProgress.total) * 100)) return Math.min(100, Math.round((this.uploadProgress.loaded / this.uploadProgress.total) * 100))
}, },
uploadProgressText() { uploadProgressText() {
const loaded = this.formatBytes(this.uploadProgress.loaded) const loaded = this.$bytesPretty(this.uploadProgress.loaded)
const total = this.formatBytes(this.uploadProgress.total) const total = this.$bytesPretty(this.uploadProgress.total)
return `${this.uploadProgressPercent}% (${loaded} / ${total})` return `${this.uploadProgressPercent}% (${loaded} / ${total})`
} }
}, },
methods: { methods: {
formatBytes(bytes) {
if (bytes === 0) return '0 Bytes'
const k = 1024
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
},
setUploadStatus(status) { setUploadStatus(status) {
this.isUploading = status === 'uploading' this.isUploading = status === 'uploading'
this.uploadFailed = status === 'failed' this.uploadFailed = status === 'failed'