diff --git a/src/main.js b/src/main.js
index 14cb52f..983b468 100644
--- a/src/main.js
+++ b/src/main.js
@@ -14,8 +14,10 @@ import '@/assets/tailwind.css';
import Nora from '@primevue/themes/nora';
import axios from 'axios';
import { LoadingStore } from './stores/LoadingStore.js';
-axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL;//'http://localhost:8082' //'
-console.log(import.meta.env.VITE_BACKEND_URL);
+
+//axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL;
+axios.defaults.baseURL = 'http://localhost:8082'
+console.log(axios.defaults.baseURL);
diff --git a/src/service/KsVideoGroupService.js b/src/service/KsVideoGroupService.js
index 5b6acaa..09a6f2b 100644
--- a/src/service/KsVideoGroupService.js
+++ b/src/service/KsVideoGroupService.js
@@ -23,5 +23,11 @@ export const KsVideoGroupService = {
getVideoGroupById(id) {
return axios.get(`/fe-api/video-group/${id}`);
+ },
+
+ getVideoCountByGroup(groupIds) {
+ return axios.get('/fe-api/ksvideos/video-count', {
+ params: { groupIds }
+ });
}
};
diff --git a/src/stores/KsVideoGroupStore.js b/src/stores/KsVideoGroupStore.js
index 425a173..198f910 100644
--- a/src/stores/KsVideoGroupStore.js
+++ b/src/stores/KsVideoGroupStore.js
@@ -5,6 +5,7 @@ import { KsVideoGroupService } from '../service/KsVideoGroupService';
export const KsVideoGroupStore = defineStore('ksvideogroup_store', () => {
const lstKsVideoGroup = ref([]);
const selectedKsVideoGroup = ref(null);
+ const videoCountsByGroup = ref([]);
async function fetchKsVideoGroup(projectId) {
try {
@@ -20,6 +21,15 @@ export const KsVideoGroupStore = defineStore('ksvideogroup_store', () => {
return lstKsVideoGroup.value;
});
+ async function fetchKsVideoGroupById(id) {
+ try {
+ const response = await KsVideoGroupService.getVideoGroupById(id);
+ selectedKsVideoGroup.value = response.data;
+ } catch (error) {
+ console.error('Error fetching video group by ID:', error);
+ }
+ }
+
const getSelectedKsVideoGroup = computed(() => {
return selectedKsVideoGroup.value;
});
@@ -29,12 +39,28 @@ export const KsVideoGroupStore = defineStore('ksvideogroup_store', () => {
console.log('selectedVideoGroup', selectedKsVideoGroup.value);
}
+ async function fetchVideoCountsByGroup(groupIds) {
+ try {
+ const response = await KsVideoGroupService.getVideoCountByGroup(groupIds);
+ videoCountsByGroup.value = response.data;
+ } catch (error) {
+ console.error('Error fetching video counts by group:', error);
+ }
+ }
+
+ const getVideoCountsByGroup = computed(() => {
+ return videoCountsByGroup.value;
+ });
+
return {
fetchKsVideoGroup,
selectedKsVideoGroup,
lstKsVideoGroup,
ksVideoGroup,
getSelectedKsVideoGroup,
- setSelectedKsVideoGroup
+ setSelectedKsVideoGroup,
+ fetchKsVideoGroupById,
+ getVideoCountsByGroup,
+ fetchVideoCountsByGroup
};
});
diff --git a/src/views/pages/KsVideos/KsNewVideoForm.vue b/src/views/pages/KsVideos/KsNewVideoForm.vue
index 95b138d..5d849d4 100644
--- a/src/views/pages/KsVideos/KsNewVideoForm.vue
+++ b/src/views/pages/KsVideos/KsNewVideoForm.vue
@@ -138,7 +138,7 @@
-
Wait until the upload is completed. You will be automatically redirected.
+
Wait until the upload is completed. You will be automatically redirected in few minutes.
@@ -291,13 +291,12 @@ onMounted(async () => {
const fetchVideos = async () => {
ksVideoStore.fetchKsVideoByGroupId(route.params.groupId).then(() => {
ksVideos.value = (ksVideoStore.ksVideo || []);
- console.log('ksVideos', ksVideos.value);
});
};
const fetchGroupVideo = async () => {
ksVideoGroupStore.fetchKsVideoGroupById(route.params.groupId).then(() => {
- groupDocType.value = (ksVideoGroupStore.getSelectedKsVideoGroup.type || []);
+ groupDocType.value = (ksVideoGroupStore.getSelectedKsVideoGroup.type || '');
});
}
diff --git a/src/views/pages/KsVideos/KsVideoGroup.vue b/src/views/pages/KsVideos/KsVideoGroup.vue
index 80a9d00..03ca6c0 100644
--- a/src/views/pages/KsVideos/KsVideoGroup.vue
+++ b/src/views/pages/KsVideos/KsVideoGroup.vue
@@ -38,9 +38,20 @@
placeholder="Search By Name" />
+
+
+
+ {{ data.description }}
+
+
+
+
+
+
- {{ mapDocType(data.type) }}
+ {{data.type.replace(/_/g, ' ').replace(/\b\w/g, char => char.toUpperCase())}}
+
+
+
+ {{ data.videoCount }}
+
+
+
+
+
+
@@ -79,6 +101,11 @@
+
+
+
+
{
- const mapping = {
- 'functional_video': 'Functional Video',
- 'code_instruction_video': 'Code Instruction Video',
- 'specification_video': 'Specification Video',
- 'other_video': 'Other'
- };
- return mapping[type] || type;
-};
-onMounted(() => {
- userPrefStore.fetchUserData().then(() => {
- loadVideoGroups();
- });
+onMounted(async () => {
+ await userPrefStore.fetchUserData();
+ await ksVideoGroupStore.fetchKsVideoGroup(userPrefStore.selectedProject.id);
+ const groupIdsArr = (ksVideoGroupStore.ksVideoGroup || []).map(g => g.id);
+ const groupIds = groupIdsArr.join(',');
+ await ksVideoGroupStore.fetchVideoCountsByGroup(groupIds);
+ videoGroups.value = getCustomDateAndCountwithAllResponse();
});
const loadVideoGroups = async () => {
- ksVideoGroupStore.fetchKsVideoGroup(userPrefStore.selectedProject.id).then(() => {
- videoGroups.value = getCustomDatewithAllResponse();
- });
+ await ksVideoGroupStore.fetchKsVideoGroup(userPrefStore.selectedProject.id);
+ videoGroups.value = getCustomDatewithAllResponse();
};
-const getCustomDatewithAllResponse = () => {
+const getCustomDateAndCountwithAllResponse = () => {
+ const counts = ksVideoGroupStore.getVideoCountsByGroup || [];
+ const countMap = {};
+ counts.forEach(c => { countMap[c.id] = c.count; });
+
return [...(ksVideoGroupStore.ksVideoGroup || [])].map((d) => {
d.date = new Date(d.date);
+ d.videoCount = countMap[d.id] || 0;
return d;
});
};
@@ -200,14 +225,15 @@ const openNewGroupModal = () => {
const closeNewGroupModal = () => {
showNewGroupModal.value = false;
- newGroup.value = { name: '', type: '' };
+ newGroup.value = { name: '', description: '', type: '' };
};
const saveNewGroup = async () => {
formDataToSend.value = new FormData(); // Reset del formData ogni volta
- if (newGroup.value.name && newGroup.value.type) {
+ if (newGroup.value.name && newGroup.value.description && newGroup.value.type) {
try {
formDataToSend.value.append('name', newGroup.value.name.trim());
+ formDataToSend.value.append('description', newGroup.value.description)
formDataToSend.value.append('type', newGroup.value.type);
formDataToSend.value.append('projectId', userPrefStore.selectedProject.id);
formDataToSend.value.append('applicationId', "");
@@ -218,9 +244,6 @@ const saveNewGroup = async () => {
showDialog.value = true;
return;
}
- // Add the name to the response data for display
- //const groupType = groupTypes.find(type => type.value === response.data.type);
- //response.data.type = groupType ? groupType.name : response.data.type;
videoGroups.value.push(response.data);
await loadVideoGroups();
closeNewGroupModal();