Skip to content

Commit

Permalink
Feature/8166 - Show current upload speed and upload details in tooltip (
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter authored Feb 9, 2023
1 parent 14e307d commit 8304bd4
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 31 deletions.
8 changes: 8 additions & 0 deletions changelog/unreleased/enhancement-show-upload-speed
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Show upload speed

We have added a tooltip that shows the current upload speed and
absolute vs processed filesize for the current upload.

https://github.com/owncloud/web/issues/8166
https://github.com/owncloud/web/pull/8187
https://github.com/owncloud/ocis/issues/5511
4 changes: 2 additions & 2 deletions packages/web-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"@ownclouders/design-system": "workspace:*",
"@popperjs/core": "^2.11.5",
"@sentry/vue": "7.31.1",
"@uppy/core": "^3.0.2",
"@uppy/core": "^3.0.5",
"@uppy/drop-target": "^2.0.0",
"@uppy/tus": "^3.0.1",
"@uppy/utils": "^5.0.2",
"@uppy/utils": "^5.1.2",
"@uppy/xhr-upload": "^3.0.1",
"@vueuse/head": "1.0.22",
"axios": "^0.27.2",
Expand Down
34 changes: 29 additions & 5 deletions packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
class="upload-info-title oc-flex oc-flex-between oc-flex-middle oc-px-m oc-py-s oc-rounded-top"
>
<p class="oc-my-xs" v-text="uploadInfoTitle" />
<p v-oc-tooltip="uploadDetails" class="oc-my-xs" v-text="uploadInfoTitle" />
<oc-button
v-if="!filesInProgressCount"
id="close-upload-info-btn"
Expand Down Expand Up @@ -138,13 +138,16 @@
</template>

<script lang="ts">
import { useCapabilityShareJailEnabled } from 'web-pkg/src/composables'
import { mapGetters } from 'vuex'
import { defineComponent } from 'vue'
import { UppyResource } from '../composables/upload'
import { urlJoin } from 'web-client/src/utils'
import { mapGetters } from 'vuex'
import { isUndefined } from 'lodash-es'
import getSpeed from '@uppy/utils/lib/getSpeed'
import { urlJoin } from 'web-client/src/utils'
import { configurationManager } from 'web-pkg/src/configuration'
import { useCapabilityShareJailEnabled } from 'web-pkg/src/composables'
import { formatFileSize } from 'web-pkg/src/helpers'
import { UppyResource } from '../composables/upload'
export default defineComponent({
setup() {
Expand All @@ -167,13 +170,28 @@ export default defineComponent({
runningUploads: 0, // all uploads (not files!) that are in progress currently
bytesTotal: 0,
bytesUploaded: 0,
uploadSpeed: 0,
filesInEstimation: {},
timeStarted: null,
remainingTime: undefined
}),
computed: {
...mapGetters(['configuration']),
uploadDetails() {
if (!this.uploadSpeed || !this.runningUploads) {
return ''
}
const uploadedBytes = formatFileSize(this.bytesUploaded, this.$language.current)
const totalBytes = formatFileSize(this.bytesTotal, this.$language.current)
const currentUploadSpeed = formatFileSize(this.uploadSpeed, this.$language.current)
return this.$gettext('%{uploadedBytes} of %{totalBytes} (%{currentUploadSpeed}/s)', {
uploadedBytes,
totalBytes,
currentUploadSpeed
})
},
uploadInfoTitle() {
if (this.inFinalization) {
return this.$gettext('Finalizing upload...')
Expand Down Expand Up @@ -295,6 +313,12 @@ export default defineComponent({
this.filesInEstimation[file.meta.uploadId] = progress.bytesUploaded
const timeElapsed = +new Date() - this.timeStarted
this.uploadSpeed = getSpeed({
bytesUploaded: this.bytesUploaded,
uploadStarted: this.timeStarted
})
const progressPercent = (100 * this.bytesUploaded) / this.bytesTotal
if (progressPercent === 0) {
return
Expand Down
56 changes: 32 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8304bd4

Please sign in to comment.