Hello Open edX Team,
I have a question about integrating Superset dashboards into a custom location within my LMS.
Currently, this dashboard is embedded inside the ‘Reports’ tab within the instructor’s side.
As you know, the Open edX platform uses a plugin (platform-plugin-aspects
) to render Superset dashboards. I am trying to replicate this behavior on my own custom URL/view, but I am running into some issues.
I’ve explored the Open edX plugin repository and found that the dashboards are embedded using the following:
- Filters (Python) -
AddSupersetTab
class:
I found theAddSupersetTab
class in theplatform_plugin_aspects/extensions/filters.py
file, which adds a tab to the dashboard.
File: platform_plugin_aspects/extensions/filters.py - Embedding Logic (JavaScript):
There’s also a JavaScript file (embed_dashboard.js
) that embeds the dashboard into the platform. This uses the Superset API and generates a guest token for accessing the dashboards.
File: platform_plugin_aspects/static/js/embed_dashboard.js - Superset Dashboard HTML:
In the HTML (superset.html
), the actual embedding takes place, which renders the dashboard view.
File: platform_plugin_aspects/static/html/superset.html - Guest Token Generation (Python):
I noticed that the plugin usesplatform_plugin_aspects/utils.py
to generate the guest token for embedding the dashboards.
File: platform_plugin_aspects/utils.py - line 91 - UUID for Dashboards:
The UUIDs for the dashboards (e.g.,course-dashboard
,learner-groups
,individual-learner
) are already predefined in theplugin.py
file under the constant
"SUPERSET_EMBEDDABLE_DASHBOARDS",
{
"course-dashboard": "c0e64194-33d1-4d5a-8c10-4f51530c5ee9",
"learner-groups": "8661d20c-cee6-4245-9fcc-610daea5fd24",
"individual-learner": "abae8a25-1ba4-4653-81bd-d3937a162a11",
},
With all of this, I am trying to replicate the behavior of embedding the dashboards on my custom URL or view. However, it’s not working as expected.
What I’m Trying to Do:
-
I want to render the dashboards in a similar manner as they appear in the “Reports” tab, but on different pages (e.g., the homepage).
-
I have created a custom URL, Django view, and HTML template where I want the dashboards to render, but it’s not working as expected.
Issue:
- I am having trouble generating the guest token correctly. It seems that when trying to generate the token on my custom URL/view, it doesn’t work, and the dashboard isn’t embedded properly.
Can anyone provide guidance on:
- How I can replicate the behavior of embedding dashboards in a specific location like the homepage or a custom page, using the same logic but with a custom URL and view?
- How I can correctly generate the guest token in my custom environment so the dashboards can be embedded without issues?
Any suggestions or advice would be greatly appreciated!
Thank you!