feat: adds VerticalBlockRenderCompleted filter hook#31388
feat: adds VerticalBlockRenderCompleted filter hook#31388mariajgrimaldi merged 11 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @tecoholic! 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. |
9159a33 to
65136a5
Compare
729856b to
b1f546e
Compare
|
@tecoholic Looks good! 👍
|
|
Hi @tecoholic - just checking to see if you are planning to pursue this pull request? Looks like some tests still need to be run. CC: @navinkarkera |
|
Adding this for reference of an usage of this filter: https://github.com/open-craft/xblock-skill-tagging/pull/3 |
|
@mphilbrick211 Hi, yes. I am still very much pursuing this PR :) I think the CI data has become outdated, and as is the PR w.r.t changes on master. Let me rebase it and get the CI run again so you can review it. |
64db05a to
010dd42
Compare
|
Hi @mariajgrimaldi and @ormsbee - Ed suggested it might be good for you both to review this. Thanks! |
|
I don't usually review filters, but this seems reasonable to me. The one thing I will say is that in the longer term, we'll probably want render hooks that are independent of the XBlock API–e.g. UnitRender, ComponentRender, etc. But the infrastructure for that probably won't be around until Palm or the Q-release, and it looks like there are immediate use cases around accessing VerticalBlock fields today, so I think it's fine to go ahead with this filter hook. |
|
@mariajgrimaldi: Do you have time to do this review? I'm always skittish of doing the reviews for filters, since I'm not the target audience and I almost never write these kinds of integrations. |
|
Hi @ormsbee! Sure. I'll do it as soon as I can. |
|
I'll be reviewing this PR once the changes in the dependent PR -in openedx-filters- are addressed 😄 |
010dd42 to
fd9eaf3
Compare
|
@mariajgrimaldi Based on your feedback on the openedx-filters PR openedx/openedx-filters#52, I have updated the hooks in the vertical block to use cc: @navinkarkera |
docs/guides/hooks/filters.rst
Outdated
There was a problem hiding this comment.
These links will be updated once openedx/openedx-filters#52 is merged.
This introduces the VerticalBlockChildrenLoaded filter that is run after all the child blocks are fetched before rendering a student or the public view. This will allow modifying the contents of the VerticalBlock before presenting it to the students. Internal-ref: https://tasks.opencraft.com/browse/BB-6932
597b2d8 to
be42ce1
Compare
mariajgrimaldi
left a comment
There was a problem hiding this comment.
this looks great! Can you include the PR where we included VerticalBlockChildRenderStarted, I'd like to test that as well with the new changes. It'd be wonderful If you have test cases for that as well! Thansk
|
@mariajgrimaldi Definitely. You should find the full details about the filter and test instructions in #30773. I have also updated the requirements files in this PR to point to openedx-filters version 1.1.0. |
mariajgrimaldi
left a comment
There was a problem hiding this comment.
This looks great! Thank you again :)
|
@tecoholic 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
Description
This introduces the VerticalBlockRenderCompleted filter that will be called after a VerticalBlock's rendering is completed. This filter is passed the instance of the
VerticalBlock, web fragment that has been created after the rendering, the context dictionary and the view name.The applications implementing the filter can modify the content that will be presented to the learner based on its own parameters. Some example scenarios:
Which edX user roles will this change impact?
Configuration
The filter can be configured as given below
Supporting information
This relies on the
VerticalBlockRenderCompletedintroduced in this PR - openedx/openedx-filters#52 - and should be merged after the openedx-filters package is released.Testing instructions
The testing instructions assuming you have working devstack setup.
lms/envs/private.pyand include the following contentsclass VerticalBlockto test the AJAX Calls.make lms-restartNow when any unit is opened in the LMS, the bottom should have 2 red boxeslike the one below (only 1 if the AJAX Button Block was skipped). This is injected by the pipeline steps of the the openedx_filter_demos via the
VerticalBlockRenderCompletedfilter.Corresponding logs like the example below can also be see in the LMS logs
make lms-logs.OPTIONAL - If you have added the AJAX Button block in config and added the
dummy_jsonhandler, then clicking the button should populate the Response block with{"status": "success"}.Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Similar prior work: #30773