Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
large-packages: false
swap-storage: true
- name: Tutor build openedx
run: tutor images build openedx aspects aspects-superset
run: tutor images build openedx aspects aspects-superset permissions
- name: Tutor start
run: tutor local start -d
- name: Tutor init
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
large-packages: false
swap-storage: true
- name: Tutor build openedx
run: tutor images build openedx-dev aspects aspects-superset
run: tutor images build openedx-dev aspects aspects-superset permissions
- name: Tutor start
run: tutor dev start -d
- name: Tutor init
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Tutor build openedx
run: tutor images build openedx aspects aspects-superset
run: tutor images build openedx aspects aspects-superset permissions
- name: Create k8s Kind Cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
- name: Mount docker image
Expand Down Expand Up @@ -340,7 +340,7 @@ jobs:
large-packages: false
swap-storage: true
- name: Tutor build openedx
run: tutor images build openedx aspects aspects-superset
run: tutor images build openedx aspects aspects-superset permissions
- name: Tutor start
run: tutor local start -d
- name: Tutor init
Expand Down Expand Up @@ -413,7 +413,7 @@ jobs:
large-packages: false
swap-storage: true
- name: Tutor build openedx
run: tutor images build openedx-dev aspects aspects-superset
run: tutor images build openedx-dev aspects aspects-superset permissions
- name: Tutor start
run: tutor dev start -d
- name: Tutor init
Expand Down Expand Up @@ -490,7 +490,7 @@ jobs:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Tutor build openedx
run: tutor images build openedx aspects aspects-superset
run: tutor images build openedx aspects aspects-superset permissions
- name: Create k8s Kind Cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
- name: Mount docker image
Expand Down
4 changes: 2 additions & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ click>=8.0,<8.3.0
bcrypt
importlib-resources
openedx-atlas
tutor>=18
tutor @ git+https://github.com/overhangio/tutor@verawood
ruamel.yaml
shandy-sqlfmt[jinjafmt]==0.26.0
tutor-mfe>=18
tutor-mfe @ git+https://github.com/overhangio/tutor-mfe@verawood
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ six==1.17.0
# python-dateutil
tqdm==4.68.3
# via shandy-sqlfmt
tutor==21.0.7
tutor @ git+https://github.com/overhangio/tutor@verawood
# via
# -r requirements/base.in
# tutor-mfe
tutor-mfe==21.0.0
tutor-mfe @ git+https://github.com/overhangio/tutor-mfe@verawood
# via -r requirements/base.in
typing-extensions==4.15.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ tqdm==4.68.3
# via
# -r requirements/base.txt
# shandy-sqlfmt
tutor==21.0.7
tutor @ git+https://github.com/overhangio/tutor@verawood
# via
# -r requirements/base.txt
# tutor-mfe
tutor-mfe==21.0.0
tutor-mfe @ git+https://github.com/overhangio/tutor-mfe@verawood
# via -r requirements/base.txt
twine==6.2.0
# via -r requirements/dev.in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% if ASPECTS_ENABLE_STUDIO_IN_CONTEXT_METRICS %}
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install openedx/frontend-plugin-aspects#v2.0.2
RUN --mount=type=cache,target=/root/.npm,sharing=shared npm install openedx/frontend-plugin-aspects#v3.0.0
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

{% if ASPECTS_ENABLE_STUDIO_IN_CONTEXT_METRICS %}

const { CourseOutlineSidebar, UnitPageSidebar, SidebarToggleWrapper, CourseHeaderButton, UnitActionsButton, SubSectionAnalyticsButton } = await import("@openedx/frontend-plugin-aspects");
const { UnitActionsButton, CourseOutlineSidebarWrapper, UnitOutlineSidebarWrapper, SubSectionAnalyticsButton } = await import("@openedx/frontend-plugin-aspects");

{% else %}
// Currently there is no way to conditionally add plugin slot configuration from tutor-mfe.
// So, as a workaround, tutor-contrib-aspects simply defines the components added to the plugin as empty components.
const CourseOutlineSidebar = () => {};
const UnitPageSidebar = () => {};
const SidebarToggleWrapper = ({component}) => component;
const CourseHeaderButton = () => {};
const UnitActionsButton = () => {};
const CourseOutlineSidebarWrapper = ({component}) => component;
const UnitOutlineSidebarWrapper = ({component}) => component;
const SubSectionAnalyticsButton = () => {};
{% endif %}
8 changes: 8 additions & 0 deletions tutoraspects/patches/openedx-common-settings
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ try:
not OPEN_EDX_FILTERS_CONFIG
except NameError: # OPEN_EDX_FILTERS_CONFIG is not defined
OPEN_EDX_FILTERS_CONFIG = {}
# When DEPR-38432 is pickedup we may want to cleanup here.
if not OPEN_EDX_FILTERS_CONFIG.get("org.openedx.learning.instructor.dashboard.render.started.v1"):
OPEN_EDX_FILTERS_CONFIG["org.openedx.learning.instructor.dashboard.render.started.v1"] = {
"fail_silently": False,
"pipeline": [],
}
if not OPEN_EDX_FILTERS_CONFIG.get("org.openedx.learning.instructor.dashboard.tabs.requested.v1"):
OPEN_EDX_FILTERS_CONFIG["org.openedx.learning.instructor.dashboard.tabs.requested.v1"] = {
"fail_silently": False,
"pipeline": [],
}

