From 8ef804bd584928a1bf68702d2bad135ee8275a0d Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:53:49 -0400 Subject: [PATCH] feat: add upload progress modal (#1113) * feat: add upload progress modal * fix: increase code coverage * fix: fix code to be more readable * fix: delete empty file --- .../files-page/FilesPage.test.jsx | 9 +- src/files-and-videos/files-page/messages.js | 9 + .../generic/EditFileErrors.jsx | 6 +- src/files-and-videos/generic/messages.js | 6 + .../videos-page/VideosPage.jsx | 47 ++-- .../videos-page/VideosPage.test.jsx | 200 +++++++++------ src/files-and-videos/videos-page/data/api.js | 21 +- .../videos-page/data/api.test.js | 30 ++- .../videos-page/data/slice.js | 1 - .../videos-page/data/thunks.js | 237 ++++++++++++------ .../videos-page/data/thunks.test.js | 6 +- src/files-and-videos/videos-page/index.js | 8 +- src/files-and-videos/videos-page/messages.js | 49 +++- .../videos-page/upload-modal/UploadModal.jsx | 94 +++++++ .../upload-modal/UploadProgressList.jsx | 46 ++++ .../upload-modal/UploadStatusIcon.jsx | 25 ++ .../videos-page/upload-modal/index.js | 3 + 17 files changed, 599 insertions(+), 198 deletions(-) create mode 100644 src/files-and-videos/videos-page/upload-modal/UploadModal.jsx create mode 100644 src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx create mode 100644 src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx create mode 100644 src/files-and-videos/videos-page/upload-modal/index.js diff --git a/src/files-and-videos/files-page/FilesPage.test.jsx b/src/files-and-videos/files-page/FilesPage.test.jsx index 1e0f4444d4..cdc1d6706d 100644 --- a/src/files-and-videos/files-page/FilesPage.test.jsx +++ b/src/files-and-videos/files-page/FilesPage.test.jsx @@ -563,7 +563,10 @@ describe('FilesAndUploads', () => { const addStatus = store.getState().assets.addingStatus; expect(addStatus).toEqual(RequestStatus.FAILED); }); - expect(screen.getByText('Error')).toBeVisible(); + const addStatus = store.getState().assets.addingStatus; + expect(addStatus).toEqual(RequestStatus.FAILED); + + expect(screen.getByText('Upload error')).toBeVisible(); }); it('404 validation should show error', async () => { @@ -575,7 +578,7 @@ describe('FilesAndUploads', () => { const addStatus = store.getState().assets.addingStatus; expect(addStatus).toEqual(RequestStatus.FAILED); - expect(screen.getByText('Error')).toBeVisible(); + expect(screen.getByText('Upload error')).toBeVisible(); }); it('404 upload should show error', async () => { @@ -588,7 +591,7 @@ describe('FilesAndUploads', () => { const addStatus = store.getState().assets.addingStatus; expect(addStatus).toEqual(RequestStatus.FAILED); - expect(screen.getByText('Error')).toBeVisible(); + expect(screen.getByText('Upload error')).toBeVisible(); }); it('404 delete should show error', async () => { diff --git a/src/files-and-videos/files-page/messages.js b/src/files-and-videos/files-page/messages.js index d2c3bf3d78..a6082edcb0 100644 --- a/src/files-and-videos/files-page/messages.js +++ b/src/files-and-videos/files-page/messages.js @@ -111,6 +111,15 @@ const messages = defineMessages({ defaultMessage: 'Cancel', description: 'The message displayed in the button to confirm cancelling the upload', }, + lockFileTooltipContent: { + id: 'course-authoring.files-and-uploads.file-info.lockFile.tooltip.content', + defaultMessage: `By default, anyone can access a file you upload if + they know the web URL, even if they are not enrolled in your course. + You can prevent outside access to a file by locking the file. When + you lock a file, the web URL only allows learners who are enrolled + in your course and signed in to access the file.`, + description: 'Tooltip message for the lock icon in the table view of files', + }, }); export default messages; diff --git a/src/files-and-videos/generic/EditFileErrors.jsx b/src/files-and-videos/generic/EditFileErrors.jsx index 4a2e1e9098..97b5c32ce4 100644 --- a/src/files-and-videos/generic/EditFileErrors.jsx +++ b/src/files-and-videos/generic/EditFileErrors.jsx @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Alert } from '@openedx/paragon'; import { ErrorAlert } from '@edx/frontend-lib-content-components'; import { RequestStatus } from '../../data/constants'; import messages from './messages'; @@ -24,10 +25,13 @@ const EditFileErrors = ({ {intl.formatMessage(messages.errorAlertMessage, { message: errorMessages.loading })} resetErrors({ errorType: 'add' })} isError={addFileStatus === RequestStatus.FAILED} > + + {intl.formatMessage(messages.uploadErrorAlertTitle)} +