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: tag sections, subsections, and the whole course (FC-0053) #879

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Mar 8, 2024

Description

Adds the Manage tags menu item and TagCount button to Sections, Subsections and the whole Course.

tag_course_outline

More Infomation

Testing Instructions

  • Enable contentstore.new_studio_mfe.use_new_course_outline_page waffle
  • Run Taxonomy Sample Data script to create units with tags.
  • Go to a course to display the course outline.
  • Click in the Manage Tags in the course header and add some tags
  • Verify the tag count component is updated in real time
  • Use the Manage tags menu item in the three dots to add tags to Sections, Subsections and Units
  • Verify the tag count component is updated in real time

Private ref: FAL-3678

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

openedx-webhooks commented Mar 8, 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-3678-tag-sections-subsections-and-the-whole-course branch 2 times, most recently from 6944de6 to 2b09ef1 Compare March 8, 2024 20:01
@rpenido rpenido changed the title Rpenido/fal 3678 tag sections subsections and the whole course feat: tag sections, subsections, and the whole course Mar 8, 2024
@rpenido rpenido changed the title feat: tag sections, subsections, and the whole course feat: tag sections, subsections, and the whole course (FC-0053) Mar 8, 2024
@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch 2 times, most recently from 47c2f4f to d928dda Compare March 8, 2024 20:36
@rpenido rpenido marked this pull request as ready for review March 11, 2024 21:11
@rpenido rpenido requested a review from a team as a code owner March 11, 2024 21:12
Comment on lines +17 to +36
const StatusBarItem = ({ title, children }) => (
<div className="d-flex flex-column justify-content-between">
<h5>{title}</h5>
<div className="d-flex align-items-center">
{children}
</div>
</div>
);

StatusBarItem.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node,
};

