From db35a037eb0473691ebc734ca6a1abc9f717cd74 Mon Sep 17 00:00:00 2001 From: Elia Bieri Date: Thu, 25 May 2023 13:34:23 +0200 Subject: [PATCH] Jump to cockpit for trainers and superusers --- .../src/components/header/MainNavigationBar.vue | 2 +- client/src/pages/DashboardPage.vue | 14 ++++++++++++-- client/src/router/guards.ts | 2 +- client/src/stores/courseSessions.ts | 17 +++++++++++------ client/src/types.ts | 1 + server/vbv_lernwelt/course/models.py | 5 ++++- server/vbv_lernwelt/course/serializers.py | 5 +++++ server/vbv_lernwelt/learnpath/models.py | 5 ++++- 8 files changed, 39 insertions(+), 12 deletions(-) diff --git a/client/src/components/header/MainNavigationBar.vue b/client/src/components/header/MainNavigationBar.vue index 7ebbe0e7..5a7f599b 100644 --- a/client/src/components/header/MainNavigationBar.vue +++ b/client/src/components/header/MainNavigationBar.vue @@ -106,7 +106,7 @@ onMounted(() => { v-if=" inCourse() && courseSessionsStore.currentCourseSession && - courseSessionsStore.hasCockpit + courseSessionsStore.currentCourseSessionHasCockpit " :to="`${courseSessionsStore.currentCourseSession.course_url}/cockpit`" class="nav-item" diff --git a/client/src/pages/DashboardPage.vue b/client/src/pages/DashboardPage.vue index e7b1f3bf..8afb26a9 100644 --- a/client/src/pages/DashboardPage.vue +++ b/client/src/pages/DashboardPage.vue @@ -2,8 +2,9 @@ import LearningPathDiagramSmall from "@/components/learningPath/LearningPathDiagramSmall.vue"; import { useCourseSessionsStore } from "@/stores/courseSessions"; import { useUserStore } from "@/stores/user"; +import type { CourseSession } from "@/types"; import log from "loglevel"; -import { onMounted } from "vue"; +import { computed, onMounted } from "vue"; log.debug("DashboardPage created"); @@ -19,6 +20,15 @@ function employer() { onMounted(async () => { log.debug("DashboardPage mounted"); }); + +const getNextStepLink = (courseSession: CourseSession) => { + return computed(() => { + if (courseSessionsStore.hasCockpit(courseSession)) { + return courseSession.cockpit_url; + } + return courseSession.learning_path_url; + }); +};