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

fix: display programs only if the url is configured #479

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dcoa
Copy link
Contributor

@dcoa dcoa commented Oct 18, 2024

Description

This PR removes the link of programs from the Header if the service is not configured.

It aims to solve the following issue #372

How to test

  1. Create a instance with frontend-app-learner-dashobord mounted in the current branch.
  2. Launch the instance and open it in the browser.
  3. Access the learner dashboard.
  4. By default you should not see help nav button.
  5. Configure programs service following the instructions here https://github.com/overhangio/tutor-discovery.
  6. Now the tab should be available.

@dcoa dcoa requested a review from a team as a code owner October 18, 2024 13:39
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 18, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @dcoa!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @2U-aperture. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.43%. Comparing base (e68dc88) to head (b3f02d8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #479      +/-   ##
==========================================
+ Coverage   97.40%   97.43%   +0.02%     
==========================================
  Files         157      157              
  Lines        1387     1403      +16     
  Branches      229      232       +3     
==========================================
+ Hits         1351     1367      +16     
  Misses         34       34              
  Partials        2        2              

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

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

I reviewed the code and I think the approach makes total sense. It hits a generic django-config-models table that is automatically cached, so it shouldn't be a performance problem.

I also tested it and it works perfectly. Congrats!

It would be better to pass the coverage CI tests, though, as noted in a review comment.

const fetchProgramsConfig = async () => {
try {
const { data } = await api.getProgramsConfig();
setConfig(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you manage to get test coverage on this line (it shouldn't be too hard, maybe by mocking getProgramsConfig), we can fix the CI failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

++ to getting this covered!

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this line is still uncovered, @dcoa.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arbrandes it is covered now :)

@arbrandes
Copy link
Contributor

@openedx/2u-aperture (@MaxFrank13, @jsnwesson), any objections to the approach, here? We'd love to get this in before the Sumac cutoff, tomorrow.

@jsnwesson
Copy link
Contributor

I can confirm that this PR still allows me to see "Programs" in my hosted devstack! @arbrandes I have no objections, as long as some test coverage can be added in the api.js file, as you mentioned.

Screenshot 2024-10-22 at 2 21 09 PM

@dcoa
Copy link
Contributor Author

dcoa commented Oct 24, 2024

@arbrandes @jsnwesson , thank you for reviewing this PR, I covered the lines in the api hook file.

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Still requires a couple of changes. Thanks, though!

const fetchProgramsConfig = async () => {
try {
const { data } = await api.getProgramsConfig();
setConfig(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this line is still uncovered, @dcoa.

src/hooks/api.js Outdated
const { data } = await api.getProgramsConfig();
setConfig(data);
} catch (error) {
console.error('Error accessing programs configuration', error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I'm not a huge fan of leaving console() calls in production code. It would be better to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what would your thoughts be on using a log.Error from frontend-platform, since this error would be useful to capture for anyone with a logging service?

Copy link
Contributor Author

@dcoa dcoa Oct 29, 2024

Choose a reason for hiding this comment

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

@jsnwesson you are right I should use the logError from frontend-platoform 👍 Do you think like that is okay or just passing the error is enough?

@dcoa dcoa force-pushed the dcoa/fix-programs-tab branch 2 times, most recently from 04856f5 to 11284e3 Compare October 31, 2024 08:30
@itsjeyd itsjeyd added core contributor PR author is a Core Contributor (who may or may not have write access to this repo). waiting for eng review PR is ready for review. Review and merge it, or suggest changes. labels Oct 31, 2024
@dcoa
Copy link
Contributor Author

dcoa commented Nov 13, 2024

@arbrandes, do you thing there is any additional change here to be addressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U waiting for eng review PR is ready for review. Review and merge it, or suggest changes.
Projects
Status: In Progress
Status: In Eng Review
Development

Successfully merging this pull request may close these issues.

5 participants