StatusBarItem.defaultProps = {
children: null,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created this component to avoid the repetition of the code below:

<div className="d-flex flex-column justify-content-between">
        <h5>{title}</h5>
....

@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from 1b57202 to c13b2c5 Compare March 11, 2024 22:17
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 96.15385% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 91.93%. Comparing base (9a6e12b) to head (dd7fdc2).
Report is 2 commits behind head on master.

Files Patch % Lines
src/content-tags-drawer/ContentTagsDrawer.jsx 71.42% 2 Missing ⚠️
src/content-tags-drawer/data/api.js 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #879      +/-   ##
==========================================
+ Coverage   91.87%   91.93%   +0.05%     
==========================================
  Files         572      571       -1     
  Lines       10058    10179     +121     
  Branches     2160     2205      +45     
==========================================
+ Hits         9241     9358     +117     
- Misses        790      794       +4     
  Partials       27       27              

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

@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch 4 times, most recently from b1c18e1 to d454fc6 Compare March 11, 2024 23:54
@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from d454fc6 to d1bad89 Compare March 12, 2024 00:01

const isDisabledPublish = (status === ITEM_BADGE_STATUS.live
|| status === ITEM_BADGE_STATUS.publishedNotLive) && !hasChanges;

const { data: contentTagCount } = useContentTagsCount(cardId);
Copy link
Contributor

Choose a reason for hiding this comment

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

@rpenido Will we follow the method of making a call on each card? I'm still leaning toward the approach of fetch tag counts of the entire course.

Copy link
Contributor Author

@rpenido rpenido Mar 12, 2024

Choose a reason for hiding this comment

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

The current code fetches tags for the entire course, but the hook returns the value only for the requested contentId.

See:

https://github.com/openedx/frontend-app-course-authoring/blob/d1bad89bf1de76d264190eea5ff23953b500789d/src/course-outline/data/apiHooks.jsx#L11-L23

Added some comments here: e6bc92d

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh, I understand, thanks 👍

@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from f89ea10 to e6bc92d Compare March 12, 2024 14:56
@ChrisChV
Copy link
Contributor

@rpenido When open the tag drawer in the course header, the drawer title keeps loading (You can see it in the GIF on the description)

image

@rpenido
Copy link
Contributor Author

rpenido commented Mar 12, 2024

@rpenido When open the tag drawer in the course header, the drawer title keeps loading (You can see it in the GIF on the description)

I totally forgot to fix that. Thank you @ChrisChV!
Fixed here: e39955a

@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from ac1b94c to dac33de Compare March 12, 2024 16:13
@rpenido rpenido requested a review from a team as a code owner March 12, 2024 16:13
@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from dac33de to e39955a Compare March 12, 2024 18:45
Copy link
Contributor

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

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

@rpenido Looks good! 👍

  • I tested this: I followed the testing instructions.
  • I read through the code and considered the security, stability and performance implications of the changes.
  • I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
  • Includes tests for bugfixes and/or features added.
  • Includes documentation

@@ -41,6 +41,14 @@ const messages = defineMessages({
id: 'course-authoring.course-outline.status-bar.highlight-emails.link',
defaultMessage: 'Learn more',
},
courseTagsTitle: {
id: 'course-authoring.course-outline.status-bar.course-tags',
defaultMessage: 'Course tags',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a friendly advance warning that soon we'll be requiring descriptions to be added to messages: openedx/frontend-build#517. For now I'm not going to block the PR, but it would be nice if you added some. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Done: f0001a4

@@ -30,6 +31,7 @@ export const getTaxonomyTagsApiUrl = (taxonomyId, options = {}) => {
};
export const getContentTaxonomyTagsApiUrl = (contentId) => new URL(`api/content_tagging/v1/object_tags/${contentId}/`, getApiBaseUrl()).href;
export const getXBlockContentDataApiURL = (contentId) => new URL(`/xblock/outline/${contentId}`, getApiBaseUrl()).href;
export const getCourseContentDataApiURL = (contentId) => new URL(`/api/courses/v1/courses/${contentId}/`, getLmsApiBaseUrl()).href;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a Studio API you can use for this? It's better not to use LMS APIs for the "Course Authoring" frontend if we don't have to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

OK I guess you can leave it for now then, but I've asked on Slack if there's a better way. I'll let you know if I hear anything better.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use /api/contentstore/v1/course_settings/:course_id which is a CMS API returns the display_name . But I guess either way is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice! Fixed here: 1f14240

@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch 3 times, most recently from cbb9879 to 95300f2 Compare March 15, 2024 21:53
@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from 95300f2 to a9fd664 Compare March 15, 2024 22:19
@rpenido rpenido requested review from xitij2000 and removed request for a team March 18, 2024 12:37
@rpenido rpenido force-pushed the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch from 97f3c87 to 7f58c5a Compare March 20, 2024 15:21
@rpenido
Copy link
Contributor Author

rpenido commented Mar 20, 2024

Hi @xitij2000 ! I rebased this PR with the last changes.

Copy link
Contributor

@xitij2000 xitij2000 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 a big PR with a lot of changes. I've tested it and it seems to work, but I will need to continue the review on monday.

Comment on lines 148 to 149
// FixMe: remove code below
// queryClient.invalidateQueries({ queryKey: ['contentTaxonomyTagsCount', contentId] });
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is left behind by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Sorry for that @xitij2000!
Fixed: 643cc1e

Copy link
Contributor

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

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

Looks good! Just a minor point, and then it's good to go from my side.

Comment on lines 144 to 147
<a
className="small ml-2"
href="#"
onClick={() => openManageTagsDrawer()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make this a button? Additionally, you can simplify the call to onClick={openManageTagsDrawer}

Copy link
Contributor Author

@rpenido rpenido Mar 27, 2024

Choose a reason for hiding this comment

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

I was following the Figma design. It is possible to have the same appearance using a button component (that way we can remove the eslint warning)?

Fixed the function assignment here: dd7fdc2

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the figma design specific that it has to be a link? I don't know the advantage of using a link here since it's being used like a button here with an onClick handler and the actual link usage is being supperessed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xitij2000 xitij2000 merged commit f57d40e into openedx:master Mar 28, 2024
6 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.

@xitij2000 xitij2000 deleted the rpenido/fal-3678-tag-sections-subsections-and-the-whole-course branch March 28, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

[Tagging] Tag sections, subsections, and the whole course
6 participants