OPEN_EDX_FILTERS_CONFIG["org.openedx.learning.instructor.dashboard.render.started.v1"]["pipeline"].append("platform_plugin_aspects.extensions.filters.AddSupersetTab")
OPEN_EDX_FILTERS_CONFIG["org.openedx.learning.instructor.dashboard.tabs.requested.v1"]["pipeline"].append("platform_plugin_aspects.extensions.filters.AddSupersetTabToInstructorDashboard")
{% endif %}

{% if ASPECTS_ENABLE_EVENT_BUS_PRODUCER %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
pip install "platform-plugin-aspects==v1.1.2"
pip install "platform-plugin-aspects==v2.0.0"

RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
pip install "edx-event-routing-backends>=9.3.0,<9.4"
pip install "edx-event-routing-backends>=10.0.0"
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
pip install "platform-plugin-aspects==v1.1.2"
pip install "platform-plugin-aspects==v2.0.0"


RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
pip install "edx-event-routing-backends>=9.3.0,<9.4"
pip install "edx-event-routing-backends>=10.0.0"
91 changes: 30 additions & 61 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
from tutor import hooks

try:
from tutormfe.hooks import PLUGIN_SLOTS
from tutormfe.hooks import FRONTEND_APPS, PLUGIN_SLOTS

_TUTORMFE_AVAILABLE = True
except ImportError:
PLUGIN_SLOTS = None
_TUTORMFE_AVAILABLE = False

from .__about__ import __version__
from .commands_v1 import COMMANDS as TUTOR_V1_COMMANDS
Expand Down Expand Up @@ -685,45 +687,17 @@ def _mount_superset_compose(

# If PLUGIN_SLOTS doesn't exist, we are on Redwood and do not
# support in-context metrics.
if PLUGIN_SLOTS:
if _TUTORMFE_AVAILABLE:
PLUGIN_SLOTS.add_items(
[
(
"authoring",
"org.openedx.frontend.authoring.course_outline_sidebar.v1",
"""
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'outline-sidebar',
priority: 1,
type: DIRECT_PLUGIN,
RenderWidget: CourseOutlineSidebar,
},
}""",
),
(
"authoring",
"org.openedx.frontend.authoring.course_outline_sidebar.v1",
"""
{
op: PLUGIN_OPERATIONS.Wrap,
widgetId: 'default_contents',
wrapper: SidebarToggleWrapper,
}""",
),
(
"authoring",
"org.openedx.frontend.authoring.course_unit_sidebar.v2",
"""
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'course-unit-sidebar',
priority: 1,
type: DIRECT_PLUGIN,
RenderWidget: UnitPageSidebar,
},
wrapper: CourseOutlineSidebarWrapper,
}""",
),
(
Expand All @@ -733,35 +707,7 @@ def _mount_superset_compose(
{
op: PLUGIN_OPERATIONS.Wrap,
widgetId: 'default_contents',
wrapper: SidebarToggleWrapper,
}""",
),
(
"authoring",
"org.openedx.frontend.authoring.course_unit_header_actions.v1",
"""
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'unit-header-aspects-button',
priority: 60,
type: DIRECT_PLUGIN,
RenderWidget: CourseHeaderButton,
},
}""",
),
(
"authoring",
"org.openedx.frontend.authoring.course_outline_header_actions.v1",
"""
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'outline-header-aspects-button',
priority: 60,
type: DIRECT_PLUGIN,
RenderWidget: CourseHeaderButton,
},
wrapper: UnitOutlineSidebarWrapper,
}""",
),
(
Expand Down Expand Up @@ -794,3 +740,26 @@ def _mount_superset_compose(
),
]
)

@FRONTEND_APPS.add()
def _add_frontend_app_aspects(apps):
apps["aspects"] = {
"npm_package": "@openedx/frontend-app-aspects",
"npm_version": "*",
"enabled": True,
}
return apps

hooks.Filters.ENV_PATCHES.add_item(
(
"mfe-site-config-imports",
"import { aspectsApp } from '@openedx/frontend-app-aspects';",
)
)

hooks.Filters.ENV_PATCHES.add_item(
(
"mfe-site-config",
"addApp(siteConfig, aspectsApp);",
)
)