-
Notifications
You must be signed in to change notification settings - Fork 84
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
base: master
Are you sure you want to change the base?
Conversation
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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf 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 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
46e2e9a
to
b5014b2
Compare
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ to getting this covered!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
@openedx/2u-aperture (@MaxFrank13, @jsnwesson), any objections to the approach, here? We'd love to get this in before the Sumac cutoff, tomorrow. |
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 |
b5014b2
to
bfbfe67
Compare
@arbrandes @jsnwesson , thank you for reviewing this PR, I covered the lines in the api hook file. |
There was a problem hiding this 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
04856f5
to
11284e3
Compare
11284e3
to
b3f02d8
Compare
@arbrandes, do you thing there is any additional change here to be addressed? |
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
frontend-app-learner-dashobord
mounted in the current branch.