Embed LearningPath diagram on person list of cockpit
This commit is contained in:
parent
299ff5271d
commit
4ff1a1097d
|
|
@ -5,6 +5,7 @@ import * as log from "loglevel";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import colors from "@/colors.json";
|
import colors from "@/colors.json";
|
||||||
|
|
||||||
import { Circle } from "@/services/circle";
|
import { Circle } from "@/services/circle";
|
||||||
import { LearningPath } from "@/services/learningPath";
|
import { LearningPath } from "@/services/learningPath";
|
||||||
import type { LearningSequence, Topic } from "@/types";
|
import type { LearningSequence, Topic } from "@/types";
|
||||||
|
|
@ -37,7 +38,8 @@ const viewBox = computed(() => {
|
||||||
const vueRouter = useRouter();
|
const vueRouter = useRouter();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
log.debug("CircleDiagram mounted");
|
log.debug("LearningPathDiagram mounted");
|
||||||
|
console.log(props.learningPath);
|
||||||
render();
|
render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@ learningPathStore
|
||||||
diagram-type="horizontalSmall"
|
diagram-type="horizontalSmall"
|
||||||
></LearningPathDiagram>
|
></LearningPathDiagram>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,15 @@ const props = defineProps<{
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<li
|
<li class="py-4 border-t border-gray-500 flex flex-row items-stretch gap-4">
|
||||||
class="py-4 leading-[45px] border-t border-gray-500 flex flex-row justify-between"
|
<div class="flex flex-row items-center w-64">
|
||||||
>
|
<img class="h-12 rounded-full mr-2" :src="avatarUrl" />
|
||||||
<div class="flex flex-row">
|
<div class="text-bold">{{ name }}</div>
|
||||||
<img class="h-[45px] rounded-full mr-2" :src="avatarUrl" />
|
|
||||||
<p class="text-bold leading-[45px]">{{ name }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="leading-[45px]">
|
<div class="flex-1 flex items-center">
|
||||||
<slot name="center"></slot>
|
<slot name="center"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="leading-[45px]">
|
<div class="flex items-center">
|
||||||
<slot name="link"></slot>
|
<slot name="link"></slot>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import LearningPathDiagram from "@/components/learningPath/LearningPathDiagram.vue";
|
||||||
import ItPersonRow from "@/components/ui/ItPersonRow.vue";
|
import ItPersonRow from "@/components/ui/ItPersonRow.vue";
|
||||||
import ItProgress from "@/components/ui/ItProgress.vue";
|
import ItProgress from "@/components/ui/ItProgress.vue";
|
||||||
import { useCockpitStore } from "@/stores/cockpit";
|
import { useCockpitStore } from "@/stores/cockpit";
|
||||||
import { useCompetenceStore } from "@/stores/competence";
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
|
import { useLearningPathStore } from "@/stores/learningPath";
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
|
@ -14,6 +16,7 @@ log.debug("CockpitIndexPage created", props.courseSlug);
|
||||||
|
|
||||||
const cockpitStore = useCockpitStore();
|
const cockpitStore = useCockpitStore();
|
||||||
const competenceStore = useCompetenceStore();
|
const competenceStore = useCompetenceStore();
|
||||||
|
const learningPathStore = useLearningPathStore();
|
||||||
|
|
||||||
function userCountStatus(userId: number) {
|
function userCountStatus(userId: number) {
|
||||||
return competenceStore.calcStatusCount(
|
return competenceStore.calcStatusCount(
|
||||||
|
|
@ -112,17 +115,37 @@ function setActiveCircle(index: number) {
|
||||||
:avatar-url="csu.avatar_url"
|
:avatar-url="csu.avatar_url"
|
||||||
>
|
>
|
||||||
<template #center>
|
<template #center>
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row items-center justify-between">
|
||||||
<div>KMU Teil 1</div>
|
<div class="flex flex-row items-center gap-4">
|
||||||
<ul class="ml-4 flex flex-row items-center">
|
<div class="h-12">
|
||||||
<li class="flex flex-row items-center mr-6">
|
<LearningPathDiagram
|
||||||
|
v-if="
|
||||||
|
learningPathStore.learningPathForUser(
|
||||||
|
props.courseSlug,
|
||||||
|
csu.user_id
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:learning-path="
|
||||||
|
learningPathStore.learningPathForUser(
|
||||||
|
props.courseSlug,
|
||||||
|
csu.user_id
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:postfix="`cockpit-${csu.user_id}`"
|
||||||
|
diagram-type="horizontalSmall"
|
||||||
|
></LearningPathDiagram>
|
||||||
|
</div>
|
||||||
|
<div>KMU Teil 1</div>
|
||||||
|
</div>
|
||||||
|
<div class="ml-4 flex flex-row items-center">
|
||||||
|
<div class="flex flex-row items-center mr-6">
|
||||||
<it-icon-smiley-thinking
|
<it-icon-smiley-thinking
|
||||||
class="w-8 h-8 mr-2 inline-block"
|
class="w-8 h-8 mr-2 inline-block"
|
||||||
></it-icon-smiley-thinking>
|
></it-icon-smiley-thinking>
|
||||||
<p class="text-bold inline-block">
|
<p class="text-bold inline-block">
|
||||||
{{ userCountStatus(csu.user_id).fail }}
|
{{ userCountStatus(csu.user_id).fail }}
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</div>
|
||||||
<li class="flex flex-row items-center mr-6">
|
<li class="flex flex-row items-center mr-6">
|
||||||
<it-icon-smiley-happy
|
<it-icon-smiley-happy
|
||||||
class="w-8 h-8 mr-2 inline-block"
|
class="w-8 h-8 mr-2 inline-block"
|
||||||
|
|
@ -139,7 +162,7 @@ function setActiveCircle(index: number) {
|
||||||
{{ userCountStatus(csu.user_id).unknown }}
|
{{ userCountStatus(csu.user_id).unknown }}
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #link>
|
<template #link>
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const learningPath = computed(() => {
|
const learningPath = computed(() => {
|
||||||
if (learningPathStore.learningPaths.size > 0) {
|
return learningPathStore.learningPathForUser(props.courseSlug, props.userId);
|
||||||
const learningPathKey = `${props.courseSlug}-lp-${props.userId}`;
|
|
||||||
return learningPathStore.learningPaths.get(learningPathKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function courseSessionUser() {
|
function courseSessionUser() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,18 @@ export const useLearningPathStore = defineStore({
|
||||||
loading: false,
|
loading: false,
|
||||||
} as LearningPathStoreState;
|
} as LearningPathStoreState;
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {
|
||||||
|
learningPathForUser: (state) => {
|
||||||
|
return (courseSlug: string, userId: number | string) => {
|
||||||
|
if (state.learningPaths.size > 0) {
|
||||||
|
const learningPathKey = `${courseSlug}-lp-${userId}`;
|
||||||
|
return state.learningPaths.get(learningPathKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async loadLearningPath(
|
async loadLearningPath(
|
||||||
slug: string,
|
slug: string,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue