diff --git a/.env b/.env index ce17454708..4235461134 100644 --- a/.env +++ b/.env @@ -43,3 +43,4 @@ AI_TRANSLATIONS_BASE_URL='' ENABLE_HOME_PAGE_COURSE_API_V2=false ENABLE_CHECKLIST_QUALITY='' ENABLE_GRADING_METHOD_IN_PROBLEMS=false +LIBRARY_MODE="v1 only" diff --git a/.env.development b/.env.development index 983ce9674f..5547e8ffec 100644 --- a/.env.development +++ b/.env.development @@ -46,3 +46,4 @@ AI_TRANSLATIONS_BASE_URL='http://localhost:18760' ENABLE_HOME_PAGE_COURSE_API_V2=false ENABLE_CHECKLIST_QUALITY=true ENABLE_GRADING_METHOD_IN_PROBLEMS=false +LIBRARY_MODE="mixed" diff --git a/.env.test b/.env.test index 28240ad2ff..0f73517968 100644 --- a/.env.test +++ b/.env.test @@ -37,3 +37,4 @@ INVITE_STUDENTS_EMAIL_TO="someone@domain.com" ENABLE_HOME_PAGE_COURSE_API_V2=true ENABLE_CHECKLIST_QUALITY=true ENABLE_GRADING_METHOD_IN_PROBLEMS=false +LIBRARY_MODE="mixed" diff --git a/README.rst b/README.rst index 3847453ea3..6f1de194b4 100644 --- a/README.rst +++ b/README.rst @@ -264,6 +264,22 @@ In additional to the standard settings, the following local configuration items Tagging/Taxonomy functionality. +Feature: Libraries V2/Legacy Tabs +================================= + +.. image:: ./docs/readme-images/feature-v2-and-legacy-libs.png + +Configuration +------------- + +In additional to the standard settings, the following local configurations can be set to switch between different library modes: + +* ``LIBRARY_MODE``: can be set to ``mixed`` (default for development), ``v1 only`` (default for production) and ``v2 only``. + + * ``mixed``: Shows 2 tabs, "Libraries" that lists the v2 libraries and "Legacy Libraries" that lists the v1 libraries. When creating a new library in this mode it will create a new v2 library. + * ``v1 only``: Shows only 1 tab, "Libraries" that lists v1 libraries only. When creating a new library in this mode it will create a new v1 library. + * ``v2 only``: Shows only 1 tab, "Libraries" that lists v2 libraries only. When creating a new library in this mode it will create a new v2 library. + Developing ********** diff --git a/docs/readme-images/feature-v2-and-legacy-libs.png b/docs/readme-images/feature-v2-and-legacy-libs.png new file mode 100644 index 0000000000..c8fd363655 Binary files /dev/null and b/docs/readme-images/feature-v2-and-legacy-libs.png differ diff --git a/src/index.jsx b/src/index.jsx index 889063acd7..e3d21096a3 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -125,6 +125,7 @@ initialize({ ENABLE_HOME_PAGE_COURSE_API_V2: process.env.ENABLE_HOME_PAGE_COURSE_API_V2 === 'true', ENABLE_CHECKLIST_QUALITY: process.env.ENABLE_CHECKLIST_QUALITY || 'true', ENABLE_GRADING_METHOD_IN_PROBLEMS: process.env.ENABLE_GRADING_METHOD_IN_PROBLEMS === 'true', + LIBRARY_MODE: process.env.LIBRARY_MODE || 'v1 only', }, 'CourseAuthoringConfig'); }, }, diff --git a/src/studio-home/StudioHome.jsx b/src/studio-home/StudioHome.jsx index acc5cd1174..2d68af9c25 100644 --- a/src/studio-home/StudioHome.jsx +++ b/src/studio-home/StudioHome.jsx @@ -44,8 +44,7 @@ const StudioHome = ({ intl }) => { dispatch, } = useStudioHome(isPaginationCoursesEnabled); - // TODO: this should be a flag in the backend - const LIB_MODE = 'mixed'; + const libMode = getConfig().LIBRARY_MODE; const { userIsActive, @@ -82,7 +81,7 @@ const StudioHome = ({ intl }) => { } let libraryHref = `${getConfig().STUDIO_BASE_URL}/home_library`; - if (isMixedOrV2LibrariesMode(LIB_MODE)) { + if (isMixedOrV2LibrariesMode(libMode)) { libraryHref = `${libraryAuthoringMfeUrl}create`; } diff --git a/src/studio-home/tabs-section/index.jsx b/src/studio-home/tabs-section/index.jsx index 789bb2bea1..997796913f 100644 --- a/src/studio-home/tabs-section/index.jsx +++ b/src/studio-home/tabs-section/index.jsx @@ -25,10 +25,7 @@ const TabsSection = ({ isPaginationCoursesEnabled, }) => { const navigate = useNavigate(); - - // TODO: this should be a flag in the backend - const LIB_MODE = 'mixed'; - + const libMode = getConfig().LIBRARY_MODE; const TABS_LIST = { courses: 'courses', libraries: 'libraries', @@ -94,7 +91,7 @@ const TabsSection = ({ } if (librariesEnabled) { - if (isMixedOrV2LibrariesMode(LIB_MODE)) { + if (isMixedOrV2LibrariesMode(libMode)) { tabs.push(