platform-plugin-aspects 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. platform_plugin_aspects/__init__.py +11 -0
  2. platform_plugin_aspects/apps.py +77 -0
  3. platform_plugin_aspects/conf/locale/babel_mako.cfg +10 -0
  4. platform_plugin_aspects/conf/locale/config.yaml +85 -0
  5. platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.mo +0 -0
  6. platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.po +99 -0
  7. platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.mo +0 -0
  8. platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.po +23 -0
  9. platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.mo +0 -0
  10. platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.po +70 -0
  11. platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.mo +0 -0
  12. platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.po +23 -0
  13. platform_plugin_aspects/extensions/__init__.py +0 -0
  14. platform_plugin_aspects/extensions/filters.py +108 -0
  15. platform_plugin_aspects/management/__init__.py +0 -0
  16. platform_plugin_aspects/management/commands/__init__.py +0 -0
  17. platform_plugin_aspects/management/commands/dump_data_to_clickhouse.py +214 -0
  18. platform_plugin_aspects/management/commands/load_test_tracking_events.py +310 -0
  19. platform_plugin_aspects/management/commands/monitor_load_test_tracking.py +440 -0
  20. platform_plugin_aspects/settings/__init__.py +0 -0
  21. platform_plugin_aspects/settings/common.py +147 -0
  22. platform_plugin_aspects/settings/production.py +38 -0
  23. platform_plugin_aspects/signals.py +305 -0
  24. platform_plugin_aspects/sinks/__init__.py +11 -0
  25. platform_plugin_aspects/sinks/base_sink.py +381 -0
  26. platform_plugin_aspects/sinks/course_enrollment_sink.py +20 -0
  27. platform_plugin_aspects/sinks/course_overview_sink.py +286 -0
  28. platform_plugin_aspects/sinks/external_id_sink.py +20 -0
  29. platform_plugin_aspects/sinks/serializers.py +274 -0
  30. platform_plugin_aspects/sinks/tag_sink.py +47 -0
  31. platform_plugin_aspects/sinks/user_profile_sink.py +20 -0
  32. platform_plugin_aspects/sinks/user_retire_sink.py +50 -0
  33. platform_plugin_aspects/static/css/superset.css +53 -0
  34. platform_plugin_aspects/static/html/superset.html +39 -0
  35. platform_plugin_aspects/static/html/superset_student.html +5 -0
  36. platform_plugin_aspects/static/js/embed_dashboard.js +94 -0
  37. platform_plugin_aspects/static/js/install_required.js +11 -0
  38. platform_plugin_aspects/static/js/superset.js +38 -0
  39. platform_plugin_aspects/tasks.py +64 -0
  40. platform_plugin_aspects/templates/instructor_dashboard/aspects.html +22 -0
  41. platform_plugin_aspects/urls.py +39 -0
  42. platform_plugin_aspects/utils.py +359 -0
  43. platform_plugin_aspects/views.py +296 -0
  44. platform_plugin_aspects/waffle.py +5 -0
  45. platform_plugin_aspects/xblock.py +239 -0
  46. platform_plugin_aspects-2.0.1.dist-info/METADATA +335 -0
  47. platform_plugin_aspects-2.0.1.dist-info/RECORD +51 -0
  48. platform_plugin_aspects-2.0.1.dist-info/WHEEL +5 -0
  49. platform_plugin_aspects-2.0.1.dist-info/entry_points.txt +8 -0
  50. platform_plugin_aspects-2.0.1.dist-info/licenses/LICENSE +201 -0
  51. platform_plugin_aspects-2.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,11 @@
