-
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
feat: bare bones taxonomy detail page [FC-0036] #655
feat: bare bones taxonomy detail page [FC-0036] #655
Conversation
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:
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. |
965385f
to
3d45969
Compare
5d927a9
to
87808bb
Compare
d408b52
to
a12f262
Compare
@rpenido I've invited you to the openedx-triage team which will allow tests to run automatically for your submissions, can you please accept the invitation. |
9ae8dc1
to
c6b68bf
Compare
568ee3e
to
56dbdd2
Compare
@rpenido Can you please rebase this and mark it as non-draft, if it's ready? We should also get the 👍🏻 here from your reviewer(s), then schedule the Core Contributor / Maintainer review. |
@rpenido Also, please put [FC-0036] into the PR title. |
and fix tests to mock useQuery.
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 tested this on my devstack
- I read through the code
- I checked for accessibility issues by navigating using the keyboard only
- Includes documentation
- User-facing strings are extracted for translation
@bradenmacdonald Standing in while @rpenido is away: I've merged latest main and addressed the comments from open-craft#5 (review) |
Done @pomegranited ! Thank you for your cover here! 😃 |
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.
A few nits.
src/taxonomy/tag-list/data/api.js
Outdated
queryFn: () => getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex)) | ||
.then((response) => response.data) | ||
.then(camelCaseObject), | ||
}); |
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.
Just realised you can use async/await here:
queryFn: () => getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex)) | |
.then((response) => response.data) | |
.then(camelCaseObject), | |
}); | |
queryFn: async () => { | |
const { data } = await getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex)); | |
return camelCaseObject(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.
Addressed with 0e19e99
src/taxonomy/tag-list/index.js
Outdated
@@ -0,0 +1 @@ | |||
export { default as TagListTable } from './TagListTable'; // eslint-disable-line import/prefer-default-export |
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.
Just a small nit. Adding it this way means any other entries you add won't need this comment.
export { default as TagListTable } from './TagListTable'; // eslint-disable-line import/prefer-default-export | |
/* eslint-disable import/prefer-default-export */ | |
export { default as TagListTable } from './TagListTable'; |
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.
Addressed with 0e19e99
const renderModals = () => ( | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
<> | ||
{isExportModalOpen && ( | ||
<ExportModal | ||
isOpen={isExportModalOpen} | ||
onClose={() => setIsExportModalOpen(false)} | ||
taxonomyId={taxonomy.id} | ||
taxonomyName={taxonomy.name} | ||
/> | ||
)} | ||
</> | ||
); |
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.
const renderModals = () => ( | |
// eslint-disable-next-line react/jsx-no-useless-fragment | |
<> | |
{isExportModalOpen && ( | |
<ExportModal | |
isOpen={isExportModalOpen} | |
onClose={() => setIsExportModalOpen(false)} | |
taxonomyId={taxonomy.id} | |
taxonomyName={taxonomy.name} | |
/> | |
)} | |
</> | |
); | |
const renderModals = () => isExportModalOpen && ( | |
<ExportModal | |
isOpen={isExportModalOpen} | |
onClose={() => setIsExportModalOpen(false)} | |
taxonomyId={taxonomy.id} | |
taxonomyName={taxonomy.name} | |
/> | |
); |
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.
Addressed with 0e19e99
const useTaxonomyDetailData = () => { | ||
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId); | ||
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId); | ||
return { isError, isFetched, taxonomy }; | ||
}; | ||
|
||
const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId); |
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.
This internal hook doesn't seem to be reused so I'm not sure why it's needed.
const useTaxonomyDetailData = () => { | |
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId); | |
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId); | |
return { isError, isFetched, taxonomy }; | |
}; | |
const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId); | |
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId); | |
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId); |
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.
Addressed with 0e19e99
const useTagListData = () => { | ||
const { isError, isFetched, isLoading } = useTagListDataStatus(taxonomyId, options); | ||
const tagList = useTagListDataResponse(taxonomyId, options); | ||
return { | ||
isError, | ||
isFetched, | ||
isLoading, | ||
tagList, | ||
}; | ||
}; | ||
|
||
const { tagList, isLoading } = useTagListData(); |
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.
const useTagListData = () => { | |
const { isError, isFetched, isLoading } = useTagListDataStatus(taxonomyId, options); | |
const tagList = useTagListDataResponse(taxonomyId, options); | |
return { | |
isError, | |
isFetched, | |
isLoading, | |
tagList, | |
}; | |
}; | |
const { tagList, isLoading } = useTagListData(); | |
const { isLoading } = useTagListDataStatus(taxonomyId, options); | |
const tagList = useTagListDataResponse(taxonomyId, options); |
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.
Addressed with 0e19e99
@pomegranited Would you be able to address those nits? ^ I also noticed a minor bug with this PR. If I click the "three dots" button, the menu opens - good. But if I click it again while the menu is open, instead of just closing the menu, it also takes me to the taxonomy detail page. |
Also: I think we should fix the URLs here. The taxonomy list should be at |
Avoids clicking through to the card when using the menu button to hide a card's menu.
* /taxonomy-list is now /taxonomies, and there's a temporary redirect * /taxonomy-list/:id: is now /taxonomy/:id:
@xitij2000 I've addressed your nits with 0e19e99. @bradenmacdonald I fixed that menu bug with 3f0dbaa, and changed the URLs with a15e3a4. Let me know if there's anything else we should fix before this can be merged? |
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.
Approved, but it seems a rebase is needed.
I can rebase now. |
@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. |
Description
Add the first version of the Taxonomy Detail page to show taxonomy metadata and its tag list.
Supporting Information
Testing instructions
Actions
menu to export the taxonomy (taxonomy modal implemented here)If you don't have any taxonomies registered, you could use the taxonomy-sample-data script.
Private-ref: FAL-3529