From 7ea7a302cab41862d1dce90b6dafae0f31429b99 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Wed, 20 Mar 2024 23:29:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20#418=20Show=20toaster=20notifica?= =?UTF-8?q?tion=20on=20upload=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tdrive/frontend/public/locales/en.json | 1 + .../src/app/features/files/services/file-upload-service.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tdrive/frontend/public/locales/en.json b/tdrive/frontend/public/locales/en.json index cf5f57f9..2fbdd9ea 100644 --- a/tdrive/frontend/public/locales/en.json +++ b/tdrive/frontend/public/locales/en.json @@ -166,6 +166,7 @@ "components.newversion.new_version_component.link": "Click here to reload", "components.newversion.new_version_modal.title": "New update available !", "components.add_mails_workspace.text_area_placeholder": "Enter emails of your users*", + "services.file_upload_service.toaster.upload_file_error": "Error uploading file: {{$1}}", "services.console_services.toaster.add_emails_error": "Error while adding email(s)", "services.console_services.toaster.add_email_error_message": "Error while adding {{$1}}", "services.console_services.toaster.success_verify_email": "A verification link has been sent to your email account", diff --git a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts index ce6d1d1f..8415074f 100644 --- a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts +++ b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts @@ -12,6 +12,8 @@ import FileUploadAPIClient from '../api/file-upload-api-client'; import { isPendingFileStatusPending } from '../utils/pending-files'; import { FileTreeObject } from "components/uploads/file-tree-utils"; import { DriveApiClient } from "features/drive/api-client/api-client"; +import { ToasterService } from 'app/features/global/services/toaster-service'; +import Languages from 'app/features/global/services/languages-service'; export enum Events { ON_CHANGE = 'notify', @@ -206,6 +208,9 @@ class FileUploadService { pendingFile.resumable.on('fileError', () => { pendingFile.status = 'error'; pendingFile.resumable.cancel(); + const intendedFilename = (pendingFile.originalFile || {}).name || (pendingFile.backendFile || { metadata: {}}).metadata.name; + ToasterService.error(Languages.t('services.file_upload_service.toaster.upload_file_error', [intendedFilename], + 'Error uploading file ' + intendedFilename)); options?.callback?.(null, options?.context || {}); this.notify(); });