diff --git a/lib/components/UploadPicker.vue b/lib/components/UploadPicker.vue index bc297e6a..f93984e6 100644 --- a/lib/components/UploadPicker.vue +++ b/lib/components/UploadPicker.vue @@ -126,6 +126,11 @@ +
+ +

{{ t('Merging uploaded chunks into a file') }}

+
+ upload.status === UploadStatus.FAILED).length !== 0 }, isUploading() { - return this.queue?.length > 0 + return this.queue?.filter((upload: Upload) => upload.status === UploadStatus.UPLOADING).length !== 0 }, isAssembling() { return this.queue?.filter((upload: Upload) => upload.status === UploadStatus.ASSEMBLING).length !== 0 @@ -394,7 +401,6 @@ export default Vue.extend({ return Array.isArray(this.content) ? this.content : await this.content(path) }, - /** * Start uploading */ @@ -507,6 +513,12 @@ $progress-width: 200px; &--paused &__progress { animation: breathing 3s ease-out infinite normal; } + + &__loading { + display: flex; + margin-left: 8px; + gap: 8px; + } } @keyframes breathing { diff --git a/lib/uploader.ts b/lib/uploader.ts index 6e1a7801..9cab90fb 100644 --- a/lib/uploader.ts +++ b/lib/uploader.ts @@ -2,27 +2,34 @@ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { AxiosError, AxiosResponse } from 'axios' -import type { WebDAVClient } from 'webdav' -import type { IDirectory } from './utils/fileTree' - -import { getCurrentUser } from '@nextcloud/auth' -import { FileType, Folder, Permission, davGetClient, davRemoteURL, davRootPath } from '@nextcloud/files' -import { encodePath } from '@nextcloud/paths' -import { normalize } from 'path' - -import axios, { isCancel } from '@nextcloud/axios' +import type {AxiosError, AxiosResponse} from 'axios' +import type {WebDAVClient} from 'webdav' +import type {IDirectory} from './utils/fileTree' + +import {getCurrentUser} from '@nextcloud/auth' +import { + davGetClient, + davRemoteURL, + davRootPath, + FileType, + Folder, + Permission +} from '@nextcloud/files' +import {encodePath} from '@nextcloud/paths' +import {normalize} from 'path' + +import axios, {isCancel} from '@nextcloud/axios' import PCancelable from 'p-cancelable' import PQueue from 'p-queue' -import { getChunk, initChunkWorkspace, uploadData } from './utils/upload.js' -import { getMaxChunksSize } from './utils/config.js' -import { Status as UploadStatus, Upload } from './upload.js' -import { isFileSystemFileEntry } from './utils/filesystem.js' -import { Directory } from './utils/fileTree.js' -import { t } from './utils/l10n.js' +import {getChunk, initChunkWorkspace, uploadData} from './utils/upload.js' +import {getMaxChunksSize} from './utils/config.js' +import {Status as UploadStatus, Upload} from './upload.js' +import {isFileSystemFileEntry} from './utils/filesystem.js' +import {Directory} from './utils/fileTree.js' +import {t} from './utils/l10n.js' import logger from './utils/logger.js' -import { getCapabilities } from '@nextcloud/capabilities' +import {getCapabilities} from '@nextcloud/capabilities' export enum Status { IDLE = 0, @@ -508,6 +515,11 @@ export class Uploader { await Promise.all(chunksQueue) this.updateStats() + // re-add upload because it was reset + this._uploadQueue.push(upload) + upload.status = UploadStatus.ASSEMBLING + this.updateStats() + upload.response = await axios.request({ method: 'MOVE', url: `${tempUrl}/.file`, @@ -519,8 +531,9 @@ export class Uploader { }, }) - this.updateStats() + this._uploadQueue.push(upload) upload.status = UploadStatus.FINISHED + this.updateStats() logger.debug(`Successfully uploaded ${file.name}`, { file, upload }) resolve(upload) } catch (error) {