-
Notifications
You must be signed in to change notification settings - Fork 16
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: add filter design to modify the instructor dashboard render #96
Conversation
Thanks for the pull request, @mariajgrimaldi! As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion. |
openedx_filters/learning/filters.py
Outdated
class RedirectToPage(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard process. | ||
""" | ||
|
||
def __init__(self, message, redirect_to=""): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
redirect_to: URL to redirect to. | ||
""" | ||
super().__init__(message, redirect_to=redirect_to) | ||
|
||
class RenderInvalidDashboard(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard render process. | ||
""" | ||
|
||
def __init__(self, message, dashboard_template="", template_context=None): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
dashboard_template: template path rendered instead. | ||
template_context: context used to the new dashboard_template. | ||
""" | ||
super().__init__( | ||
message, | ||
dashboard_template=dashboard_template, | ||
template_context=template_context, | ||
) | ||
|
||
class RenderCustomResponse(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard rendering process. | ||
""" | ||
|
||
def __init__(self, message, response=None): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
response: custom response which will be returned by the dashboard view. | ||
""" | ||
super().__init__( | ||
message, | ||
response=response, |
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.
[curious about other opinions] I wonder if these exceptions are needed in this case, is this a question we should ask every time we add a filter that interacts with templates? Or should we always add the same exceptions for them?
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 like the predictability of always having the same exceptions. As a dev I'd like to have an idea of what I can expect of a filter that is *.render.started.v1
.
In this case I personally would rather try to use such filter for extending the instructor dashboard capabilities and not to replace them altogether, but the filter should be agnostic to that. I can imagine all sort of uses for this.
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.
Good! This is a good time to standardize all these types of things. I'll make a mental note to add it to the ongoing docs work :)
openedx_filters/learning/filters.py
Outdated
""" | ||
super().__init__( | ||
message, | ||
dashboard_template=dashboard_template, |
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.
[seeking advice] I used dashboard_template
instead of instructor_dashboard_template
, is it confusing?
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 also think it can be easily confused with the student dashboard. However instructor_dashboard_template seems like unnecessary long.
We could use the same compromise the platform used and go with instructor_template
. I think it conveys the most critical part of the info.
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.
Thanks! That's what I needed.
Custom class used to create instructor dashboard filters and its custom methods. | ||
""" | ||
|
||
filter_type = "org.openedx.learning.instructor.dashboard.render.started.v1" |
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.
[seeking advice] should we use: org.openedx.learning.instructor_dashboard.render.started.v1
instead?
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.
We have used "." for separating "course.enrollment" in the past. I think here it's the same kind of separation and thus "." is correct.
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.
Same here for the docs! Thanks for the help :)
cc @felipemontoya when you have a chance ;) |
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 this together with https://github.com/openedx/edx-platform/pull/32448/files and I think this filter works as expected.
There is a nit about naming one of the variables but once that is fixed this looks like its good to be merged. I leave my approval already.
Custom class used to create instructor dashboard filters and its custom methods. | ||
""" | ||
|
||
filter_type = "org.openedx.learning.instructor.dashboard.render.started.v1" |
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.
We have used "." for separating "course.enrollment" in the past. I think here it's the same kind of separation and thus "." is correct.
openedx_filters/learning/filters.py
Outdated
""" | ||
super().__init__( | ||
message, | ||
dashboard_template=dashboard_template, |
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 also think it can be easily confused with the student dashboard. However instructor_dashboard_template seems like unnecessary long.
We could use the same compromise the platform used and go with instructor_template
. I think it conveys the most critical part of the info.
openedx_filters/learning/filters.py
Outdated
class RedirectToPage(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard process. | ||
""" | ||
|
||
def __init__(self, message, redirect_to=""): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
redirect_to: URL to redirect to. | ||
""" | ||
super().__init__(message, redirect_to=redirect_to) | ||
|
||
class RenderInvalidDashboard(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard render process. | ||
""" | ||
|
||
def __init__(self, message, dashboard_template="", template_context=None): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
dashboard_template: template path rendered instead. | ||
template_context: context used to the new dashboard_template. | ||
""" | ||
super().__init__( | ||
message, | ||
dashboard_template=dashboard_template, | ||
template_context=template_context, | ||
) | ||
|
||
class RenderCustomResponse(OpenEdxFilterException): | ||
""" | ||
Custom class used to stop the instructor dashboard rendering process. | ||
""" | ||
|
||
def __init__(self, message, response=None): | ||
""" | ||
Override init that defines specific arguments used in the instructor dashboard render process. | ||
|
||
Arguments: | ||
message: error message for the exception. | ||
response: custom response which will be returned by the dashboard view. | ||
""" | ||
super().__init__( | ||
message, | ||
response=response, |
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 like the predictability of always having the same exceptions. As a dev I'd like to have an idea of what I can expect of a filter that is *.render.started.v1
.
In this case I personally would rather try to use such filter for extending the instructor dashboard capabilities and not to replace them altogether, but the filter should be agnostic to that. I can imagine all sort of uses for this.
131db66
to
f56956d
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.
Thanks for the review @felipemontoya, I'll merge this now.
@mariajgrimaldi 🎉 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:
This PR adds a new filter to modify the instructor dashboard rendering process. For example: modify the section tabs of the instructor context --that specifies which tabs to render, adding a brand new one defined in a different plugin. The use case we're currently testing is to add a new tab to the instructor dashboard, which renders management information about an Xblock.
Installation instructions:
In case you want to test the use case shown here, you'll need a couple of stuff:
git+https://github.com/eduNEXT/xblock-limesurvey.git@MJG/instructor-tab
git+https://github.com/openedx/openedx-filters.git@MJG/instructor-tab-filters
MJG/instructor-dashboard-filter
Testing instructions:
Reviewers:
Merge checklist:
Post merge:
finished.