From 64858352de9982370ee5115f022971d3d06cf066 Mon Sep 17 00:00:00 2001
From: virgilchiriac <17074330+virgilchiriac@users.noreply.github.com>
Date: Fri, 16 Aug 2024 09:14:20 +0200
Subject: [PATCH 1/8] BC-7345 - upgrade node (#3346)
---
.github/workflows/test.yml | 6 +++++-
.npmrc | 1 +
.nvmrc | 2 +-
Dockerfile | 2 +-
package-lock.json | 11 +++++++----
package.json | 4 ++--
6 files changed, 17 insertions(+), 9 deletions(-)
create mode 100644 .npmrc
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0e52199b5f..0989349ac2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -10,7 +10,7 @@ permissions:
contents: read
env:
- node: 18
+ node: 20
jobs:
unit:
runs-on: ubuntu-latest
@@ -49,6 +49,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ - name: setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ env.node }}
- name: npm ci
run: npm ci --prefer-offline --no-audit
- name: npm run lint
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000000..b6f27f1359
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+engine-strict=true
diff --git a/.nvmrc b/.nvmrc
index 3c032078a4..209e3ef4b6 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-18
+20
diff --git a/Dockerfile b/Dockerfile
index 0b0daa5972..8036526997 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
# build stage
-FROM docker.io/node:18-bullseye AS build-stage
+FROM docker.io/node:20 AS build-stage
## add libraries needed for installing canvas npm package
RUN apt update && apt install -y g++ libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev;
diff --git a/package-lock.json b/package-lock.json
index 60d6c90f7a..9246ee6d0f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,7 @@
"dependencies": {
"@braintree/sanitize-url": "^6.0.4",
"@ckeditor/ckeditor5-vue": "^5.1.0",
- "@hpi-schul-cloud/ckeditor": "^1.0.0",
+ "@hpi-schul-cloud/ckeditor": "^1.1.0",
"@lumieducation/h5p-webcomponents": "^9.2.2",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
@@ -88,7 +88,7 @@
"webpack-plugin-vuetify": "^3.0.3"
},
"engines": {
- "node": "18",
+ "node": "20",
"npm": ">=9"
}
},
@@ -1835,10 +1835,13 @@
"license": "MIT"
},
"node_modules/@hpi-schul-cloud/ckeditor": {
- "version": "1.0.0",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@hpi-schul-cloud/ckeditor/-/ckeditor-1.1.0.tgz",
+ "integrity": "sha512-pcmF/JtrCB9K4uXQdKiFaziPEKYbv1E9M4HJJANBXem+FFLMHWbBkmdJQxR1LRizLc4FqAvlzmKQq5pHdlng8A==",
"license": "AGPL-3.0",
"engines": {
- "node": "18"
+ "node": "20",
+ "npm": ">=10"
}
},
"node_modules/@humanwhocodes/config-array": {
diff --git a/package.json b/package.json
index 97dcebb441..ed761f443a 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"dependencies": {
"@braintree/sanitize-url": "^6.0.4",
"@ckeditor/ckeditor5-vue": "^5.1.0",
- "@hpi-schul-cloud/ckeditor": "^1.0.0",
+ "@hpi-schul-cloud/ckeditor": "^1.1.0",
"@lumieducation/h5p-webcomponents": "^9.2.2",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
@@ -102,7 +102,7 @@
}
},
"engines": {
- "node": "18",
+ "node": "20",
"npm": ">=9"
}
}
From 5b87a95f64439edffabdca0851411470d48e22eb Mon Sep 17 00:00:00 2001
From: virgilchiriac <17074330+virgilchiriac@users.noreply.github.com>
Date: Fri, 16 Aug 2024 15:36:42 +0200
Subject: [PATCH 2/8] BC-7826 - make logo link to dashboard (#3359)
---
src/modules/ui/layout/CloudLogo.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/ui/layout/CloudLogo.vue b/src/modules/ui/layout/CloudLogo.vue
index 0a02469d81..1d7021b149 100644
--- a/src/modules/ui/layout/CloudLogo.vue
+++ b/src/modules/ui/layout/CloudLogo.vue
@@ -1,5 +1,5 @@
-
+
From b4e65f69f167d98fb708f57e5d5ee0095b098a98 Mon Sep 17 00:00:00 2001
From: Murat Merdoglu <64781656+muratmerdoglu-dp@users.noreply.github.com>
Date: Mon, 19 Aug 2024 15:50:02 +0200
Subject: [PATCH 3/8] BC-7808 - Fix unexpected cloned card element (#3353)
BC-7808 - implement key changing to force the component to re-rendering
---
src/modules/data/board/Board.store.unit.ts | 1 -
.../boardActions/boardSocketApi.composable.ts | 11 +++++--
.../boardSocketApi.composable.unit.ts | 14 ++++++++-
.../board/fixSamePositionDnD.composable.ts | 29 +++++++++++++++++++
.../fixSamePositionDnD.composable.unit.ts | 16 ++++++++++
src/modules/data/board/index.ts | 2 ++
.../feature/board/board/BoardColumn.unit.ts | 19 +++++++++++-
.../feature/board/board/BoardColumn.vue | 13 +++++++--
8 files changed, 98 insertions(+), 7 deletions(-)
create mode 100644 src/modules/data/board/fixSamePositionDnD.composable.ts
create mode 100644 src/modules/data/board/fixSamePositionDnD.composable.unit.ts
diff --git a/src/modules/data/board/Board.store.unit.ts b/src/modules/data/board/Board.store.unit.ts
index 696d4a4921..079bab5af0 100644
--- a/src/modules/data/board/Board.store.unit.ts
+++ b/src/modules/data/board/Board.store.unit.ts
@@ -661,7 +661,6 @@ describe("BoardStore", () => {
expect(secondColumnCardsAfterMove?.map((card) => card.cardId)).toEqual([
secondCardId,
]);
-
expect(firstColumnCardsAfterMove?.map((card) => card.cardId)).toEqual([
firstCardId,
thirdCardId,
diff --git a/src/modules/data/board/boardActions/boardSocketApi.composable.ts b/src/modules/data/board/boardActions/boardSocketApi.composable.ts
index 16eac25a8a..5deaced929 100644
--- a/src/modules/data/board/boardActions/boardSocketApi.composable.ts
+++ b/src/modules/data/board/boardActions/boardSocketApi.composable.ts
@@ -1,6 +1,6 @@
import * as BoardActions from "./boardActions";
import * as CardActions from "../cardActions/cardActions";
-import { useSocketConnection } from "@data-board";
+import { useSocketConnection, useForceRender } from "@data-board";
import { useBoardStore } from "../Board.store";
import {
CreateCardRequestPayload,
@@ -9,6 +9,7 @@ import {
DisconnectSocketRequestPayload,
FetchBoardRequestPayload,
MoveCardRequestPayload,
+ MoveCardSuccessPayload,
MoveColumnRequestPayload,
UpdateBoardTitleRequestPayload,
UpdateBoardVisibilityRequestPayload,
@@ -95,7 +96,8 @@ export const useBoardSocketApi = () => {
...successActions,
...failureActions,
...ariaLiveNotifications,
- on(BoardActions.disconnectSocket, disconnectSocketRequest)
+ on(BoardActions.disconnectSocket, disconnectSocketRequest),
+ on(BoardActions.moveCardSuccess, setRenderKeyAfterMoveCard)
);
};
@@ -171,6 +173,11 @@ export const useBoardSocketApi = () => {
emitOnSocket("update-board-visibility-request", payload);
};
+ const setRenderKeyAfterMoveCard = (payload: MoveCardSuccessPayload) => {
+ const { generateRenderKey } = useForceRender(payload.fromColumnId);
+ generateRenderKey();
+ };
+
const createCardFailure = () => notifySocketError("notCreated", "boardCard");
const createColumnFailure = () =>
notifySocketError("notCreated", "boardColumn");
diff --git a/src/modules/data/board/boardActions/boardSocketApi.composable.unit.ts b/src/modules/data/board/boardActions/boardSocketApi.composable.unit.ts
index dfa5d562e1..0e1b672ba1 100644
--- a/src/modules/data/board/boardActions/boardSocketApi.composable.unit.ts
+++ b/src/modules/data/board/boardActions/boardSocketApi.composable.unit.ts
@@ -9,7 +9,11 @@ import {
mockedPiniaStoreTyping,
} from "@@/tests/test-utils";
import setupStores from "@@/tests/test-utils/setupStores";
-import { useBoardStore, useSocketConnection } from "@data-board";
+import {
+ useBoardStore,
+ useSocketConnection,
+ useForceRender,
+} from "@data-board";
import { createMock, DeepMocked } from "@golevelup/ts-jest";
import { createTestingPinia } from "@pinia/testing";
import { useBoardNotifier, useSharedLastCreatedElement } from "@util-board";
@@ -36,6 +40,9 @@ import { useBoardSocketApi } from "./boardSocketApi.composable";
jest.mock("../socket/socket");
const mockedUseSocketConnection = jest.mocked(useSocketConnection);
+jest.mock("../fixSamePositionDnD.composable");
+const mockedUseForceRender = jest.mocked(useForceRender);
+
jest.mock("./boardRestApi.composable");
const mockedUseBoardRestApi = jest.mocked(useBoardRestApi);
@@ -59,6 +66,7 @@ describe("useBoardSocketApi", () => {
let mockedSharedLastCreatedElementActions: DeepMocked<
ReturnType
>;
+ let mockedUseForceRenderHandler: ReturnType;
beforeEach(() => {
setActivePinia(createTestingPinia());
@@ -89,6 +97,9 @@ describe("useBoardSocketApi", () => {
mockedSharedLastCreatedElement.mockReturnValue(
mockedSharedLastCreatedElementActions
);
+ mockedUseForceRenderHandler =
+ createMock>();
+ mockedUseForceRender.mockReturnValue(mockedUseForceRenderHandler);
});
it("should be defined", () => {
@@ -176,6 +187,7 @@ describe("useBoardSocketApi", () => {
dispatch(BoardActions.moveCardSuccess(payload));
expect(boardStore.moveCardSuccess).toHaveBeenCalledWith(payload);
+ expect(mockedUseForceRenderHandler.generateRenderKey).toHaveBeenCalled();
});
it("should call moveColumnSuccess for corresponding action", () => {
diff --git a/src/modules/data/board/fixSamePositionDnD.composable.ts b/src/modules/data/board/fixSamePositionDnD.composable.ts
new file mode 100644
index 0000000000..18d43085f5
--- /dev/null
+++ b/src/modules/data/board/fixSamePositionDnD.composable.ts
@@ -0,0 +1,29 @@
+import { reactive } from "vue";
+
+const renderKeyList = reactive>({});
+
+const getMaxRenderKey = () => {
+ return Object.values(renderKeyList).reduce((a, b) => Math.max(a, b), 0);
+};
+
+/*
+ * This artificial generating renderKey forces a component to re-render by changing the element key.
+ * It is used to fix issue described on https://ticketsystem.dbildungscloud.de/browse/BC-7806
+ *
+ * This solution is based on the article on https://michaelnthiessen.com/force-re-render/
+ */
+export const useForceRender = (id: string) => {
+ const generateRenderKey = () => {
+ renderKeyList[id] = getMaxRenderKey() + 1;
+ };
+
+ const getRenderKey = (): number => {
+ if (!renderKeyList[id]) generateRenderKey();
+ return renderKeyList[id];
+ };
+
+ return {
+ generateRenderKey,
+ getRenderKey,
+ };
+};
diff --git a/src/modules/data/board/fixSamePositionDnD.composable.unit.ts b/src/modules/data/board/fixSamePositionDnD.composable.unit.ts
new file mode 100644
index 0000000000..ed9ea1e6c7
--- /dev/null
+++ b/src/modules/data/board/fixSamePositionDnD.composable.unit.ts
@@ -0,0 +1,16 @@
+import { useForceRender } from "./fixSamePositionDnD.composable";
+
+describe("fixSamePositionDnD", () => {
+ it("should set render key to the list", () => {
+ const { getRenderKey } = useForceRender("test-id-#1");
+ const renderKey = getRenderKey();
+ expect(renderKey).toBe(1);
+ });
+
+ it('should increase the render key when "generateRenderKey" is called', () => {
+ const { generateRenderKey, getRenderKey } = useForceRender("test-id-#1");
+ expect(getRenderKey()).toBe(1);
+ generateRenderKey();
+ expect(getRenderKey()).toBe(2);
+ });
+});
diff --git a/src/modules/data/board/index.ts b/src/modules/data/board/index.ts
index 860ce2ee41..a2a0c8d797 100644
--- a/src/modules/data/board/index.ts
+++ b/src/modules/data/board/index.ts
@@ -9,6 +9,7 @@ import * as cardActions from "./cardActions/cardActions";
import { useSocketConnection } from "./socket/socket";
import { useCardStore } from "./Card.store";
import { useBoardInactivity } from "./boardInactivity.composable";
+import { useForceRender } from "./fixSamePositionDnD.composable";
export {
boardActions,
@@ -20,6 +21,7 @@ export {
useCardStore,
useContentElementState,
useEditMode,
+ useForceRender,
useSharedEditMode,
useSharedBoardPageInformation,
useSocketConnection,
diff --git a/src/modules/feature/board/board/BoardColumn.unit.ts b/src/modules/feature/board/board/BoardColumn.unit.ts
index 41639ce20a..0e6e310316 100644
--- a/src/modules/feature/board/board/BoardColumn.unit.ts
+++ b/src/modules/feature/board/board/BoardColumn.unit.ts
@@ -4,7 +4,11 @@ import {
envsFactory,
} from "@@/tests/test-utils/factory";
import { shallowMount } from "@vue/test-utils";
-import { useBoardPermissions, useBoardStore } from "@data-board";
+import {
+ useBoardPermissions,
+ useBoardStore,
+ useForceRender,
+} from "@data-board";
import {
BoardPermissionChecks,
defaultPermissions,
@@ -32,8 +36,12 @@ const mockedUserPermissions = jest.mocked(useBoardPermissions);
jest.mock("@util-board");
const mockedUseBoardNotifier = jest.mocked(useBoardNotifier);
+jest.mock("@data-board/fixSamePositionDnD.composable");
+const mockedUseForceRender = jest.mocked(useForceRender);
+
describe("BoardColumn", () => {
let mockedBoardNotifierCalls: DeepMocked>;
+ let mockedUseForceRenderHandler: ReturnType;
beforeEach(() => {
setupStores({ envConfigModule: EnvConfigModule });
@@ -45,6 +53,10 @@ describe("BoardColumn", () => {
mockedBoardNotifierCalls =
createMock>();
mockedUseBoardNotifier.mockReturnValue(mockedBoardNotifierCalls);
+
+ mockedUseForceRenderHandler =
+ createMock>();
+ mockedUseForceRender.mockReturnValue(mockedUseForceRenderHandler);
});
const setup = (options?: {
@@ -93,6 +105,11 @@ describe("BoardColumn", () => {
const { wrapper } = setup();
expect(wrapper.findComponent(BoardColumnVue).exists()).toBe(true);
});
+
+ it("should trigger 'getRenderKey' method", () => {
+ setup();
+ expect(mockedUseForceRenderHandler.getRenderKey).toHaveBeenCalled();
+ });
});
describe("when a card moved ", () => {
diff --git a/src/modules/feature/board/board/BoardColumn.vue b/src/modules/feature/board/board/BoardColumn.vue
index fffefb5868..3b809a076e 100644
--- a/src/modules/feature/board/board/BoardColumn.vue
+++ b/src/modules/feature/board/board/BoardColumn.vue
@@ -1,5 +1,5 @@
-
+
getRenderKey());
+
return {
cardDropPlaceholderOptions,
columnClasses,
@@ -335,6 +343,7 @@ export default defineComponent({
onUpdateTitle,
getChildPayload,
reactiveIndex,
+ renderKey,
showAddButton,
sortableGhostClasses,
};
From a9ba2e586721bf19627ea33dc5209d32b5800d09 Mon Sep 17 00:00:00 2001
From: mamutmk5 <3045922+mamutmk5@users.noreply.github.com>
Date: Mon, 19 Aug 2024 16:57:18 +0200
Subject: [PATCH 4/8] BC-7854 - split Ansible Jobs by Tags (#3365)
---
ansible/roles/nuxt-client-core/tasks/main.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ansible/roles/nuxt-client-core/tasks/main.yml b/ansible/roles/nuxt-client-core/tasks/main.yml
index 3c28690652..64cf8d2a94 100644
--- a/ansible/roles/nuxt-client-core/tasks/main.yml
+++ b/ansible/roles/nuxt-client-core/tasks/main.yml
@@ -3,6 +3,8 @@
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: svc.yml.j2
+ tags:
+ - service
- name: Configmap
kubernetes.core.k8s:
@@ -10,9 +12,13 @@
namespace: "{{ NAMESPACE }}"
template: configmap.yml.j2
apply: yes
+ tags:
+ - configmap
- name: Deployment
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
+ tags:
+ - deployment
From b4ad8621a5d8fd3672a1dcbb5c67a35268fe7909 Mon Sep 17 00:00:00 2001
From: wolfganggreschus
Date: Tue, 20 Aug 2024 10:45:40 +0200
Subject: [PATCH 5/8] BC-7664 - rename room stores and room pages (#3361)
* rename modules
* rename pages
* refactor imports
* update routes
* fix tests
---------
Co-authored-by: Uwe Ilgenstein
---
.../atoms/vCustomBreadcrumbs.unit.ts | 6 +-
.../CommonCartridgeExportModal.unit.ts | 11 +-
.../molecules/CommonCartridgeExportModal.vue | 6 +-
.../CommonCartridgeImportModal.unit.ts | 8 +-
.../molecules/CommonCartridgeImportModal.vue | 10 +-
src/components/molecules/RoomModal.unit.ts | 12 +-
src/components/molecules/RoomModal.vue | 4 +-
src/components/share/ImportFlow.unit.ts | 8 +-
.../templates/RoomDashboard.unit.ts | 28 +-
src/components/templates/RoomDashboard.vue | 24 +-
src/components/templates/RoomWrapper.unit.ts | 10 +-
src/components/templates/RoomWrapper.vue | 8 +-
src/layouts/LoggedIn.unit.ts | 2 +-
src/main.ts | 17 +-
.../board/BoardPageInformation.composable.ts | 2 +-
src/modules/feature/board/board/Board.unit.ts | 18 +-
src/modules/feature/board/board/Board.vue | 6 +-
src/modules/ui/layout/sidebar/Sidebar.unit.ts | 2 +-
.../sidebar/SidebarCategoryItem.unit.ts | 2 +-
.../ui/layout/sidebar/SidebarItem.unit.ts | 4 +-
src/modules/ui/layout/sidebar/SidebarItem.vue | 2 +-
.../layout/sidebar/SidebarItems.composable.ts | 2 +-
...ntextExternalToolConfigurator.page.unit.ts | 13 +-
...seContextExternalToolConfigurator.page.vue | 16 +-
...unit.ts => CourseRoomDetails.page.unit.ts} | 18 +-
...ls.page.vue => CourseRoomDetails.page.vue} | 22 +-
...st.unit.ts => CourseRoomList.page.unit.ts} | 19 +-
...mList.page.vue => CourseRoomList.page.vue} | 19 +-
...nit.js => CourseRoomOverview.page.unit.js} | 30 +-
...w.page.vue => CourseRoomOverview.page.vue} | 61 +++--
.../tools/RoomExternalToolsOverview.unit.ts | 19 +-
.../rooms/tools/RoomExternalToolsOverview.vue | 12 +-
.../tools/RoomVideoConferenceSection.unit.ts | 47 ++--
.../tools/RoomVideoConferenceSection.vue | 12 +-
src/plugins/store.ts | 1 -
src/router/routes.ts | 47 ++--
src/router/vue-client-route.js | 8 +-
src/store/common-cartridge-export.ts | 4 +-
src/store/common-cartridge-export.unit.ts | 14 +-
src/store/{room.ts => course-room-details.ts} | 4 +-
...om.unit.ts => course-room-details.unit.ts} | 257 ++++++++++--------
src/store/{rooms.ts => course-room-list.ts} | 4 +-
...rooms.unit.ts => course-room-list.unit.ts} | 242 +++++++++--------
src/store/share.ts | 2 +-
src/store/share.unit.ts | 6 +-
src/store/store-accessor.ts | 16 +-
src/utils/inject/injection-keys.ts | 11 +-
src/utils/sidebar-base-items.ts | 8 +-
48 files changed, 592 insertions(+), 512 deletions(-)
rename src/pages/rooms/{room-details.unit.ts => CourseRoomDetails.page.unit.ts} (97%)
rename src/pages/rooms/{RoomDetails.page.vue => CourseRoomDetails.page.vue} (95%)
rename src/pages/rooms/{room-list.unit.ts => CourseRoomList.page.unit.ts} (90%)
rename src/pages/rooms/{RoomList.page.vue => CourseRoomList.page.vue} (85%)
rename src/pages/rooms/{room-overview.unit.js => CourseRoomOverview.page.unit.js} (94%)
rename src/pages/rooms/{RoomOverview.page.vue => CourseRoomOverview.page.vue} (89%)
rename src/store/{room.ts => course-room-details.ts} (98%)
rename src/store/{room.unit.ts => course-room-details.unit.ts} (69%)
rename src/store/{rooms.ts => course-room-list.ts} (98%)
rename src/store/{rooms.unit.ts => course-room-list.unit.ts} (66%)
diff --git a/src/components/atoms/vCustomBreadcrumbs.unit.ts b/src/components/atoms/vCustomBreadcrumbs.unit.ts
index 3ec55742cc..d290d70d33 100644
--- a/src/components/atoms/vCustomBreadcrumbs.unit.ts
+++ b/src/components/atoms/vCustomBreadcrumbs.unit.ts
@@ -12,7 +12,9 @@ describe("@/components/atoms/vCustomBreadcrumbs", () => {
plugins: [createTestingVuetify(), createTestingI18n()],
},
props: {
- breadcrumbs: [{ title: "Cursos actuales", to: "/rooms-overview" }],
+ breadcrumbs: [
+ { title: "Cursos actuales", to: "/rooms/courses-overview" },
+ ],
},
});
@@ -26,7 +28,7 @@ describe("@/components/atoms/vCustomBreadcrumbs", () => {
name: "v-breadcrumbs-item",
});
- expect(breadcrumbsItem.props().to).toStrictEqual("/rooms-overview");
+ expect(breadcrumbsItem.props().to).toStrictEqual("/rooms/courses-overview");
expect(breadcrumbsItem.element.innerHTML).toContain("Cursos actuales");
});
});
diff --git a/src/components/molecules/CommonCartridgeExportModal.unit.ts b/src/components/molecules/CommonCartridgeExportModal.unit.ts
index 2c7aa897c1..3c93210924 100644
--- a/src/components/molecules/CommonCartridgeExportModal.unit.ts
+++ b/src/components/molecules/CommonCartridgeExportModal.unit.ts
@@ -1,11 +1,11 @@
import CommonCartridgeExportModal from "@/components/molecules/CommonCartridgeExportModal.vue";
import CommonCartridgeExportModule from "@/store/common-cartridge-export";
import NotifierModule from "@/store/notifier";
-import RoomModule from "@/store/room";
+import courseRoomDetailsModule from "@/store/course-room-details";
import {
COMMON_CARTRIDGE_EXPORT_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import {
@@ -17,7 +17,7 @@ import { VDialog } from "vuetify/lib/components/index.mjs";
describe("@/components/molecules/CommonCartridgeExportModal", () => {
let exportModuleMock: CommonCartridgeExportModule;
- let roomModuleMock: RoomModule;
+ let courseRoomDetailsModuleMock: courseRoomDetailsModule;
const setup = () => {
exportModuleMock = createModuleMocks(CommonCartridgeExportModule, {
@@ -29,7 +29,7 @@ describe("@/components/molecules/CommonCartridgeExportModal", () => {
startExport: jest.fn(),
resetExportFlow: jest.fn(),
});
- roomModuleMock = createModuleMocks(RoomModule, {
+ courseRoomDetailsModuleMock = createModuleMocks(courseRoomDetailsModule, {
getRoomData: {
roomId: "1",
title: "title",
@@ -46,7 +46,8 @@ describe("@/components/molecules/CommonCartridgeExportModal", () => {
provide: {
[COMMON_CARTRIDGE_EXPORT_MODULE_KEY.valueOf()]: exportModuleMock,
[NOTIFIER_MODULE_KEY.valueOf()]: createModuleMocks(NotifierModule),
- [ROOM_MODULE_KEY.valueOf()]: roomModuleMock,
+ [COURSE_ROOM_DETAILS_MODULE_KEY.valueOf()]:
+ courseRoomDetailsModuleMock,
},
},
});
diff --git a/src/components/molecules/CommonCartridgeExportModal.vue b/src/components/molecules/CommonCartridgeExportModal.vue
index f05ec43192..43c3b9ac75 100644
--- a/src/components/molecules/CommonCartridgeExportModal.vue
+++ b/src/components/molecules/CommonCartridgeExportModal.vue
@@ -164,7 +164,7 @@ import {
COMMON_CARTRIDGE_EXPORT_MODULE_KEY,
injectStrict,
NOTIFIER_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
} from "@/utils/inject";
import { mdiInformation } from "@mdi/js";
import { computed, ref, watch } from "vue";
@@ -181,7 +181,7 @@ const notifier = injectStrict(NOTIFIER_MODULE_KEY);
const commonCartridgeExportModule = injectStrict(
COMMON_CARTRIDGE_EXPORT_MODULE_KEY
);
-const roomModule = injectStrict(ROOM_MODULE_KEY);
+const courseRoomDetailsModule = injectStrict(COURSE_ROOM_DETAILS_MODULE_KEY);
const emit = defineEmits([
"update:isExportModalOpen",
@@ -220,7 +220,7 @@ const allColumnBoardsSelected = computed(() => {
});
watch(
- () => roomModule.getRoomData.elements,
+ () => courseRoomDetailsModule.getRoomData.elements,
(newValue) => {
allTopics.value = [];
allTasks.value = [];
diff --git a/src/components/molecules/CommonCartridgeImportModal.unit.ts b/src/components/molecules/CommonCartridgeImportModal.unit.ts
index 6071119568..694707a1eb 100644
--- a/src/components/molecules/CommonCartridgeImportModal.unit.ts
+++ b/src/components/molecules/CommonCartridgeImportModal.unit.ts
@@ -1,4 +1,4 @@
-import RoomsModule from "@/store/rooms";
+import CourseRoomListModule from "@/store/course-room-list";
import CommonCartridgeImportModal from "./CommonCartridgeImportModal.vue";
import { mount } from "@vue/test-utils";
import LoadingStateModule from "@/store/loading-state";
@@ -7,7 +7,7 @@ import {
COMMON_CARTRIDGE_IMPORT_MODULE_KEY,
LOADING_STATE_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOMS_MODULE_KEY,
+ COURSE_ROOM_LIST_MODULE_KEY,
} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import {
@@ -21,7 +21,7 @@ describe("@/components/molecules/CommonCartridgeImportModal", () => {
document.body.setAttribute("data-app", "true");
const notifierModuleMock = createModuleMocks(NotifierModule);
- const roomsModuleMock = createModuleMocks(RoomsModule, {
+ const roomsModuleMock = createModuleMocks(CourseRoomListModule, {
getAllElements: [],
});
const commonCartridgeImportModule = createModuleMocks(
@@ -36,7 +36,7 @@ describe("@/components/molecules/CommonCartridgeImportModal", () => {
[LOADING_STATE_MODULE_KEY.valueOf()]:
createModuleMocks(LoadingStateModule),
[NOTIFIER_MODULE_KEY.valueOf()]: notifierModuleMock,
- [ROOMS_MODULE_KEY.valueOf()]: roomsModuleMock,
+ [COURSE_ROOM_LIST_MODULE_KEY.valueOf()]: roomsModuleMock,
[COMMON_CARTRIDGE_IMPORT_MODULE_KEY.valueOf()]:
commonCartridgeImportModule,
},
diff --git a/src/components/molecules/CommonCartridgeImportModal.vue b/src/components/molecules/CommonCartridgeImportModal.vue
index 0a39aafb82..86f8a57655 100644
--- a/src/components/molecules/CommonCartridgeImportModal.vue
+++ b/src/components/molecules/CommonCartridgeImportModal.vue
@@ -60,12 +60,12 @@ import {
COMMON_CARTRIDGE_IMPORT_MODULE_KEY,
LOADING_STATE_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOMS_MODULE_KEY,
+ COURSE_ROOM_LIST_MODULE_KEY,
injectStrict,
} from "@/utils/inject";
const i18n = useI18n();
-const roomsModule = injectStrict(ROOMS_MODULE_KEY);
+const courseRoomListModule = injectStrict(COURSE_ROOM_LIST_MODULE_KEY);
const loadingStateModule = injectStrict(LOADING_STATE_MODULE_KEY);
const notifierModule = injectStrict(NOTIFIER_MODULE_KEY);
const commonCartridgeImportModule = injectStrict(
@@ -109,11 +109,11 @@ async function onConfirm(): Promise {
if (commonCartridgeImportModule.isSuccess) {
await Promise.allSettled([
- roomsModule.fetch(),
- roomsModule.fetchAllElements(),
+ courseRoomListModule.fetch(),
+ courseRoomListModule.fetchAllElements(),
]);
loadingStateModule.close();
- const title = roomsModule.getAllElements[0]?.title;
+ const title = courseRoomListModule.getAllElements[0]?.title;
notifierModule.show({
status: "success",
text: i18n.t("pages.rooms.ccImportCourse.success", { name: title }),
diff --git a/src/components/molecules/RoomModal.unit.ts b/src/components/molecules/RoomModal.unit.ts
index 5f11272ef7..999c3d1e19 100644
--- a/src/components/molecules/RoomModal.unit.ts
+++ b/src/components/molecules/RoomModal.unit.ts
@@ -1,7 +1,7 @@
import RoomAvatarIterator from "@/components/organisms/RoomAvatarIterator.vue";
import vCustomDialog from "@/components/organisms/vCustomDialog.vue";
-import { roomsModule } from "@/store";
-import RoomsModule from "@/store/rooms";
+import { courseRoomListModule } from "@/store";
+import CourseRoomListModule from "@/store/course-room-list";
import {
createTestingI18n,
createTestingVuetify,
@@ -13,7 +13,7 @@ import RoomModal from "./RoomModal.vue";
describe("RoomModal", () => {
const getWrapper = (props: { isOpen: boolean }) => {
const { isOpen } = props;
- setupStores({ roomsModule: RoomsModule });
+ setupStores({ courseRoomListModule: CourseRoomListModule });
const wrapper = mount(RoomModal, {
global: { plugins: [createTestingVuetify(), createTestingI18n()] },
@@ -105,7 +105,7 @@ describe("RoomModal", () => {
const setup = async () => {
const { wrapper } = getWrapper({ isOpen: true });
- const storeRoomUpdateMock = jest.spyOn(roomsModule, "update");
+ const storeRoomUpdateMock = jest.spyOn(courseRoomListModule, "update");
const titleInput = wrapper
.findComponent({ name: "v-text-field" })
.find("input");
@@ -140,7 +140,7 @@ describe("RoomModal", () => {
const setup = async () => {
const { wrapper } = getWrapper({ isOpen: true });
- const storeRoomUpdateMock = jest.spyOn(roomsModule, "update");
+ const storeRoomUpdateMock = jest.spyOn(courseRoomListModule, "update");
const titleInput = wrapper
.findComponent({ name: "v-text-field" })
.find("input");
@@ -181,7 +181,7 @@ describe("RoomModal", () => {
const setup = async () => {
const { wrapper } = getWrapper({ isOpen: true });
- const storeRoomUpdateMock = jest.spyOn(roomsModule, "update");
+ const storeRoomUpdateMock = jest.spyOn(courseRoomListModule, "update");
const titleInput = wrapper
.findComponent({ name: "v-text-field" })
.find("input");
diff --git a/src/components/molecules/RoomModal.vue b/src/components/molecules/RoomModal.vue
index a48e62b1e8..ee04b4ac8e 100644
--- a/src/components/molecules/RoomModal.vue
+++ b/src/components/molecules/RoomModal.vue
@@ -35,7 +35,7 @@
diff --git a/src/modules/ui/layout/sidebar/Sidebar.unit.ts b/src/modules/ui/layout/sidebar/Sidebar.unit.ts
index 84a06401ce..dde717f856 100644
--- a/src/modules/ui/layout/sidebar/Sidebar.unit.ts
+++ b/src/modules/ui/layout/sidebar/Sidebar.unit.ts
@@ -20,7 +20,7 @@ import { SchulcloudTheme } from "@/serverApi/v3";
import { envsFactory } from "@@/tests/test-utils";
jest.mock("vue-router", () => ({
- useRoute: () => ({ path: "rooms-list" }),
+ useRoute: () => ({ path: "rooms/courses-list" }),
}));
const setup = (permissions?: string[]) => {
diff --git a/src/modules/ui/layout/sidebar/SidebarCategoryItem.unit.ts b/src/modules/ui/layout/sidebar/SidebarCategoryItem.unit.ts
index 1c61ca0bea..2527086313 100644
--- a/src/modules/ui/layout/sidebar/SidebarCategoryItem.unit.ts
+++ b/src/modules/ui/layout/sidebar/SidebarCategoryItem.unit.ts
@@ -30,7 +30,7 @@ const groupItem: SidebarGroupItem = {
};
jest.mock("vue-router", () => ({
- useRoute: () => ({ path: "rooms-list" }),
+ useRoute: () => ({ path: "rooms/courses-list" }),
}));
describe("@ui-layout/SidebarCategoryItem", () => {
diff --git a/src/modules/ui/layout/sidebar/SidebarItem.unit.ts b/src/modules/ui/layout/sidebar/SidebarItem.unit.ts
index 88328e5420..8615baf344 100644
--- a/src/modules/ui/layout/sidebar/SidebarItem.unit.ts
+++ b/src/modules/ui/layout/sidebar/SidebarItem.unit.ts
@@ -20,7 +20,7 @@ const childItem: SidebarSingleItem = {
};
jest.mock("vue-router", () => ({
- useRoute: () => ({ path: "rooms-list" }),
+ useRoute: () => ({ path: "rooms/courses-list" }),
}));
describe("@ui-layout/SidebarItem", () => {
@@ -56,7 +56,7 @@ describe("@ui-layout/SidebarItem", () => {
icon: "mdiOpen",
title: "title",
testId: "testId",
- to: "/rooms-overview",
+ to: "/rooms/courses-overview",
});
expect(wrapper.classes()).toContain("v-list-item--active");
diff --git a/src/modules/ui/layout/sidebar/SidebarItem.vue b/src/modules/ui/layout/sidebar/SidebarItem.vue
index d8f3708e3c..c6c2bcd4a9 100644
--- a/src/modules/ui/layout/sidebar/SidebarItem.vue
+++ b/src/modules/ui/layout/sidebar/SidebarItem.vue
@@ -35,7 +35,7 @@ const route = useRoute();
const isActive = computed(() => {
const anyCoursePageIsActive =
- route.path.includes("room") && props.item.to === "/rooms-overview";
+ route.path.includes("room") && props.item.to === "/rooms/courses-overview";
if (anyCoursePageIsActive) {
return true;
diff --git a/src/modules/ui/layout/sidebar/SidebarItems.composable.ts b/src/modules/ui/layout/sidebar/SidebarItems.composable.ts
index 4684a3106a..ad3ebea555 100644
--- a/src/modules/ui/layout/sidebar/SidebarItems.composable.ts
+++ b/src/modules/ui/layout/sidebar/SidebarItems.composable.ts
@@ -23,7 +23,7 @@ export const useSidebarItems = () => {
},
{
title: "global.sidebar.item.courses",
- to: "/rooms-overview",
+ to: "/rooms/courses-overview",
icon: "$mdiSchoolOutline",
testId: "Course-Overview",
},
diff --git a/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.unit.ts b/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.unit.ts
index 909aec95e2..5a2891e987 100644
--- a/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.unit.ts
+++ b/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.unit.ts
@@ -1,8 +1,11 @@
import ContextExternalToolConfigurator from "@/components/external-tools/configuration/ContextExternalToolConfigurator.vue";
import { ToolContextType } from "@/serverApi/v3";
import NotifierModule from "@/store/notifier";
-import RoomModule from "@/store/room";
-import { NOTIFIER_MODULE_KEY, ROOM_MODULE_KEY } from "@/utils/inject";
+import CourseRoomDetailsModule from "@/store/course-room-details";
+import {
+ NOTIFIER_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
+} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import { contextExternalToolFactory } from "@@/tests/test-utils/factory";
import {
@@ -33,7 +36,7 @@ describe("CourseContextExternalToolConfigurator", () => {
const notifierModule = createModuleMocks(NotifierModule);
const roomTitle = "Room Title";
- const roomModule = createModuleMocks(RoomModule, {
+ const courseRoomDetailsModule = createModuleMocks(CourseRoomDetailsModule, {
getRoomData: {
title: roomTitle,
roomId: "contextId",
@@ -53,7 +56,7 @@ describe("CourseContextExternalToolConfigurator", () => {
],
provide: {
[NOTIFIER_MODULE_KEY.valueOf()]: notifierModule,
- [ROOM_MODULE_KEY.valueOf()]: roomModule,
+ [COURSE_ROOM_DETAILS_MODULE_KEY.valueOf()]: courseRoomDetailsModule,
},
stubs: {
ContextExternalToolConfigurator: {
@@ -73,7 +76,7 @@ describe("CourseContextExternalToolConfigurator", () => {
return {
wrapper,
- roomModule,
+ courseRoomDetailsModule,
notifierModule,
roomTitle,
};
diff --git a/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.vue b/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.vue
index e5cb79b820..3bf43cea00 100644
--- a/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.vue
+++ b/src/pages/context-external-tool/CourseContextExternalToolConfigurator.page.vue
@@ -24,11 +24,11 @@ import { Breadcrumb } from "@/components/templates/default-wireframe.types";
import DefaultWireframe from "@/components/templates/DefaultWireframe.vue";
import { ToolContextType } from "@/serverApi/v3";
import NotifierModule from "@/store/notifier";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import {
injectStrict,
NOTIFIER_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
} from "@/utils/inject";
import { RenderHTML } from "@feature-render-html";
import { computed, ComputedRef, onMounted, PropType, Ref, ref } from "vue";
@@ -42,14 +42,18 @@ const props = defineProps({
});
const notifierModule: NotifierModule = injectStrict(NOTIFIER_MODULE_KEY);
-const roomModule: RoomModule = injectStrict(ROOM_MODULE_KEY);
+const courseRoomDetailsModule: CourseRoomDetailsModule = injectStrict(
+ COURSE_ROOM_DETAILS_MODULE_KEY
+);
const { t } = useI18n();
const contextRoute = computed(() => `/rooms/${props.contextId}`);
const breadcrumbs: ComputedRef = computed(() => {
- const crumbs = [{ title: t("common.words.courses"), to: "/rooms-overview/" }];
+ const crumbs = [
+ { title: t("common.words.courses"), to: "/rooms/courses-overview/" },
+ ];
if (courseTitle.value) {
crumbs.push({ title: courseTitle.value, to: contextRoute });
@@ -59,7 +63,7 @@ const breadcrumbs: ComputedRef = computed(() => {
});
const courseTitle: ComputedRef = computed(
- () => roomModule.getRoomData.title
+ () => courseRoomDetailsModule.getRoomData.title
);
const router: Router = useRouter();
@@ -85,6 +89,6 @@ const contextExternalToolConfigurator: Ref {
await contextExternalToolConfigurator.value?.fetchData();
- await roomModule.fetchContent(props.contextId);
+ await courseRoomDetailsModule.fetchContent(props.contextId);
});
diff --git a/src/pages/rooms/room-details.unit.ts b/src/pages/rooms/CourseRoomDetails.page.unit.ts
similarity index 97%
rename from src/pages/rooms/room-details.unit.ts
rename to src/pages/rooms/CourseRoomDetails.page.unit.ts
index 56f34f02d2..cd100d312f 100644
--- a/src/pages/rooms/room-details.unit.ts
+++ b/src/pages/rooms/CourseRoomDetails.page.unit.ts
@@ -10,7 +10,7 @@ import CopyModule from "@/store/copy";
import EnvConfigModule from "@/store/env-config";
import LoadingStateModule from "@/store/loading-state";
import NotifierModule from "@/store/notifier";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import ShareModule from "@/store/share";
import { initializeAxios } from "@/utils/api";
import {
@@ -19,7 +19,7 @@ import {
COPY_MODULE_KEY,
ENV_CONFIG_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
SHARE_MODULE_KEY,
} from "@/utils/inject/injection-keys";
import { createModuleMocks } from "@/utils/mock-store-module";
@@ -34,7 +34,7 @@ import { SpeedDialMenu, SpeedDialMenuAction } from "@ui-speed-dial-menu";
import { mount } from "@vue/test-utils";
import { AxiosInstance } from "axios";
import { VBtn } from "vuetify/lib/components/index.mjs";
-import RoomDetailsPage from "./RoomDetails.page.vue";
+import CourseRoomDetailsPage from "./CourseRoomDetails.page.vue";
import RoomExternalToolsOverview from "./tools/RoomExternalToolsOverview.vue";
import { SelectBoardLayoutDialog } from "@ui-room-details";
import DefaultWireframe from "../../components/templates/DefaultWireframe.vue";
@@ -117,7 +117,7 @@ let loadingStateModuleMock: LoadingStateModule;
let notifierModule: NotifierModule;
let shareModule: ShareModule;
let downloadModule: CommonCartridgeExportModule;
-let roomModule: RoomModule;
+let courseRoomDetailsModule: CourseRoomDetailsModule;
let authModule: AuthModule;
const getWrapper = (
@@ -148,7 +148,7 @@ const getWrapper = (
startShareFlow: jest.fn(),
resetShareFlow: jest.fn(),
});
- roomModule = createModuleMocks(RoomModule, {
+ courseRoomDetailsModule = createModuleMocks(CourseRoomDetailsModule, {
fetchContent: jest.fn(),
getRoomData: mockData,
getPermissionData: permissionData,
@@ -170,7 +170,7 @@ const getWrapper = (
.spyOn(window, "matchMedia")
.mockReturnValue(createMock());
- return mount(RoomDetailsPage, {
+ return mount(CourseRoomDetailsPage, {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
mocks: {
@@ -184,7 +184,7 @@ const getWrapper = (
[SHARE_MODULE_KEY.valueOf()]: shareModule,
[ENV_CONFIG_MODULE_KEY.valueOf()]: envConfigModuleMock,
[COMMON_CARTRIDGE_EXPORT_MODULE_KEY.valueOf()]: downloadModule,
- [ROOM_MODULE_KEY.valueOf()]: roomModule,
+ [COURSE_ROOM_DETAILS_MODULE_KEY.valueOf()]: courseRoomDetailsModule,
[AUTH_MODULE_KEY.valueOf()]: authModule,
},
stubs: {
@@ -196,7 +196,7 @@ const getWrapper = (
});
};
-describe("@/pages/RoomDetails.page.vue", () => {
+describe("@/pages/CourseRoomDetails.page.vue", () => {
beforeEach(() => {
setupStores({
envConfigModule: EnvConfigModule,
@@ -220,7 +220,7 @@ describe("@/pages/RoomDetails.page.vue", () => {
it("should fetch data", async () => {
getWrapper();
- expect(roomModule.fetchContent).toHaveBeenCalled();
+ expect(courseRoomDetailsModule.fetchContent).toHaveBeenCalled();
});
it("'to course files' button should have correct path", () => {
diff --git a/src/pages/rooms/RoomDetails.page.vue b/src/pages/rooms/CourseRoomDetails.page.vue
similarity index 95%
rename from src/pages/rooms/RoomDetails.page.vue
rename to src/pages/rooms/CourseRoomDetails.page.vue
index ed52ea929c..64df69051e 100644
--- a/src/pages/rooms/RoomDetails.page.vue
+++ b/src/pages/rooms/CourseRoomDetails.page.vue
@@ -145,7 +145,7 @@ import {
AUTH_MODULE_KEY,
COMMON_CARTRIDGE_EXPORT_MODULE_KEY,
COPY_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
SHARE_MODULE_KEY,
} from "@/utils/inject";
@@ -181,7 +181,7 @@ export default defineComponent({
copyModule: { from: COPY_MODULE_KEY },
shareModule: { from: SHARE_MODULE_KEY },
commonCartridgeExportModule: { from: COMMON_CARTRIDGE_EXPORT_MODULE_KEY },
- roomModule: { from: ROOM_MODULE_KEY },
+ courseRoomDetailsModule: { from: COURSE_ROOM_DETAILS_MODULE_KEY },
authModule: { from: AUTH_MODULE_KEY },
},
data() {
@@ -197,7 +197,7 @@ export default defineComponent({
breadcrumbs: [
{
title: this.$t("common.words.courses"),
- to: "/rooms-overview",
+ to: "/rooms/courses-overview",
disabled: false,
},
],
@@ -353,10 +353,10 @@ export default defineComponent({
return items;
},
roomData() {
- return this.roomModule.getRoomData;
+ return this.courseRoomDetailsModule.getRoomData;
},
scopedPermissions() {
- return this.roomModule.getPermissionData || [];
+ return this.courseRoomDetailsModule.getPermissionData || [];
},
roles() {
return this.authModule.getUserRoles;
@@ -449,8 +449,8 @@ export default defineComponent({
this.setActiveTab(this.$route.query.tab);
}
- await this.roomModule.fetchContent(this.courseId);
- await this.roomModule.fetchScopePermission({
+ await this.courseRoomDetailsModule.fetchContent(this.courseId);
+ await this.courseRoomDetailsModule.fetchScopePermission({
courseId: this.courseId,
userId: this.authModule.getUser?.id,
});
@@ -507,7 +507,7 @@ export default defineComponent({
this.commonCartridgeExportModule.startExportFlow();
},
async refreshRoom() {
- await this.roomModule.fetchContent(this.courseId);
+ await this.courseRoomDetailsModule.fetchContent(this.courseId);
},
async onCopyRoom(courseId) {
const copyParams = {
@@ -525,12 +525,12 @@ export default defineComponent({
"/rooms/" + copyResult.id.replace(/[^a-z\d]/g, "")
);
} else {
- await this.$router.push("/rooms-overview");
+ await this.$router.push("/rooms/courses-overview");
}
},
async onCopyBoardElement(payload) {
await this.copy(payload);
- await this.roomModule.fetchContent(payload.courseId);
+ await this.courseRoomDetailsModule.fetchContent(payload.courseId);
},
onCopyResultModalClosed() {
this.copyModule.reset();
@@ -542,7 +542,7 @@ export default defineComponent({
parentId: courseId,
layout,
};
- const board = await this.roomModule.createBoard(params);
+ const board = await this.courseRoomDetailsModule.createBoard(params);
await this.$router.push(`/rooms/${board.id}/board`);
},
},
diff --git a/src/pages/rooms/room-list.unit.ts b/src/pages/rooms/CourseRoomList.page.unit.ts
similarity index 90%
rename from src/pages/rooms/room-list.unit.ts
rename to src/pages/rooms/CourseRoomList.page.unit.ts
index 4319fd43fa..b5acde219b 100644
--- a/src/pages/rooms/room-list.unit.ts
+++ b/src/pages/rooms/CourseRoomList.page.unit.ts
@@ -1,15 +1,15 @@
-import { roomsModule } from "@/store";
+import { courseRoomListModule } from "@/store";
import { mount } from "@vue/test-utils";
-import RoomList from "./RoomList.page.vue";
+import CourseRoomList from "./CourseRoomList.page.vue";
import setupStores from "@@/tests/test-utils/setupStores";
-import RoomsModule from "@/store/rooms";
+import CourseRoomListModule from "@/store/course-room-list";
import AuthModule from "@/store/auth";
import EnvConfigModule from "@/store/env-config";
import {
COMMON_CARTRIDGE_IMPORT_MODULE_KEY,
LOADING_STATE_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOMS_MODULE_KEY,
+ COURSE_ROOM_LIST_MODULE_KEY,
} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import LoadingStateModule from "@/store/loading-state";
@@ -22,7 +22,7 @@ import {
import CommonCartridgeImportModule from "@/store/common-cartridge-import";
const getWrapper = (device = "desktop") => {
- return mount(RoomList, {
+ return mount(CourseRoomList, {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
provide: {
@@ -33,7 +33,8 @@ const getWrapper = (device = "desktop") => {
[LOADING_STATE_MODULE_KEY.valueOf()]:
createModuleMocks(LoadingStateModule),
[NOTIFIER_MODULE_KEY.valueOf()]: createModuleMocks(NotifierModule),
- [ROOMS_MODULE_KEY.valueOf()]: createModuleMocks(RoomsModule),
+ [COURSE_ROOM_LIST_MODULE_KEY.valueOf()]:
+ createModuleMocks(CourseRoomListModule),
[COMMON_CARTRIDGE_IMPORT_MODULE_KEY.valueOf()]: createModuleMocks(
CommonCartridgeImportModule
),
@@ -79,14 +80,14 @@ const mockData = [
},
];
-describe("@/pages/room-list.vue", () => {
+describe("@/pages/CourseRoomListPage", () => {
beforeEach(() => {
setupStores({
- roomsModule: RoomsModule,
+ courseRoomListModule: CourseRoomListModule,
authModule: AuthModule,
envConfigModule: EnvConfigModule,
});
- roomsModule.setAllElements(mockData);
+ courseRoomListModule.setAllElements(mockData);
});
describe("when data is not loaded yet", () => {
diff --git a/src/pages/rooms/RoomList.page.vue b/src/pages/rooms/CourseRoomList.page.vue
similarity index 85%
rename from src/pages/rooms/RoomList.page.vue
rename to src/pages/rooms/CourseRoomList.page.vue
index 347fab63fc..4113b943e4 100644
--- a/src/pages/rooms/RoomList.page.vue
+++ b/src/pages/rooms/CourseRoomList.page.vue
@@ -8,7 +8,7 @@
{{ $t("pages.rooms.index.courses.active") }}
@@ -61,7 +61,7 @@
diff --git a/src/pages/rooms/room-overview.unit.js b/src/pages/rooms/CourseRoomOverview.page.unit.js
similarity index 94%
rename from src/pages/rooms/room-overview.unit.js
rename to src/pages/rooms/CourseRoomOverview.page.unit.js
index f1a90325d8..cef1890194 100644
--- a/src/pages/rooms/room-overview.unit.js
+++ b/src/pages/rooms/CourseRoomOverview.page.unit.js
@@ -1,24 +1,24 @@
import RoomModal from "@/components/molecules/RoomModal";
-import { authModule, roomsModule } from "@/store";
+import { authModule, courseRoomListModule } from "@/store";
import AuthModule from "@/store/auth";
import CopyModule from "@/store/copy";
import EnvConfigModule from "@/store/env-config";
import LoadingStateModule from "@/store/loading-state";
import NotifierModule from "@/store/notifier";
-import RoomsModule from "@/store/rooms";
+import CourseRoomListModule from "@/store/course-room-list";
import CommonCartridgeImportModule from "@/store/common-cartridge-import";
import {
ENV_CONFIG_MODULE_KEY,
LOADING_STATE_MODULE_KEY,
NOTIFIER_MODULE_KEY,
- ROOMS_MODULE_KEY,
+ COURSE_ROOM_LIST_MODULE_KEY,
COMMON_CARTRIDGE_IMPORT_MODULE_KEY,
COPY_MODULE_KEY,
} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import setupStores from "@@/tests/test-utils/setupStores";
import { mount } from "@vue/test-utils";
-import RoomOverview from "./RoomOverview.page.vue";
+import CourseRoomOverviewPage from "./CourseRoomOverview.page.vue";
import {
createTestingI18n,
createTestingVuetify,
@@ -99,18 +99,18 @@ const mockAuthStoreData = {
setupStores({
authModule: AuthModule,
envConfigModule: EnvConfigModule,
- roomsModule: RoomsModule,
+ courseRoomListModule: CourseRoomListModule,
});
const spyMocks = {
storeRoomAlignMock: jest
- .spyOn(roomsModule, "align")
+ .spyOn(courseRoomListModule, "align")
.mockImplementation(async () => ({})),
storeModuleFetchMock: jest
- .spyOn(roomsModule, "fetch")
+ .spyOn(courseRoomListModule, "fetch")
.mockImplementation(async () => ({})),
storeModuleFetchAllMock: jest
- .spyOn(roomsModule, "fetchAllElements")
+ .spyOn(courseRoomListModule, "fetchAllElements")
.mockImplementation(async () => ({})),
};
@@ -132,8 +132,8 @@ const getWrapper = (device = "desktop", options = {}) => {
const envConfigModuleMock = createModuleMocks(EnvConfigModule, {
getCtlToolsTabEnabled: false,
});
- const roomsModuleMock = createModuleMocks(RoomsModule);
- return mount(RoomOverview, {
+ const courseRoomListModuleMock = createModuleMocks(courseRoomListModule);
+ return mount(CourseRoomOverviewPage, {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
provide: {
@@ -156,7 +156,7 @@ const getWrapper = (device = "desktop", options = {}) => {
[ENV_CONFIG_MODULE_KEY.valueOf()]: envConfigModuleMock,
[LOADING_STATE_MODULE_KEY.valueOf()]: loadingStateModuleMock,
[NOTIFIER_MODULE_KEY.valueOf()]: notifierModuleMock,
- [ROOMS_MODULE_KEY.valueOf()]: roomsModuleMock,
+ [COURSE_ROOM_LIST_MODULE_KEY.valueOf()]: courseRoomListModuleMock,
},
props: {
role: "student",
@@ -165,10 +165,10 @@ const getWrapper = (device = "desktop", options = {}) => {
});
};
-describe("@/pages/RoomOverview", () => {
+describe("@/pages/CourseRoomOverview.page", () => {
beforeEach(() => {
- roomsModule.setRoomData(mockRoomStoreData);
- roomsModule.setAllElements(mockCourseData);
+ courseRoomListModule.setRoomData(mockRoomStoreData);
+ courseRoomListModule.setAllElements(mockCourseData);
authModule.setMe(mockAuthStoreData);
});
@@ -577,7 +577,7 @@ describe("@/pages/RoomOverview", () => {
},
];
- roomsModule.setRoomData(roomData);
+ courseRoomListModule.setRoomData(roomData);
const wrapper = getWrapper();
expect(wrapper.findComponent('[data-test-position="8-0"]').exists()).toBe(
false
diff --git a/src/pages/rooms/RoomOverview.page.vue b/src/pages/rooms/CourseRoomOverview.page.vue
similarity index 89%
rename from src/pages/rooms/RoomOverview.page.vue
rename to src/pages/rooms/CourseRoomOverview.page.vue
index 7bbdb7ac0e..88a19aaa04 100644
--- a/src/pages/rooms/RoomOverview.page.vue
+++ b/src/pages/rooms/CourseRoomOverview.page.vue
@@ -8,7 +8,7 @@
{{ $t("pages.rooms.index.courses.all") }}
@@ -129,7 +129,7 @@ import RoomModal from "@/components/molecules/RoomModal";
import vRoomGroupAvatar from "@/components/molecules/vRoomGroupAvatar";
import ImportFlow from "@/components/share/ImportFlow.vue";
import RoomWrapper from "@/components/templates/RoomWrapper.vue";
-import { roomsModule } from "@/store";
+import { courseRoomListModule } from "@/store";
import { NOTIFIER_MODULE_KEY } from "@/utils/inject";
import { buildPageTitle } from "@/utils/pageTitle";
import { mdiCheck, mdiMagnify } from "@mdi/js";
@@ -192,28 +192,26 @@ export default defineComponent({
},
computed: {
hasCurrentRooms() {
- return roomsModule.hasCurrentRooms;
+ return courseRoomListModule.hasCurrentRooms;
},
rooms() {
- return JSON.parse(JSON.stringify(roomsModule.getRoomsData)).filter(
- (item) => {
- if (item.groupElements) {
- const groupElements = item.groupElements.filter((groupItem) => {
- return groupItem.title
- .toLowerCase()
- .includes(this.searchText.toLowerCase());
- });
- item.groupElements = groupElements;
- return groupElements;
- }
- return item.title
- .toLowerCase()
- .includes(this.searchText.toLowerCase());
+ return JSON.parse(
+ JSON.stringify(courseRoomListModule.getRoomsData)
+ ).filter((item) => {
+ if (item.groupElements) {
+ const groupElements = item.groupElements.filter((groupItem) => {
+ return groupItem.title
+ .toLowerCase()
+ .includes(this.searchText.toLowerCase());
+ });
+ item.groupElements = groupElements;
+ return groupElements;
}
- );
+ return item.title.toLowerCase().includes(this.searchText.toLowerCase());
+ });
},
courses() {
- return roomsModule.getAllElements;
+ return courseRoomListModule.getAllElements;
},
hasRoomsBeingCopied() {
return this.rooms.some((item) => item.copyingSince !== undefined);
@@ -229,8 +227,8 @@ export default defineComponent({
},
},
async created() {
- await roomsModule.fetch(); // TODO: this method will receive a string parameter (Eg, mobile | tablet | desktop)
- await roomsModule.fetchAllElements();
+ await courseRoomListModule.fetch(); // TODO: this method will receive a string parameter (Eg, mobile | tablet | desktop)
+ await courseRoomListModule.fetchAllElements();
this.getDeviceDims();
if (this.hasRoomsBeingCopied) {
this.initCoursePolling(0, new Date());
@@ -266,9 +264,12 @@ export default defineComponent({
this.dimensions.colCount = 6;
break;
}
- const lastItem = roomsModule.getRoomsData.reduce((prev, current) => {
- return prev.yPosition > current.yPosition ? prev : current;
- }, {});
+ const lastItem = courseRoomListModule.getRoomsData.reduce(
+ (prev, current) => {
+ return prev.yPosition > current.yPosition ? prev : current;
+ },
+ {}
+ );
this.dimensions.rowCount =
lastItem.yPosition &&
@@ -358,7 +359,7 @@ export default defineComponent({
this.draggedElement.from = {
x: this.groupDialog.groupData.xPosition,
y: this.groupDialog.groupData.yPosition,
- groupIndex: roomsModule.roomsData
+ groupIndex: courseRoomListModule.roomsData
.find((item) => item.groupId == this.groupDialog.groupData.groupId)
.groupElements.findIndex((groupItem) => groupItem.id == element.id),
};
@@ -372,7 +373,7 @@ export default defineComponent({
this.dragging = true;
},
async savePosition() {
- await roomsModule.align(this.draggedElement);
+ await courseRoomListModule.align(this.draggedElement);
this.groupDialog.groupData = {};
},
defaultNaming(pos) {
@@ -382,15 +383,15 @@ export default defineComponent({
xPosition: pos.x,
yPosition: pos.y,
};
- roomsModule.update(payload);
+ courseRoomListModule.update(payload);
},
onImportSuccess(name, id) {
this.showImportSuccess(name);
if (id) {
this.$router.replace({ name: "rooms-id", params: { id } });
} else {
- this.$router.replace({ name: "rooms-overview" });
- roomsModule.fetch();
+ this.$router.replace({ name: "course-room-overview" });
+ courseRoomListModule.fetch();
}
},
showImportSuccess(name) {
@@ -406,7 +407,7 @@ export default defineComponent({
const nextTimeout = count * count * 1000 + 5000;
setTimeout(
async () => {
- await roomsModule.fetch({ indicateLoading: false });
+ await courseRoomListModule.fetch({ indicateLoading: false });
if (this.hasRoomsBeingCopied) {
this.initCoursePolling(count + 1, started ?? new Date());
} else {
diff --git a/src/pages/rooms/tools/RoomExternalToolsOverview.unit.ts b/src/pages/rooms/tools/RoomExternalToolsOverview.unit.ts
index b6e51aa438..54c12d0b10 100644
--- a/src/pages/rooms/tools/RoomExternalToolsOverview.unit.ts
+++ b/src/pages/rooms/tools/RoomExternalToolsOverview.unit.ts
@@ -1,8 +1,11 @@
import { ConfigResponse } from "@/serverApi/v3";
import EnvConfigModule from "@/store/env-config";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import { CourseFeatures } from "@/store/types/room";
-import { ENV_CONFIG_MODULE_KEY, ROOM_MODULE_KEY } from "@/utils/inject";
+import {
+ ENV_CONFIG_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
+} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
import {
businessErrorFactory,
@@ -31,7 +34,7 @@ describe("RoomExternalToolOverview", () => {
>;
const getWrapper = () => {
- const roomModule = createModuleMocks(RoomModule, {
+ const courseRoomDetailsModule = createModuleMocks(CourseRoomDetailsModule, {
getLoading: false,
});
@@ -40,14 +43,14 @@ describe("RoomExternalToolOverview", () => {
getEnv: { CTL_TOOLS_RELOAD_TIME_MS: refreshTime } as ConfigResponse,
});
- roomModule.fetchCourse.mockResolvedValue(null);
+ courseRoomDetailsModule.fetchCourse.mockResolvedValue(null);
const wrapper = shallowMount(RoomExternalToolsOverview, {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
provide: {
[ENV_CONFIG_MODULE_KEY.valueOf()]: envConfigModuleMock,
- [ROOM_MODULE_KEY.valueOf()]: roomModule,
+ [COURSE_ROOM_DETAILS_MODULE_KEY.valueOf()]: courseRoomDetailsModule,
},
},
props: {
@@ -57,7 +60,7 @@ describe("RoomExternalToolOverview", () => {
return {
wrapper,
- roomModule,
+ courseRoomDetailsModule,
refreshTime,
};
};
@@ -141,9 +144,9 @@ describe("RoomExternalToolOverview", () => {
describe("when video conferences are enabled", () => {
const setup = async () => {
- const { wrapper, roomModule } = getWrapper();
+ const { wrapper, courseRoomDetailsModule } = getWrapper();
- roomModule.fetchCourse.mockResolvedValue(
+ courseRoomDetailsModule.fetchCourse.mockResolvedValue(
courseFactory.build({ features: [CourseFeatures.VIDEOCONFERENCE] })
);
diff --git a/src/pages/rooms/tools/RoomExternalToolsOverview.vue b/src/pages/rooms/tools/RoomExternalToolsOverview.vue
index 6258ce02d8..77bbcf1d2b 100644
--- a/src/pages/rooms/tools/RoomExternalToolsOverview.vue
+++ b/src/pages/rooms/tools/RoomExternalToolsOverview.vue
@@ -46,12 +46,12 @@
import { mdiAlertCircle } from "@/components/icons/material";
import VCustomEmptyState from "@/components/molecules/vCustomEmptyState.vue";
import { ToolContextType } from "@/serverApi/v3";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import { Course, CourseFeatures } from "@/store/types/room";
import {
ENV_CONFIG_MODULE_KEY,
injectStrict,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
} from "@/utils/inject";
import {
ExternalToolDisplayData,
@@ -70,7 +70,9 @@ const props = defineProps({
});
const { t } = useI18n();
-const roomModule: RoomModule = injectStrict(ROOM_MODULE_KEY);
+const courseRoomDetailsModule: CourseRoomDetailsModule = injectStrict(
+ COURSE_ROOM_DETAILS_MODULE_KEY
+);
const envConfigModule = injectStrict(ENV_CONFIG_MODULE_KEY);
const {
@@ -92,7 +94,7 @@ const isVideoConferenceAvailable: ComputedRef = computed(() => {
onMounted(async () => {
await fetchDisplayData(props.roomId, ToolContextType.Course);
- course.value = await roomModule.fetchCourse(props.roomId);
+ course.value = await courseRoomDetailsModule.fetchCourse(props.roomId);
});
const refreshTimeInMs = envConfigModule.getEnv.CTL_TOOLS_RELOAD_TIME_MS;
@@ -106,7 +108,7 @@ onUnmounted(() => {
});
const loading: ComputedRef = computed(
- () => isDisplayDataLoading.value || roomModule.getLoading
+ () => isDisplayDataLoading.value || courseRoomDetailsModule.getLoading
);
const onDeleteTool = async (displayData: ExternalToolDisplayData) => {
diff --git a/src/pages/rooms/tools/RoomVideoConferenceSection.unit.ts b/src/pages/rooms/tools/RoomVideoConferenceSection.unit.ts
index 3cb8a43e1d..f45a33ed9e 100644
--- a/src/pages/rooms/tools/RoomVideoConferenceSection.unit.ts
+++ b/src/pages/rooms/tools/RoomVideoConferenceSection.unit.ts
@@ -1,11 +1,11 @@
import { VideoConferenceScope } from "@/serverApi/v3";
import AuthModule from "@/store/auth";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import { VideoConferenceState } from "@/store/types/video-conference";
import VideoConferenceModule from "@/store/video-conference";
import {
AUTH_MODULE_KEY,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
VIDEO_CONFERENCE_MODULE_KEY,
} from "@/utils/inject";
import { createModuleMocks } from "@/utils/mock-store-module";
@@ -51,7 +51,7 @@ describe("RoomVideoConferenceSection", () => {
...videoConferenceModuleGetter,
});
- const roomModule = createModuleMocks(RoomModule, {
+ const courseRoomDetailsModule = createModuleMocks(CourseRoomDetailsModule, {
getRoomData: {
roomId: props.roomId,
title: "roomName",
@@ -68,7 +68,7 @@ describe("RoomVideoConferenceSection", () => {
provide: {
[AUTH_MODULE_KEY.valueOf()]: authModule,
[VIDEO_CONFERENCE_MODULE_KEY.valueOf()]: videoConferenceModule,
- [ROOM_MODULE_KEY.valueOf()]: roomModule,
+ [COURSE_ROOM_DETAILS_MODULE_KEY.valueOf()]: courseRoomDetailsModule,
},
mocks: {
$t: (key: string, dynamic?: object): string =>
@@ -82,7 +82,7 @@ describe("RoomVideoConferenceSection", () => {
wrapper,
authModule,
videoConferenceModule,
- roomModule,
+ courseRoomDetailsModule,
};
};
@@ -518,29 +518,30 @@ describe("RoomVideoConferenceSection", () => {
describe("when open videoconference configuration dialog", () => {
const setup = () => {
- const { wrapper, videoConferenceModule, roomModule } = getWrapper(
- {
- roomId: "roomId",
- },
- ["start_meeting"],
- false,
- {
- getVideoConferenceInfo: {
- state: VideoConferenceState.NOT_STARTED,
- options: {
- everyAttendeeJoinsMuted: false,
- moderatorMustApproveJoinRequests: true,
- everybodyJoinsAsModerator: false,
- },
+ const { wrapper, videoConferenceModule, courseRoomDetailsModule } =
+ getWrapper(
+ {
+ roomId: "roomId",
},
- getLoading: true,
- }
- );
+ ["start_meeting"],
+ false,
+ {
+ getVideoConferenceInfo: {
+ state: VideoConferenceState.NOT_STARTED,
+ options: {
+ everyAttendeeJoinsMuted: false,
+ moderatorMustApproveJoinRequests: true,
+ everybodyJoinsAsModerator: false,
+ },
+ },
+ getLoading: true,
+ }
+ );
return {
wrapper,
videoConferenceModule,
- roomModule,
+ courseRoomDetailsModule,
};
};
diff --git a/src/pages/rooms/tools/RoomVideoConferenceSection.vue b/src/pages/rooms/tools/RoomVideoConferenceSection.vue
index e418db20d9..23a7eeeafe 100644
--- a/src/pages/rooms/tools/RoomVideoConferenceSection.vue
+++ b/src/pages/rooms/tools/RoomVideoConferenceSection.vue
@@ -112,7 +112,7 @@ import VideoConferenceModule from "@/store/video-conference";
import {
AUTH_MODULE_KEY,
injectStrict,
- ROOM_MODULE_KEY,
+ COURSE_ROOM_DETAILS_MODULE_KEY,
VIDEO_CONFERENCE_MODULE_KEY,
} from "@/utils/inject";
import {
@@ -124,7 +124,7 @@ import {
Ref,
} from "vue";
import VCustomDialog from "@/components/organisms/vCustomDialog.vue";
-import RoomModule from "@/store/room";
+import CourseRoomDetailsModule from "@/store/course-room-details";
import { mdiCheck } from "@mdi/js";
export default defineComponent({
@@ -141,9 +141,13 @@ export default defineComponent({
const videoConferenceModule: VideoConferenceModule = injectStrict(
VIDEO_CONFERENCE_MODULE_KEY
);
- const roomModule: RoomModule = injectStrict(ROOM_MODULE_KEY);
+ const courseRoomDetailsModule: CourseRoomDetailsModule = injectStrict(
+ COURSE_ROOM_DETAILS_MODULE_KEY
+ );
- const roomName = computed(() => roomModule.getRoomData.title ?? "");
+ const roomName = computed(
+ () => courseRoomDetailsModule.getRoomData.title ?? ""
+ );
const videoConferenceInfo: ComputedRef = computed(
() => videoConferenceModule.getVideoConferenceInfo
diff --git a/src/plugins/store.ts b/src/plugins/store.ts
index 029f5c01c7..809a6c5bca 100644
--- a/src/plugins/store.ts
+++ b/src/plugins/store.ts
@@ -3,7 +3,6 @@
import { createStore, Store } from "vuex";
// Note: you shouldn't need to import store modules here.
import { initializeStores, modules } from "@/store/store-accessor";
-
import activation from "@/store/activation";
import { bulkConsent } from "@/store/bulkConsent";
import calendar from "@/store/calendar";
diff --git a/src/router/routes.ts b/src/router/routes.ts
index f5760ad7db..751a3addad 100644
--- a/src/router/routes.ts
+++ b/src/router/routes.ts
@@ -231,33 +231,48 @@ export const routes: Readonly = [
beforeEnter: createPermissionGuard(["news_edit"]),
},
{
- path: `/rooms/:id(${REGEX_ID})`,
- component: () => import("@/pages/rooms/RoomDetails.page.vue"),
- name: "rooms-id",
- },
- {
+ // TODO BC-7822, BC-7823 target this route at new rooms page and replace the redirect with the new component used
path: `/rooms`,
- redirect: { name: "rooms-overview" },
+ redirect: { name: "course-room-overview" },
name: "rooms",
},
- {
- path: `/rooms/:id(${REGEX_ID})/board`,
- component: async () => (await import("@page-board")).ColumnBoardPage,
- name: "rooms-board",
- props: (route: RouteLocationNormalized) => ({
- boardId: route.params.id,
- }),
- },
+ // TODO BC-7877 This redirect should be removed. Currently this route is used by the legacy client (and dof_app_deploy).
+ // So we have to replace the reference there by "course-room-list" path.
{
path: "/rooms-list",
- component: () => import("@/pages/rooms/RoomList.page.vue"),
+ redirect: { name: "course-room-list" },
name: "rooms-list",
},
+ {
+ path: "/rooms/courses-list",
+ component: () => import("@/pages/rooms/CourseRoomList.page.vue"),
+ name: "course-room-list",
+ },
{
path: "/rooms-overview",
- component: () => import("@/pages/rooms/RoomOverview.page.vue"),
+ redirect: { name: "course-room-overview" },
name: "rooms-overview",
},
+ {
+ path: "/rooms/courses-overview",
+ component: () => import("@/pages/rooms/CourseRoomOverview.page.vue"),
+ name: "course-room-overview",
+ },
+ {
+ // TODO BC-7822, BC-7823 target this route at new room details page
+ // and decide on that page which sub-component (page) has to be rendered
+ path: `/rooms/:id(${REGEX_ID})`,
+ component: () => import("@/pages/rooms/CourseRoomDetails.page.vue"),
+ name: "rooms-id",
+ },
+ {
+ path: `/rooms/:id(${REGEX_ID})/board`,
+ component: async () => (await import("@page-board")).ColumnBoardPage,
+ name: "rooms-board",
+ props: (route: RouteLocationNormalized) => ({
+ boardId: route.params.id,
+ }),
+ },
{
path: "/tasks",
component: () => import("@/pages/tasks/TaskOverview.page.vue"),
diff --git a/src/router/vue-client-route.js b/src/router/vue-client-route.js
index b9f1f05e26..9a58f193b7 100644
--- a/src/router/vue-client-route.js
+++ b/src/router/vue-client-route.js
@@ -34,13 +34,15 @@ const vueRoutes = [
`^/news/new/?$`,
`^/news/${mongoId}/edit/?$`,
`^/poc-files/?$`,
- `^/rooms-overview/?$`,
- `^/rooms-list/?$`,
`^/h5p/player/${h5pId}/?$`,
`^/h5p/editor/?$`,
`^/h5p/editor/${h5pId}/?$`,
- `^/rooms/${mongoId}/?$`,
`^/rooms/?$`,
+ `^/rooms/rooms-list/?$`,
+ `^/rooms/courses-list/?$`,
+ `^/rooms/courses-overview/?$`,
+ `^/rooms-overview/?$`,
+ `^/rooms/${mongoId}/?$`,
`^/rooms/${mongoId}/board?$`,
`^/tasks/?$`,
`^/error/?$`,
diff --git a/src/store/common-cartridge-export.ts b/src/store/common-cartridge-export.ts
index ac4789b15e..153bd2103e 100644
--- a/src/store/common-cartridge-export.ts
+++ b/src/store/common-cartridge-export.ts
@@ -1,5 +1,5 @@
import { Action, Module, Mutation, VuexModule } from "vuex-module-decorators";
-import { roomModule } from "./store-accessor";
+import { courseRoomDetailsModule } from "./store-accessor";
@Module({
name: "commonCartridgeExportModule",
@@ -19,7 +19,7 @@ export default class CommonCartridgeExportModule extends VuexModule {
return;
}
- await roomModule.downloadCommonCartridgeCourse({
+ await courseRoomDetailsModule.downloadCommonCartridgeCourse({
version: this.getVersion,
topics: this.getTopics,
tasks: this.getTasks,
diff --git a/src/store/common-cartridge-export.unit.ts b/src/store/common-cartridge-export.unit.ts
index 2afb2493f9..2b01b85fcb 100644
--- a/src/store/common-cartridge-export.unit.ts
+++ b/src/store/common-cartridge-export.unit.ts
@@ -1,18 +1,18 @@
import setupStores from "@@/tests/test-utils/setupStores";
import CommonCartridgeExportModule from "./common-cartridge-export";
-import RoomModule from "./room";
-import { roomModule } from "./store-accessor";
+import CourseRoomDetailsModule from "./course-room-details";
+import { courseRoomDetailsModule } from "./store-accessor";
describe("commonCartridgeExportModule", () => {
describe("actions", () => {
beforeEach(() => {
- setupStores({ roomModule: RoomModule });
+ setupStores({ courseRoomDetailsModule: CourseRoomDetailsModule });
});
describe("startExport", () => {
- it("should call roomModule.downloadCommonCartridgeCourse with the correct version and topic", () => {
+ it("should call courseRoomDetailsModule.downloadCommonCartridgeCourse with the correct version and topic", () => {
const commonCartridgeExportModule = new CommonCartridgeExportModule({});
- const roomModuleMock = jest.spyOn(
- roomModule,
+ const courseRoomDetailModuleMock = jest.spyOn(
+ courseRoomDetailsModule,
"downloadCommonCartridgeCourse"
);
@@ -23,7 +23,7 @@ describe("commonCartridgeExportModule", () => {
commonCartridgeExportModule.startExport();
- expect(roomModuleMock).toHaveBeenCalledWith({
+ expect(courseRoomDetailModuleMock).toHaveBeenCalledWith({
version: "1.1.0",
topics: ["topic"],
tasks: ["task"],
diff --git a/src/store/room.ts b/src/store/course-room-details.ts
similarity index 98%
rename from src/store/room.ts
rename to src/store/course-room-details.ts
index ca64dedd8e..6ddbdf988f 100644
--- a/src/store/room.ts
+++ b/src/store/course-room-details.ts
@@ -22,11 +22,11 @@ import { HttpStatusCode } from "./types/http-status-code.enum";
import { Course } from "./types/room";
@Module({
- name: "roomModule",
+ name: "courseRoomDetailsModule",
namespaced: true,
stateFactory: true,
})
-export default class RoomModule extends VuexModule {
+export default class CourseRoomDetailsModule extends VuexModule {
roomData: SingleColumnBoardResponse = {
roomId: "",
title: "",
diff --git a/src/store/room.unit.ts b/src/store/course-room-details.unit.ts
similarity index 69%
rename from src/store/room.unit.ts
rename to src/store/course-room-details.unit.ts
index e2f79f7241..132dcb2d3f 100644
--- a/src/store/room.unit.ts
+++ b/src/store/course-room-details.unit.ts
@@ -8,7 +8,7 @@ import { meResponseFactory } from "@@/tests/test-utils";
import { courseFactory } from "@@/tests/test-utils/factory";
import setupStores from "@@/tests/test-utils/setupStores";
import { AxiosError, AxiosInstance } from "axios";
-import RoomModule from "./room";
+import CourseRoomDetailsModule from "./course-room-details";
import { HttpStatusCode } from "./types/http-status-code.enum";
import { Course } from "./types/room";
@@ -63,7 +63,7 @@ describe("room module", () => {
describe("fetchCourse", () => {
describe("when the api returns a response", () => {
const setup = () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const course: Course = courseFactory.build();
@@ -72,24 +72,24 @@ describe("room module", () => {
});
return {
- roomModule,
+ courseRoomDetailsModule,
course,
};
};
it("should call backend", async () => {
- const { roomModule } = setup();
+ const { courseRoomDetailsModule } = setup();
- await roomModule.fetchCourse("courseId");
+ await courseRoomDetailsModule.fetchCourse("courseId");
expect(receivedRequests[0].path).toEqual("/v1/courses/courseId");
});
it("should return a course", async () => {
- const { roomModule, course } = setup();
+ const { courseRoomDetailsModule, course } = setup();
const result: Course | null =
- await roomModule.fetchCourse("courseId");
+ await courseRoomDetailsModule.fetchCourse("courseId");
expect(result).toEqual(course);
});
@@ -97,31 +97,31 @@ describe("room module", () => {
describe("when the api returns an error", () => {
const setup = () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const error: AxiosError = new AxiosError();
getRequestReturn = Promise.reject(error);
return {
- roomModule,
+ courseRoomDetailsModule,
error,
};
};
it("should set an error", async () => {
- const { roomModule, error } = setup();
+ const { courseRoomDetailsModule, error } = setup();
- await roomModule.fetchCourse("courseId");
+ await courseRoomDetailsModule.fetchCourse("courseId");
- expect(roomModule.getError).toEqual(error);
+ expect(courseRoomDetailsModule.getError).toEqual(error);
});
it("should return null", async () => {
- const { roomModule } = setup();
+ const { courseRoomDetailsModule } = setup();
const result: Course | null =
- await roomModule.fetchCourse("courseId");
+ await courseRoomDetailsModule.fetchCourse("courseId");
expect(result).toBeNull();
});
@@ -134,10 +134,10 @@ describe("room module", () => {
.spyOn(serverApi, "RoomsApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.RoomsApiInterface);
- const roomModule = new RoomModule({});
- await roomModule.fetchContent("123");
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+ await courseRoomDetailsModule.fetchContent("123");
- expect(roomModule.getLoading).toBe(false);
+ expect(courseRoomDetailsModule.getLoading).toBe(false);
expect(mockApi.roomsControllerGetRoomBoard).toHaveBeenCalled();
expect(
mockApi.roomsControllerGetRoomBoard.mock.calls[0][0]
@@ -151,10 +151,13 @@ describe("room module", () => {
.spyOn(serverApi, "RoomsApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.RoomsApiInterface);
- const roomModule = new RoomModule({});
- await roomModule.publishCard({ elementId: "54321", visibility: true });
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+ await courseRoomDetailsModule.publishCard({
+ elementId: "54321",
+ visibility: true,
+ });
- expect(roomModule.getLoading).toBe(false);
+ expect(courseRoomDetailsModule.getLoading).toBe(false);
expect(
mockApi.roomsControllerPatchElementVisibility
).toHaveBeenCalled();
@@ -171,13 +174,13 @@ describe("room module", () => {
.spyOn(serverApi, "RoomsApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.RoomsApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const payload = {
elements: ["1234", "2345", "3456", "4567"],
};
- await roomModule.sortElements(payload);
+ await courseRoomDetailsModule.sortElements(payload);
- expect(roomModule.getLoading).toBe(false);
+ expect(courseRoomDetailsModule.getLoading).toBe(false);
expect(
mockApi.roomsControllerPatchOrderingOfElements
).toHaveBeenCalled();
@@ -197,9 +200,9 @@ describe("room module", () => {
.spyOn(serverApi, "LessonApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.LessonApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteLesson("id");
+ await courseRoomDetailsModule.deleteLesson("id");
expect(mockApi.lessonControllerDelete).toHaveBeenCalledTimes(1);
expect(mockApi.lessonControllerDelete).toHaveBeenCalledWith("id");
@@ -216,11 +219,11 @@ describe("room module", () => {
.spyOn(serverApi, "LessonApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.LessonApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteLesson("id");
+ await courseRoomDetailsModule.deleteLesson("id");
- expect(roomModule.businessError).toStrictEqual(error);
+ expect(courseRoomDetailsModule.businessError).toStrictEqual(error);
spy.mockRestore();
});
@@ -235,9 +238,9 @@ describe("room module", () => {
.spyOn(serverApi, "TaskApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.TaskApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteTask("id");
+ await courseRoomDetailsModule.deleteTask("id");
expect(mockApi.taskControllerDelete).toHaveBeenCalledTimes(1);
expect(mockApi.taskControllerDelete).toHaveBeenCalledWith("id");
@@ -254,11 +257,11 @@ describe("room module", () => {
.spyOn(serverApi, "TaskApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.TaskApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteTask("id");
+ await courseRoomDetailsModule.deleteTask("id");
- expect(roomModule.businessError).toStrictEqual(error);
+ expect(courseRoomDetailsModule.businessError).toStrictEqual(error);
spy.mockRestore();
});
@@ -273,14 +276,14 @@ describe("room module", () => {
.spyOn(serverApi, "BoardApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.BoardApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const params = {
title: "title",
parentId: "parentId",
parentType: BoardParentType.Course,
layout: serverApi.BoardLayout.Columns,
};
- await roomModule.createBoard(params);
+ await courseRoomDetailsModule.createBoard(params);
expect(mockApi.boardControllerCreateBoard).toHaveBeenCalledTimes(1);
expect(mockApi.boardControllerCreateBoard).toHaveBeenCalledWith(params);
@@ -296,14 +299,14 @@ describe("room module", () => {
.spyOn(serverApi, "BoardApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.BoardApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const params = {
title: "title",
parentId: "parentId",
parentType: BoardParentType.Course,
layout: serverApi.BoardLayout.List,
};
- await roomModule.createBoard(params);
+ await courseRoomDetailsModule.createBoard(params);
expect(mockApi.boardControllerCreateBoard).toHaveBeenCalledTimes(1);
expect(mockApi.boardControllerCreateBoard).toHaveBeenCalledWith(params);
@@ -320,7 +323,7 @@ describe("room module", () => {
.spyOn(serverApi, "BoardApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.BoardApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const params = {
title: "title",
@@ -328,9 +331,9 @@ describe("room module", () => {
parentType: BoardParentType.Course,
layout: serverApi.BoardLayout.Columns,
};
- await roomModule.createBoard(params);
+ await courseRoomDetailsModule.createBoard(params);
- expect(roomModule.businessError).toStrictEqual(error);
+ expect(courseRoomDetailsModule.businessError).toStrictEqual(error);
spy.mockRestore();
});
@@ -345,9 +348,9 @@ describe("room module", () => {
.spyOn(serverApi, "BoardApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.BoardApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteBoard("id");
+ await courseRoomDetailsModule.deleteBoard("id");
expect(mockApi.boardControllerDeleteBoard).toHaveBeenCalledTimes(1);
expect(mockApi.boardControllerDeleteBoard).toHaveBeenCalledWith("id");
@@ -364,11 +367,11 @@ describe("room module", () => {
.spyOn(serverApi, "BoardApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.BoardApiInterface);
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- await roomModule.deleteBoard("id");
+ await courseRoomDetailsModule.deleteBoard("id");
- expect(roomModule.businessError).toStrictEqual(error);
+ expect(courseRoomDetailsModule.businessError).toStrictEqual(error);
spy.mockRestore();
});
@@ -376,7 +379,7 @@ describe("room module", () => {
describe("downloadCommonCartridgeCourse", () => {
it("should call backend api", async () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const mockApi = {
lessonControllerDelete: jest.fn(() => Promise.resolve()),
};
@@ -385,7 +388,7 @@ describe("room module", () => {
.mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
await expect(
- roomModule.downloadCommonCartridgeCourse({
+ courseRoomDetailsModule.downloadCommonCartridgeCourse({
version: "1.1.0",
topics: [],
tasks: [],
@@ -396,7 +399,7 @@ describe("room module", () => {
spy.mockRestore();
});
it("should catch error in catch block", async () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const error = { statusCode: 418, message: "I'm a teapot" };
const mockApi = {
courseControllerExportCourse: jest.fn(() =>
@@ -407,14 +410,14 @@ describe("room module", () => {
.spyOn(serverApi, "CoursesApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
- await roomModule.downloadCommonCartridgeCourse({
+ await courseRoomDetailsModule.downloadCommonCartridgeCourse({
version: "1.1.0",
topics: [],
tasks: [],
columnBoards: [],
});
- expect(roomModule.businessError).toStrictEqual(error);
+ expect(courseRoomDetailsModule.businessError).toStrictEqual(error);
spy.mockRestore();
});
@@ -447,13 +450,19 @@ describe("room module", () => {
.spyOn(serverApi, "TaskApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.TaskApiInterface);
- const roomModule = new RoomModule({});
- const setBusinessErrorSpy = jest.spyOn(roomModule, "setBusinessError");
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+ const setBusinessErrorSpy = jest.spyOn(
+ courseRoomDetailsModule,
+ "setBusinessError"
+ );
const resetBusinessErrorSpy = jest.spyOn(
- roomModule,
+ courseRoomDetailsModule,
"resetBusinessError"
);
- await roomModule.finishTask({ itemId: "finishId", action: "finish" });
+ await courseRoomDetailsModule.finishTask({
+ itemId: "finishId",
+ action: "finish",
+ });
expect(resetBusinessErrorSpy).toHaveBeenCalled();
expect(setBusinessErrorSpy).not.toHaveBeenCalled();
@@ -485,20 +494,28 @@ describe("room module", () => {
.spyOn(serverApi, "TaskApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.TaskApiInterface);
- const roomModule = new RoomModule({});
- const finishTaskSpy = jest.spyOn(roomModule, "finishTask");
- const setBusinessErrorSpy = jest.spyOn(roomModule, "setBusinessError");
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+ const finishTaskSpy = jest.spyOn(courseRoomDetailsModule, "finishTask");
+ const setBusinessErrorSpy = jest.spyOn(
+ courseRoomDetailsModule,
+ "setBusinessError"
+ );
const resetBusinessErrorSpy = jest.spyOn(
- roomModule,
+ courseRoomDetailsModule,
"resetBusinessError"
);
- await roomModule.finishTask({ itemId: "finishId", action: "finish" });
+ await courseRoomDetailsModule.finishTask({
+ itemId: "finishId",
+ action: "finish",
+ });
expect(resetBusinessErrorSpy).toHaveBeenCalled();
expect(finishTaskSpy).toHaveBeenCalled();
expect(setBusinessErrorSpy).toHaveBeenCalled();
- expect(roomModule.businessError.statusCode).toStrictEqual(404);
- expect(roomModule.businessError.message).toStrictEqual(
+ expect(courseRoomDetailsModule.businessError.statusCode).toStrictEqual(
+ 404
+ );
+ expect(courseRoomDetailsModule.businessError.message).toStrictEqual(
"friendly error"
);
});
@@ -524,12 +541,12 @@ describe("room module", () => {
},
} as AxiosInstance);
})();
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const fetchScopePermissionSpy = jest.spyOn(
- roomModule,
+ courseRoomDetailsModule,
"fetchScopePermission"
);
- await roomModule.fetchScopePermission({
+ await courseRoomDetailsModule.fetchScopePermission({
courseId: "courseId",
userId: "userId",
});
@@ -548,7 +565,7 @@ describe("room module", () => {
describe("mutations", () => {
describe("setRoomData", () => {
it("should set the room data", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const expectedData = {
id: "123",
courseName: "Sample Course",
@@ -578,29 +595,31 @@ describe("room module", () => {
],
};
- expect(roomModule.getRoomData).not.toStrictEqual(expectedData);
- roomModule.setRoomData(expectedData as any);
- expect(roomModule.roomData).toStrictEqual(expectedData);
+ expect(courseRoomDetailsModule.getRoomData).not.toStrictEqual(
+ expectedData
+ );
+ courseRoomDetailsModule.setRoomData(expectedData as any);
+ expect(courseRoomDetailsModule.roomData).toStrictEqual(expectedData);
});
});
describe("setLoading", () => {
it("should set loading", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const loadingValue = true;
- expect(roomModule.getLoading).not.toBe(loadingValue);
- roomModule.setLoading(loadingValue);
- expect(roomModule.loading).toBe(loadingValue);
+ expect(courseRoomDetailsModule.getLoading).not.toBe(loadingValue);
+ courseRoomDetailsModule.setLoading(loadingValue);
+ expect(courseRoomDetailsModule.loading).toBe(loadingValue);
});
});
describe("setError", () => {
it("should set error", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const errorData = { message: "some error" };
- expect(roomModule.getError).not.toBe(errorData);
- roomModule.setError(errorData);
- expect(roomModule.error).toBe(errorData);
+ expect(courseRoomDetailsModule.getError).not.toBe(errorData);
+ courseRoomDetailsModule.setError(errorData);
+ expect(courseRoomDetailsModule.error).toBe(errorData);
});
it.each([
@@ -612,57 +631,65 @@ describe("room module", () => {
HttpStatusCode.InternalServerError,
])("should create an application-error for http-error(%p)", (code) => {
const setErrorSpy = jest.spyOn(applicationErrorModule, "setError");
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const errorData = { response: { data: { code } } };
- roomModule.setError(errorData);
+ courseRoomDetailsModule.setError(errorData);
expect(setErrorSpy).toHaveBeenCalled();
});
});
describe("setBusinessError", () => {
it("should set businessError", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const businessErrorData = {
statusCode: "400",
message: "error",
error: { type: "BadRequest" },
};
- expect(roomModule.getBusinessError).not.toBe(businessErrorData);
- roomModule.setBusinessError(businessErrorData);
- expect(roomModule.businessError).toBe(businessErrorData);
+ expect(courseRoomDetailsModule.getBusinessError).not.toBe(
+ businessErrorData
+ );
+ courseRoomDetailsModule.setBusinessError(businessErrorData);
+ expect(courseRoomDetailsModule.businessError).toBe(businessErrorData);
});
it("should reset businessError", () => {
- const roomModule = new RoomModule({});
- roomModule.businessError = {
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
+ courseRoomDetailsModule.businessError = {
statusCode: "400",
message: "error",
error: {},
};
- roomModule.resetBusinessError();
- expect(roomModule.businessError.statusCode).toStrictEqual("");
- expect(roomModule.businessError.message).toStrictEqual("");
+ courseRoomDetailsModule.resetBusinessError();
+ expect(courseRoomDetailsModule.businessError.statusCode).toStrictEqual(
+ ""
+ );
+ expect(courseRoomDetailsModule.businessError.message).toStrictEqual("");
});
});
describe("setCourseShareToken", () => {
it("should set the state", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const payload = "token_test";
- roomModule.setCourseShareToken(payload);
- expect(roomModule.getCourseShareToken).toStrictEqual(payload);
+ courseRoomDetailsModule.setCourseShareToken(payload);
+ expect(courseRoomDetailsModule.getCourseShareToken).toStrictEqual(
+ payload
+ );
});
});
describe("setPermissionData", () => {
it("should set the permission data", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const expectedPermissions = ["PERMISSION_ONE", "PERMISSION_TWO"];
- expect(roomModule.getPermissionData).toStrictEqual([]);
- roomModule.setPermissionData(expectedPermissions);
- expect(roomModule.getPermissionData).toStrictEqual(expectedPermissions);
+ expect(courseRoomDetailsModule.getPermissionData).toStrictEqual([]);
+ courseRoomDetailsModule.setPermissionData(expectedPermissions);
+ expect(courseRoomDetailsModule.getPermissionData).toStrictEqual(
+ expectedPermissions
+ );
});
});
});
@@ -670,7 +697,7 @@ describe("room module", () => {
describe("getters", () => {
describe("getRoomsData", () => {
it("should return rooms state", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const expectedData = {
id: "123",
courseName: "Sample Course",
@@ -700,34 +727,34 @@ describe("room module", () => {
],
};
- roomModule.setRoomData(expectedData as any);
- expect(roomModule.getRoomData).toStrictEqual(expectedData);
+ courseRoomDetailsModule.setRoomData(expectedData as any);
+ expect(courseRoomDetailsModule.getRoomData).toStrictEqual(expectedData);
});
});
describe("getLoading", () => {
it("should return loading state", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
- expect(roomModule.getLoading).not.toStrictEqual(true);
- roomModule.setLoading(true);
- expect(roomModule.getLoading).toStrictEqual(true);
+ expect(courseRoomDetailsModule.getLoading).not.toStrictEqual(true);
+ courseRoomDetailsModule.setLoading(true);
+ expect(courseRoomDetailsModule.getLoading).toStrictEqual(true);
});
});
describe("getError", () => {
it("should return error state", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const errorData = { message: "some error" };
- expect(roomModule.getError).toStrictEqual(null);
- roomModule.setError(errorData);
- expect(roomModule.getError).toStrictEqual(errorData);
+ expect(courseRoomDetailsModule.getError).toStrictEqual(null);
+ courseRoomDetailsModule.setError(errorData);
+ expect(courseRoomDetailsModule.getError).toStrictEqual(errorData);
});
});
describe("roomIsEmpty", () => {
it("should return false if there are any elements in the room", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const testData = {
id: "123",
courseName: "Sample Course",
@@ -756,31 +783,33 @@ describe("room module", () => {
},
],
};
- roomModule.setRoomData(testData as any);
- const result = roomModule.roomIsEmpty;
+ courseRoomDetailsModule.setRoomData(testData as any);
+ const result = courseRoomDetailsModule.roomIsEmpty;
expect(result).toStrictEqual(false);
});
it("should return true if there are no elements in the room", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const testData = {
id: "123",
courseName: "Sample Course",
displayColor: "black",
elements: [],
};
- roomModule.setRoomData(testData as any);
- const result = roomModule.roomIsEmpty;
+ courseRoomDetailsModule.setRoomData(testData as any);
+ const result = courseRoomDetailsModule.roomIsEmpty;
expect(result).toStrictEqual(true);
});
});
describe("getPermissionData", () => {
it("should return the permission data", () => {
- const roomModule = new RoomModule({});
+ const courseRoomDetailsModule = new CourseRoomDetailsModule({});
const expectedPermissions = ["THREE", "FOUR"];
- roomModule.setPermissionData(expectedPermissions);
- expect(roomModule.getPermissionData).toStrictEqual(expectedPermissions);
+ courseRoomDetailsModule.setPermissionData(expectedPermissions);
+ expect(courseRoomDetailsModule.getPermissionData).toStrictEqual(
+ expectedPermissions
+ );
});
});
});
diff --git a/src/store/rooms.ts b/src/store/course-room-list.ts
similarity index 98%
rename from src/store/rooms.ts
rename to src/store/course-room-list.ts
index a3cfd71263..b42e965523 100644
--- a/src/store/rooms.ts
+++ b/src/store/course-room-list.ts
@@ -20,11 +20,11 @@ import {
import { AlertPayload } from "./types/alert-payload";
@Module({
- name: "roomsModule",
+ name: "courseRoomListModule",
namespaced: true,
stateFactory: true,
})
-export default class RoomsModule extends VuexModule {
+export default class CourseRoomListModule extends VuexModule {
roomsData: DashboardGridElementResponse[] = [];
gridElementsId = "";
allElements: CourseMetadataResponse[] = [];
diff --git a/src/store/rooms.unit.ts b/src/store/course-room-list.unit.ts
similarity index 66%
rename from src/store/rooms.unit.ts
rename to src/store/course-room-list.unit.ts
index 3baaa5abdb..64cef7e741 100644
--- a/src/store/rooms.unit.ts
+++ b/src/store/course-room-list.unit.ts
@@ -1,7 +1,7 @@
import { AxiosInstance } from "axios";
import * as serverApi from "../serverApi/v3/api";
import { initializeAxios } from "../utils/api";
-import RoomsModule from "./rooms";
+import CourseRoomListModule from "./course-room-list";
import { AlertPayload } from "./types/alert-payload";
import { RoomsData } from "./types/rooms";
@@ -99,18 +99,18 @@ describe("rooms module", () => {
mockApi as unknown as serverApi.DashboardApiInterface
);
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- roomsModule
+ courseRoomListModule
.fetch({
indicateLoading: true,
device: "mobile",
})
.then(() => {
- expect(roomsModule.getLoading).toBe(false);
+ expect(courseRoomListModule.getLoading).toBe(false);
});
- expect(roomsModule.getLoading).toBe(true);
+ expect(courseRoomListModule.getLoading).toBe(true);
expect(mockApi.dashboardControllerFindForUser).toHaveBeenCalled();
});
});
@@ -129,7 +129,7 @@ describe("rooms module", () => {
mockApi as unknown as serverApi.DashboardApiInterface
);
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const payload = {
from: { x: 1, y: 1 },
@@ -141,11 +141,11 @@ describe("rooms module", () => {
to: { x: 2, y: 2 },
};
- roomsModule.align(payload).then(() => {
- expect(roomsModule.getLoading).toBe(false);
+ courseRoomListModule.align(payload).then(() => {
+ expect(courseRoomListModule.getLoading).toBe(false);
});
- expect(roomsModule.getLoading).toBe(true);
+ expect(courseRoomListModule.getLoading).toBe(true);
expect(mockApi.dashboardControllerMoveElement).toHaveBeenLastCalledWith(
"",
expectedParam
@@ -156,12 +156,12 @@ describe("rooms module", () => {
describe("delete", () => {
it("should call 'setPosition' mutation", async () => {
// TODO: call server will be here when server ready
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- const setRoomDataSpy = jest.spyOn(roomsModule, "setRoomData");
- const setLoadingSpy = jest.spyOn(roomsModule, "setLoading");
+ const setRoomDataSpy = jest.spyOn(courseRoomListModule, "setRoomData");
+ const setLoadingSpy = jest.spyOn(courseRoomListModule, "setLoading");
- await roomsModule.delete("id");
+ await courseRoomListModule.delete("id");
expect(setLoadingSpy).toHaveBeenCalled();
expect(setLoadingSpy.mock.calls[0][0]).toBe(true);
@@ -182,7 +182,7 @@ describe("rooms module", () => {
mockApi as unknown as serverApi.DashboardApiInterface
);
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const roomsData: RoomsData = {
id: "dummyId",
title: "dummy title",
@@ -192,10 +192,10 @@ describe("rooms module", () => {
displayColor: "#FF0000",
isSynchronized: false,
};
- roomsModule.setRoomDataId(roomsData.id);
- await roomsModule.update(roomsData);
+ courseRoomListModule.setRoomDataId(roomsData.id);
+ await courseRoomListModule.update(roomsData);
- expect(roomsModule.getLoading).toBe(false);
+ expect(courseRoomListModule.getLoading).toBe(false);
expect(mockApi.dashboardControllerPatchGroup).toHaveBeenLastCalledWith(
roomsData.id,
roomsData.xPosition,
@@ -216,7 +216,7 @@ describe("rooms module", () => {
.mockReturnValue(
mockApi as unknown as serverApi.DashboardApiInterface
);
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const roomsData: RoomsData = {
id: "dummyId",
title: "dummy title",
@@ -226,11 +226,11 @@ describe("rooms module", () => {
displayColor: "#FF0000",
isSynchronized: false,
};
- roomsModule.setRoomDataId(roomsData.id);
- await roomsModule.update(roomsData);
+ courseRoomListModule.setRoomDataId(roomsData.id);
+ await courseRoomListModule.update(roomsData);
- expect(roomsModule.getLoading).toBe(false);
- expect(roomsModule.getError).toStrictEqual({ ...error });
+ expect(courseRoomListModule.getLoading).toBe(false);
+ expect(courseRoomListModule.getError).toStrictEqual({ ...error });
expect(mockApi.dashboardControllerPatchGroup).toHaveBeenLastCalledWith(
roomsData.id,
roomsData.xPosition,
@@ -246,10 +246,10 @@ describe("rooms module", () => {
jest
.spyOn(serverApi, "CoursesApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
- const roomsModule = new RoomsModule({});
- await roomsModule.fetchAllElements();
+ const courseRoomListModule = new CourseRoomListModule({});
+ await courseRoomListModule.fetchAllElements();
- expect(roomsModule.getLoading).toBe(false);
+ expect(courseRoomListModule.getLoading).toBe(false);
expect(mockApi.courseControllerFindForUser).toHaveBeenCalledTimes(1);
expect(
@@ -270,15 +270,15 @@ describe("rooms module", () => {
jest
.spyOn(serverApi, "CoursesApiFactory")
.mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface);
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- roomsModule.fetchAllElements().then(() => {
- expect(roomsModule.getLoading).toBe(false);
- expect(roomsModule.getError).toStrictEqual({ ...error });
+ courseRoomListModule.fetchAllElements().then(() => {
+ expect(courseRoomListModule.getLoading).toBe(false);
+ expect(courseRoomListModule.getError).toStrictEqual({ ...error });
done();
});
- expect(roomsModule.getLoading).toBe(true);
+ expect(courseRoomListModule.getLoading).toBe(true);
});
});
@@ -290,14 +290,14 @@ describe("rooms module", () => {
status: "success",
message: "",
};
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const getSharedCourseDataSpy = jest.spyOn(
- roomsModule,
+ courseRoomListModule,
"confirmSharedCourseData"
);
getSharedCourseDataSpy.mockImplementation();
- await roomsModule.confirmSharedCourseData(sharedCourseData);
+ await courseRoomListModule.confirmSharedCourseData(sharedCourseData);
expect(getSharedCourseDataSpy.mock.calls[0][0]).toStrictEqual(
sharedCourseData
);
@@ -311,10 +311,10 @@ describe("rooms module", () => {
message: "",
};
const setBusinessErrorMock = jest.fn();
- const roomsModule = new RoomsModule({});
- roomsModule.setBusinessError = setBusinessErrorMock;
+ const courseRoomListModule = new CourseRoomListModule({});
+ courseRoomListModule.setBusinessError = setBusinessErrorMock;
- await roomsModule.confirmSharedCourseData(sharedCourseData);
+ await courseRoomListModule.confirmSharedCourseData(sharedCourseData);
expect(setBusinessErrorMock).toHaveBeenCalled();
});
});
@@ -323,7 +323,7 @@ describe("rooms module", () => {
describe("mutations", () => {
describe("setRoomData", () => {
it("should set the room data", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const roomsDataToBeChanged = [
{
id: "someId",
@@ -346,47 +346,47 @@ describe("rooms module", () => {
to: "/rooms/someId",
},
];
- expect(roomsModule.getRoomsData).not.toStrictEqual(
+ expect(courseRoomListModule.getRoomsData).not.toStrictEqual(
roomsDataToBeChanged
);
- roomsModule.setRoomData(roomsDataToBeChanged as any);
- expect(roomsModule.roomsData).toStrictEqual(expectedData);
+ courseRoomListModule.setRoomData(roomsDataToBeChanged as any);
+ expect(courseRoomListModule.roomsData).toStrictEqual(expectedData);
});
});
describe("setRoomDataId", () => {
it("should set the room data id", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const id = "sample_id";
- roomsModule.setRoomDataId(id);
- expect(roomsModule.gridElementsId).toStrictEqual(id);
+ courseRoomListModule.setRoomDataId(id);
+ expect(courseRoomListModule.gridElementsId).toStrictEqual(id);
});
});
describe("setLoading", () => {
it("should set loading", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const loadingValue = true;
- expect(roomsModule.getLoading).not.toBe(loadingValue);
- roomsModule.setLoading(loadingValue);
- expect(roomsModule.loading).toBe(loadingValue);
+ expect(courseRoomListModule.getLoading).not.toBe(loadingValue);
+ courseRoomListModule.setLoading(loadingValue);
+ expect(courseRoomListModule.loading).toBe(loadingValue);
});
});
describe("setError", () => {
it("should set error", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const errorData = { message: "some error" };
- expect(roomsModule.getError).not.toBe(errorData);
- roomsModule.setError(errorData);
- expect(roomsModule.error).toBe(errorData);
+ expect(courseRoomListModule.getError).not.toBe(errorData);
+ courseRoomListModule.setError(errorData);
+ expect(courseRoomListModule.error).toBe(errorData);
});
});
describe("setPosition", () => {
it("should re-position the state", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const draggedObject = {
from: { x: 6, y: 1 },
item: {
@@ -408,15 +408,15 @@ describe("rooms module", () => {
yPosition: 2,
to: "/rooms/123",
};
- roomsModule.setRoomData(mockData.gridElements as any);
- roomsModule.setPosition(draggedObject);
- expect(roomsModule.roomsData[0]).toStrictEqual(expectedObject);
+ courseRoomListModule.setRoomData(mockData.gridElements as any);
+ courseRoomListModule.setPosition(draggedObject);
+ expect(courseRoomListModule.roomsData[0]).toStrictEqual(expectedObject);
});
});
describe("setAllElements", () => {
it("should set the all elements data", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const itemsToBeSet = [
{
id: "123",
@@ -461,14 +461,14 @@ describe("rooms module", () => {
to: "/rooms/234",
},
];
- roomsModule.setAllElements(itemsToBeSet);
- expect(roomsModule.allElements).toStrictEqual(expectedData);
+ courseRoomListModule.setAllElements(itemsToBeSet);
+ expect(courseRoomListModule.allElements).toStrictEqual(expectedData);
});
});
describe("setSharedCourseData, setImportedCourseId", () => {
it("should set the state and imported course id", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const sharedCourseData = {
code: "123",
courseName: "Mathe",
@@ -477,36 +477,42 @@ describe("rooms module", () => {
};
const importedCourseId = "456789";
- roomsModule.setSharedCourseData(sharedCourseData);
- roomsModule.setImportedCourseId(importedCourseId);
- expect(roomsModule.sharedCourseData).toStrictEqual(sharedCourseData);
- expect(roomsModule.importedCourseId).toStrictEqual(importedCourseId);
+ courseRoomListModule.setSharedCourseData(sharedCourseData);
+ courseRoomListModule.setImportedCourseId(importedCourseId);
+ expect(courseRoomListModule.sharedCourseData).toStrictEqual(
+ sharedCourseData
+ );
+ expect(courseRoomListModule.importedCourseId).toStrictEqual(
+ importedCourseId
+ );
});
});
describe("setBusinessError", () => {
it("should set businessError", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const businessErrorData = {
statusCode: "400",
message: "error",
error: { type: "BadRequest" },
};
- expect(roomsModule.getBusinessError).not.toBe(businessErrorData);
- roomsModule.setBusinessError(businessErrorData);
- expect(roomsModule.businessError).toBe(businessErrorData);
+ expect(courseRoomListModule.getBusinessError).not.toBe(
+ businessErrorData
+ );
+ courseRoomListModule.setBusinessError(businessErrorData);
+ expect(courseRoomListModule.businessError).toBe(businessErrorData);
});
it("should reset businessError", () => {
- const roomsModule = new RoomsModule({});
- roomsModule.businessError = {
+ const courseRoomListModule = new CourseRoomListModule({});
+ courseRoomListModule.businessError = {
statusCode: "400",
message: "error",
error: {},
};
- roomsModule.resetBusinessError();
- expect(roomsModule.businessError.statusCode).toStrictEqual("");
- expect(roomsModule.businessError.message).toStrictEqual("");
+ courseRoomListModule.resetBusinessError();
+ expect(courseRoomListModule.businessError.statusCode).toStrictEqual("");
+ expect(courseRoomListModule.businessError.message).toStrictEqual("");
});
});
});
@@ -514,7 +520,7 @@ describe("rooms module", () => {
describe("getters", () => {
describe("getRoomsData", () => {
it("should return rooms state", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const itemsToBeSet = [
{
id: "123",
@@ -555,44 +561,44 @@ describe("rooms module", () => {
},
];
- roomsModule.setRoomData(itemsToBeSet as any);
- expect(roomsModule.getRoomsData).toStrictEqual(expectedData);
+ courseRoomListModule.setRoomData(itemsToBeSet as any);
+ expect(courseRoomListModule.getRoomsData).toStrictEqual(expectedData);
});
});
describe("getLoading", () => {
it("should return loading state", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- expect(roomsModule.getLoading).not.toStrictEqual(true);
- roomsModule.setLoading(true);
- expect(roomsModule.getLoading).toStrictEqual(true);
+ expect(courseRoomListModule.getLoading).not.toStrictEqual(true);
+ courseRoomListModule.setLoading(true);
+ expect(courseRoomListModule.getLoading).toStrictEqual(true);
});
});
describe("getError", () => {
it("should return error state", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const errorData = { message: "some error" };
- expect(roomsModule.getError).toStrictEqual(null);
- roomsModule.setError(errorData);
- expect(roomsModule.getError).toStrictEqual(errorData);
+ expect(courseRoomListModule.getError).toStrictEqual(null);
+ courseRoomListModule.setError(errorData);
+ expect(courseRoomListModule.getError).toStrictEqual(errorData);
});
});
describe("getRoomsId", () => {
it("should return rooms id state", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const sampleId = "sample_id";
- expect(roomsModule.getRoomsId).toStrictEqual("");
- roomsModule.setRoomDataId(sampleId);
- expect(roomsModule.getRoomsId).toStrictEqual(sampleId);
+ expect(courseRoomListModule.getRoomsId).toStrictEqual("");
+ courseRoomListModule.setRoomDataId(sampleId);
+ expect(courseRoomListModule.getRoomsId).toStrictEqual(sampleId);
});
});
describe("getCourseSharingStatus", () => {
it("should return shared course data", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const sharedCourseData = {
code: "123",
courseName: "Mathe",
@@ -600,8 +606,8 @@ describe("rooms module", () => {
message: "",
};
- roomsModule.setSharedCourseData(sharedCourseData);
- expect(roomsModule.getCourseSharingStatus).toStrictEqual(
+ courseRoomListModule.setSharedCourseData(sharedCourseData);
+ expect(courseRoomListModule.getCourseSharingStatus).toStrictEqual(
sharedCourseData
);
});
@@ -609,17 +615,19 @@ describe("rooms module", () => {
describe("getImportedCourseId", () => {
it("should return imported course id", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const sampleId = "sample_id";
- expect(roomsModule.getImportedCourseId).toStrictEqual("");
- roomsModule.setImportedCourseId(sampleId);
- expect(roomsModule.getImportedCourseId).toStrictEqual(sampleId);
+ expect(courseRoomListModule.getImportedCourseId).toStrictEqual("");
+ courseRoomListModule.setImportedCourseId(sampleId);
+ expect(courseRoomListModule.getImportedCourseId).toStrictEqual(
+ sampleId
+ );
});
});
describe("getAllElements", () => {
it("should return rooms-list AllElements", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const itemsToBeSet = [
{
id: "123",
@@ -665,19 +673,19 @@ describe("rooms module", () => {
to: "/rooms/234",
},
];
- expect(roomsModule.getAllElements).toStrictEqual([]);
- roomsModule.setAllElements(itemsToBeSet);
- expect(roomsModule.getAllElements).toStrictEqual(expectedData);
+ expect(courseRoomListModule.getAllElements).toStrictEqual([]);
+ courseRoomListModule.setAllElements(itemsToBeSet);
+ expect(courseRoomListModule.getAllElements).toStrictEqual(expectedData);
});
});
describe("hasRooms", () => {
it("should return true if rooms is empty", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- expect(roomsModule.hasRooms).toStrictEqual(false);
- roomsModule.setAllElements([]);
- expect(roomsModule.hasRooms).toStrictEqual(false);
+ expect(courseRoomListModule.hasRooms).toStrictEqual(false);
+ courseRoomListModule.setAllElements([]);
+ expect(courseRoomListModule.hasRooms).toStrictEqual(false);
});
it("should return false if rooms is not empty", () => {
@@ -700,21 +708,21 @@ describe("rooms module", () => {
},
];
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- expect(roomsModule.hasRooms).toStrictEqual(false);
- roomsModule.setAllElements(itemsToBeSet);
- expect(roomsModule.hasRooms).toStrictEqual(true);
+ expect(courseRoomListModule.hasRooms).toStrictEqual(false);
+ courseRoomListModule.setAllElements(itemsToBeSet);
+ expect(courseRoomListModule.hasRooms).toStrictEqual(true);
});
});
describe("hasCurrentRooms", () => {
it("should return true if rooms is empty", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- expect(roomsModule.hasCurrentRooms).toStrictEqual(false);
- roomsModule.setRoomData([]);
- expect(roomsModule.hasCurrentRooms).toStrictEqual(false);
+ expect(courseRoomListModule.hasCurrentRooms).toStrictEqual(false);
+ courseRoomListModule.setRoomData([]);
+ expect(courseRoomListModule.hasCurrentRooms).toStrictEqual(false);
});
it("should return false if rooms is not empty", () => {
@@ -737,25 +745,25 @@ describe("rooms module", () => {
},
];
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
- expect(roomsModule.hasCurrentRooms).toStrictEqual(false);
- roomsModule.setRoomData(itemsToBeSet as any);
- expect(roomsModule.hasCurrentRooms).toStrictEqual(true);
+ expect(courseRoomListModule.hasCurrentRooms).toStrictEqual(false);
+ courseRoomListModule.setRoomData(itemsToBeSet as any);
+ expect(courseRoomListModule.hasCurrentRooms).toStrictEqual(true);
});
});
describe("getAlertData", () => {
it("should return alert data", () => {
- const roomsModule = new RoomsModule({});
+ const courseRoomListModule = new CourseRoomListModule({});
const alertData: AlertPayload = {
status: "success",
text: "pages.rooms.uploadCourse.success",
autoClose: true,
};
- roomsModule.setAlertData(alertData);
- expect(roomsModule.getAlertData).toStrictEqual(alertData);
+ courseRoomListModule.setAlertData(alertData);
+ expect(courseRoomListModule.getAlertData).toStrictEqual(alertData);
});
});
});
diff --git a/src/store/share.ts b/src/store/share.ts
index e7b3e2073f..2a1f772bc2 100644
--- a/src/store/share.ts
+++ b/src/store/share.ts
@@ -53,7 +53,7 @@ export default class ShareModule extends VuexModule {
shareTokenPayload
);
if (!shareTokenResult) return undefined;
- const shareUrl = `${window.location.origin}/rooms-overview?import=${shareTokenResult.data.token}`;
+ const shareUrl = `${window.location.origin}/rooms/courses-overview?import=${shareTokenResult.data.token}`;
this.setShareUrl(shareUrl);
return shareTokenResult.data;
} catch {
diff --git a/src/store/share.unit.ts b/src/store/share.unit.ts
index fc42d4341e..af5d88c2ab 100644
--- a/src/store/share.unit.ts
+++ b/src/store/share.unit.ts
@@ -5,7 +5,7 @@ import {
ShareTokenBodyParamsParentTypeEnum,
} from "../serverApi/v3/api";
import setupStores from "@@/tests/test-utils/setupStores";
-import RoomModule from "@/store/room";
+import courseRoomDetailsModule from "@/store/course-room-details";
const sharePayload: SharePayload = {
id: "sampleCourseId",
@@ -22,7 +22,7 @@ const expectedServerPayload = {
describe("share module", () => {
describe("actions", () => {
beforeEach(() => {
- setupStores({ roomModule: RoomModule });
+ setupStores({ courseRoomDetailsModule: courseRoomDetailsModule });
});
describe("createShareUrl", () => {
@@ -69,7 +69,7 @@ describe("share module", () => {
await shareModule.createShareUrl(sharePayload);
const result = setShareUrlMock.mock.calls[0][0];
- expect(result).toContain("rooms-overview?import=sampleToken");
+ expect(result).toContain("rooms/courses-overview?import=sampleToken");
});
it("should return undefined on error", async () => {
diff --git a/src/store/store-accessor.ts b/src/store/store-accessor.ts
index f6b8ad583e..6cf1814cb2 100644
--- a/src/store/store-accessor.ts
+++ b/src/store/store-accessor.ts
@@ -21,8 +21,8 @@ import LoadingStateModule from "@/store/loading-state";
import NewsModule from "@/store/news";
import NotifierModule from "@/store/notifier";
import PrivacyPolicyModule from "@/store/privacy-policy";
-import RoomModule from "@/store/room";
-import RoomsModule from "@/store/rooms";
+import CourseRoomDetailsModule from "@/store/course-room-details";
+import CourseRoomListModule from "@/store/course-room-list";
import SchoolExternalToolsModule from "@/store/school-external-tools";
import SchoolsModule from "@/store/schools";
import ShareModule from "@/store/share";
@@ -55,8 +55,8 @@ export let newsModule: NewsModule;
export let notifierModule: NotifierModule;
export let privacyPolicyModule: PrivacyPolicyModule;
export let termsOfUseModule: TermsOfUseModule;
-export let roomModule: RoomModule;
-export let roomsModule: RoomsModule;
+export let courseRoomDetailsModule: CourseRoomDetailsModule;
+export let courseRoomListModule: CourseRoomListModule;
export let schoolExternalToolsModule: SchoolExternalToolsModule;
export let schoolsModule: SchoolsModule;
export let shareModule: ShareModule;
@@ -86,8 +86,8 @@ export function initializeStores(store: Store): void {
notifierModule = getModule(NotifierModule, store);
privacyPolicyModule = getModule(PrivacyPolicyModule, store);
termsOfUseModule = getModule(TermsOfUseModule, store);
- roomModule = getModule(RoomModule, store);
- roomsModule = getModule(RoomsModule, store);
+ courseRoomDetailsModule = getModule(CourseRoomDetailsModule, store);
+ courseRoomListModule = getModule(CourseRoomListModule, store);
schoolExternalToolsModule = getModule(SchoolExternalToolsModule, store);
schoolsModule = getModule(SchoolsModule, store);
shareModule = getModule(ShareModule, store);
@@ -120,8 +120,8 @@ export const modules = {
notifierModule: NotifierModule,
privacyPolicyModule: PrivacyPolicyModule,
termsOfUseModule: TermsOfUseModule,
- roomModule: RoomModule,
- roomsModule: RoomsModule,
+ courseRoomDetailsModule: CourseRoomDetailsModule,
+ courseRoomListModule: CourseRoomListModule,
schoolExternalToolsModule: SchoolExternalToolsModule,
schoolsModule: SchoolsModule,
shareModule: ShareModule,
diff --git a/src/utils/inject/injection-keys.ts b/src/utils/inject/injection-keys.ts
index 705e0e59c0..c9e6745d1a 100644
--- a/src/utils/inject/injection-keys.ts
+++ b/src/utils/inject/injection-keys.ts
@@ -11,8 +11,8 @@ import LoadingStateModule from "@/store/loading-state";
import NewsModule from "@/store/news";
import NotifierModule from "@/store/notifier";
import PrivacyPolicyModule from "@/store/privacy-policy";
-import RoomModule from "@/store/room";
-import RoomsModule from "@/store/rooms";
+import CourseRoomDetailsModule from "@/store/course-room-details";
+import CourseRoomListModule from "@/store/course-room-list";
import SchoolExternalToolsModule from "@/store/school-external-tools";
import SchoolsModule from "@/store/schools";
import ShareModule from "@/store/share";
@@ -34,7 +34,8 @@ export const SCHOOL_EXTERNAL_TOOLS_MODULE_KEY: InjectionKey =
Symbol("applicationError");
-export const ROOM_MODULE_KEY: InjectionKey = Symbol("roomModule");
+export const COURSE_ROOM_DETAILS_MODULE_KEY: InjectionKey =
+ Symbol("courseRoomDetailsModule");
export const VIDEO_CONFERENCE_MODULE_KEY: InjectionKey =
Symbol("videoConferenceModule");
export const STATUS_ALERTS_MODULE_KEY: InjectionKey =
@@ -53,8 +54,8 @@ export const SCHOOLS_MODULE_KEY: InjectionKey =
Symbol("schoolsModule");
export const COMMON_CARTRIDGE_EXPORT_MODULE_KEY: InjectionKey =
Symbol("commonCartridgeExportModule");
-export const ROOMS_MODULE_KEY: InjectionKey =
- Symbol("roomsModule");
+export const COURSE_ROOM_LIST_MODULE_KEY: InjectionKey =
+ Symbol("courseRoomListModule");
export const LOADING_STATE_MODULE_KEY: InjectionKey =
Symbol("loadingStateModule");
export const NEWS_MODULE_KEY: InjectionKey = Symbol("newsModule");
diff --git a/src/utils/sidebar-base-items.ts b/src/utils/sidebar-base-items.ts
index 8aebd951b2..83acc14b93 100644
--- a/src/utils/sidebar-base-items.ts
+++ b/src/utils/sidebar-base-items.ts
@@ -42,14 +42,10 @@ const getSidebarItems = (): SidebarItemList => [
},
{
title: "global.sidebar.item.courses",
- to: "/rooms-overview",
+ to: "/rooms/courses-overview",
icon: "$mdiSchoolOutline",
testId: "Course-Overview",
- activeForUrls: [
- "^/rooms-overview($|/.*)",
- "^/rooms($|/.*)",
- "^/rooms-list($|/.*)",
- ],
+ activeForUrls: ["^/rooms($|/.*)"],
},
{
title: "global.sidebar.item.teams",
From a454ccf28cb06aab6e4d40039180713ce05f5d10 Mon Sep 17 00:00:00 2001
From: Gordon Nicholas <160246213+GordonNicholasCap@users.noreply.github.com>
Date: Tue, 20 Aug 2024 16:47:05 +0200
Subject: [PATCH 6/8] N21-2119 migration assistant external role (#3364)
---
.../molecules/vImportUsersMatchSearch.unit.ts | 248 +++++++++++++++++-
.../molecules/vImportUsersMatchSearch.vue | 58 +++-
src/locales/de.ts | 10 +
src/locales/en.ts | 10 +
src/locales/es.ts | 10 +
src/locales/uk.ts | 10 +
src/serverApi/v3/api.ts | 118 +++++++++
7 files changed, 454 insertions(+), 10 deletions(-)
diff --git a/src/components/molecules/vImportUsersMatchSearch.unit.ts b/src/components/molecules/vImportUsersMatchSearch.unit.ts
index 5fc85e8dd4..038981a81a 100644
--- a/src/components/molecules/vImportUsersMatchSearch.unit.ts
+++ b/src/components/molecules/vImportUsersMatchSearch.unit.ts
@@ -1,5 +1,6 @@
import { importUsersModule } from "@/store";
import ImportUsersModule from "@/store/import-users";
+import { ImportUserResponseRoleNamesEnum } from "@/serverApi/v3";
import { THEME_KEY } from "@/utils/inject";
import {
createTestingI18n,
@@ -24,8 +25,9 @@ const testProps = {
loginName: "max_mus",
firstName: "Max",
lastName: "Mustermann",
- roleNames: ["student"],
+ roleNames: [ImportUserResponseRoleNamesEnum.Student],
classNames: ["6a"],
+ externalRoleNames: [],
},
isDialog: true,
ldapSource: "LDAP",
@@ -93,7 +95,7 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
loginName: "lehrer@schul-cloud.org",
firstName: "Cord",
lastName: "Carl",
- roleNames: ["teacher"],
+ roleNames: [ImportUserResponseRoleNamesEnum.Teacher],
text: "Cord Carl",
};
const wrapper = getWrapper(testProps);
@@ -115,7 +117,7 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
loginName: "lehrer@schul-cloud.org",
firstName: "Cord",
lastName: "Carl",
- roleNames: ["teacher"],
+ roleNames: [ImportUserResponseRoleNamesEnum.Teacher],
text: "Cord Carl",
};
@@ -150,7 +152,7 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
loginName: "max_mus",
firstName: "Max",
lastName: "Mustermann",
- roleNames: ["student"],
+ roleNames: [ImportUserResponseRoleNamesEnum.Student],
classNames: ["6a"],
};
const match = {
@@ -158,7 +160,7 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
loginName: "admin@schul-cloud.org",
firstName: "Thorsten",
lastName: "Test",
- roleNames: ["admin"],
+ roleNames: [ImportUserResponseRoleNamesEnum.Admin],
matchedBy: "admin",
};
const wrapper = getWrapper({
@@ -192,7 +194,7 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
expect(deleteMatchButton.props("disabled")).toBe(true);
});
- it("should disable save button when no no item was selected", () => {
+ it("should disable save button when no item was selected", () => {
const wrapper = getWrapper(testProps);
const saveMatchButton = wrapper
@@ -213,4 +215,238 @@ describe("@/components/molecules/vImportUsersMatchSearch", () => {
expect(editedItemUsername.exists()).toBe(false);
});
+
+ describe("when the theme is not NBC", () => {
+ const setup = () => {
+ const setupTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Student],
+ classNames: ["6a"],
+ externalRoleNames: ["student-external"],
+ },
+ isDialog: true,
+ ldapSource: "ldap-external",
+ isNbc: false,
+ };
+ return {
+ setupTestProps,
+ };
+ };
+
+ it("should not contain any text for external role", () => {
+ const { setupTestProps } = setup();
+ const wrapper = getWrapper(setupTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).not.toContain(
+ `common.labels.role ${setupTestProps.ldapSource}`
+ );
+ });
+ });
+
+ describe("when the theme is NBC", () => {
+ describe("when the external role is 'Lern' (Student)", () => {
+ const setup = () => {
+ const adminTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Student],
+ classNames: ["6a"],
+ externalRoleNames: ["Lern"],
+ },
+ isDialog: true,
+ ldapSource: "moin.schule",
+ isNbc: true,
+ };
+ return {
+ adminTestProps,
+ };
+ };
+
+ it("should correctly show the external role of the user", () => {
+ const { adminTestProps } = setup();
+ const wrapper = getWrapper(adminTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).toContain("Max");
+ expect(editedItemElement).toContain("Mustermann");
+ expect(editedItemElement).toContain("common.roleName.student");
+ expect(editedItemElement).toContain(
+ `common.labels.role ${adminTestProps.ldapSource}: ` +
+ "components.molecules.importUsersMatch.externalRoleName.schulconnex.student)"
+ );
+ });
+ });
+ describe("when the external role is 'Lehr' (Teacher)", () => {
+ const setup = () => {
+ const adminTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Teacher],
+ classNames: ["6a"],
+ externalRoleNames: ["Lehr"],
+ },
+ isDialog: true,
+ ldapSource: "moin.schule",
+ isNbc: true,
+ };
+ return {
+ adminTestProps,
+ };
+ };
+
+ it("should correctly show the external role of the user", () => {
+ const { adminTestProps } = setup();
+ const wrapper = getWrapper(adminTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).toContain("Max");
+ expect(editedItemElement).toContain("Mustermann");
+ expect(editedItemElement).toContain("common.roleName.teacher");
+ expect(editedItemElement).toContain(
+ `common.labels.role ${adminTestProps.ldapSource}: ` +
+ "components.molecules.importUsersMatch.externalRoleName.schulconnex.teacher)"
+ );
+ });
+ });
+ describe("when the external role is 'Leit' (Management)", () => {
+ const setup = () => {
+ const adminTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Admin],
+ classNames: ["6a"],
+ externalRoleNames: ["Leit"],
+ },
+ isDialog: true,
+ ldapSource: "moin.schule",
+ isNbc: true,
+ };
+ return {
+ adminTestProps,
+ };
+ };
+
+ it("should correctly show the external role of the user", () => {
+ const { adminTestProps } = setup();
+ const wrapper = getWrapper(adminTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).toContain("Max");
+ expect(editedItemElement).toContain("Mustermann");
+ expect(editedItemElement).toContain("common.roleName.administrator");
+ expect(editedItemElement).toContain(
+ `common.labels.role ${adminTestProps.ldapSource}: ` +
+ "components.molecules.importUsersMatch.externalRoleName.schulconnex.manager)"
+ );
+ });
+ });
+ describe("when the external role is 'OrgAdmin' (Admin)", () => {
+ const setup = () => {
+ const adminTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Admin],
+ classNames: ["6a"],
+ externalRoleNames: ["OrgAdmin"],
+ },
+ isDialog: true,
+ ldapSource: "moin.schule",
+ isNbc: true,
+ };
+ return {
+ adminTestProps,
+ };
+ };
+
+ it("should correctly show the external role of the user", () => {
+ const { adminTestProps } = setup();
+ const wrapper = getWrapper(adminTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).toContain("Max");
+ expect(editedItemElement).toContain("Mustermann");
+ expect(editedItemElement).toContain("common.roleName.administrator");
+ expect(editedItemElement).toContain(
+ `common.labels.role ${adminTestProps.ldapSource}: ` +
+ "components.molecules.importUsersMatch.externalRoleName.schulconnex.orgAdmin)"
+ );
+ });
+ });
+
+ describe("when externalRoleNames prop is empty", () => {
+ const setup = () => {
+ const setupTestProps = {
+ editedItem: {
+ flagged: false,
+ importUserId: "123",
+ loginName: "max_mus",
+ firstName: "Max",
+ lastName: "Mustermann",
+ roleNames: [ImportUserResponseRoleNamesEnum.Student],
+ classNames: ["6a"],
+ externalRoleNames: [],
+ },
+ isDialog: true,
+ ldapSource: "moin.schule",
+ isNbc: true,
+ };
+ return {
+ setupTestProps,
+ };
+ };
+
+ it("should show that the role is not available", () => {
+ const { setupTestProps } = setup();
+ const wrapper = getWrapper(setupTestProps);
+
+ const editedItemElement = wrapper
+ .find("[data-testid=edited-item]")
+ .html();
+
+ expect(editedItemElement).toContain("Max");
+ expect(editedItemElement).toContain("Mustermann");
+ expect(editedItemElement).toContain("common.roleName.student");
+ expect(editedItemElement).toContain(
+ "components.molecules.importUsersMatch.externalRoleName.none"
+ );
+ });
+ });
+ });
});
diff --git a/src/components/molecules/vImportUsersMatchSearch.vue b/src/components/molecules/vImportUsersMatchSearch.vue
index 94a8656d39..e8dad88f0c 100644
--- a/src/components/molecules/vImportUsersMatchSearch.vue
+++ b/src/components/molecules/vImportUsersMatchSearch.vue
@@ -44,6 +44,7 @@
{{ mapRoleNames(editedItem.roleNames) }}
+ {{ isNbc ? externalRoleText : "" }}
diff --git a/src/modules/ui/board/BoardMenuActionDelete.vue b/src/modules/ui/board/BoardMenuActionDelete.vue
index 19e954740d..478e2b2ba1 100644
--- a/src/modules/ui/board/BoardMenuActionDelete.vue
+++ b/src/modules/ui/board/BoardMenuActionDelete.vue
@@ -26,23 +26,23 @@ const emit = defineEmits(["click"]);
const scope = injectStrict(MENU_SCOPE);
const { askDeleteConfirmation } = useDeleteConfirmationDialog();
-const getLanguageKeyTypeName = (scope: string) => {
- switch (scope) {
- case "column":
- return "components.boardColumn";
- case "card":
- return "components.boardCard";
- case "element":
- return "components.boardElement";
- default:
- return "components.board";
- }
+const languageKeyForScopeType: Record = {
+ board: "components.board",
+ column: "components.boardColumn",
+ card: "components.boardCard",
+ collaborativeTextEditorElement:
+ "components.cardElement.collaborativeTextEditorElement",
+ drawingElement: "components.cardElement.drawingElement",
+ externalToolElement: "components.cardElement.externalToolElement",
+ fileElement: "components.cardElement.fileElement",
+ linkElement: "components.cardElement.LinkElement",
+ submissionElement: "components.cardElement.submissionElement",
};
const onClick = (): void => {
const promise = askDeleteConfirmation(
props.name,
- getLanguageKeyTypeName(scope)
+ languageKeyForScopeType[scope]
);
emit("click", promise);
diff --git a/src/modules/ui/board/board-menu-scope.ts b/src/modules/ui/board/board-menu-scope.ts
index 6290c635a8..bda0b49fbe 100644
--- a/src/modules/ui/board/board-menu-scope.ts
+++ b/src/modules/ui/board/board-menu-scope.ts
@@ -1 +1,10 @@
-export type BoardMenuScope = "element" | "card" | "column" | "board";
+export type BoardMenuScope =
+ | "card"
+ | "column"
+ | "board"
+ | "collaborativeTextEditorElement"
+ | "drawingElement"
+ | "externalToolElement"
+ | "fileElement"
+ | "linkElement"
+ | "submissionElement";
From 85a4120306b4a2f72df68c9d486e87d3dd98379b Mon Sep 17 00:00:00 2001
From: hoeppner-dataport <106819770+hoeppner-dataport@users.noreply.github.com>
Date: Wed, 21 Aug 2024 13:47:47 +0200
Subject: [PATCH 8/8] BC-7830 - board loadtests merge (#3369)
Problems identified during loadtests
* fix: avoid fetchCard of newly created card
* fix: richtext live updating
---
src/modules/data/board/Board.store.ts | 4 +++
src/modules/data/board/Board.store.unit.ts | 32 +++++++++++++++----
src/modules/data/board/Card.store.ts | 8 +++++
src/modules/data/board/Card.store.unit.ts | 21 ++++++++++++
.../RichTextContentElement.vue | 2 +-
.../feature/board/board/BoardColumn.unit.ts | 13 ++++++--
src/modules/feature/board/card/CardHost.vue | 4 ++-
7 files changed, 73 insertions(+), 11 deletions(-)
diff --git a/src/modules/data/board/Board.store.ts b/src/modules/data/board/Board.store.ts
index 92ca20ddf1..5e0a96fa11 100644
--- a/src/modules/data/board/Board.store.ts
+++ b/src/modules/data/board/Board.store.ts
@@ -6,6 +6,7 @@ import { useBoardSocketApi } from "./boardActions/boardSocketApi.composable";
import { useBoardFocusHandler } from "./BoardFocusHandler.composable";
import { useSharedEditMode } from "./EditMode.composable";
import { envConfigModule } from "@/store";
+import { useCardStore } from "./Card.store";
import {
CreateCardRequestPayload,
CreateCardSuccessPayload,
@@ -30,6 +31,7 @@ import {
import { DeleteCardSuccessPayload } from "./cardActions/cardActionPayload";
export const useBoardStore = defineStore("boardStore", () => {
+ const cardStore = useCardStore();
const board = ref(undefined);
const isLoading = ref(false);
const { setFocus } = useBoardFocusHandler();
@@ -94,6 +96,8 @@ export const useBoardStore = defineStore("boardStore", () => {
const { newCard } = payload;
+ cardStore.createCardSuccess(payload);
+
const columnIndex = board.value.columns.findIndex(
(column) => column.id === payload.columnId
);
diff --git a/src/modules/data/board/Board.store.unit.ts b/src/modules/data/board/Board.store.unit.ts
index 079bab5af0..d7c2d8a26b 100644
--- a/src/modules/data/board/Board.store.unit.ts
+++ b/src/modules/data/board/Board.store.unit.ts
@@ -7,22 +7,20 @@ import {
envsFactory,
} from "@@/tests/test-utils/factory";
import { createMock, DeepMocked } from "@golevelup/ts-jest";
-import { useBoardNotifier } from "@util-board";
+import { useBoardNotifier, useSharedLastCreatedElement } from "@util-board";
import { createPinia, setActivePinia } from "pinia";
-import { ref } from "vue";
+import { computed, ref } from "vue";
import { useBoardStore } from "./Board.store";
import { useSharedEditMode } from "./EditMode.composable";
import { envConfigModule } from "@/store";
import EnvConfigModule from "@/store/env-config";
import { cardResponseFactory } from "@@/tests/test-utils/factory/cardResponseFactory";
import setupStores from "@@/tests/test-utils/setupStores";
-import { useSocketConnection } from "@data-board";
-import { useI18n } from "vue-i18n";
+import { useCardStore, useSocketConnection } from "@data-board";
import { useBoardRestApi } from "./boardActions/boardRestApi.composable";
import { useBoardSocketApi } from "./boardActions/boardSocketApi.composable";
-
-jest.mock("vue-i18n");
-(useI18n as jest.Mock).mockReturnValue({ t: (key: string) => key });
+import { mockedPiniaStoreTyping } from "@@/tests/test-utils";
+import { useCardSocketApi } from "./cardActions/cardSocketApi.composable";
jest.mock("./boardActions/boardSocketApi.composable");
const mockedUseBoardSocketApi = jest.mocked(useBoardSocketApi);
@@ -35,6 +33,9 @@ const mockedSharedEditMode = jest.mocked(useSharedEditMode);
jest.mock("@util-board");
const mockedUseBoardNotifier = jest.mocked(useBoardNotifier);
+const mockUseSharedLastCreatedElement = jest.mocked(
+ useSharedLastCreatedElement
+);
jest.mock("@/components/error-handling/ErrorHandler.composable");
const mockedUseErrorHandler = jest.mocked(useErrorHandler);
@@ -42,6 +43,9 @@ const mockedUseErrorHandler = jest.mocked(useErrorHandler);
jest.mock("@data-board/socket/socket");
const mockedUseSocketConnection = jest.mocked(useSocketConnection);
+jest.mock("./cardActions/cardSocketApi.composable");
+const mockedUseCardSocketApi = jest.mocked(useCardSocketApi);
+
describe("BoardStore", () => {
let mockedBoardNotifierCalls: DeepMocked>;
let mockedErrorHandlerCalls: DeepMocked>;
@@ -50,6 +54,9 @@ describe("BoardStore", () => {
>;
let mockedSocketApiActions: DeepMocked>;
let mockedBoardRestApiActions: DeepMocked>;
+ let mockedCardSocketApiActions: DeepMocked<
+ ReturnType
+ >;
let setEditModeId: jest.Mock;
beforeEach(() => {
@@ -74,11 +81,20 @@ describe("BoardStore", () => {
createMock>();
mockedUseBoardRestApi.mockReturnValue(mockedBoardRestApiActions);
+ mockedCardSocketApiActions =
+ createMock>();
+ mockedUseCardSocketApi.mockReturnValue(mockedCardSocketApiActions);
+
setEditModeId = jest.fn();
mockedSharedEditMode.mockReturnValue({
setEditModeId,
editModeId: ref(undefined),
});
+
+ mockUseSharedLastCreatedElement.mockReturnValue({
+ lastCreatedElementId: computed(() => "element-id"),
+ resetLastCreatedElementId: jest.fn(),
+ });
});
const setup = (options?: { createBoard?: boolean; socketFlag?: boolean }) => {
@@ -107,6 +123,8 @@ describe("BoardStore", () => {
boardStore.board = board;
}
+ mockedPiniaStoreTyping(useCardStore);
+
return { boardStore, board, firstColumn, secondColumn, cards };
};
diff --git a/src/modules/data/board/Card.store.ts b/src/modules/data/board/Card.store.ts
index 55a928f395..32bb60395d 100644
--- a/src/modules/data/board/Card.store.ts
+++ b/src/modules/data/board/Card.store.ts
@@ -4,6 +4,7 @@ import { envConfigModule } from "@/store";
import { useBoardFocusHandler } from "./BoardFocusHandler.composable";
import { CardResponse, ContentElementType } from "@/serverApi/v3";
+import { CreateCardSuccessPayload } from "./boardActions/boardActionPayload";
import {
CreateElementSuccessPayload,
DeleteCardSuccessPayload,
@@ -48,6 +49,12 @@ export const useCardStore = defineStore("cardStore", () => {
return cards.value[cardId];
};
+ const createCardSuccess = (payload: CreateCardSuccessPayload) => {
+ if (payload.newCard) {
+ cards.value[payload.newCard.id] = payload.newCard;
+ }
+ };
+
const updateCardTitleRequest = socketOrRest.updateCardTitleRequest;
const updateCardTitleSuccess = async (
@@ -184,6 +191,7 @@ export const useCardStore = defineStore("cardStore", () => {
};
return {
+ createCardSuccess,
createElementRequest,
createElementSuccess,
deleteElementRequest,
diff --git a/src/modules/data/board/Card.store.unit.ts b/src/modules/data/board/Card.store.unit.ts
index 143a93112f..d9591728a4 100644
--- a/src/modules/data/board/Card.store.unit.ts
+++ b/src/modules/data/board/Card.store.unit.ts
@@ -161,6 +161,27 @@ describe("CardStore", () => {
});
});
+ describe("createCardSuccess", () => {
+ describe("when card is provided", () => {
+ it("should add the card to the store", async () => {
+ const { cardStore } = setup();
+
+ const newCardId = "idNewCard";
+ const newCard = cardResponseFactory.build({ id: newCardId });
+ await cardStore.createCardSuccess({
+ newCard,
+ columnId: "any-column-id",
+ isOwnAction: true,
+ });
+
+ expect(cardStore.cards[newCardId]).toBeDefined();
+ expect(cardStore.cards[newCardId]).toEqual(
+ expect.objectContaining({ id: newCardId, elements: [] })
+ );
+ });
+ });
+ });
+
describe("deleteCardRequest", () => {
it("should call socket Api if feature flag is enabled", () => {
const { cardStore, cardId } = setup(true);
diff --git a/src/modules/feature/board-text-element/RichTextContentElement.vue b/src/modules/feature/board-text-element/RichTextContentElement.vue
index c596c60447..2c697eedde 100644
--- a/src/modules/feature/board-text-element/RichTextContentElement.vue
+++ b/src/modules/feature/board-text-element/RichTextContentElement.vue
@@ -3,7 +3,7 @@
"element-id"),
+ resetLastCreatedElementId: jest.fn(),
+});
+
describe("BoardColumn", () => {
let mockedBoardNotifierCalls: DeepMocked>;
let mockedUseForceRenderHandler: ReturnType;
diff --git a/src/modules/feature/board/card/CardHost.vue b/src/modules/feature/board/card/CardHost.vue
index ae7218efa4..bca6ebc900 100644
--- a/src/modules/feature/board/card/CardHost.vue
+++ b/src/modules/feature/board/card/CardHost.vue
@@ -231,7 +231,9 @@ export default defineComponent({
});
onMounted(async () => {
- await cardStore.fetchCardRequest({ cardIds: [cardId.value] });
+ if (card.value === undefined) {
+ await cardStore.fetchCardRequest({ cardIds: [cardId.value] });
+ }
});
return {