From 1d6c5a93e86bf68d710b440df7e4f91886225c1b Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Tue, 2 Jan 2024 16:36:03 +0300 Subject: [PATCH 01/11] feat!: add ATLAS_OPTIONS and remove i18n-merge.js --- README.rst | 29 ++++-------- .../20240109_111839_i_atlas_options.md | 1 + tutormfe/templates/mfe/build/mfe/Dockerfile | 21 +-------- .../mfe/build/mfe/i18n/i18n-merge.js | 47 ------------------- 4 files changed, 10 insertions(+), 88 deletions(-) create mode 100644 changelog.d/20240109_111839_i_atlas_options.md delete mode 100755 tutormfe/templates/mfe/build/mfe/i18n/i18n-merge.js diff --git a/README.rst b/README.rst index 791b6fce..1642c09c 100644 --- a/README.rst +++ b/README.rst @@ -160,30 +160,17 @@ To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` mfes.pop("profile") return mfes -Adding custom translations to your MFEs -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This plugin makes it possible to change existing and add new translation strings to MFEs. Here is how to do it: - -1. Identify the ID of the string you would like to translate. For instance, the ID of the "Account Information" string in the account MFE is "account.settings.section.account.information" (see `source `__). -2. Create a folder and i18n file corresponding to your MFE app and language in the Tutor root. This location of this file should be ``/path/to/tutor/env/plugins/mfe/build/mfe/i18n//.json``. For instance, to add French ("fr") translation strings to the account MFE, run:: - - cd "$(tutor config printroot)/env/plugins/mfe/build/mfe/i18n/" - mkdir account - touch account/fr.json - -3. Add your entries to this file in JSON format, where the key is the string ID and the value is the actual string. For instance:: - - { - "account.settings.section.account.information": "Information du compte" - } +Using custom translations to your MFEs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -4. Rebuild the MFE image and restart the MFE with:: +By default, translations are pulled from the `openedx/openedx-translations repository `_ on build time. - tutor images build mfe - tutor local start -d +To use your own translations repository, you can override the +``ATLAS_REPOSITORY: your-organization/translations`` configuration variable. -Your custom translation strings should now appear in your app. +The +`Getting and customizing Translations `_ +section in the Tutor configuration documentation explains how to do this. Customising MFEs ~~~~~~~~~~~~~~~~ diff --git a/changelog.d/20240109_111839_i_atlas_options.md b/changelog.d/20240109_111839_i_atlas_options.md new file mode 100644 index 00000000..58cccd47 --- /dev/null +++ b/changelog.d/20240109_111839_i_atlas_options.md @@ -0,0 +1 @@ +- 💥[Feature] Use `ATLAS_OPTIONS` for `atlas pull`. This breaks the `i18n-merge.js` custom locale Tutor MFE feature in favor of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html) `atlas pull` options. (by @omarithawi) diff --git a/tutormfe/templates/mfe/build/mfe/Dockerfile b/tutormfe/templates/mfe/build/mfe/Dockerfile index 732000f2..274b0b4e 100644 --- a/tutormfe/templates/mfe/build/mfe/Dockerfile +++ b/tutormfe/templates/mfe/build/mfe/Dockerfile @@ -20,16 +20,6 @@ RUN mkdir -p /openedx/app /openedx/env WORKDIR /openedx/app ENV PATH /openedx/app/node_modules/.bin:${PATH} -######## i18n strings -FROM base AS i18n -COPY ./i18n /openedx/i18n -RUN chmod a+x /openedx/i18n/*.js -RUN echo "copying i18n data" \ - {%- for app_name, app in iter_mfes() %} - && mkdir -p /openedx/i18n/{{ app_name }} \ - {%- endfor %} - echo "done." - {% for app_name, app in iter_mfes() %} ####################### {{ app_name }} MFE ######## {{ app_name }} (git) @@ -42,14 +32,6 @@ ADD --keep-git-dir=true {{ app["repository"] }}#{{ app.get("version", MFE_COMMON FROM scratch as {{ app_name }}-src COPY --from={{ app_name }}-git /openedx/app / -######## {{ app_name }} (i18n) -FROM base AS {{ app_name }}-i18n -COPY --from={{ app_name }}-src / /openedx/app -COPY --from=i18n /openedx/i18n/{{ app_name }} /openedx/i18n/{{ app_name }} -COPY --from=i18n /openedx/i18n/i18n-merge.js /openedx/i18n/i18n-merge.js -RUN stat /openedx/app/src/i18n/messages 2> /dev/null || (echo "missing messages folder" && mkdir -p /openedx/app/src/i18n/messages) -RUN /openedx/i18n/i18n-merge.js /openedx/app/src/i18n/messages /openedx/i18n/{{ app_name }} /openedx/app/src/i18n/messages - ######## {{ app_name }} (common) FROM base AS {{ app_name }}-common COPY --from={{ app_name }}-src /package.json /openedx/app/package.json @@ -65,12 +47,11 @@ RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-a {{ patch("mfe-dockerfile-post-npm-install") }} {{ patch("mfe-dockerfile-post-npm-install-{}".format(app_name)) }} COPY --from={{ app_name }}-src / /openedx/app -COPY --from={{ app_name }}-i18n /openedx/app/src/i18n/messages /openedx/app/src/i18n/messages # Whenever a new MFE supports Atlas, it should be added to this list. # When all MFEs support Atlas, this if-statement should be removed. {% if app_name in ["communications"] %} -RUN make OPENEDX_ATLAS_PULL=true pull_translations +RUN make OPENEDX_ATLAS_PULL=true ATLAS_OPTIONS="--repository={{ ATLAS_REPOSITORY }} --revision={{ ATLAS_REVISION }} {{ ATLAS_OPTIONS }}" pull_translations {% endif %} EXPOSE {{ app['port'] }} diff --git a/tutormfe/templates/mfe/build/mfe/i18n/i18n-merge.js b/tutormfe/templates/mfe/build/mfe/i18n/i18n-merge.js deleted file mode 100755 index c8cceda5..00000000 --- a/tutormfe/templates/mfe/build/mfe/i18n/i18n-merge.js +++ /dev/null @@ -1,47 +0,0 @@ -#! /usr/bin/env node -// Add to the current folder your custom translation strings, with the following file hierarchy: -// -// i18n/ -// / -// .json -// -// For instance, to override French strings from the payment app: -// -// i18n/ -// payment/ -// fr.json -// -// Your custom translation strings will automatically be compiled in the MFE Docker image. - -const fs = require('fs'); -const path = require('path'); - -function main() { - // Merge the messages from multiple directories and aggregate the content in a single directory. - // This is certainly not great idiomatic nodejs code. Please open a PR to improve this bit! - merge(process.argv[2], process.argv[3], process.argv[4]) -} - -function merge(dir1, dir2, outputDir) { - fs.readdirSync(dir1, { - withFileTypes: true - }).forEach(file1 => { - if (file1.isFile() && file1.name.endsWith(".json")) { - var path1 = path.resolve(path.join(dir1, file1.name)); - var data1 = require(path1); - var path2 = path.resolve(path.join(dir2, file1.name)); - fs.access(path2, (err) => { - if (err) { - return; - } - var pathOutput = path.resolve(path.join(outputDir, file1.name)); - console.log("Merging i18 strings from " + path1 + " with " + path2 + " to " + pathOutput); - var data2 = require(path2); - var final = Object.assign(data1, data2); - fs.writeFileSync(pathOutput, JSON.stringify(final, null, 2)); - }); - } - }); -} - -main() From c8a816037e2f5024c947776e6621131aebda663d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 6 Feb 2024 11:41:23 +0100 Subject: [PATCH 02/11] fix: remove pkg_resources for compatibility with python 3.12 pkg_resources is a package that is unavailable in python 3.12, unless setuptools is explicitely installed. Turns out, there are replacement functions coming from importlib_resources, which can be obtained from the importlib-resources pypi package. This package will be installed with tutor starting from 17.0.2. --- .../20240212_115536_regis_pkg_resources.md | 1 + tutormfe/plugin.py | 26 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 changelog.d/20240212_115536_regis_pkg_resources.md diff --git a/changelog.d/20240212_115536_regis_pkg_resources.md b/changelog.d/20240212_115536_regis_pkg_resources.md new file mode 100644 index 00000000..35b6d201 --- /dev/null +++ b/changelog.d/20240212_115536_regis_pkg_resources.md @@ -0,0 +1 @@ +- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb) diff --git a/tutormfe/plugin.py b/tutormfe/plugin.py index 421761af..ab1fe035 100644 --- a/tutormfe/plugin.py +++ b/tutormfe/plugin.py @@ -5,10 +5,10 @@ import typing as t from glob import glob -import pkg_resources +import importlib_resources from tutor import fmt -from tutor.__about__ import __version_suffix__ from tutor import hooks as tutor_hooks +from tutor.__about__ import __version_suffix__ from tutor.hooks import priorities from tutor.types import Config, get_typed @@ -168,11 +168,14 @@ def _mounted_mfe_image_management() -> None: # init script with open( os.path.join( - pkg_resources.resource_filename("tutormfe", "templates"), - "mfe", - "tasks", - "lms", - "init", + str( + importlib_resources.files("tutormfe") + / "templates" + / "mfe" + / "tasks" + / "lms" + / "init" + ) ), encoding="utf-8", ) as task_file: @@ -248,7 +251,7 @@ def _build_3rd_party_dev_mfes_on_launch( # Boilerplate code # Add the "templates" folder as a template root tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item( - pkg_resources.resource_filename("tutormfe", "templates") + str(importlib_resources.files("tutormfe") / "templates") ) # Render the "build" and "apps" folders tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items( @@ -258,12 +261,7 @@ def _build_3rd_party_dev_mfes_on_launch( ], ) # Load patches from files -for path in glob( - os.path.join( - pkg_resources.resource_filename("tutormfe", "patches"), - "*", - ) -): +for path in glob(str(importlib_resources.files("tutormfe") / "patches" / "*")): with open(path, encoding="utf-8") as patch_file: # Here we force tutor-mfe lms patches to be loaded first, thus ensuring when operators override # MFE_CONFIG and/or MFE_CONFIG_OVERRIDES, their patches will be loaded after this plugin's From d3dd838e233b8e4a8cfd099d1fee585b28ed4d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 20 Feb 2024 15:15:40 +0100 Subject: [PATCH 03/11] ci: remove now useless OPENEDX_RELEASE variable --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7795af78..6ec2e55e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,6 @@ variables: TUTOR_PLUGIN: mfe TUTOR_IMAGES: mfe authn-dev account-dev communications-dev course-authoring-dev discussions-dev gradebook-dev learner-dashboard-dev learning-dev ora-grading-dev profile-dev TUTOR_PYPI_PACKAGE: tutor-mfe - OPENEDX_RELEASE: palm GITHUB_REPO: overhangio/tutor-mfe include: From 829ba703a1589a4257432017ed2d7b68abfeec17 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Mon, 29 Jan 2024 18:04:49 +0300 Subject: [PATCH 04/11] feat: enable `atlas pull` for all MFEs --- README.rst | 16 +++++++++++++--- changelog.d/20240202_172501_i_atlas_for_all.md | 1 + tutormfe/templates/mfe/build/mfe/Dockerfile | 4 ---- 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 changelog.d/20240202_172501_i_atlas_for_all.md diff --git a/README.rst b/README.rst index 1642c09c..a2cfa6bb 100644 --- a/README.rst +++ b/README.rst @@ -130,6 +130,7 @@ Adding new MFEs - As of Tutor v16 (Palm release) it is no longer possible to add new MFEs by creating ``*_MFE_APP`` settings. Instead, users must implement the approach described below. - As of Tutor v17 (Quince release) you must make sure that the git URL of your MFE repository ends with ``.git``. Otherwise the plugin build will fail. +- As of Tutor v18 (Redwood release) all MFEs must provide a ``make pull_translations`` command. Otherwise the plugin build will fail. Providing an empty command is enough to bypass this requirement. See the `Custom translations section <#mfe-custom-translations>`_ for more information. Other MFE developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, create a Tutor plugin and add your MFE configuration to the ``tutormfe.hooks.MFE_APPS`` filter. This configuration should include the name, git repository (and optionally: git branch or tag) and development port. For example:: @@ -163,10 +164,19 @@ To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` Using custom translations to your MFEs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -By default, translations are pulled from the `openedx/openedx-translations repository `_ on build time. +.. _mfe-custom-translations: -To use your own translations repository, you can override the -``ATLAS_REPOSITORY: your-organization/translations`` configuration variable. +During docker image build, this plugin runs ``make pull_translations`` for each Micro-frontend. This +program is used in the ``Dockerfile`` to pull translations from the `openedx/openedx-translations repository `_ via `openedx-atlas `_. + +The ``make pull_translations`` command passes the ``ATLAS_OPTIONS`` environment variable to the ``atlas pull`` command. This allows specifying a custom repository or branch to pull translations from. + +Translations in the MFE plugin as well as other Tutor plugins can be customized with the following configuration +variables: + +- ``ATLAS_REVISION`` (default: ``"main"`` on nightly and ``"{{ OPENEDX_COMMON_VERSION }}"`` if a named release is used) +- ``ATLAS_REPOSITORY`` (default: ``"openedx/openedx-translations"``). +- ``ATLAS_OPTIONS`` (default: ``""``) Pass additional arguments to ``atlas pull``. Refer to the `atlas documentations `_ for more information. The `Getting and customizing Translations `_ diff --git a/changelog.d/20240202_172501_i_atlas_for_all.md b/changelog.d/20240202_172501_i_atlas_for_all.md new file mode 100644 index 00000000..c3dde6cd --- /dev/null +++ b/changelog.d/20240202_172501_i_atlas_for_all.md @@ -0,0 +1 @@ +- [Feature] Enable `atlas pull` on all Micro-frontends. (by @omarithawi) diff --git a/tutormfe/templates/mfe/build/mfe/Dockerfile b/tutormfe/templates/mfe/build/mfe/Dockerfile index 274b0b4e..fe62ff24 100644 --- a/tutormfe/templates/mfe/build/mfe/Dockerfile +++ b/tutormfe/templates/mfe/build/mfe/Dockerfile @@ -48,11 +48,7 @@ RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-a {{ patch("mfe-dockerfile-post-npm-install-{}".format(app_name)) }} COPY --from={{ app_name }}-src / /openedx/app -# Whenever a new MFE supports Atlas, it should be added to this list. -# When all MFEs support Atlas, this if-statement should be removed. -{% if app_name in ["communications"] %} RUN make OPENEDX_ATLAS_PULL=true ATLAS_OPTIONS="--repository={{ ATLAS_REPOSITORY }} --revision={{ ATLAS_REVISION }} {{ ATLAS_OPTIONS }}" pull_translations -{% endif %} EXPOSE {{ app['port'] }} From d45e4aad5678a6ae601880f3257f7af639dec1c1 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Wed, 28 Feb 2024 11:17:01 -0300 Subject: [PATCH 05/11] fix: dev mode after frontend-build namespace change See https://github.com/openedx/axim-engineering/issues/23 --- changelog.d/20240228_111818_arbrandes_nightly.md | 1 + tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20240228_111818_arbrandes_nightly.md diff --git a/changelog.d/20240228_111818_arbrandes_nightly.md b/changelog.d/20240228_111818_arbrandes_nightly.md new file mode 100644 index 00000000..0e6c4915 --- /dev/null +++ b/changelog.d/20240228_111818_arbrandes_nightly.md @@ -0,0 +1 @@ +- [Bugfix] Fix dev mode after frontend-build NPM namespace change (by @arbrandes) diff --git a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js index ee7f9ccb..5d73e668 100644 --- a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js +++ b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js @@ -4,7 +4,7 @@ const fs = require('fs'); const baseDevConfig = ( fs.existsSync('./webpack.dev.config.js') ? require('./webpack.dev.config.js') - : require('@edx/frontend-build/config/webpack.dev.config.js') + : require('@openedx/frontend-build/config/webpack.dev.config.js') ); module.exports = merge(baseDevConfig, { From fbf84be7220d5f3fc964e0d03d5662c18ee417de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 5 Mar 2024 11:51:51 +0500 Subject: [PATCH 06/11] ci: don't even try to auto-add PRs to github project Auto-adding PRs to the Github project is not working because the github-token is not available there. --- .github/workflows/auto-add-to-project.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/auto-add-to-project.yml b/.github/workflows/auto-add-to-project.yml index d4ab7a42..7dadeb66 100644 --- a/.github/workflows/auto-add-to-project.yml +++ b/.github/workflows/auto-add-to-project.yml @@ -1,9 +1,6 @@ -name: Auto Add Issues and Pull Requests to Project +name: Auto Add Issues to Project on: - pull_request: - types: - - opened issues: types: - opened From da9e17f4be83e36e4d04485e29f7d0a74338c381 Mon Sep 17 00:00:00 2001 From: Syed Muhammad Dawoud Sheraz Ali <40599381+DawoudSheraz@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:13:11 +0500 Subject: [PATCH 07/11] chore: docs cleanup (#205) --- README.rst | 54 ++++++++++++++----- .../mfe/apps/mfe/webpack.dev-tutor.config.js | 2 +- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index 6386dce1..13ef2f10 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ To check what the current value of `MFE_HOST` is actually set to, run:: tutor config printvalue MFE_HOST Authn -~~~~~~~~~ +~~~~~ .. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/authn.png :alt: Authn MFE screenshot @@ -112,7 +112,7 @@ ORA Grading When enabled, Open Response Assessments ("ORA") that have a staff grading step will link to this new MFE, either when clicking "Grade Available Responses" from the exercise itself, or via a link in the Instructor Dashboard. It is meant to streamline the grading process with better previews of submitted content. Profile -~~~~~~~~~ +~~~~~~~ .. image:: https://raw.githubusercontent.com/overhangio/tutor-mfe/master/screenshots/profile.png :alt: Profile MFE screenshot @@ -132,7 +132,9 @@ Adding new MFEs - As of Tutor v17 (Quince release) you must make sure that the git URL of your MFE repository ends with ``.git``. Otherwise the plugin build will fail. - As of Tutor v18 (Redwood release) all MFEs must provide a ``make pull_translations`` command. Otherwise the plugin build will fail. Providing an empty command is enough to bypass this requirement. See the `Custom translations section <#mfe-custom-translations>`_ for more information. -Other MFE developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, create a Tutor plugin and add your MFE configuration to the ``tutormfe.hooks.MFE_APPS`` filter. This configuration should include the name, git repository (and optionally: git branch or tag) and development port. For example:: +Other MFE developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, create a Tutor plugin and add your MFE configuration to the ``tutormfe.hooks.MFE_APPS`` filter. This configuration should include the name, git repository (and optionally: git branch or tag) and development port. For example: + +.. code-block:: python from tutormfe.hooks import MFE_APPS @@ -152,8 +154,9 @@ Assets will be served at ``http(s)://{{ MFE_HOST }}/mymfe``. Developers are free Disabling individual MFEs ~~~~~~~~~~~~~~~~~~~~~~~~~ -To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` filter. For instance, to disable some of the MFEs that ship with this plugin:: +To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` filter. For instance, to disable some of the MFEs that ship with this plugin: +.. code-block::python @MFE_APPS.add() def _remove_some_my_mfe(mfes): @@ -188,7 +191,8 @@ Customising MFEs .. _mfe-lms-settings: To change the MFEs logos from the default to your own logos, override the corresponding settings in the MFEs environment using patches `mfe-lms-production-settings` and `mfe-lms-development-settings`. For example, using the following plugin: -:: + +.. code-block::python from tutor import hooks @@ -215,12 +219,13 @@ To change the MFEs logos from the default to your own logos, override the corres ] ) -If patches are the same in development and production, they can be replaced by a single `mfe-lms-common-settings` patch. +If patches are the same in development and production, they can be replaced by a single ``mfe-lms-common-settings`` patch. .. _mfe-docker-post-npm-install: To install custom components for the MFEs, such as the `header `_ and `footer `_, override the components by adding a patch to ``mfe-dockerfile-post-npm-install`` in your plugin: -:: + +.. code-block::python from tutor import hooks @@ -237,7 +242,8 @@ To install custom components for the MFEs, such as the `header `_ package: -:: + +.. code-block::python hooks.Filters.ENV_PATCHES.add_item( ( @@ -248,7 +254,9 @@ The same applies to installing a custom `brand `_, you might also need to provide a token for your registry, which can be done with an additional ``npm config set`` command as well: -:: + +.. code-block::python from tutor import hooks @@ -392,44 +402,52 @@ Finally, restart the platform with:: Template patch catalog ---------------------- -This is the list of all patches used across tutor-mfe (outside of any plugin). Alternatively, you can search for patches in tutor-mfe templates by grepping the source code:: - +This is the list of all patches used across tutor-mfe (outside of any plugin). Alternatively, you can search for patches in tutor-mfe templates by grepping the source code: + +.. code-block::python + git clone https://github.com/overhangio/tutor-mfe cd tutor-mfe git grep "{{ patch" -- tutormfe/templates mfe-lms-development-settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Python-formatted LMS settings in development. Values defined here override the values from `mfe-lms-common-settings <#mfe-lms-common-settings>`_ or `mfe-lms-production-settings <#mfe-lms-production-settings>`_. For an example on the usage of this patch, check out `this section <#mfe-lms-settings>`_. File changed: ``apps/openedx/settings/lms/development.py`` mfe-lms-production-settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Python-formatted LMS settings in production. Values defined here override the values from `mfe-lms-common-settings <#mfe-lms-common-settings>`_. For an example on the usage of this patch, check out `this section <#mfe-lms-settings>`_. File changed: ``apps/openedx/settings/lms/production.py`` mfe-lms-common-settings ~~~~~~~~~~~~~~~~~~~~~~~ + Python-formatted LMS settings used both in production and development. File changed: ``apps/openedx/settings/partials/common_lms.py`` mfe-webpack-dev-config ~~~~~~~~~~~~~~~~~~~~~~ + Add any configurations at the end of the development webpack config file in Javascript format. File changed: ``tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js`` mfe-dockerfile-pre-npm-install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for before the npm install is initiated. File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-pre-npm-install-{} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for before the npm install is initiated for a specific MFE. Add the exact MFE name at the end to only change instructions for that MFE. Example: ``mfe-dockerfile-pre-npm-install-learning`` will only apply any instructions specified for the learning MFE. @@ -438,18 +456,21 @@ File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-production-final ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions in the final layer. Useful for overriding the CMD or ENTRYPOINT. File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-post-npm-install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for after the npm install has completed. This will apply the instructions to every MFE. For an example on the usage of this patch, check out `here <#mfe-docker-post-npm-install>`_. File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-post-npm-install-{} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for after the npm install has completed for a specific MFE. Add the exact MFE name at the end to only change instructions for that MFE. For an example on the usage of this patch, check out `here <#mfe-docker-post-npm-install>`_. Example: ``mfe-dockerfile-post-npm-install-authn`` will only apply any instructions specified for the authn MFE. @@ -458,12 +479,14 @@ File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-pre-npm-build ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for before the build step initializes. This will apply the instructions to every MFE. For an example on the usage of this patch, see `over here <#mfe-docker-pre-npm-build>`_. File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-pre-npm-build-{} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for before the build step initializes for a specific MFE. Add the exact MFE name at the end to only change instructions for that MFE. For an example on the usage of this patch, see `over here <#mfe-docker-pre-npm-build>`_. Example: ``mfe-dockerfile-post-npm-build-learning`` will only apply any instructions specified for the learning MFE. @@ -472,12 +495,14 @@ File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-post-npm-build ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for after the build step has completed. This will apply the instructions to every MFE. File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-dockerfile-post-npm-build-{} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Add any instructions for after the build step has completed for a specific MFE. Add the exact MFE name at the end to only change instructions for that MFE. Example: ``mfe-dockerfile-post-npm-build-learning`` will only apply any instructions specified for the learning MFE. @@ -486,6 +511,7 @@ File changed: ``tutormfe/templates/mfe/build/mfe/Dockerfile`` mfe-caddyfile ~~~~~~~~~~~~~ + Add any configurations for the mfe-caddyfile. File changed: ``tutormfe/templates/mfe/apps/mfe/Caddyfile`` @@ -494,7 +520,7 @@ File changed: ``tutormfe/templates/mfe/apps/mfe/Caddyfile`` Troubleshooting --------------- -This Tutor plugin is maintained by Adolfo Brandes from `tCRIL `__. Community support is available from the official `Open edX forum `__. Do you need help with this plugin? See the `troubleshooting `__ section from the Tutor documentation. +This Tutor plugin is maintained by Adolfo Brandes from `Axim `__. Community support is available from the official `Open edX forum `__. Do you need help with this plugin? See the `troubleshooting `__ section from the Tutor documentation. License ------- diff --git a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js index 823eda73..9bfda27a 100644 --- a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js +++ b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js @@ -11,7 +11,7 @@ module.exports = merge(baseDevConfig, { // This configuration needs to be defined here, because CLI // arguments are ignored by the "npm run start" command devServer: { - // We will have to make changes to thix config in later releases of webpack dev devServer + // We will have to make changes to this config in later releases of webpack dev devServer // https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md allowedHosts: 'all', proxy: { From 68fa38778aa96f44a0f41893c1c9318ba3aaeed7 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Tue, 14 May 2024 02:28:49 -0300 Subject: [PATCH 08/11] feat: Enable new Course Authoring features (#208) Add toggles for all the new Studio pages and features in the Course Authoring MFE. --- .../patches/openedx-lms-development-settings | 6 ++- .../patches/openedx-lms-production-settings | 6 ++- tutormfe/templates/mfe/tasks/lms/init | 37 +++++++++++++++++-- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/tutormfe/patches/openedx-lms-development-settings b/tutormfe/patches/openedx-lms-development-settings index 2fcc22e8..79da7401 100644 --- a/tutormfe/patches/openedx-lms-development-settings +++ b/tutormfe/patches/openedx-lms-development-settings @@ -36,9 +36,11 @@ MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL {% endif %} {% if get_mfe("course-authoring") %} -MFE_CONFIG["ENABLE_NEW_EDITOR_PAGES"] = True -MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True MFE_CONFIG["COURSE_AUTHORING_MICROFRONTEND_URL"] = "http://{{ MFE_HOST }}:{{ get_mfe("course-authoring")["port"] }}/course-authoring" +MFE_CONFIG["ENABLE_ASSETS_PAGE"] = "true" +MFE_CONFIG["ENABLE_HOME_PAGE_COURSE_API_V2"] = "true" +MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = "true" +MFE_CONFIG["ENABLE_TAGGING_TAXONOMY_PAGES"] = "true" {% endif %} {% if get_mfe("discussions") %} diff --git a/tutormfe/patches/openedx-lms-production-settings b/tutormfe/patches/openedx-lms-production-settings index 37b79471..d7b7a42a 100644 --- a/tutormfe/patches/openedx-lms-production-settings +++ b/tutormfe/patches/openedx-lms-production-settings @@ -37,9 +37,11 @@ MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL {% endif %} {% if get_mfe("course-authoring") %} -MFE_CONFIG["ENABLE_NEW_EDITOR_PAGES"] = True -MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True MFE_CONFIG["COURSE_AUTHORING_MICROFRONTEND_URL"] = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/course-authoring" +MFE_CONFIG["ENABLE_ASSETS_PAGE"] = "true" +MFE_CONFIG["ENABLE_HOME_PAGE_COURSE_API_V2"] = "true" +MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = "true" +MFE_CONFIG["ENABLE_TAGGING_TAXONOMY_PAGES"] = "true" {% endif %} {% if get_mfe("discussions") %} diff --git a/tutormfe/templates/mfe/tasks/lms/init b/tutormfe/templates/mfe/tasks/lms/init index 69e364f0..2320772c 100644 --- a/tutormfe/templates/mfe/tasks/lms/init +++ b/tutormfe/templates/mfe/tasks/lms/init @@ -29,15 +29,44 @@ site-configuration unset --domain={{ LMS_HOST }}:8000 ENABLE_PROFILE_MICROFRONTE {% endif %} {% if is_mfe_enabled("course-authoring") %} +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_advanced_settings_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_advanced_settings_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_certificates_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_certificates_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_course_outline_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_course_outline_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_course_team_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_course_team_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_custom_pages) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_custom_pages +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_export_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_export_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_files_uploads_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_files_uploads_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_grading_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_grading_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_group_configurations_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_group_configurations_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_import_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_import_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_schedule_details_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_schedule_details_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_textbooks_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_textbooks_page (./manage.py lms waffle_flag --list | grep discussions.pages_and_resources_mfe) || ./manage.py lms waffle_flag --create --everyone discussions.pages_and_resources_mfe -(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_text_editor) || ./manage.py lms waffle_flag --create --deactivate new_core_editors.use_new_text_editor -(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_video_editor) || ./manage.py lms waffle_flag --create --deactivate new_core_editors.use_new_video_editor -(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_problem_editor) || ./manage.py lms waffle_flag --create --deactivate new_core_editors.use_new_problem_editor +(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_problem_editor) || ./manage.py lms waffle_flag --create --everyone new_core_editors.use_new_problem_editor +(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_text_editor) || ./manage.py lms waffle_flag --create --everyone new_core_editors.use_new_text_editor +(./manage.py lms waffle_flag --list | grep new_core_editors.use_new_video_editor) || ./manage.py lms waffle_flag --create --everyone new_core_editors.use_new_video_editor +(./manage.py lms waffle_flag --list | grep new_studio_mfe.use_new_home_page) || ./manage.py lms waffle_flag --create --everyone new_studio_mfe.use_new_home_page +(./manage.py lms waffle_flag --list | grep new_studio_mfe.use_tagging_taxonomy_list_page) || ./manage.py lms waffle_flag --create --everyone new_studio_mfe.use_tagging_taxonomy_list_page {% else %} +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_advanced_settings_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_certificates_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_course_outline_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_course_team_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_custom_pages +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_export_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_files_uploads_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_grading_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_group_configurations_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_import_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_schedule_details_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_textbooks_page +./manage.py lms waffle_delete --flags contentstore.new_studio_mfe.use_new_updates_page ./manage.py lms waffle_delete --flags discussions.pages_and_resources_mfe +./manage.py lms waffle_delete --flags new_core_editors.use_new_problem_editor ./manage.py lms waffle_delete --flags new_core_editors.use_new_text_editor ./manage.py lms waffle_delete --flags new_core_editors.use_new_video_editor -./manage.py lms waffle_delete --flags new_core_editors.use_new_problem_editor +./manage.py lms waffle_delete --flags new_studio_mfe.use_new_home_page +./manage.py lms waffle_delete --flags new_studio_mfe.use_tagging_taxonomy_list_page {% endif %} {% if is_mfe_enabled("discussions") %} From 5bb43faa21218352436e1d90e16f2202963576ee Mon Sep 17 00:00:00 2001 From: Glib Glugovskiy Date: Thu, 16 May 2024 11:09:30 +0300 Subject: [PATCH 09/11] feat: add new learning mfe toggles for navigation sidebar --- tutormfe/templates/mfe/tasks/lms/init | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tutormfe/templates/mfe/tasks/lms/init b/tutormfe/templates/mfe/tasks/lms/init index 2320772c..30141f66 100644 --- a/tutormfe/templates/mfe/tasks/lms/init +++ b/tutormfe/templates/mfe/tasks/lms/init @@ -24,8 +24,12 @@ site-configuration unset --domain={{ LMS_HOST }}:8000 ENABLE_PROFILE_MICROFRONTE {% if is_mfe_enabled("learning") %} (./manage.py lms waffle_flag --list | grep course_home.course_home_mfe_progress_tab) || ./manage.py lms waffle_flag --create --everyone course_home.course_home_mfe_progress_tab +(./manage.py lms waffle_flag --list | grep courseware.enable_navigation_sidebar) || ./manage.py lms waffle_flag --create --deactivate courseware.enable_navigation_sidebar +(./manage.py lms waffle_flag --list | grep courseware.always_open_auxiliary_sidebar) || ./manage.py lms waffle_flag --create --deactivate courseware.always_open_auxiliary_sidebar {% else %} ./manage.py lms waffle_delete --flags course_home.course_home_mfe_progress_tab +./manage.py lms waffle_delete --flags courseware.enable_navigation_sidebar +./manage.py lms waffle_delete --flags courseware.always_open_auxiliary_sidebar {% endif %} {% if is_mfe_enabled("course-authoring") %} From 2099934a57a73b97ce8477850b127823140e0006 Mon Sep 17 00:00:00 2001 From: Glib Glugovskiy Date: Fri, 7 Jun 2024 15:54:36 +0300 Subject: [PATCH 10/11] fix: create waffle flag for new studio updates page on init --- tutormfe/templates/mfe/tasks/lms/init | 1 + 1 file changed, 1 insertion(+) diff --git a/tutormfe/templates/mfe/tasks/lms/init b/tutormfe/templates/mfe/tasks/lms/init index 30141f66..cf10abb6 100644 --- a/tutormfe/templates/mfe/tasks/lms/init +++ b/tutormfe/templates/mfe/tasks/lms/init @@ -45,6 +45,7 @@ site-configuration unset --domain={{ LMS_HOST }}:8000 ENABLE_PROFILE_MICROFRONTE (./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_import_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_import_page (./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_schedule_details_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_schedule_details_page (./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_textbooks_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_textbooks_page +(./manage.py lms waffle_flag --list | grep contentstore.new_studio_mfe.use_new_updates_page) || ./manage.py lms waffle_flag --create --everyone contentstore.new_studio_mfe.use_new_updates_page (./manage.py lms waffle_flag --list | grep discussions.pages_and_resources_mfe) || ./manage.py lms waffle_flag --create --everyone discussions.pages_and_resources_mfe (./manage.py lms waffle_flag --list | grep new_core_editors.use_new_problem_editor) || ./manage.py lms waffle_flag --create --everyone new_core_editors.use_new_problem_editor (./manage.py lms waffle_flag --list | grep new_core_editors.use_new_text_editor) || ./manage.py lms waffle_flag --create --everyone new_core_editors.use_new_text_editor From 6e16f2f21807f02033b1f21b237f3af16fea6673 Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Fri, 3 May 2024 17:24:33 +0500 Subject: [PATCH 11/11] v18.0.0 upgrade to redwood --- CHANGELOG.md | 7 +++++++ changelog.d/20240109_111839_i_atlas_options.md | 1 - changelog.d/20240202_172501_i_atlas_for_all.md | 1 - changelog.d/20240228_111818_arbrandes_nightly.md | 1 - setup.py | 4 ++-- tutormfe/__about__.py | 2 +- tutormfe/hooks.py | 1 + 7 files changed, 11 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/20240109_111839_i_atlas_options.md delete mode 100644 changelog.d/20240202_172501_i_atlas_for_all.md delete mode 100644 changelog.d/20240228_111818_arbrandes_nightly.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff0e970..2fb8d9df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes: + +## v18.0.0 (2024-06-19) + +- 💥[Feature] Upgrade to Redwood (by @hinakhadim) +- [Feature] Enable `atlas pull` on all Micro-frontends. (by @omarithawi) +- 💥[Feature] Use `ATLAS_OPTIONS` for `atlas pull`. This breaks the `i18n-merge.js` custom locale Tutor MFE feature in favor of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html) `atlas pull` options. (by @omarithawi) + ## v17.0.1 (2024-03-26) diff --git a/changelog.d/20240109_111839_i_atlas_options.md b/changelog.d/20240109_111839_i_atlas_options.md deleted file mode 100644 index 58cccd47..00000000 --- a/changelog.d/20240109_111839_i_atlas_options.md +++ /dev/null @@ -1 +0,0 @@ -- 💥[Feature] Use `ATLAS_OPTIONS` for `atlas pull`. This breaks the `i18n-merge.js` custom locale Tutor MFE feature in favor of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html) `atlas pull` options. (by @omarithawi) diff --git a/changelog.d/20240202_172501_i_atlas_for_all.md b/changelog.d/20240202_172501_i_atlas_for_all.md deleted file mode 100644 index c3dde6cd..00000000 --- a/changelog.d/20240202_172501_i_atlas_for_all.md +++ /dev/null @@ -1 +0,0 @@ -- [Feature] Enable `atlas pull` on all Micro-frontends. (by @omarithawi) diff --git a/changelog.d/20240228_111818_arbrandes_nightly.md b/changelog.d/20240228_111818_arbrandes_nightly.md deleted file mode 100644 index 0e6c4915..00000000 --- a/changelog.d/20240228_111818_arbrandes_nightly.md +++ /dev/null @@ -1 +0,0 @@ -- [Bugfix] Fix dev mode after frontend-build NPM namespace change (by @arbrandes) diff --git a/setup.py b/setup.py index 1234f35c..6e427edd 100644 --- a/setup.py +++ b/setup.py @@ -40,8 +40,8 @@ def load_about(): packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.8", - install_requires=["tutor>=17.0.0,<18.0.0"], - extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]}, + install_requires=["tutor>=18.0.0,<19.0.0"], + extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]}, entry_points={"tutor.plugin.v1": ["mfe = tutormfe.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/tutormfe/__about__.py b/tutormfe/__about__.py index dba3a77b..c6a8b8ed 100644 --- a/tutormfe/__about__.py +++ b/tutormfe/__about__.py @@ -1 +1 @@ -__version__ = "17.0.1" +__version__ = "18.0.0" diff --git a/tutormfe/hooks.py b/tutormfe/hooks.py index e62c2eb2..e23d461d 100644 --- a/tutormfe/hooks.py +++ b/tutormfe/hooks.py @@ -3,6 +3,7 @@ the tutor-mfe hooks would be created in the context of some other plugin that imports them. """ + from __future__ import annotations import typing as t