Skip to content

Commit

Permalink
chore: fix studio not reload correctly (#2156)
Browse files Browse the repository at this point in the history
* chore: fix studio not reload correctly

chore: update linting

* chore: version bump
  • Loading branch information
leangseu-edx authored Jan 9, 2024
1 parent 732f122 commit 68fc523
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Initialization Information for Open Assessment Module
"""

__version__ = '6.0.23'
__version__ = '6.0.24'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% if show_survey %}
<div id="openassessment_hotjar"></div>
<script>
<script type="text/javascript">
// check to see if hotjar is available, then trigger hotjar event
const hasWindow = typeof window !== 'undefined';
if (hasWindow && window.hj) {
Expand Down
14 changes: 0 additions & 14 deletions openassessment/templates/openassessmentblock/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@
If the new views are not enabled, `.ora-view` will be hidden, otherwise, `.ora-legacy-view`
will be hidden.
-->
<!-- Hotjar Tracking Code for https://www.edx.org/ -->
<script>
const isMobile = window.navigator.userAgent.includes("org.edx.mobile");
if(!isMobile){
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:{{hotjar_site_id}},hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
}
</script>
<div class="wrapper wrapper--xblock wrapper--openassessment theme--basic">
<!--Template for legacy ORA UI (will not co-exist with .ora-view)-->
<div class="openassessment problem">
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/openassessmentblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ def student_view(self, context=None): # pylint: disable=unused-argument
"title": self.title,
"xblock_id": self.get_xblock_id(),
"course_id": self.course_id,
"hotjar_site_id": getattr(settings, 'HOTJAR_SITE_ID', '00000'),
}

template = get_template("openassessmentblock/base.html")
Expand All @@ -630,6 +629,7 @@ def student_view(self, context=None): # pylint: disable=unused-argument
additional_js_context={
"MFE_VIEW_ENABLED": self.mfe_views_enabled and self.mfe_views_supported,
"ORA_MICROFRONTEND_URL": getattr(settings, 'ORA_MICROFRONTEND_URL', ''),
"HOTJAR_SITE_ID": getattr(settings, 'HOTJAR_SITE_ID', '00000'),
}
)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions openassessment/xblock/static/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"openassessment-editor-textarea.js.map": "/openassessment-editor-textarea.2cee26d88c3441ada635.js.map",
"openassessment-editor-tinymce.js": "/openassessment-editor-tinymce.0b97b77ad7f1b7150f67.js",
"openassessment-editor-tinymce.js.map": "/openassessment-editor-tinymce.0b97b77ad7f1b7150f67.js.map",
"openassessment-lms.css": "/openassessment-lms.ec995a870be806fa3c83.css",
"openassessment-lms.js": "/openassessment-lms.ec995a870be806fa3c83.js",
"openassessment-lms.css.map": "/openassessment-lms.ec995a870be806fa3c83.css.map",
"openassessment-lms.js.map": "/openassessment-lms.ec995a870be806fa3c83.js.map",
"openassessment-lms.css": "/openassessment-lms.736feb2cdd817e20a912.css",
"openassessment-lms.js": "/openassessment-lms.736feb2cdd817e20a912.js",
"openassessment-lms.css.map": "/openassessment-lms.736feb2cdd817e20a912.css.map",
"openassessment-lms.js.map": "/openassessment-lms.736feb2cdd817e20a912.js.map",
"openassessment-ltr.css": "/openassessment-ltr.fc51066b10e768424924.css",
"openassessment-ltr.js": "/openassessment-ltr.fc51066b10e768424924.js",
"openassessment-ltr.css.map": "/openassessment-ltr.fc51066b10e768424924.css.map",
Expand All @@ -18,6 +18,6 @@
"openassessment-rtl.js.map": "/openassessment-rtl.95f543e97ff08b79004e.js.map",
"openassessment-studio.js": "/openassessment-studio.d576fb212cefa2e4b720.js",
"openassessment-studio.js.map": "/openassessment-studio.d576fb212cefa2e4b720.js.map",
"fallback-default.png": "/4620b30a966533ace489dcc7afb151b9.png",
"fallback-default.png": "/1b90ce76fe01a1aa6e5ec289a5fb3799.png",
"default-avatar.svg": "/95ec738c0b7faac5b5c9126794446bbd.svg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "b2a9cf4156c3630c8859";
/******/ var hotCurrentHash = "b421809a578f06021f44";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "b2a9cf4156c3630c8859";
/******/ var hotCurrentHash = "b421809a578f06021f44";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

This file was deleted.

8 changes: 4 additions & 4 deletions openassessment/xblock/static/dist/openassessment-lms.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions openassessment/xblock/static/dist/openassessment-ltr.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "b2a9cf4156c3630c8859";
/******/ var hotCurrentHash = "b421809a578f06021f44";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down Expand Up @@ -891,7 +891,7 @@ eval("\n\n/* eslint-disable */\nfunction normalizeUrl(pathComponents) {\n retur
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n if(true) {\n // 1702323925024\n var cssReload = __webpack_require__(/*! ./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js */ \"./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.i, {\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n //# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtbHRyLnNjc3M/Yjg0YyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQ1U7QUFDVixPQUFPLElBQVU7QUFDakI7QUFDQSxzQkFBc0IsbUJBQU8sQ0FBQyx3SkFBeUcsRUFBRSxRQUFTLEdBQUcsZUFBZTtBQUNwSztBQUNBO0FBQ0EiLCJmaWxlIjoiLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtbHRyLnNjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBleHRyYWN0ZWQgYnkgbWluaS1jc3MtZXh0cmFjdC1wbHVnaW5cbmV4cG9ydCB7fTtcbiAgICBpZihtb2R1bGUuaG90KSB7XG4gICAgICAvLyAxNzAyMzIzOTI1MDI0XG4gICAgICB2YXIgY3NzUmVsb2FkID0gcmVxdWlyZShcIi9ob21lL2ZlYW5pbC9zcmMvb3BlbmVkeC9lZHgtb3JhMi9ub2RlX21vZHVsZXMvbWluaS1jc3MtZXh0cmFjdC1wbHVnaW4vZGlzdC9obXIvaG90TW9kdWxlUmVwbGFjZW1lbnQuanNcIikobW9kdWxlLmlkLCB7XCJsb2NhbHNcIjpmYWxzZX0pO1xuICAgICAgbW9kdWxlLmhvdC5kaXNwb3NlKGNzc1JlbG9hZCk7XG4gICAgICBtb2R1bGUuaG90LmFjY2VwdCh1bmRlZmluZWQsIGNzc1JlbG9hZCk7XG4gICAgfVxuICAiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./openassessment/xblock/static/sass/openassessment-ltr.scss\n");
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n if(true) {\n // 1704482231973\n var cssReload = __webpack_require__(/*! ./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js */ \"./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.i, {\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n //# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtbHRyLnNjc3M/Yjg0YyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQ1U7QUFDVixPQUFPLElBQVU7QUFDakI7QUFDQSxzQkFBc0IsbUJBQU8sQ0FBQyx3SkFBcUcsRUFBRSxRQUFTLEdBQUcsZUFBZTtBQUNoSztBQUNBO0FBQ0EiLCJmaWxlIjoiLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtbHRyLnNjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBleHRyYWN0ZWQgYnkgbWluaS1jc3MtZXh0cmFjdC1wbHVnaW5cbmV4cG9ydCB7fTtcbiAgICBpZihtb2R1bGUuaG90KSB7XG4gICAgICAvLyAxNzA0NDgyMjMxOTczXG4gICAgICB2YXIgY3NzUmVsb2FkID0gcmVxdWlyZShcIi9Vc2Vycy9sa2ltMS9naXQvc3JjL2VkeC1vcmEyL25vZGVfbW9kdWxlcy9taW5pLWNzcy1leHRyYWN0LXBsdWdpbi9kaXN0L2htci9ob3RNb2R1bGVSZXBsYWNlbWVudC5qc1wiKShtb2R1bGUuaWQsIHtcImxvY2Fsc1wiOmZhbHNlfSk7XG4gICAgICBtb2R1bGUuaG90LmRpc3Bvc2UoY3NzUmVsb2FkKTtcbiAgICAgIG1vZHVsZS5ob3QuYWNjZXB0KHVuZGVmaW5lZCwgY3NzUmVsb2FkKTtcbiAgICB9XG4gICJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./openassessment/xblock/static/sass/openassessment-ltr.scss\n");

/***/ })

Expand Down
4 changes: 2 additions & 2 deletions openassessment/xblock/static/dist/openassessment-rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "b2a9cf4156c3630c8859";
/******/ var hotCurrentHash = "b421809a578f06021f44";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down Expand Up @@ -891,7 +891,7 @@ eval("\n\n/* eslint-disable */\nfunction normalizeUrl(pathComponents) {\n retur
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n if(true) {\n // 1702323924232\n var cssReload = __webpack_require__(/*! ./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js */ \"./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.i, {\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n //# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtcnRsLnNjc3M/YzI0NCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQ1U7QUFDVixPQUFPLElBQVU7QUFDakI7QUFDQSxzQkFBc0IsbUJBQU8sQ0FBQyx3SkFBeUcsRUFBRSxRQUFTLEdBQUcsZUFBZTtBQUNwSztBQUNBO0FBQ0EiLCJmaWxlIjoiLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtcnRsLnNjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBleHRyYWN0ZWQgYnkgbWluaS1jc3MtZXh0cmFjdC1wbHVnaW5cbmV4cG9ydCB7fTtcbiAgICBpZihtb2R1bGUuaG90KSB7XG4gICAgICAvLyAxNzAyMzIzOTI0MjMyXG4gICAgICB2YXIgY3NzUmVsb2FkID0gcmVxdWlyZShcIi9ob21lL2ZlYW5pbC9zcmMvb3BlbmVkeC9lZHgtb3JhMi9ub2RlX21vZHVsZXMvbWluaS1jc3MtZXh0cmFjdC1wbHVnaW4vZGlzdC9obXIvaG90TW9kdWxlUmVwbGFjZW1lbnQuanNcIikobW9kdWxlLmlkLCB7XCJsb2NhbHNcIjpmYWxzZX0pO1xuICAgICAgbW9kdWxlLmhvdC5kaXNwb3NlKGNzc1JlbG9hZCk7XG4gICAgICBtb2R1bGUuaG90LmFjY2VwdCh1bmRlZmluZWQsIGNzc1JlbG9hZCk7XG4gICAgfVxuICAiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./openassessment/xblock/static/sass/openassessment-rtl.scss\n");
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n if(true) {\n // 1704482230456\n var cssReload = __webpack_require__(/*! ./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js */ \"./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.i, {\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n //# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtcnRsLnNjc3M/YzI0NCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQ1U7QUFDVixPQUFPLElBQVU7QUFDakI7QUFDQSxzQkFBc0IsbUJBQU8sQ0FBQyx3SkFBcUcsRUFBRSxRQUFTLEdBQUcsZUFBZTtBQUNoSztBQUNBO0FBQ0EiLCJmaWxlIjoiLi9vcGVuYXNzZXNzbWVudC94YmxvY2svc3RhdGljL3Nhc3Mvb3BlbmFzc2Vzc21lbnQtcnRsLnNjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBleHRyYWN0ZWQgYnkgbWluaS1jc3MtZXh0cmFjdC1wbHVnaW5cbmV4cG9ydCB7fTtcbiAgICBpZihtb2R1bGUuaG90KSB7XG4gICAgICAvLyAxNzA0NDgyMjMwNDU2XG4gICAgICB2YXIgY3NzUmVsb2FkID0gcmVxdWlyZShcIi9Vc2Vycy9sa2ltMS9naXQvc3JjL2VkeC1vcmEyL25vZGVfbW9kdWxlcy9taW5pLWNzcy1leHRyYWN0LXBsdWdpbi9kaXN0L2htci9ob3RNb2R1bGVSZXBsYWNlbWVudC5qc1wiKShtb2R1bGUuaWQsIHtcImxvY2Fsc1wiOmZhbHNlfSk7XG4gICAgICBtb2R1bGUuaG90LmRpc3Bvc2UoY3NzUmVsb2FkKTtcbiAgICAgIG1vZHVsZS5ob3QuYWNjZXB0KHVuZGVmaW5lZCwgY3NzUmVsb2FkKTtcbiAgICB9XG4gICJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./openassessment/xblock/static/sass/openassessment-rtl.scss\n");

/***/ })

Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-studio.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions openassessment/xblock/static/js/src/lms/oa_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,32 @@ export class BaseView {
this.element = element;
this.server = server;

const { ORA_MICROFRONTEND_URL, MFE_VIEW_ENABLED } = data.CONTEXT || {};
const { ORA_MICROFRONTEND_URL, MFE_VIEW_ENABLED, HOTJAR_SITE_ID } = data.CONTEXT || {};

this.ORA_MICROFRONTEND_URL = ORA_MICROFRONTEND_URL;
if (!this.ORA_MICROFRONTEND_URL && MFE_VIEW_ENABLED) {
// eslint-disable-next-line no-console
console.error('ORA_MICROFRONTEND_URL is not defined. ORA MFE will not be loaded.');
}
this.show_mfe_views = ORA_MICROFRONTEND_URL && MFE_VIEW_ENABLED && !window.navigator.userAgent.includes('org.edx.mobile');
const isMobile = window.navigator.userAgent.includes('org.edx.mobile');
if (!isMobile && HOTJAR_SITE_ID) {
/*
* Hotjar shouuld be rewrite and encapsulated and import on use. Window is being share
* globally and it's not a good practice to have this override lms/cms `hotjar`.
*/
/* eslint-disable */
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid: HOTJAR_SITE_ID,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
/* eslint-enable */
}

this.show_mfe_views = ORA_MICROFRONTEND_URL && MFE_VIEW_ENABLED && !isMobile;

const oraMfeView = $('#ora-mfe-view', this.element);
const oraLegacyView = $('#ora-legacy-view', this.element);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-ora2",
"version": "6.0.23",
"version": "6.0.24",
"repository": "https://github.com/openedx/edx-ora2.git",
"dependencies": {
"@edx/frontend-build": "8.0.6",
Expand Down

0 comments on commit 68fc523

Please sign in to comment.