Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add video page #640

Merged
merged 49 commits into from
Nov 6, 2023
Merged

feat: add video page #640

merged 49 commits into from
Nov 6, 2023

Conversation

KristinAoki
Copy link
Member

@KristinAoki KristinAoki commented Oct 17, 2023

JIRA Ticket: TNL-10913

This PR refactors the files and uploads table and makes it more page agnostic. This PR also adds the video page.

Testing:

make sure you test these flags' behaviors
Screenshot 2023-10-18 at 11 57 29 AM

This PR is dependent on edx-platform #33528

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 43 lines in your changes are missing coverage. Please review.

Comparison is base (221fcf7) 86.67% compared to head (4fd19de) 88.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
+ Coverage   86.67%   88.02%   +1.35%     
==========================================
  Files         389      417      +28     
  Lines        5799     6598     +799     
  Branches     1274     1428     +154     
==========================================
+ Hits         5026     5808     +782     
- Misses        748      765      +17     
  Partials       25       25              
Files Coverage Δ
src/CourseAuthoringRoutes.jsx 100.00% <100.00%> (ø)
src/files-and-videos/ApiStatusToast.jsx 71.42% <ø> (ø)
src/files-and-videos/FileInfo.jsx 100.00% <100.00%> (ø)
src/files-and-videos/FileInput.jsx 100.00% <100.00%> (ø)
src/files-and-videos/FileThumbnail.jsx 100.00% <100.00%> (ø)
src/files-and-videos/UsageMetricsMessage.jsx 100.00% <ø> (ø)
src/files-and-videos/data/api.js 100.00% <ø> (ø)
src/files-and-videos/data/constant.js 100.00% <ø> (ø)
src/files-and-videos/data/slice.js 95.00% <ø> (ø)
src/files-and-videos/data/thunks.js 100.00% <100.00%> (ø)
... and 45 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jesperhodge jesperhodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm at best half-done with the review, but I want to give some early feedback.
What I see works very very well. It's a huge amount of work and has barely any problems - I found a few very minor display bugs but added comments for them. The code is also very readable and structured and I haven't discovered any problems there so far.
Your refactoring of the Files components is really great. I am still looking at that but I don't see any issue with that.
The folder structure seems a bit nested and hard to follow for me now - I left a comment about this. It's also not a big thing.
The tests you added that I have looked at so far are very good and cover a lot. I generally like that you test many components together in an integration test fashion. I think there is still a lot that is not covered, however; I so far (I mainly looked at TranscriptSettings tests) only see testing for the "happy path". Besides checking what happens when you get 500 or error responses, I think there's need for testing a lot of edge cases.
UPDATE:
I wasn't correct in saying you don't test for edge cases/unit tests. The tests for api.js cover edge cases very well, my comment was directed at the transcript settings folder.

src/files-and-videos/assets/FilesAndUploads.jsx Outdated Show resolved Hide resolved
src/files-and-videos/assets/index.js Outdated Show resolved Hide resolved
src/CourseAuthoringRoutes.jsx Outdated Show resolved Hide resolved
src/CourseAuthoringRoutes.jsx Outdated Show resolved Hide resolved
src/files-and-videos/FileTable.jsx Show resolved Hide resolved
Copy link
Member

@jesperhodge jesperhodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finished the review. If you only see comments about tests, that's because the code itself is actually so well-written and functions so well that I don't find any issues there. It's very impressive.

src/files-and-videos/videos/data/api.js Outdated Show resolved Hide resolved
jest.mock('file-saver');

describe('api.js', () => {
describe('getDownload', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are great, but I only see tests for the getDownload function. It would be good to test each function in here directly or at least indirectly when they're called in another function. Covering them by testing the react components that call them I think is not be enough to cover edge cases - you see from the tests for this function alone how many possible edge cases there are.

I don't think this needs to account for every possible edge case at all, but just the most important ones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that only the getDownload has a lot of edge cases because of the nested errors. I think that I sufficiently cover the cases in the integration tests for the other api calls.

src/files-and-videos/videos/data/thunks.js Outdated Show resolved Hide resolved
src/files-and-videos/videos/data/utils.js Outdated Show resolved Hide resolved
src/files-and-videos/data/utils.js Show resolved Hide resolved
src/files-and-videos/videos/VideoThumbnail.jsx Outdated Show resolved Hide resolved
src/files-and-videos/videos/Videos.test.jsx Outdated Show resolved Hide resolved
src/files-and-videos/FileTable.jsx Show resolved Hide resolved
Copy link
Member

@jesperhodge jesperhodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work. As far as the tests go, you have added really good tests for edge cases and failing api requests everywhere, and according to Codecov you also have 95% test coverage and raised the coverage of the project quite a bit. This is great. Codecov does show some uncovered lines but I don't think there is a need to go for 100% in this project.
With the folder structure, the changes you made are helpful, but the organizing principle is still intransparent for me. It's not immediately obvious which components are the files and video pages, where the components belong to that are in the files-and-videos folder not in subfolders, and why components such as AssetThumbnail that are not pages themselves live in the files-page folder.
I wanted to show you other ways of organizing this, so I played around a bit and created a PR (with this as target) that reorganizes stuff in a way that looks good to me. You can have a look at it to see whether you agree it is an improvement. https://github.com/openedx/frontend-app-course-authoring/pull/660/files
Otherwise I just had the request to not update paragon right now unless absolutely necessary.

package.json Outdated
"@edx/frontend-platform": "5.6.1",
"@edx/paragon": "^20.45.4",
"@edx/paragon": "^21.5.6",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not strictly necessary, right?
I would like to defer this to a separate PR until we have figured out the library-authoring gocd pipeline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the problem is that there is a dependency conflict with the frontend-component-footer version pinned via npm alias in https://github.com/edx/edx-internal/blob/master/frontends/frontend-app-course-authoring/stage_config.yml (as well as the prod version of this and probably edge-internal repo as well). The gocd pipeline for library-authoring ran into a new error however when I updated that, indicating that the problem is not that simple to fix.

Copy link
Member

@jesperhodge jesperhodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed to move out paragon update as well as following folder structure changes to followup PRs, this all looks great.

@KristinAoki KristinAoki force-pushed the KristinAoki/video-page branch from 68cd2ba to 07eaac6 Compare November 3, 2023 21:35
@KristinAoki KristinAoki merged commit a28338d into master Nov 6, 2023
4 of 5 checks passed
@KristinAoki KristinAoki deleted the KristinAoki/video-page branch November 6, 2023 13:51
Ian2012 pushed a commit to eduNEXT/frontend-app-course-authoring that referenced this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants