From 72b3a8b1637313cf01722d5dae3e9465357b9afd Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 10 Dec 2024 18:41:30 -0800 Subject: [PATCH] Upgrade to vue2.7 and remove @vue/composition-api. --- .../assets/src/state/modules/core/actions.js | 6 +- .../assets/src/composables/useCoachTabs.js | 2 +- .../assets/src/composables/useCoreCoach.js | 2 +- .../assets/src/composables/useFetchTree.js | 2 +- .../coach/assets/src/composables/useGroups.js | 2 +- .../assets/src/composables/useLessons.js | 2 +- .../assets/src/composables/useQuizCreation.js | 2 +- .../src/composables/useQuizResources.js | 2 +- .../assets/src/composables/useQuizzes.js | 2 +- .../assets/src/modules/lessonsRoot/index.js | 4 +- .../src/views/groups/GroupsRootPage/index.vue | 2 +- .../ContentCardList.vue | 2 +- .../views/lessons/LessonSummaryPage/index.vue | 2 +- .../sidePanels/LessonResourceSelection.vue | 2 +- .../src/views/lessons/LessonsRootPage.vue | 4 +- .../CreateExamPage/CreateQuizSection.vue | 2 +- .../CreateExamPage/QuestionListPreview.vue | 2 +- .../CreateExamPage/ReplaceQuestions.vue | 2 +- .../CreateExamPage/ResourceSelection.vue | 2 +- .../quizzes/CreateExamPage/SectionEditor.vue | 2 +- .../quizzes/CreateExamPage/SectionOrder.vue | 2 +- .../CreateExamPage/SectionSidePanel.vue | 2 +- .../views/quizzes/CreateExamPage/index.vue | 2 +- .../src/views/quizzes/ExamsRootPage.vue | 2 +- .../coach/assets/test/useQuizCreation.spec.js | 8 +- .../assets/src/composables/useContentTasks.js | 2 +- .../src/composables/useDeviceRestart.js | 2 +- .../assets/src/composables/usePlugins.js | 2 +- .../src/views/DeviceSettingsPage/index.vue | 2 +- .../assets/src/modules/importCSV/index.js | 14 +- .../assets/src/modules/manageCSV/index.js | 4 +- .../views/ManageClassPage/useDeleteClass.js | 2 +- .../src/composables/__mocks__/useDevices.js | 2 +- .../__tests__/useProgressTracking.spec.js | 2 +- .../composables/__tests__/useSearch.spec.js | 13 +- .../src/composables/useCardLayoutSpan.js | 2 +- .../src/composables/useCardViewStyle.js | 2 +- .../assets/src/composables/useContentLink.js | 2 +- .../src/composables/useContentNodeProgress.js | 2 +- .../assets/src/composables/useCoreLearn.js | 2 +- .../src/composables/useDeviceSettings.js | 2 +- .../assets/src/composables/useDevices.js | 2 +- .../src/composables/useDownloadRequests.js | 3 +- .../src/composables/useLearnerResources.js | 2 +- .../src/composables/useLearningActivities.js | 2 +- .../src/composables/usePinnedDevices.js | 2 +- .../src/composables/useProgressTracking.js | 2 +- .../views/DownloadsList/index.vue | 2 +- .../src/my_downloads/views/MyDownloads.vue | 2 +- .../learn/assets/src/views/ContentPage.vue | 2 +- .../src/views/DeviceConnectionStatus.vue | 2 +- .../src/views/ExploreLibrariesPage/index.vue | 2 +- .../src/views/HomePage/ContinueLearning.vue | 2 +- .../views/HomePage/__tests__/HomePage.spec.js | 2 +- .../learn/assets/src/views/HomePage/index.vue | 2 +- .../src/views/LearningActivityLabel/index.vue | 2 +- .../src/views/LibraryPage/OtherLibraries.vue | 2 +- .../LibraryPage/ResumableContentGrid.vue | 2 +- .../assets/src/views/LibraryPage/index.vue | 2 +- .../src/views/ResourceSyncingUiAlert.vue | 2 +- .../assets/src/views/SearchResultsGrid.vue | 2 +- .../assets/src/views/TopicsContentPage.vue | 2 +- .../assets/src/views/TopicsPage/index.vue | 2 +- .../views/classes/AssignedQuizzesCards.vue | 2 +- .../views/classes/ClassAssignmentsPage.vue | 2 +- .../assets/test/views/topics-page.spec.js | 49 ++++-- .../assets/src/composables/useCurrentUser.js | 2 +- .../assets/src/composables/useOnMyOwnSetup.js | 2 +- .../ChangeFacility/ChooseAdmin/index.vue | 2 +- .../src/views/ChangeFacility/ConfirmMerge.vue | 2 +- .../ConfirmAccountDetails.vue | 2 +- .../MergeAccountDialog/index.vue | 2 +- .../MergeDifferentAccounts/index.vue | 2 +- .../views/ChangeFacility/MergeFacility.vue | 2 +- .../views/ChangeFacility/SelectFacility.vue | 2 +- .../views/ChangeFacility/UsernameExists.vue | 2 +- .../assets/src/views/ChangeFacility/index.vue | 2 +- .../assets/src/views/ProfilePage/index.vue | 2 +- .../components/SearchFiltersPanel/index.vue | 2 +- .../SyncSchedule/ManageSyncSchedule.vue | 2 +- .../accordion/AccordionContainer.vue | 2 +- .../components/accordion/useAccordion.js | 2 +- .../quizzes/QuizReport/AttemptLogList.vue | 2 +- .../SelectDeviceForm.vue | 2 +- .../useConnectionChecker.js | 2 +- .../useDeviceDeletion.js | 2 +- .../SelectDeviceModalGroup/useDevices.js | 2 +- .../kolibri-common/components/useAccordion.js | 2 +- .../__tests__/useBaseSearch.spec.js | 13 +- .../composables/useBaseSearch.js | 2 +- .../kolibri-common/composables/useChannels.js | 2 +- .../composables/useCoachMetadataTags.js | 2 +- .../composables/useUserSyncStatus.js | 2 +- packages/kolibri-tools/jest.conf/setup.js | 2 - packages/kolibri-tools/lib/moduleMapping.js | 2 +- .../lib/webpack.config.plugin.js | 11 +- packages/kolibri-tools/package.json | 2 +- packages/kolibri/__tests__/heartbeat.spec.js | 2 +- .../pages/AppBarPage/internal/AppBar.vue | 2 +- .../internal/__tests__/TotalPoints.spec.js | 2 +- .../composables/__mocks__/useSnackbar.js | 2 +- .../composables/__mocks__/useTotalProgress.js | 2 +- .../kolibri/composables/__mocks__/useUser.js | 2 +- .../composables/internal/useScrollPosition.js | 2 +- packages/kolibri/composables/useNav.js | 2 +- packages/kolibri/composables/useNow.js | 2 +- packages/kolibri/composables/useSnackbar.js | 2 +- .../kolibri/composables/useTotalProgress.js | 2 +- packages/kolibri/composables/useUser.js | 2 +- packages/kolibri/index.js | 2 - packages/kolibri/internal/apiSpec.js | 1 - packages/kolibri/internal/useConnection.js | 2 +- packages/kolibri/package.json | 10 +- .../styles/internal/initializeTheme.js | 4 +- yarn.lock | 166 ++++++++++-------- 115 files changed, 272 insertions(+), 238 deletions(-) diff --git a/kolibri/core/assets/src/state/modules/core/actions.js b/kolibri/core/assets/src/state/modules/core/actions.js index 24f000ddae9..a7c12c112db 100644 --- a/kolibri/core/assets/src/state/modules/core/actions.js +++ b/kolibri/core/assets/src/state/modules/core/actions.js @@ -10,7 +10,7 @@ import { setServerTime } from 'kolibri/utils/serverClock'; import urls from 'kolibri/urls'; import redirectBrowser from 'kolibri/utils/redirectBrowser'; import CatchErrors from 'kolibri/utils/CatchErrors'; -import Vue from 'vue'; +import { nextTick } from 'vue'; import Lockr from 'lockr'; import { DisconnectionErrorCodes, @@ -202,7 +202,7 @@ export function getFacilityConfig(store, facilityId) { export function loading(store) { return new Promise(resolve => { store.commit('CORE_SET_PAGE_LOADING', true); - Vue.nextTick(() => { + nextTick(() => { resolve(); }); }); @@ -211,7 +211,7 @@ export function loading(store) { export function notLoading(store) { return new Promise(resolve => { store.commit('CORE_SET_PAGE_LOADING', false); - Vue.nextTick(() => { + nextTick(() => { resolve(); }); }); diff --git a/kolibri/plugins/coach/assets/src/composables/useCoachTabs.js b/kolibri/plugins/coach/assets/src/composables/useCoachTabs.js index f1a827eae4c..4bbbda090d4 100644 --- a/kolibri/plugins/coach/assets/src/composables/useCoachTabs.js +++ b/kolibri/plugins/coach/assets/src/composables/useCoachTabs.js @@ -19,7 +19,7 @@ * Then when you need find out if tabs were clicked recently, * call `wereTabsClickedRecently`. */ -import { reactive } from '@vue/composition-api'; +import { reactive } from 'vue'; // tabs interaction is considered to be recent // when it's not older than ... diff --git a/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js b/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js index 8cc05a553c6..c6e09633559 100644 --- a/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js +++ b/kolibri/plugins/coach/assets/src/composables/useCoreCoach.js @@ -1,7 +1,7 @@ import find from 'lodash/find'; import logger from 'kolibri-logging'; import { get } from '@vueuse/core'; -import { computed, getCurrentInstance } from '@vue/composition-api'; +import { computed, getCurrentInstance } from 'vue'; import { currentLanguage, isRtl } from 'kolibri/utils/i18n'; import useUser from 'kolibri/composables/useUser'; import { coachStrings } from '../views/common/commonCoachStrings'; diff --git a/kolibri/plugins/coach/assets/src/composables/useFetchTree.js b/kolibri/plugins/coach/assets/src/composables/useFetchTree.js index d3ba1963277..85a5b861db2 100644 --- a/kolibri/plugins/coach/assets/src/composables/useFetchTree.js +++ b/kolibri/plugins/coach/assets/src/composables/useFetchTree.js @@ -1,5 +1,5 @@ import { get, set } from '@vueuse/core'; -import { computed, ref } from '@vue/composition-api'; +import { computed, ref } from 'vue'; import ContentNodeResource from 'kolibri-common/apiResources/ContentNodeResource'; /** diff --git a/kolibri/plugins/coach/assets/src/composables/useGroups.js b/kolibri/plugins/coach/assets/src/composables/useGroups.js index 0c7cc67ad42..fa61b5eab88 100644 --- a/kolibri/plugins/coach/assets/src/composables/useGroups.js +++ b/kolibri/plugins/coach/assets/src/composables/useGroups.js @@ -1,4 +1,4 @@ -import { ref } from '@vue/composition-api'; +import { ref } from 'vue'; import samePageCheckGenerator from 'kolibri-common/utils/samePageCheckGenerator'; import LearnerGroupResource from 'kolibri-common/apiResources/LearnerGroupResource'; import FacilityUserResource from 'kolibri-common/apiResources/FacilityUserResource'; diff --git a/kolibri/plugins/coach/assets/src/composables/useLessons.js b/kolibri/plugins/coach/assets/src/composables/useLessons.js index bed80183fb9..771d19b9998 100644 --- a/kolibri/plugins/coach/assets/src/composables/useLessons.js +++ b/kolibri/plugins/coach/assets/src/composables/useLessons.js @@ -1,4 +1,4 @@ -import { ref } from '@vue/composition-api'; +import { ref } from 'vue'; import LearnerGroupResource from 'kolibri-common/apiResources/LearnerGroupResource'; import useUser from 'kolibri/composables/useUser'; import { PageNames } from '../constants'; diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index b7f9f4f8afa..d28586e2c0e 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -5,7 +5,7 @@ import { MAX_QUESTIONS_PER_QUIZ_SECTION } from 'kolibri/constants'; import ExamResource from 'kolibri-common/apiResources/ExamResource'; import { validateObject, objectWithDefaults } from 'kolibri/utils/objectSpecs'; import { get, set } from '@vueuse/core'; -import { computed, ref, provide, inject, getCurrentInstance, watch } from '@vue/composition-api'; +import { computed, ref, provide, inject, getCurrentInstance, watch } from 'vue'; import { fetchExamWithContent } from 'kolibri-common/quizzes/utils'; // TODO: Probably move this to this file's local dir import selectQuestions, { getExerciseQuestionsMap } from '../utils/selectQuestions.js'; diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizResources.js b/kolibri/plugins/coach/assets/src/composables/useQuizResources.js index 1e55a5bee4f..afeccb47a00 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizResources.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizResources.js @@ -1,5 +1,5 @@ import { get, set } from '@vueuse/core'; -import { computed, ref } from '@vue/composition-api'; +import { computed, ref } from 'vue'; import ContentNodeResource from 'kolibri-common/apiResources/ContentNodeResource'; import { ContentNodeKinds } from 'kolibri/constants'; import logging from 'kolibri-logging'; diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizzes.js b/kolibri/plugins/coach/assets/src/composables/useQuizzes.js index 977d6f2b4d1..c6d3414eaa0 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizzes.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizzes.js @@ -1,5 +1,5 @@ import orderBy from 'lodash/orderBy'; -import { computed, getCurrentInstance } from '@vue/composition-api'; +import { computed, getCurrentInstance } from 'vue'; export default function useQuizzes(store) { store = store || getCurrentInstance().proxy.$store; diff --git a/kolibri/plugins/coach/assets/src/modules/lessonsRoot/index.js b/kolibri/plugins/coach/assets/src/modules/lessonsRoot/index.js index 1f2adfe53c7..2bc03a644bc 100644 --- a/kolibri/plugins/coach/assets/src/modules/lessonsRoot/index.js +++ b/kolibri/plugins/coach/assets/src/modules/lessonsRoot/index.js @@ -1,4 +1,4 @@ -import Vue from 'vue'; +import { set } from 'vue'; import * as actions from './actions'; function defaultState() { @@ -30,7 +30,7 @@ export default { for (const [key, val] of Object.entries(sizeItem)) { const lesson = state.lessons.find(lesson => lesson.id === key); if (lesson) { - Vue.set(lesson, 'size', val); + set(lesson, 'size', val); } } } diff --git a/kolibri/plugins/coach/assets/src/views/groups/GroupsRootPage/index.vue b/kolibri/plugins/coach/assets/src/views/groups/GroupsRootPage/index.vue index 86c7ea2070a..9fc1146a977 100644 --- a/kolibri/plugins/coach/assets/src/views/groups/GroupsRootPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/groups/GroupsRootPage/index.vue @@ -91,7 +91,7 @@