Repository navigation
refactor: read and reorder custom pages from authoring v1 (FC-0118) - #3368
taimoor-ahmed-1 wants to merge 2 commits into
Conversation
The textbooks page read GET /api/contentstore/v1/textbooks/{course_id},
which openedx-platform#39157 superseded with the paginated
GET /api/authoring/v2/courses/{course_key}/textbooks/.
getTextbooks now reads every page of the v2 list and returns the same
{ textbooks } shape as before, so the page and hooks are unchanged.
Creating, editing and deleting a textbook stay on the Studio route.
Adds getAllPages, which requests the largest page size and then any
remaining pages by number, for the other Studio lists that are moving
to paginated endpoints.
The custom pages screen read GET /api/contentstore/v0/tabs/{course_id}
and reordered with POST /api/contentstore/v0/tabs/{course_id}/reorder,
which openedx-platform#39305 supersedes with the paginated
GET /api/authoring/v1/custom_pages/?course_key={course_key} and
PUT /api/authoring/v1/courses/{course_key}/custom_page_order/.
getCustomPages now reads every page of the v1 list, sending the course
key as a query parameter so it is percent-encoded, and returns the same
array of pages as before. Like v0, the list holds only custom pages,
with the same members per page.
updateCustomPageOrder now takes the page ids (usage keys) in their new
order and sends them as {"custom_pages": [...]}, instead of v0's list of
{tab_locator} objects; useReorderCustomPages passes the ids.
getTabHandlerUrl is replaced by getCustomPagesApiUrl and
getCustomPageOrderApiUrl.
Adding, editing and deleting a page stay on the Studio xblock route.
|
Thanks for the pull request, @taimoor-ahmed-1! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are 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. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. 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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3368 +/- ##
==========================================
+ Coverage 96.36% 96.39% +0.02%
==========================================
Files 1467 1473 +6
Lines 36182 36485 +303
Branches 8692 8807 +115
==========================================
+ Hits 34867 35168 +301
+ Misses 1272 1261 -11
- Partials 43 56 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Part of #3361 (FC-0118 Phase 3, parent openedx/openedx-platform#39349).
Draft until openedx/openedx-platform#39305 merges: it adds the endpoint this PR calls. The old address stays live until it is removed through the DEPR process (openedx/openedx-platform#39128).
GET /api/contentstore/v0/tabs/{course_id}→GET /api/authoring/v1/custom_pages/?course_key={course_key}, read page by page withgetAllPages. The course key is sent as a query parameter so its+is percent-encoded. The items have the same fields; v0 and v1 both return only static tabs.POST /api/contentstore/v0/tabs/{course_id}/reorderwith[{tab_locator}]→PUT /api/authoring/v1/courses/{course_key}/custom_page_order/with{"custom_pages": [<usage key>, …]}.updateCustomPageOrdernow takes the ids; its only caller isuseReorderCustomPages./xblock/. The tab-settings endpoint has no caller in this MFE.User roles impacted: Course Author (Content → Pages & Resources → Custom pages). No visible change expected.
Supporting information
Testing instructions
npm test -- src/custom-pagesOther information
getTabHandlerUrlis replaced bygetCustomPagesApiUrlandgetCustomPageOrderApiUrl; only this area's tests used it.Best Practices Checklist
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use. (None added.)../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'