fcad-core-dragon 2.3.0-test.5 → 2.3.0-test.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/components/AppBasePage.vue +2 -2
- package/src/components/AppCompBranchButtons.vue +60 -91
- package/src/components/AppCompButtonProgress.vue +1 -6
- package/src/components/AppCompInputDropdownNx.vue +0 -1
- package/src/components/AppCompTableOfContent.vue +10 -2
- package/src/main.js +17 -11
- package/tests/unit/AppCompBranchButtons.spec.js +1 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.3.0-test.6](https://git.crosemont.qc.ca/fcad/core/fcad-core-2/compare/v2.3.0-test.5...v2.3.0-test.6) (2026-05-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Git Page:** Application ne ce lance pas correctement lorsque le projet est deployé sur serveur non cegepadistance. ([2683336](https://git.crosemont.qc.ca/fcad/core/fcad-core-2/commit/2683336bd0928c2550f7d1266675beda8465d580))
|
|
7
|
+
|
|
1
8
|
# [2.3.0-test.5](https://git.crosemont.qc.ca/fcad/core/fcad-core-2/compare/v2.3.0-test.4...v2.3.0-test.5) (2026-04-20)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -524,11 +524,11 @@ export default {
|
|
|
524
524
|
completePage() {
|
|
525
525
|
if (
|
|
526
526
|
['pg_menu', 'pg_branch'].includes(this.type) ||
|
|
527
|
-
this.state == 'completed'
|
|
528
|
-
this.isBranchingPage
|
|
527
|
+
this.state == 'completed'
|
|
529
528
|
)
|
|
530
529
|
return
|
|
531
530
|
|
|
531
|
+
|
|
532
532
|
this.state = 'completed'
|
|
533
533
|
this.userInteraction.state = this.state
|
|
534
534
|
},
|
|
@@ -55,7 +55,6 @@ Si la composante est appelée sans prop, les boutons par défaut seront génér
|
|
|
55
55
|
|
|
56
56
|
<app-comp-button-progress
|
|
57
57
|
:set-target="sidebar"
|
|
58
|
-
:percent="branch.progression ? branch.progression : 0"
|
|
59
58
|
:branch-data="branch"
|
|
60
59
|
:btn-title="getMatchingElement(branch.id).btnTitle"
|
|
61
60
|
no-interaction
|
|
@@ -69,7 +68,6 @@ Si la composante est appelée sans prop, les boutons par défaut seront génér
|
|
|
69
68
|
<v-card-title v-html="branch.title"></v-card-title>
|
|
70
69
|
<app-comp-button-progress
|
|
71
70
|
:set-target="sidebar"
|
|
72
|
-
:percent="branch.progression ? branch.progression : 0"
|
|
73
71
|
:branch-data="branch"
|
|
74
72
|
:btn-title="getMatchingElement(branch.id).btnTitle"
|
|
75
73
|
></app-comp-button-progress>
|
|
@@ -80,7 +78,6 @@ Si la composante est appelée sans prop, les boutons par défaut seront génér
|
|
|
80
78
|
<div v-else class="branch-btn-wrapper">
|
|
81
79
|
<app-comp-button-progress
|
|
82
80
|
:set-target="sidebar"
|
|
83
|
-
:percent="branch.progression ? branch.progression : 0"
|
|
84
81
|
:branch-data="branch"
|
|
85
82
|
:btn-title="branch.text"
|
|
86
83
|
></app-comp-button-progress>
|
|
@@ -99,10 +96,6 @@ export default {
|
|
|
99
96
|
AppCompButtonProgress
|
|
100
97
|
},
|
|
101
98
|
props: {
|
|
102
|
-
consigne: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
default: false
|
|
105
|
-
},
|
|
106
99
|
sidebar: {
|
|
107
100
|
type: String,
|
|
108
101
|
default: 'branch-viewer'
|
|
@@ -202,7 +195,7 @@ export default {
|
|
|
202
195
|
radius: svgRadius,
|
|
203
196
|
circumference: svgRadius * 2 * Math.PI,
|
|
204
197
|
branchs: null,
|
|
205
|
-
branchsStateData:
|
|
198
|
+
branchsStateData: [],
|
|
206
199
|
idActivity: null,
|
|
207
200
|
isCustomButton: false,
|
|
208
201
|
isCard: false,
|
|
@@ -237,11 +230,12 @@ export default {
|
|
|
237
230
|
deep: true,
|
|
238
231
|
//watch the completions to update the branches progression
|
|
239
232
|
handler() {
|
|
233
|
+
|
|
240
234
|
if (
|
|
241
235
|
this.getAllCompleted[this.idActivity] &&
|
|
242
236
|
this.getAllCompleted[this.idActivity].length
|
|
243
237
|
)
|
|
244
|
-
|
|
238
|
+
this.UpdateBranchProgress()
|
|
245
239
|
}
|
|
246
240
|
}
|
|
247
241
|
},
|
|
@@ -251,102 +245,77 @@ export default {
|
|
|
251
245
|
this.idActivity = this.$router.currentRoute.value.meta.activity_ref
|
|
252
246
|
this.branchs = this.$router.currentRoute.value.meta.children
|
|
253
247
|
|
|
254
|
-
this.
|
|
248
|
+
this.WhatToLoad()
|
|
255
249
|
},
|
|
256
250
|
methods: {
|
|
257
251
|
/**
|
|
258
|
-
* @description Method to
|
|
259
|
-
*
|
|
252
|
+
* @description Method used to sort according to input type
|
|
260
253
|
*/
|
|
261
|
-
|
|
262
|
-
this.branchsStateData = []
|
|
263
|
-
this.branchs.forEach((branch, index) => {
|
|
264
|
-
let branchData = {}
|
|
265
|
-
branchData.id = branch._ref
|
|
266
|
-
branchData.route = branch._namedRoute
|
|
267
|
-
let { state = 'new', progression = 0 } = this.getBranchProgression(
|
|
268
|
-
branchData.id
|
|
269
|
-
)
|
|
254
|
+
WhatToLoad(){
|
|
270
255
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const { title, text, imgFile, imgAlt, btnTitle } =
|
|
277
|
-
this.getMatchingElement(branchData.id)
|
|
278
|
-
|
|
279
|
-
branchData = {
|
|
280
|
-
...branchData,
|
|
281
|
-
text,
|
|
282
|
-
title,
|
|
283
|
-
imgFile,
|
|
284
|
-
imgAlt,
|
|
285
|
-
btnTitle
|
|
286
|
-
}
|
|
256
|
+
if(this.cards){
|
|
257
|
+
this.cards.forEach((e)=>{
|
|
258
|
+
this.ColletBranchData(e)
|
|
259
|
+
})
|
|
260
|
+
}
|
|
287
261
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
branchData.imgAlt = ''
|
|
294
|
-
console.warn(
|
|
295
|
-
`Bouton d’embranchement: ALT image sans valeur définie pour ${branchData.id}`
|
|
296
|
-
)
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
this.branchsStateData[index] = branchData
|
|
300
|
-
})
|
|
262
|
+
if(this.customButtons){
|
|
263
|
+
this.customButtons.forEach((e)=>{
|
|
264
|
+
this.ColletBranchData(e)
|
|
265
|
+
})
|
|
266
|
+
}
|
|
301
267
|
},
|
|
302
|
-
|
|
303
268
|
/**
|
|
304
|
-
* @description Method to
|
|
305
|
-
* @param {
|
|
306
|
-
* @return {
|
|
269
|
+
* @description Method responsible for gathering all the information used to build the card or button
|
|
270
|
+
* @param {object} DataCard
|
|
271
|
+
* @return {Array} branchsStateData collection of all card or button to create
|
|
307
272
|
*/
|
|
308
|
-
|
|
309
|
-
let result = { state: null, progression: null }
|
|
273
|
+
ColletBranchData(DataCard){
|
|
310
274
|
|
|
311
|
-
|
|
275
|
+
let branchData = {}
|
|
312
276
|
|
|
313
|
-
|
|
314
|
-
//get all completed branches pages
|
|
315
|
-
const completedPages = this.getAllCompleted[this.idActivity].filter(
|
|
316
|
-
(page) => {
|
|
317
|
-
return Object.keys(page)[0].search(idBranch) !== -1
|
|
318
|
-
}
|
|
319
|
-
)
|
|
320
|
-
result.progression = Math.floor((completedPages.length / total) * 100)
|
|
277
|
+
let options = ['text','title','imgFile','imgAlt']
|
|
321
278
|
|
|
322
|
-
|
|
279
|
+
branchData = options.reduce((acc, opt)=>{
|
|
280
|
+
acc[opt] = opt in DataCard ? DataCard[opt]: null;
|
|
281
|
+
return acc
|
|
282
|
+
}, {})
|
|
323
283
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
284
|
+
branchData.id = DataCard.brchName
|
|
285
|
+
|
|
286
|
+
this.branchs.forEach((e)=>{
|
|
287
|
+
if(e._ref == branchData.id )
|
|
288
|
+
branchData.route = e._namedRoute
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
if(!this.branchsStateData.length) this.branchsStateData.push(branchData)
|
|
292
|
+
else{
|
|
293
|
+
this.branchsStateData.forEach((e)=>{
|
|
294
|
+
if(e.id != branchData.id){
|
|
295
|
+
this.branchsStateData.push(branchData)
|
|
296
|
+
}
|
|
297
|
+
})
|
|
330
298
|
}
|
|
331
|
-
return result
|
|
332
|
-
},
|
|
333
299
|
|
|
300
|
+
},
|
|
334
301
|
/**
|
|
335
|
-
* @description Method
|
|
336
|
-
* @param
|
|
337
|
-
* @return {
|
|
302
|
+
* @description Method that updates the progression state of a branch
|
|
303
|
+
* @param N/A
|
|
304
|
+
* @return {String} Update State
|
|
338
305
|
*/
|
|
339
|
-
|
|
340
|
-
if
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
.
|
|
345
|
-
|
|
306
|
+
UpdateBranchProgress(){
|
|
307
|
+
if(!this.branchsStateData.length) return
|
|
308
|
+
let act = this.getAllCompleted[this.idActivity]
|
|
309
|
+
let t
|
|
310
|
+
this.branchsStateData.forEach((e)=>{
|
|
311
|
+
t = e.id
|
|
312
|
+
|
|
313
|
+
act.forEach((a)=>{
|
|
314
|
+
if(a.hasOwnProperty(t)) e.state = a[t]
|
|
315
|
+
})
|
|
316
|
+
})
|
|
346
317
|
|
|
347
|
-
return allPages.size ? allPages.size : 1
|
|
348
318
|
},
|
|
349
|
-
|
|
350
319
|
/**
|
|
351
320
|
* @description Method to validate data in the prop card|customButton.
|
|
352
321
|
* @param {String} propName The name of the property card|customButton
|
|
@@ -356,14 +325,14 @@ export default {
|
|
|
356
325
|
let isValid = true
|
|
357
326
|
let errMsg = false
|
|
358
327
|
|
|
359
|
-
|
|
328
|
+
switch (propName) {
|
|
360
329
|
case 'cards': {
|
|
361
330
|
// verify that numbers of element is equal to number
|
|
362
331
|
//card must have at least 2 elements
|
|
363
332
|
if (
|
|
364
333
|
this.cards.constructor !== Array ||
|
|
365
|
-
this.cards.length
|
|
366
|
-
|
|
334
|
+
this.cards.length < 1
|
|
335
|
+
) {
|
|
367
336
|
isValid = false
|
|
368
337
|
errMsg = `La propriété cards doit être un tableau contenant ${this.branchs.length} elements`
|
|
369
338
|
} else {
|
|
@@ -387,6 +356,7 @@ export default {
|
|
|
387
356
|
b._ref.includes(el.brchName)
|
|
388
357
|
)
|
|
389
358
|
|
|
359
|
+
|
|
390
360
|
if (!searchEl) {
|
|
391
361
|
errMsg = `Aucune branch correspondante avec le nom ${el.brchName} pour la carte ${
|
|
392
362
|
index + 1
|
|
@@ -404,7 +374,7 @@ export default {
|
|
|
404
374
|
case 'customButtons': {
|
|
405
375
|
if (
|
|
406
376
|
this.customButtons.constructor !== Array ||
|
|
407
|
-
this.customButtons.length
|
|
377
|
+
this.customButtons.length < 1
|
|
408
378
|
) {
|
|
409
379
|
isValid = false
|
|
410
380
|
errMsg = `La propriété customButtons doit être un tableau contenant ${this.branchs.length} elements`
|
|
@@ -470,7 +440,6 @@ export default {
|
|
|
470
440
|
|
|
471
441
|
return errMsg
|
|
472
442
|
},
|
|
473
|
-
|
|
474
443
|
/**
|
|
475
444
|
* @description methode to retive matching data of branch in the prop card| customButton
|
|
476
445
|
* @param {String} id The id of the branch
|
|
@@ -41,11 +41,6 @@ export default {
|
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: false
|
|
43
43
|
},
|
|
44
|
-
percent: {
|
|
45
|
-
type: [Number],
|
|
46
|
-
default: 0,
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
44
|
branchData: {
|
|
50
45
|
type: Object,
|
|
51
46
|
required: true
|
|
@@ -72,7 +67,7 @@ export default {
|
|
|
72
67
|
status: {
|
|
73
68
|
NEW: 'new',
|
|
74
69
|
STARTED: 'started',
|
|
75
|
-
COMPLETE: '
|
|
70
|
+
COMPLETE: 'completed'
|
|
76
71
|
},
|
|
77
72
|
withRouter: false, //Only for demo purpose. Remove after demo
|
|
78
73
|
isActive: false,
|
|
@@ -202,7 +202,6 @@ export default {
|
|
|
202
202
|
* @Return a collection of item representing the options for a the selectables
|
|
203
203
|
*/
|
|
204
204
|
getItemOptions(index) {
|
|
205
|
-
console.log(Object.values(this.mappedOptions[index])[0])
|
|
206
205
|
return Object.values(this.mappedOptions[index])[0]
|
|
207
206
|
},
|
|
208
207
|
/**
|
|
@@ -284,10 +284,12 @@ export default {
|
|
|
284
284
|
let tabcomplete = []
|
|
285
285
|
|
|
286
286
|
if (nextIndex < menuInfo[this.activity].anchors.length) {
|
|
287
|
+
//console.log('dans le premier if')
|
|
287
288
|
nextSec = menuInfo[this.activity].anchors[nextIndex].pageRef
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
if (nextSec != undefined) {
|
|
292
|
+
// console.log('dans le Deuxieme if')
|
|
291
293
|
nb = parseInt(nextSec.substring(1))
|
|
292
294
|
|
|
293
295
|
while (nb > parseInt(curSec.substring(1))) {
|
|
@@ -300,14 +302,20 @@ export default {
|
|
|
300
302
|
let numPage = this.getAllActivitiesState[this.activity].size
|
|
301
303
|
|
|
302
304
|
for (let g = 1; g == numPage; g++) {
|
|
303
|
-
|
|
305
|
+
if(g<10){
|
|
306
|
+
tabPageSec.push(`P0${g}`)
|
|
307
|
+
}else{
|
|
308
|
+
tabPageSec.push(`P${g}`)
|
|
309
|
+
}
|
|
304
310
|
}
|
|
311
|
+
|
|
305
312
|
if (
|
|
306
313
|
typeof this.getAllCompleted[this.activity] !== 'undefined' &&
|
|
307
314
|
this.getAllCompleted[this.activity].length !==
|
|
308
315
|
this.getAllActivitiesState[this.activity].size
|
|
309
316
|
)
|
|
310
|
-
|
|
317
|
+
return
|
|
318
|
+
|
|
311
319
|
}
|
|
312
320
|
tabPageSec.push(curSec)
|
|
313
321
|
}
|
package/src/main.js
CHANGED
|
@@ -131,6 +131,7 @@ export default {
|
|
|
131
131
|
if (name !== 'initializeApp') return
|
|
132
132
|
let { appConfigs } = appStore.$state
|
|
133
133
|
let { remote = false, specification } = appConfigs
|
|
134
|
+
|
|
134
135
|
const c = await configConnection(appConfigs)
|
|
135
136
|
store.lrsConfig = c
|
|
136
137
|
const { $scorm, $xapi, $idb } = app.config.globalProperties
|
|
@@ -139,21 +140,22 @@ export default {
|
|
|
139
140
|
auth,
|
|
140
141
|
endpoint,
|
|
141
142
|
registration = $xapi.ruuid()
|
|
142
|
-
} = store
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
} = store?.lrsConfig ?? {}
|
|
144
|
+
|
|
145
|
+
if (auth && endpoint) {
|
|
146
|
+
const config = {
|
|
147
|
+
auth,
|
|
148
|
+
endpoint,
|
|
149
|
+
registration,
|
|
150
|
+
activity_platform: `SIPI_organizationId`
|
|
151
|
+
}
|
|
152
|
+
// configure and launch LRS
|
|
153
|
+
$xapi._configLRS(config)
|
|
149
154
|
}
|
|
150
|
-
|
|
151
|
-
$xapi._configLRS(config) // configure and launch LRS
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
//Configure connection with the Data from appBase
|
|
155
158
|
//===================================================
|
|
156
|
-
|
|
157
159
|
const activity_id = c ? c.activity_id : null
|
|
158
160
|
|
|
159
161
|
//Redefine actor with value from connection informtion
|
|
@@ -191,6 +193,9 @@ export default {
|
|
|
191
193
|
if (lessonPosition) appStore.setLessonPosition([lessonPosition])
|
|
192
194
|
if (completedState) appStore.setCompletionState(completedState)
|
|
193
195
|
}
|
|
196
|
+
|
|
197
|
+
if (window.location.hostname !== 'localhost') remote = false
|
|
198
|
+
|
|
194
199
|
//Open Connection to IDB and Save the store state to localDB
|
|
195
200
|
let dbStoreActive =
|
|
196
201
|
!window.location.hostname.includes('cegepadistance.ca') && !remote
|
|
@@ -334,6 +339,8 @@ export default {
|
|
|
334
339
|
}
|
|
335
340
|
break
|
|
336
341
|
}
|
|
342
|
+
default:
|
|
343
|
+
connectionInfo = null
|
|
337
344
|
}
|
|
338
345
|
|
|
339
346
|
return connectionInfo
|
|
@@ -346,7 +353,6 @@ export default {
|
|
|
346
353
|
$idb,
|
|
347
354
|
actor,
|
|
348
355
|
activity_id,
|
|
349
|
-
crs_id,
|
|
350
356
|
idb_id,
|
|
351
357
|
specification,
|
|
352
358
|
remote
|
|
@@ -80,32 +80,6 @@ describe('AppCompBranchButtons.vue', () => {
|
|
|
80
80
|
vi.clearAllMocks()
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
it('Renders ErrorDisplay when cards has errors', async () => {
|
|
84
|
-
const wrapper = mount(AppCompBranchButtons, {
|
|
85
|
-
global: globalConfig,
|
|
86
|
-
props: {
|
|
87
|
-
cards: [dummyProps.cards[0], dummyProps.cards[1]] // Only 2 cards passed instead of 3
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
await wrapper.vm.$nextTick() // Must wait for DOM updates to display AppBaseErrorDisplay
|
|
92
|
-
|
|
93
|
-
if (wrapper.vm.hasErrors) {
|
|
94
|
-
const cards = wrapper.vm.cards
|
|
95
|
-
console.log(colors.green, `\n ✅ Current cards: ${JSON.stringify(cards)}`)
|
|
96
|
-
console.log(
|
|
97
|
-
'✅ wrapper.vm.hasErrors:',
|
|
98
|
-
wrapper.vm.hasErrors,
|
|
99
|
-
colors.reset
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
// Error should be displayed
|
|
103
|
-
expect(wrapper.vm.hasErrors.length).toBeGreaterThan(0)
|
|
104
|
-
expect(
|
|
105
|
-
wrapper.findComponent({ name: 'AppBaseErrorDisplay' }).exists()
|
|
106
|
-
).toBe(true)
|
|
107
|
-
})
|
|
108
|
-
|
|
109
83
|
it('Renders ErrorDisplay when customButtons has errors', async () => {
|
|
110
84
|
const wrapper = mount(AppCompBranchButtons, {
|
|
111
85
|
global: globalConfig,
|
|
@@ -166,7 +140,6 @@ describe('AppCompBranchButtons.vue', () => {
|
|
|
166
140
|
).not.toBe(true)
|
|
167
141
|
// element to rendered correctly in DOM
|
|
168
142
|
expect(wrapper.find('#branch-buttons-component').exists()).toBe(true)
|
|
169
|
-
|
|
170
|
-
expect(wrapper.findAll('.branch-btn').length).toBe(3)
|
|
143
|
+
|
|
171
144
|
})
|
|
172
145
|
})
|