1
+ """
2
+ Aspects plugins for edx-platform.
3
+ """
4
+
5
+ import os
6
+ from importlib.metadata import version
7
+ from pathlib import Path
8
+
9
+ __version__ = version("platform-plugin-aspects")
10
+
11
+ ROOT_DIRECTORY = Path(os.path.dirname(os.path.abspath(__file__)))
@@ -0,0 +1,77 @@
1
+ """
2
+ platform_plugin_aspects Django application initialization.
3
+ """
4
+
5
+ from django.apps import AppConfig
6
+ from edx_django_utils.plugins import PluginSettings, PluginSignals, PluginURLs
7
+
8
+
9
+ class PlatformPluginAspectsConfig(AppConfig):
10
+ """
11
+ Configuration for the aspects Django application.
12
+ """
13
+
14
+ name = "platform_plugin_aspects"
15
+
16
+ plugin_app = {
17
+ PluginURLs.CONFIG: {
18
+ "lms.djangoapp": {
19
+ PluginURLs.NAMESPACE: "",
20
+ PluginURLs.REGEX: r"^aspects/",
21
+ PluginURLs.RELATIVE_PATH: "urls",
22
+ },
23
+ "cms.djangoapp": {
24
+ PluginURLs.NAMESPACE: "",
25
+ PluginURLs.REGEX: r"^aspects/",
26
+ PluginURLs.RELATIVE_PATH: "urls",
27
+ },
28
+ },
29
+ PluginSettings.CONFIG: {
30
+ "lms.djangoapp": {
31
+ "production": {PluginSettings.RELATIVE_PATH: "settings.production"},
32
+ "common": {PluginSettings.RELATIVE_PATH: "settings.common"},
33
+ },
34
+ "cms.djangoapp": {
35
+ "production": {PluginSettings.RELATIVE_PATH: "settings.production"},
36
+ "common": {PluginSettings.RELATIVE_PATH: "settings.common"},
37
+ },
38
+ },
39
+ # Configuration setting for Plugin Signals for this app.
40
+ PluginSignals.CONFIG: {
41
+ # Configure the Plugin Signals for each Project Type, as needed.
42
+ "cms.djangoapp": {
43
+ # List of all plugin Signal receivers for this app and project type.
44
+ PluginSignals.RECEIVERS: [
45
+ {
46
+ # The name of the app's signal receiver function.
47
+ PluginSignals.RECEIVER_FUNC_NAME: "receive_course_publish",
48
+ # The full path to the module where the signal is defined.
49
+ PluginSignals.SIGNAL_PATH: "xmodule.modulestore.django.COURSE_PUBLISHED",
50
+ }
51
+ ],
52
+ },
53
+ "lms.djangoapp": {
54
+ # List of all plugin Signal receivers for this app and project type.
55
+ PluginSignals.RECEIVERS: [
56
+ {
57
+ # The name of the app's signal receiver function.
58
+ PluginSignals.RECEIVER_FUNC_NAME: "receive_course_enrollment_changed",
59
+ # The full path to the module where the signal is defined.
60
+ PluginSignals.SIGNAL_PATH: "common.djangoapps.student.signals.signals.ENROLL_STATUS_CHANGE",
61
+ }
62
+ ],
63
+ },
64
+ },
65
+ }
66
+
67
+ def ready(self):
68
+ """Load modules of Aspects."""
69
+ super().ready()
70
+ from platform_plugin_aspects import ( # pylint: disable=import-outside-toplevel, unused-import
71
+ signals,
72
+ sinks,
73
+ tasks,
74
+ )
75
+ from platform_plugin_aspects.extensions import ( # pylint: disable=unused-import, import-outside-toplevel
76
+ filters,
77
+ )
@@ -0,0 +1,10 @@
1
+ # Extraction from Mako templates.
2
+ # Mako files can appear in a number of different places. Some we want to
3
+ # extract strings from, some we don't.
4
+ #
5
+ # Extract from these directory trees:
6
+ #
7
+ # templates/instructor_dashboard/
8
+ #
9
+ [mako: templates/**/*.html]
10
+ input_encoding = utf-8
@@ -0,0 +1,85 @@
1
+ # Configuration for i18n workflow.
2
+
3
+ locales:
4
+ - en # English - Source Language
5
+ - am # Amharic
6
+ - ar # Arabic
7
+ - az # Azerbaijani
8
+ - bg_BG # Bulgarian (Bulgaria)
9
+ - bn_BD # Bengali (Bangladesh)
10
+ - bn_IN # Bengali (India)
11
+ - bs # Bosnian
12
+ - ca # Catalan
13
+ - ca@valencia # Catalan (Valencia)
14
+ - cs # Czech
15
+ - cy # Welsh
16
+ - da # Danish
17
+ - de_DE # German (Germany)
18
+ - el # Greek
19
+ - en # English
20
+ - en_GB # English (United Kingdom)
21
+ # Don't pull these until we figure out why pages randomly display in these locales,
22
+ # when the user's browser is in English and the user is not logged in.
23
+ # - en@lolcat # LOLCAT English
24
+ # - en@pirate # Pirate English
25
+ - es_419 # Spanish (Latin America)
26
+ - es_AR # Spanish (Argentina)
27
+ - es_EC # Spanish (Ecuador)
28
+ - es_ES # Spanish (Spain)
29
+ - es_MX # Spanish (Mexico)
30
+ - es_PE # Spanish (Peru)
31
+ - et_EE # Estonian (Estonia)
32
+ - eu_ES # Basque (Spain)
33
+ - fa # Persian
34
+ - fa_IR # Persian (Iran)
35
+ - fi_FI # Finnish (Finland)
36
+ - fil # Filipino
37
+ - fr # French
38
+ - gl # Galician
39
+ - gu # Gujarati
40
+ - he # Hebrew
41
+ - hi # Hindi
42
+ - hr # Croatian
43
+ - hu # Hungarian
44
+ - hy_AM # Armenian (Armenia)
45
+ - id # Indonesian
46
+ - it_IT # Italian (Italy)
47
+ - ja_JP # Japanese (Japan)
48
+ - kk_KZ # Kazakh (Kazakhstan)
49
+ - km_KH # Khmer (Cambodia)
50
+ - kn # Kannada
51
+ - ko_KR # Korean (Korea)
52
+ - lt_LT # Lithuanian (Lithuania)
53
+ - ml # Malayalam
54
+ - mn # Mongolian
55
+ - mr # Marathi
56
+ - ms # Malay
57
+ - nb # Norwegian Bokmål
58
+ - ne # Nepali
59
+ - nl_NL # Dutch (Netherlands)
60
+ - or # Oriya
61
+ - pl # Polish
62
+ - pt_BR # Portuguese (Brazil)
63
+ - pt_PT # Portuguese (Portugal)
64
+ - ro # Romanian
65
+ - ru # Russian
66
+ - si # Sinhala
67
+ - sk # Slovak
68
+ - sl # Slovenian
69
+ - sq # Albanian
70
+ - sr # Serbian
71
+ - ta # Tamil
72
+ - te # Telugu
73
+ - th # Thai
74
+ - tr_TR # Turkish (Turkey)
75
+ - uk # Ukranian
76
+ - ur # Urdu
77
+ - uz # Uzbek
78
+ - vi # Vietnamese
79
+ - zh_CN # Chinese (China)
80
+ - zh_HK # Chinese (Hong Kong)
81
+ - zh_TW # Chinese (Taiwan)
82
+
83
+ # The locales used for fake-accented English, for testing.
84
+ dummy_locales:
85
+ - eo
@@ -0,0 +1,99 @@
1
+ # edX translation file.
2
+ # Copyright (C) 2024 EdX
3
+ # This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
4
+ # EdX Team <info@edx.org>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: 0.1a\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2024-05-06 15:45-0400\n"
11
+ "PO-Revision-Date: 2023-06-13 09:00+0000\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: openedx-translation <openedx-translation@googlegroups.com>\n"
14
+ "Language: en\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
20
+ #: extensions/filters.py:60
21
+ msgid "Reports"
22
+ msgstr ""
23
+
24
+ #: settings/common.py:29
25
+ msgid "Course Dashboard"
26
+ msgstr ""
27
+
28
+ #: settings/common.py:35
29
+ msgid "Individual Learner Dashboard"
30
+ msgstr ""
31
+
32
+ #: settings/common.py:41
33
+ msgid "At-Risk Learners Dashboard"
34
+ msgstr ""
35
+
36
+ #: static/html/superset.html:9
37
+ msgid ""
38
+ "Superset is not configured properly. Please contact your system "
39
+ "administrator."
40
+ msgstr ""
41
+
42
+ #: static/html/superset_student.html:4
43
+ msgid ""
44
+ "Superset is only visible to course staff and instructors. Please contact "
45
+ "your system administrator."
46
+ msgstr ""
47
+
48
+ #: utils.py:162
49
+ #, python-brace-format
50
+ msgid ""
51
+ "Unable to fetch Superset guest token, Superset server error {server_response}"
52
+ msgstr ""
53
+
54
+ #: utils.py:171
55
+ msgid ""
56
+ "Unable to fetch Superset guest token, mostly likely due to invalid settings."
57
+ "SUPERSET_CONFIG"
58
+ msgstr ""
59
+
60
+ #: views.py:85
61
+ #, python-brace-format
62
+ msgid "Invalid course id: '{course_id}'"
63
+ msgstr ""
64
+
65
+ #: views.py:97
66
+ #, python-brace-format
67
+ msgid "Course not found: '{course_id}'"
68
+ msgstr ""
69
+
70
+ #: xblock.py:40 xblock.py:41
71
+ msgid "Display name"
72
+ msgstr ""
73
+
74
+ #: xblock.py:42
75
+ msgid "Superset Dashboard"
76
+ msgstr ""
77
+
78
+ #: xblock.py:47
79
+ msgid "Dashboard UUID"
80
+ msgstr ""
81
+
82
+ #: xblock.py:49
83
+ msgid ""
84
+ "The ID of the dashboard to embed. Available in the Superset embed dashboard "
85
+ "UI."
86
+ msgstr ""
87
+
88
+ #: xblock.py:56
89
+ msgid "Filters"
90
+ msgstr ""
91
+
92
+ #: xblock.py:58
93
+ msgid ""
94
+ "List of SQL filters to apply to the\n"
95
+ " dashboard. E.g: [\"org='edX'\", \"country in ('us', 'co')\"]\n"
96
+ " The fields used here must be available on every dataset used "
97
+ "by the dashboard.\n"
98
+ " "
99
+ msgstr ""
@@ -0,0 +1,23 @@
1
+ # Translations template for PROJECT.
2
+ # Copyright (C) 2024 ORGANIZATION
3
+ # This file is distributed under the same license as the PROJECT project.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PROJECT VERSION\n"
10
+ "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11
+ "POT-Creation-Date: 2024-03-13 11:48+1030\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=utf-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Generated-By: Babel 2.14.0\n"
19
+
20
+ #: templates/instructor_dashboard/aspects.html:17
21
+ msgid "Go to Superset"
22
+ msgstr ""
23
+
@@ -0,0 +1,70 @@
1
+ # edX translation file.
2
+ # Copyright (C) 2024 EdX
3
+ # This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
4
+ # EdX Team <info@edx.org>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: 0.1a\n"
9
+ "Report-Msgid-Bugs-To: openedx-translation@googlegroups.com\n"
10
+ "POT-Creation-Date: 2023-06-13 08:00+0000\n"
11
+ "PO-Revision-Date: 2023-06-13 09:00+0000\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: openedx-translation <openedx-translation@googlegroups.com>\n"
14
+ "Language: eo\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
20
+ #: static/html/superset.html
21
+ msgid ""
22
+ "Superset is not configured properly. Please contact your system "
23
+ "administrator."
24
+ msgstr ""
25
+ "Süpérsét ïs nöt çönfïgüréd pröpérlý. Pléäsé çöntäçt ýöür sýstém "
26
+ "ädmïnïsträtör. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєт#"
27
+
28
+ #: static/html/superset_student.html
29
+ msgid ""
30
+ "Superset is only visible to course staff and instructors. Please contact "
31
+ "your system administrator."
32
+ msgstr ""
33
+ "Süpérsét ïs önlý vïsïßlé tö çöürsé stäff änd ïnstrüçtörs. Pléäsé çöntäçt "
34
+ "ýöür sýstém ädmïnïsträtör. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
35
+
36
+ #: xblock.py xblock.py
37
+ msgid "Display name"
38
+ msgstr "Dïspläý nämé Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
39
+
40
+ #: xblock.py
41
+ msgid "Superset Dashboard"
42
+ msgstr "Süpérsét Däshßöärd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
43
+
44
+ #: xblock.py
45
+ msgid "Dashboard UUID"
46
+ msgstr "Däshßöärd ÛÛÌD Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
47
+
48
+ #: xblock.py
49
+ msgid ""
50
+ "The ID of the dashboard to embed. Available in the Superset embed dashboard "
51
+ "UI."
52
+ msgstr ""
53
+ "Thé ÌD öf thé däshßöärd tö émßéd. Àväïläßlé ïn thé Süpérsét émßéd däshßöärd "
54
+ "ÛÌ. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєт#"
55
+
56
+ #: xblock.py
57
+ msgid "Filters"
58
+ msgstr "Fïltérs Ⱡ'σяєм ιρѕυм #"
59
+
60
+ #: xblock.py
61
+ msgid ""
62
+ "List of SQL filters to apply to the\n"
63
+ " dashboard. E.g: [\"org='edX'\", \"country in ('us', 'co')\"]\n"
64
+ " The fields used here must be available on every dataset used by the dashboard.\n"
65
+ " "
66
+ msgstr ""
67
+ "Lïst öf SQL fïltérs tö äpplý tö thé\n"
68
+ " däshßöärd. É.g: [\"örg='édX'\", \"çöüntrý ïn ('üs', 'çö')\"]\n"
69
+ " Thé fïélds üséd héré müst ßé äväïläßlé ön évérý dätäsét üséd ßý thé däshßöärd.\n"
70
+ " Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α∂ιριѕι¢ιηg єłιт, ѕє∂ ∂σ єιυѕмσ∂ тємρσя ιη¢ι∂ι∂υηт υт łαвσяє єт ∂σłσяє мαgηα αłιqυα. υт єηιм α∂ мιηιм νєηιαм, qυιѕ ησѕтяυ∂ єχєя¢ιтαтιση υłłαм¢σ łαвσяιѕ ηιѕι υт αłιqυιρ єχ єα ¢σммσ∂σ ¢σηѕєqυαт. ∂υιѕ αυтє ιяυяє ∂σłσя ιη яєρяєнєη∂єяιт ιη νσłυρтαтє νєłιт єѕѕє ¢ιłłυм ∂σłσяє єυ ƒυgιαт ηυłłα ραяιαт#"
@@ -0,0 +1,23 @@
1
+ # Translations template for PROJECT.
2
+ # Copyright (C) 2024 ORGANIZATION
3
+ # This file is distributed under the same license as the PROJECT project.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PROJECT VERSION\n"
9
+ "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10
+ "POT-Creation-Date: 2024-03-13 11:48+1030\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: eo\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=utf-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+ "Generated-By: Babel 2.14.0\n"
20
+
21
+ #: templates/instructor_dashboard/aspects.html
22
+ msgid "Go to Superset"
23
+ msgstr "Gö tö Süpérsét Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
File without changes
@@ -0,0 +1,108 @@
1
+ """
2
+ Open edX Filters needed for Aspects integration.
3
+ """
4
+
5
+ import importlib.resources
6
+
7
+ from crum import get_current_user
8
+ from django.conf import settings
9
+ from django.template import Context, Template
10
+ from openedx_filters import PipelineStep
11
+ from web_fragments.fragment import Fragment
12
+
13
+ from platform_plugin_aspects.utils import (
14
+ _,
15
+ generate_superset_context,
16
+ get_user_dashboard_locale,
17
+ )
18
+
19
+ TEMPLATE_ABSOLUTE_PATH = "/instructor_dashboard/"
20
+ BLOCK_CATEGORY = "aspects"
21
+
22
+
23
+ class AddSupersetTab(PipelineStep):
24
+ """
25
+ Add superset tab to instructor dashboard.
26
+ """
27
+
28
+ def run_filter(
29
+ self, context, template_name
30
+ ): # pylint: disable=arguments-differ, unused-argument
31
+ """Execute filter that modifies the instructor dashboard context.
32
+ Args:
33
+ context (dict): the context for the instructor dashboard.
34
+ _ (str): instructor dashboard template name.
35
+ """
36
+ course = context["course"]
37
+ dashboards = settings.ASPECTS_INSTRUCTOR_DASHBOARDS
38
+ show_dashboard_link = settings.SUPERSET_SHOW_INSTRUCTOR_DASHBOARD_LINK
39
+
40
+ user = get_current_user()
41
+ formatted_language = get_user_dashboard_locale(user)
42
+
43
+ context["course_id"] = course.id
44
+ context = generate_superset_context(
45
+ context,
46
+ dashboards=dashboards,
47
+ language=formatted_language,
48
+ )
49
+
50
+ template = Template(self.resource_string("static/html/superset.html"))
51
+ html = template.render(Context(context))
52
+ frag = Fragment(html)
53
+ frag.add_css(self.resource_string("static/css/superset.css"))
54
+ frag.add_javascript(self.resource_string("static/js/embed_dashboard.js"))
55
+ section_data = {
56
+ "fragment": frag,
57
+ "section_key": BLOCK_CATEGORY,
58
+ "section_display_name": _("Reports"),
59
+ "course_id": str(context.get("course_id")),
60
+ "superset_guest_token_url": str(context.get("superset_guest_token_url")),
61
+ "superset_url": str(context.get("superset_url")),
62
+ "template_path_prefix": TEMPLATE_ABSOLUTE_PATH,
63
+ "show_dashboard_link": show_dashboard_link,
64
+ }
65
+
66
+ context["sections"].append(section_data)
67
+ return {
68
+ "context": context,
69
+ }
70
+
71
+ def resource_string(self, path):
72
+ """Handy helper for getting resources from our kit."""
73
+ data = (
74
+ importlib.resources.files("platform_plugin_aspects")
75
+ .joinpath(path)
76
+ .read_text(encoding="utf-8")
77
+ )
78
+
79
+ return data
80
+
81
+
82
+ class AddSupersetTabToInstructorDashboard(PipelineStep):
83
+ """
84
+ Add superset tab to instructor dashboard app.
85
+ """
86
+
87
+ def run_filter(
88
+ self, tabs, user, course_key
89
+ ): # pylint: disable=arguments-differ, unused-argument
90
+ """Execute filter that modifies the instructor dashboard context.
91
+ Args:
92
+ tabs (list): the list of tabs for the instructor dashboard.
93
+ user (User): the current user.
94
+ course_key (str): the course key.
95
+ """
96
+ modified_tabs = tabs.copy()
97
+ tab_id = "aspects"
98
+ course_id = str(course_key)
99
+
100
+ custom_tab = {
101
+ "tab_id": tab_id,
102
+ "title": _("Reports"),
103
+ "url": f"/instructor-dashboard/{course_id}/{tab_id}/",
104
+ "sort_order": 120,
105
+ }
106
+
107
+ modified_tabs.append(custom_tab)
108
+ return {"tabs": modified_tabs}
File without changes