platform-plugin-aspects 0.11.0__tar.gz → 0.11.2__tar.gz
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.
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/CHANGELOG.rst +16 -0
- {platform_plugin_aspects-0.11.0/platform_plugin_aspects.egg-info → platform_plugin_aspects-0.11.2}/PKG-INFO +17 -1
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/__init__.py +1 -1
- platform_plugin_aspects-0.11.2/platform_plugin_aspects/signals.py +295 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/js/embed_dashboard.js +19 -5
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/js/superset.js +1 -1
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2/platform_plugin_aspects.egg-info}/PKG-INFO +17 -1
- platform_plugin_aspects-0.11.0/platform_plugin_aspects/signals.py +0 -247
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/LICENSE +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/MANIFEST.in +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/README.rst +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/apps.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/extensions/__init__.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/extensions/filters.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/management/__init__.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/management/commands/__init__.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/management/commands/dump_data_to_clickhouse.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/management/commands/load_test_tracking_events.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/management/commands/monitor_load_test_tracking.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/settings/__init__.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/settings/common.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/settings/production.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/__init__.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/base_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/course_enrollment_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/course_overview_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/external_id_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/serializers.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/tag_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/user_profile_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/sinks/user_retire_sink.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/css/superset.css +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/html/superset.html +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/html/superset_student.html +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/static/js/install_required.js +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/tasks.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/templates/instructor_dashboard/aspects.html +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/urls.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/utils.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/views.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/waffle.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/xblock.py +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/SOURCES.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/dependency_links.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/entry_points.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/not-zip-safe +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/requires.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects.egg-info/top_level.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/requirements/base.in +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/requirements/constraints.txt +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/setup.cfg +0 -0
- {platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/setup.py +0 -0
|
@@ -14,6 +14,22 @@ Change Log
|
|
|
14
14
|
Unreleased
|
|
15
15
|
**********
|
|
16
16
|
|
|
17
|
+
0.11.2 - 2024-10-04
|
|
18
|
+
*******************
|
|
19
|
+
|
|
20
|
+
Fixes
|
|
21
|
+
=====
|
|
22
|
+
|
|
23
|
+
* wait for transaction commit before trying to sink models.
|
|
24
|
+
|
|
25
|
+
0.11.1 - 2024-09-06
|
|
26
|
+
*******************
|
|
27
|
+
|
|
28
|
+
Fixes
|
|
29
|
+
=====
|
|
30
|
+
|
|
31
|
+
* delay loading of unfocused dashboards in LMS.
|
|
32
|
+
|
|
17
33
|
0.11.0 - 2024-09-04
|
|
18
34
|
*******************
|
|
19
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: platform-plugin-aspects
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: Aspects plugins for edx-platform
|
|
5
5
|
Home-page: https://github.com/openedx/platform-plugin-aspects
|
|
6
6
|
Author: Open edX Project
|
|
@@ -278,6 +278,22 @@ Change Log
|
|
|
278
278
|
Unreleased
|
|
279
279
|
**********
|
|
280
280
|
|
|
281
|
+
0.11.2 - 2024-10-04
|
|
282
|
+
*******************
|
|
283
|
+
|
|
284
|
+
Fixes
|
|
285
|
+
=====
|
|
286
|
+
|
|
287
|
+
* wait for transaction commit before trying to sink models.
|
|
288
|
+
|
|
289
|
+
0.11.1 - 2024-09-06
|
|
290
|
+
*******************
|
|
291
|
+
|
|
292
|
+
Fixes
|
|
293
|
+
=====
|
|
294
|
+
|
|
295
|
+
* delay loading of unfocused dashboards in LMS.
|
|
296
|
+
|
|
281
297
|
0.11.0 - 2024-09-04
|
|
282
298
|
*******************
|
|
283
299
|
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Signal handler functions, mapped to specific signals in apps.py.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from django.db import transaction
|
|
6
|
+
from django.db.models.signals import post_delete, post_save
|
|
7
|
+
from django.dispatch import Signal, receiver
|
|
8
|
+
from opaque_keys import InvalidKeyError
|
|
9
|
+
|
|
10
|
+
from platform_plugin_aspects.sinks import (
|
|
11
|
+
CourseEnrollmentSink,
|
|
12
|
+
ExternalIdSink,
|
|
13
|
+
ObjectTagSink,
|
|
14
|
+
TagSink,
|
|
15
|
+
TaxonomySink,
|
|
16
|
+
UserProfileSink,
|
|
17
|
+
UserRetirementSink,
|
|
18
|
+
)
|
|
19
|
+
from platform_plugin_aspects.utils import get_model
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
from openedx.core.djangoapps.user_api.accounts.signals import USER_RETIRE_LMS_MISC
|
|
23
|
+
except ImportError:
|
|
24
|
+
# Tests don't have the platform installed
|
|
25
|
+
USER_RETIRE_LMS_MISC = Signal()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def receive_course_publish( # pylint: disable=unused-argument # pragma: no cover
|
|
29
|
+
sender, course_key, **kwargs
|
|
30
|
+
):
|
|
31
|
+
"""
|
|
32
|
+
Receives COURSE_PUBLISHED signal and queues the dump job.
|
|
33
|
+
"""
|
|
34
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
35
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
36
|
+
dump_course_to_clickhouse,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
dump_course_to_clickhouse.delay(str(course_key))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def receive_course_enrollment_changed( # pylint: disable=unused-argument # pragma: no cover
|
|
43
|
+
sender, **kwargs
|
|
44
|
+
):
|
|
45
|
+
"""
|
|
46
|
+
Receives ENROLL_STATUS_CHANGE signal and queues the dump job.
|
|
47
|
+
"""
|
|
48
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
49
|
+
dump_data_to_clickhouse,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
user = kwargs.get("user")
|
|
53
|
+
course_id = kwargs.get("course_id")
|
|
54
|
+
|
|
55
|
+
CourseEnrollment = get_model("course_enrollment")
|
|
56
|
+
instance = CourseEnrollment.objects.get(user=user, course_id=course_id)
|
|
57
|
+
|
|
58
|
+
sink = CourseEnrollmentSink(None, None)
|
|
59
|
+
|
|
60
|
+
dump_data_to_clickhouse.delay(
|
|
61
|
+
sink_module=sink.__module__,
|
|
62
|
+
sink_name=sink.__class__.__name__,
|
|
63
|
+
object_id=instance.id,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def on_user_profile_updated_txn(*args, **kwargs):
|
|
68
|
+
"""
|
|
69
|
+
Handle user_profile saves in the middle of a transaction.
|
|
70
|
+
|
|
71
|
+
Handle saves in the middle of a transaction.
|
|
72
|
+
If this gets fired before the transaction commits, the task may try to
|
|
73
|
+
query an id that doesn't exist yet and throw an error. This should postpone
|
|
74
|
+
queuing the Celery task until after the transaction is committed.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
def on_user_profile_updated(instance, **kwargs):
|
|
78
|
+
"""
|
|
79
|
+
Queues the UserProfile dump job when the parent transaction is committed.
|
|
80
|
+
"""
|
|
81
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
82
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
83
|
+
dump_data_to_clickhouse,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
sink = UserProfileSink(None, None)
|
|
87
|
+
dump_data_to_clickhouse.delay(
|
|
88
|
+
sink_module=sink.__module__,
|
|
89
|
+
sink_name=sink.__class__.__name__,
|
|
90
|
+
object_id=str(instance.id),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
transaction.on_commit(lambda: on_user_profile_updated(*args, **kwargs))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# Connect the UserProfile.post_save signal handler only if we have a model to attach to.
|
|
97
|
+
# (prevents celery errors during tests)
|
|
98
|
+
_user_profile = get_model("user_profile")
|
|
99
|
+
if _user_profile:
|
|
100
|
+
post_save.connect(
|
|
101
|
+
on_user_profile_updated_txn, sender=_user_profile
|
|
102
|
+
) # pragma: no cover
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def on_externalid_saved_txn(*args, **kwargs):
|
|
106
|
+
"""
|
|
107
|
+
Handle external_id saves in the middle of a transaction.
|
|
108
|
+
|
|
109
|
+
Handle saves in the middle of a transaction.
|
|
110
|
+
If this gets fired before the transaction commits, the task may try to
|
|
111
|
+
query an id that doesn't exist yet and throw an error. This should postpone
|
|
112
|
+
queuing the Celery task until after the transaction is committed.
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
def on_externalid_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
116
|
+
sender, instance, **kwargs
|
|
117
|
+
):
|
|
118
|
+
"""
|
|
119
|
+
Receives post save signal and queues the dump job.
|
|
120
|
+
"""
|
|
121
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
122
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
123
|
+
dump_data_to_clickhouse,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
sink = ExternalIdSink(None, None)
|
|
127
|
+
dump_data_to_clickhouse.delay(
|
|
128
|
+
sink_module=sink.__module__,
|
|
129
|
+
sink_name=sink.__class__.__name__,
|
|
130
|
+
object_id=str(instance.id),
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
transaction.on_commit(lambda: on_externalid_saved(*args, **kwargs))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
137
|
+
# (prevents celery errors during tests)
|
|
138
|
+
_external_id = get_model("external_id")
|
|
139
|
+
if _external_id:
|
|
140
|
+
post_save.connect(on_externalid_saved_txn, sender=_external_id) # pragma: no cover
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@receiver(USER_RETIRE_LMS_MISC)
|
|
144
|
+
def on_user_retirement( # pylint: disable=unused-argument # pragma: no cover
|
|
145
|
+
sender, user, **kwargs
|
|
146
|
+
):
|
|
147
|
+
"""
|
|
148
|
+
Receives a user retirement signal and queues the retire_user job.
|
|
149
|
+
"""
|
|
150
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
151
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
152
|
+
dump_data_to_clickhouse,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
sink = UserRetirementSink(None, None)
|
|
156
|
+
dump_data_to_clickhouse.delay(
|
|
157
|
+
sink_module=sink.__module__,
|
|
158
|
+
sink_name=sink.__class__.__name__,
|
|
159
|
+
object_id=str(user.id),
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def on_tag_saved_txn(*args, **kwargs):
|
|
164
|
+
"""
|
|
165
|
+
Handle external_id saves in the middle of a transaction.
|
|
166
|
+
|
|
167
|
+
Handle saves in the middle of a transaction.
|
|
168
|
+
If this gets fired before the transaction commits, the task may try to
|
|
169
|
+
query an id that doesn't exist yet and throw an error. This should postpone
|
|
170
|
+
queuing the Celery task until after the transaction is committed.
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
def on_tag_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
174
|
+
sender, instance, **kwargs
|
|
175
|
+
):
|
|
176
|
+
"""
|
|
177
|
+
Receives post save signal and queues the dump job.
|
|
178
|
+
"""
|
|
179
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
180
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
181
|
+
dump_data_to_clickhouse,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
sink = TagSink(None, None)
|
|
185
|
+
dump_data_to_clickhouse.delay(
|
|
186
|
+
sink_module=sink.__module__,
|
|
187
|
+
sink_name=sink.__class__.__name__,
|
|
188
|
+
object_id=str(instance.id),
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
transaction.on_commit(lambda: on_tag_saved(*args, **kwargs))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
195
|
+
# (prevents celery errors during tests)
|
|
196
|
+
_tag = get_model("tag")
|
|
197
|
+
if _tag:
|
|
198
|
+
post_save.connect(on_tag_saved_txn, sender=_tag) # pragma: no cover
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def on_taxonomy_saved_txn(*args, **kwargs):
|
|
202
|
+
"""
|
|
203
|
+
Handle external_id saves in the middle of a transaction.
|
|
204
|
+
|
|
205
|
+
Handle saves in the middle of a transaction.
|
|
206
|
+
If this gets fired before the transaction commits, the task may try to
|
|
207
|
+
query an id that doesn't exist yet and throw an error. This should postpone
|
|
208
|
+
queuing the Celery task until after the transaction is committed.
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
def on_taxonomy_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
212
|
+
sender, instance, **kwargs
|
|
213
|
+
):
|
|
214
|
+
"""
|
|
215
|
+
Receives post save signal and queues the dump job.
|
|
216
|
+
"""
|
|
217
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
218
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
219
|
+
dump_data_to_clickhouse,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
sink = TaxonomySink(None, None)
|
|
223
|
+
dump_data_to_clickhouse.delay(
|
|
224
|
+
sink_module=sink.__module__,
|
|
225
|
+
sink_name=sink.__class__.__name__,
|
|
226
|
+
object_id=str(instance.id),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
transaction.on_commit(lambda: on_taxonomy_saved(*args, **kwargs))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
233
|
+
# (prevents celery errors during tests)
|
|
234
|
+
_taxonomy = get_model("taxonomy")
|
|
235
|
+
if _taxonomy:
|
|
236
|
+
post_save.connect(on_taxonomy_saved_txn, sender=_taxonomy) # pragma: no cover
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def on_object_tag_saved_txn(*args, **kwargs):
|
|
240
|
+
"""
|
|
241
|
+
Handle external_id saves in the middle of a transaction.
|
|
242
|
+
|
|
243
|
+
Handle saves in the middle of a transaction.
|
|
244
|
+
If this gets fired before the transaction commits, the task may try to
|
|
245
|
+
query an id that doesn't exist yet and throw an error. This should postpone
|
|
246
|
+
queuing the Celery task until after the transaction is committed.
|
|
247
|
+
"""
|
|
248
|
+
|
|
249
|
+
def on_object_tag_saved(sender, instance, **kwargs): # pragma: no cover
|
|
250
|
+
"""
|
|
251
|
+
Receives post save signal and queues the dump job.
|
|
252
|
+
"""
|
|
253
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
254
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
255
|
+
dump_data_to_clickhouse,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
sink = ObjectTagSink(None, None)
|
|
259
|
+
dump_data_to_clickhouse.delay(
|
|
260
|
+
sink_module=sink.__module__,
|
|
261
|
+
sink_name=sink.__class__.__name__,
|
|
262
|
+
object_id=str(instance.id),
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
on_object_tag_deleted(sender, instance, **kwargs)
|
|
266
|
+
|
|
267
|
+
transaction.on_commit(lambda: on_object_tag_saved(*args, **kwargs))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def on_object_tag_deleted( # pylint: disable=unused-argument # pragma: no cover
|
|
271
|
+
sender, instance, **kwargs
|
|
272
|
+
):
|
|
273
|
+
"""
|
|
274
|
+
Receives post save signal and queues the dump job.
|
|
275
|
+
"""
|
|
276
|
+
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
277
|
+
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
278
|
+
dump_course_to_clickhouse,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
CourseOverview = get_model("course_overviews")
|
|
282
|
+
if CourseOverview:
|
|
283
|
+
try:
|
|
284
|
+
CourseOverview.objects.get(id=instance.object_id)
|
|
285
|
+
dump_course_to_clickhouse.delay(instance.object_id)
|
|
286
|
+
except (CourseOverview.DoesNotExist, InvalidKeyError):
|
|
287
|
+
pass
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
291
|
+
# (prevents celery errors during tests)
|
|
292
|
+
_object_tag = get_model("object_tag")
|
|
293
|
+
if _object_tag: # pragma: no cover
|
|
294
|
+
post_save.connect(on_object_tag_saved_txn, sender=_object_tag)
|
|
295
|
+
post_delete.connect(on_object_tag_deleted, sender=_object_tag)
|
|
@@ -43,9 +43,7 @@ async function fetchGuestToken() {
|
|
|
43
43
|
return data.guestToken;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function
|
|
47
|
-
xblock_id = xblock_id || "";
|
|
48
|
-
|
|
46
|
+
function _embedDashboard(dashboard_uuid, superset_url, xblock_id){
|
|
49
47
|
window.supersetEmbeddedSdk
|
|
50
48
|
.embedDashboard({
|
|
51
49
|
id: dashboard_uuid, // given by the Superset embedding UI
|
|
@@ -70,10 +68,26 @@ function embedDashboard(dashboard_uuid, superset_url, xblock_id) {
|
|
|
70
68
|
when the dashboard is loaded
|
|
71
69
|
*/
|
|
72
70
|
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function embedDashboard(dashboard, superset_url, xblock_id, index) {
|
|
74
|
+
xblock_id = xblock_id || "";
|
|
75
|
+
let radio = document.querySelector(`#tab-${index+1}`)
|
|
76
|
+
if (index == 0){
|
|
77
|
+
dashboard.loaded = true;
|
|
78
|
+
_embedDashboard(dashboard.uuid, superset_url, xblock_id)
|
|
79
|
+
}
|
|
80
|
+
radio.addEventListener("change", () => {
|
|
81
|
+
if (dashboard.loaded){
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
dashboard.loaded = true;
|
|
85
|
+
_embedDashboard(dashboard.uuid, superset_url, xblock_id)
|
|
86
|
+
});
|
|
73
87
|
};
|
|
74
88
|
|
|
75
89
|
if (window.superset_dashboards !== undefined) {
|
|
76
|
-
window.superset_dashboards.forEach(function(dashboard) {
|
|
77
|
-
embedDashboard(dashboard
|
|
90
|
+
window.superset_dashboards.forEach(function(dashboard, i) {
|
|
91
|
+
embedDashboard(dashboard, window.superset_url, dashboard.uuid, i);
|
|
78
92
|
});
|
|
79
93
|
}
|
|
@@ -8,7 +8,7 @@ function SupersetXBlock(runtime, element, context) {
|
|
|
8
8
|
window.from_xblock = true;
|
|
9
9
|
|
|
10
10
|
function initSuperset(supersetEmbeddedSdk) {
|
|
11
|
-
|
|
11
|
+
_embedDashboard(dashboard_uuid, superset_url, xblock_id);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
if (typeof require === "function") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: platform-plugin-aspects
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: Aspects plugins for edx-platform
|
|
5
5
|
Home-page: https://github.com/openedx/platform-plugin-aspects
|
|
6
6
|
Author: Open edX Project
|
|
@@ -278,6 +278,22 @@ Change Log
|
|
|
278
278
|
Unreleased
|
|
279
279
|
**********
|
|
280
280
|
|
|
281
|
+
0.11.2 - 2024-10-04
|
|
282
|
+
*******************
|
|
283
|
+
|
|
284
|
+
Fixes
|
|
285
|
+
=====
|
|
286
|
+
|
|
287
|
+
* wait for transaction commit before trying to sink models.
|
|
288
|
+
|
|
289
|
+
0.11.1 - 2024-09-06
|
|
290
|
+
*******************
|
|
291
|
+
|
|
292
|
+
Fixes
|
|
293
|
+
=====
|
|
294
|
+
|
|
295
|
+
* delay loading of unfocused dashboards in LMS.
|
|
296
|
+
|
|
281
297
|
0.11.0 - 2024-09-04
|
|
282
298
|
*******************
|
|
283
299
|
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Signal handler functions, mapped to specific signals in apps.py.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from django.db import transaction
|
|
6
|
-
from django.db.models.signals import post_delete, post_save
|
|
7
|
-
from django.dispatch import Signal, receiver
|
|
8
|
-
|
|
9
|
-
from platform_plugin_aspects.sinks import (
|
|
10
|
-
CourseEnrollmentSink,
|
|
11
|
-
ExternalIdSink,
|
|
12
|
-
ObjectTagSink,
|
|
13
|
-
TagSink,
|
|
14
|
-
TaxonomySink,
|
|
15
|
-
UserProfileSink,
|
|
16
|
-
UserRetirementSink,
|
|
17
|
-
)
|
|
18
|
-
from platform_plugin_aspects.utils import get_model
|
|
19
|
-
|
|
20
|
-
try:
|
|
21
|
-
from openedx.core.djangoapps.user_api.accounts.signals import USER_RETIRE_LMS_MISC
|
|
22
|
-
except ImportError:
|
|
23
|
-
# Tests don't have the platform installed
|
|
24
|
-
USER_RETIRE_LMS_MISC = Signal()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def receive_course_publish( # pylint: disable=unused-argument # pragma: no cover
|
|
28
|
-
sender, course_key, **kwargs
|
|
29
|
-
):
|
|
30
|
-
"""
|
|
31
|
-
Receives COURSE_PUBLISHED signal and queues the dump job.
|
|
32
|
-
"""
|
|
33
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
34
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
35
|
-
dump_course_to_clickhouse,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
dump_course_to_clickhouse.delay(str(course_key))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def receive_course_enrollment_changed( # pylint: disable=unused-argument # pragma: no cover
|
|
42
|
-
sender, **kwargs
|
|
43
|
-
):
|
|
44
|
-
"""
|
|
45
|
-
Receives ENROLL_STATUS_CHANGE signal and queues the dump job.
|
|
46
|
-
"""
|
|
47
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
48
|
-
dump_data_to_clickhouse,
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
user = kwargs.get("user")
|
|
52
|
-
course_id = kwargs.get("course_id")
|
|
53
|
-
|
|
54
|
-
CourseEnrollment = get_model("course_enrollment")
|
|
55
|
-
instance = CourseEnrollment.objects.get(user=user, course_id=course_id)
|
|
56
|
-
|
|
57
|
-
sink = CourseEnrollmentSink(None, None)
|
|
58
|
-
|
|
59
|
-
dump_data_to_clickhouse.delay(
|
|
60
|
-
sink_module=sink.__module__,
|
|
61
|
-
sink_name=sink.__class__.__name__,
|
|
62
|
-
object_id=instance.id,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def on_user_profile_updated(instance):
|
|
67
|
-
"""
|
|
68
|
-
Queues the UserProfile dump job when the parent transaction is committed.
|
|
69
|
-
"""
|
|
70
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
71
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
72
|
-
dump_data_to_clickhouse,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
sink = UserProfileSink(None, None)
|
|
76
|
-
dump_data_to_clickhouse.delay(
|
|
77
|
-
sink_module=sink.__module__,
|
|
78
|
-
sink_name=sink.__class__.__name__,
|
|
79
|
-
object_id=str(instance.id),
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def on_user_profile_updated_txn(**kwargs):
|
|
84
|
-
"""
|
|
85
|
-
Handle user_profile saves in the middle of a transaction.
|
|
86
|
-
|
|
87
|
-
If this gets fired before the transaction commits, the task may try to
|
|
88
|
-
query an id that doesn't exist yet and throw an error. This should postpone
|
|
89
|
-
queuing the Celery task until after the transaction is committed.
|
|
90
|
-
"""
|
|
91
|
-
transaction.on_commit(
|
|
92
|
-
lambda: on_user_profile_updated(kwargs["instance"])
|
|
93
|
-
) # pragma: no cover
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
# Connect the UserProfile.post_save signal handler only if we have a model to attach to.
|
|
97
|
-
# (prevents celery errors during tests)
|
|
98
|
-
_user_profile = get_model("user_profile")
|
|
99
|
-
if _user_profile:
|
|
100
|
-
post_save.connect(
|
|
101
|
-
on_user_profile_updated_txn, sender=_user_profile
|
|
102
|
-
) # pragma: no cover
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def on_externalid_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
106
|
-
sender, instance, **kwargs
|
|
107
|
-
):
|
|
108
|
-
"""
|
|
109
|
-
Receives post save signal and queues the dump job.
|
|
110
|
-
"""
|
|
111
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
112
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
113
|
-
dump_data_to_clickhouse,
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
sink = ExternalIdSink(None, None)
|
|
117
|
-
dump_data_to_clickhouse.delay(
|
|
118
|
-
sink_module=sink.__module__,
|
|
119
|
-
sink_name=sink.__class__.__name__,
|
|
120
|
-
object_id=str(instance.id),
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
125
|
-
# (prevents celery errors during tests)
|
|
126
|
-
_external_id = get_model("external_id")
|
|
127
|
-
if _external_id:
|
|
128
|
-
post_save.connect(on_externalid_saved, sender=_external_id) # pragma: no cover
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
@receiver(USER_RETIRE_LMS_MISC)
|
|
132
|
-
def on_user_retirement( # pylint: disable=unused-argument # pragma: no cover
|
|
133
|
-
sender, user, **kwargs
|
|
134
|
-
):
|
|
135
|
-
"""
|
|
136
|
-
Receives a user retirement signal and queues the retire_user job.
|
|
137
|
-
"""
|
|
138
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
139
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
140
|
-
dump_data_to_clickhouse,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
sink = UserRetirementSink(None, None)
|
|
144
|
-
dump_data_to_clickhouse.delay(
|
|
145
|
-
sink_module=sink.__module__,
|
|
146
|
-
sink_name=sink.__class__.__name__,
|
|
147
|
-
object_id=str(user.id),
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def on_tag_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
152
|
-
sender, instance, **kwargs
|
|
153
|
-
):
|
|
154
|
-
"""
|
|
155
|
-
Receives post save signal and queues the dump job.
|
|
156
|
-
"""
|
|
157
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
158
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
159
|
-
dump_data_to_clickhouse,
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
sink = TagSink(None, None)
|
|
163
|
-
dump_data_to_clickhouse.delay(
|
|
164
|
-
sink_module=sink.__module__,
|
|
165
|
-
sink_name=sink.__class__.__name__,
|
|
166
|
-
object_id=str(instance.id),
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
171
|
-
# (prevents celery errors during tests)
|
|
172
|
-
_tag = get_model("tag")
|
|
173
|
-
if _tag:
|
|
174
|
-
post_save.connect(on_tag_saved, sender=_tag) # pragma: no cover
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
def on_taxonomy_saved( # pylint: disable=unused-argument # pragma: no cover
|
|
178
|
-
sender, instance, **kwargs
|
|
179
|
-
):
|
|
180
|
-
"""
|
|
181
|
-
Receives post save signal and queues the dump job.
|
|
182
|
-
"""
|
|
183
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
184
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
185
|
-
dump_data_to_clickhouse,
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
sink = TaxonomySink(None, None)
|
|
189
|
-
dump_data_to_clickhouse.delay(
|
|
190
|
-
sink_module=sink.__module__,
|
|
191
|
-
sink_name=sink.__class__.__name__,
|
|
192
|
-
object_id=str(instance.id),
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
197
|
-
# (prevents celery errors during tests)
|
|
198
|
-
_taxonomy = get_model("taxonomy")
|
|
199
|
-
if _taxonomy:
|
|
200
|
-
post_save.connect(on_taxonomy_saved, sender=_taxonomy) # pragma: no cover
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
def on_object_tag_saved(sender, instance, **kwargs): # pragma: no cover
|
|
204
|
-
"""
|
|
205
|
-
Receives post save signal and queues the dump job.
|
|
206
|
-
"""
|
|
207
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
208
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
209
|
-
dump_data_to_clickhouse,
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
sink = ObjectTagSink(None, None)
|
|
213
|
-
dump_data_to_clickhouse.delay(
|
|
214
|
-
sink_module=sink.__module__,
|
|
215
|
-
sink_name=sink.__class__.__name__,
|
|
216
|
-
object_id=str(instance.id),
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
on_object_tag_deleted(sender, instance, **kwargs)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
def on_object_tag_deleted( # pylint: disable=unused-argument # pragma: no cover
|
|
223
|
-
sender, instance, **kwargs
|
|
224
|
-
):
|
|
225
|
-
"""
|
|
226
|
-
Receives post save signal and queues the dump job.
|
|
227
|
-
"""
|
|
228
|
-
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
|
|
229
|
-
from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel
|
|
230
|
-
dump_course_to_clickhouse,
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
CourseOverview = get_model("course_overviews")
|
|
234
|
-
if CourseOverview:
|
|
235
|
-
try:
|
|
236
|
-
CourseOverview.objects.get(id=instance.object_id)
|
|
237
|
-
dump_course_to_clickhouse.delay(instance.object_id)
|
|
238
|
-
except CourseOverview.DoesNotExist:
|
|
239
|
-
pass
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
# Connect the ExternalId.post_save signal handler only if we have a model to attach to.
|
|
243
|
-
# (prevents celery errors during tests)
|
|
244
|
-
_object_tag = get_model("object_tag")
|
|
245
|
-
if _object_tag: # pragma: no cover
|
|
246
|
-
post_save.connect(on_object_tag_saved, sender=_object_tag)
|
|
247
|
-
post_delete.connect(on_object_tag_deleted, sender=_object_tag)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/apps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/urls.py
RENAMED
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/utils.py
RENAMED
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/views.py
RENAMED
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/waffle.py
RENAMED
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/platform_plugin_aspects/xblock.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{platform_plugin_aspects-0.11.0 → platform_plugin_aspects-0.11.2}/requirements/constraints.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|