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: create library form [FC-0059] #1116

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Jun 20, 2024

Description

This PR adds a Create Library form to course-authoring.

image

More Info

Testing Instructions

  • Run your local stack on this branch for course authoring and feat: Create content in library permission added to API response edx-platform#34934 for edx-platform
  • Make sure you have the studio.library_authoring_mfe waffle flag DISABLED
  • Go to the Studio Home and go to the "Libraries" tab
  • Click on the "+ New library" button
  • You should be redirected to the new library form
  • Fill the fields trying some invalid data to check validation
  • Fill the fields correctly and hit "Create".
  • A new library should be created, and you should be redirected to its Home
  • Go back to Studio Home and create a new library using the same data (to force a duplicate ID)
  • You should see an error message after submitting

Private ref: FAL-3768

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 20, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 20, 2024

Thanks for the pull request, @rpenido! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch 3 times, most recently from 1b451bb to a82a7bc Compare June 20, 2024 02:20
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.68%. Comparing base (71fcf9f) to head (d94bbe2).
Report is 672 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1116      +/-   ##
==========================================
- Coverage   92.68%   92.68%   -0.01%     
==========================================
  Files         693      693              
  Lines       12347    12346       -1     
  Branches     2661     2661              
==========================================
- Hits        11444    11443       -1     
  Misses        872      872              
  Partials       31       31              

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

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch from bd7e63f to 8724ac0 Compare June 20, 2024 02:33
@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch 5 times, most recently from c6f08df to a008837 Compare June 23, 2024 11:21
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 This looks and works great @rpenido !

Couple of small nits: Will let Braden weigh in on the description field issue (discussion on the open-craft PR), and I've raised a todo for later with the backend error reporting.

  • I tested this on my tutor dev (nightly) stack using the PR test instructions
  • I read through the code (using feat: create library form (TEMP) open-craft/frontend-app-authoring#42)
  • I checked for accessibility issues by using my keyboard only to create a library
  • Includes documentation -- help text for form fields
  • User-facing strings are extracted for translation

Comment on lines 84 to 90
setApiError((
<>
{error.message}
<br />
{JSON.stringify(error.response?.data)}
</>
));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is ok for now, but we're going to have to display this error to users better at some stage:
image

@rpenido rpenido changed the title feat: create library form feat: create library form [FC-0059] Jun 26, 2024
@bradenmacdonald
Copy link
Contributor

@rpenido What's the status of this PR - is something blocking the review?

@rpenido
Copy link
Contributor Author

rpenido commented Jul 8, 2024

@bradenmacdonald This PR depends on this one:

If you want to do a pass (that would be awesome), it would be better to use the following temp PR for the diff: open-craft#42

@bradenmacdonald
Copy link
Contributor

@rpenido Sure, I did a quick pass on the temp PR. It looks good; just had some minor comments about react query.

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch from 4d9da7f to 63e7593 Compare July 9, 2024 14:16
@bradenmacdonald
Copy link
Contributor

@rpenido Please rebase this and get the coverage test passing; I can review whenever you're ready.

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch 3 times, most recently from 8466521 to f07b0bd Compare July 10, 2024 14:53
@rpenido
Copy link
Contributor Author

rpenido commented Jul 10, 2024

Hi @bradenmacdonald! This is ready for your review.

@rpenido rpenido marked this pull request as ready for review July 10, 2024 14:54
@rpenido rpenido requested a review from a team as a code owner July 10, 2024 14:54
@KristinAoki
Copy link
Member

@rpenido Is this form for V1 libraries or V2 libraries?

@rpenido
Copy link
Contributor Author

rpenido commented Jul 10, 2024

@rpenido Is this form for V1 libraries or V2 libraries?

V2 libraries

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch 2 times, most recently from c539118 to af3a9d1 Compare July 10, 2024 22:39
@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch from af3a9d1 to 8fa7880 Compare July 10, 2024 23:11
@bradenmacdonald
Copy link
Contributor

@KristinAoki FYI, You will see this on your devstack because we have it enabled by default for developers, but it's off by default in production, so this new library v2 UX that we're building shouldn't appear on edx.org. There, users should just see the existing "v1" UI which links to the legacy Studio.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @rpenido ! Just some minor suggestions before I approve + merge.

👍

  • I tested this: on my tutor devstack
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation: n/a

src/library-authoring/create-library/CreateLibrary.tsx Outdated Show resolved Hide resolved
src/library-authoring/create-library/data/apiHooks.ts Outdated Show resolved Hide resolved
return useMutation({
mutationFn: createLibraryV2,
onSettled: () => {
queryClient.invalidateQueries({ queryKey: ['listV2Libraries'] });
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use a "query key factory" for the query key instead of hard-coding a string here - see this example: https://github.com/openedx/frontend-app-course-authoring/blob/5dee203401c323b89492e3597934377284eb074d/src/taxonomy/data/apiHooks.js#L20-L66

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: d94bbe2
This included moving some api/apiHook functions to library-authoring

@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch from 752b094 to d94bbe2 Compare July 12, 2024 11:37
@rpenido
Copy link
Contributor Author

rpenido commented Jul 12, 2024

Hi @bradenmacdonald! This is ready for another pass.

@bradenmacdonald bradenmacdonald merged commit e087001 into openedx:master Jul 12, 2024
7 checks passed
@openedx-webhooks
Copy link

@rpenido 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@bradenmacdonald bradenmacdonald deleted the rpenido/fal-3768-create-new-library-form branch July 12, 2024 12:54
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Library Home Page - "Bare Bones"
6 participants