@abi-software/map-side-bar 2.10.0 → 2.10.2
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/dist/map-side-bar.js +4778 -4672
- package/dist/map-side-bar.umd.cjs +34 -34
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/components/AnnotationTool.vue +1 -0
- package/src/components/ConnectivityCard.vue +8 -0
- package/src/components/ConnectivityExplorer.vue +24 -2
- package/src/components/ConnectivityInfo.vue +37 -2
- package/src/components/DatasetExplorer.vue +24 -2
- package/src/components/SearchHistory.vue +29 -0
- package/src/components/SideBar.vue +20 -0
- package/src/components/Tabs.vue +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/*",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"./src/*": "./src/*"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@abi-software/gallery": "^1.
|
|
41
|
+
"@abi-software/gallery": "^1.2.0",
|
|
42
42
|
"@abi-software/map-utilities": "^1.7.0",
|
|
43
|
-
"@abi-software/svg-sprite": "^1.0.
|
|
43
|
+
"@abi-software/svg-sprite": "^1.0.2",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
|
46
46
|
"element-plus": "2.8.4",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:annotationEntry="annotationEntry"
|
|
14
14
|
@annotation="$emit('annotation', $event)"
|
|
15
15
|
@hover-changed="$emit('hover-changed', $event)"
|
|
16
|
+
@trackEvent="$emit('trackEvent', $event)"
|
|
16
17
|
/>
|
|
17
18
|
<div v-if="createData && createData.toBeDeleted" class="delete-container">
|
|
18
19
|
<el-row>
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script>
|
|
29
|
+
import EventBus from './EventBus';
|
|
30
|
+
|
|
29
31
|
export default {
|
|
30
32
|
name: "ConnectivityCard",
|
|
31
33
|
data() {
|
|
@@ -71,6 +73,12 @@ export default {
|
|
|
71
73
|
cardClicked: function (data) {
|
|
72
74
|
if (!this.loading) {
|
|
73
75
|
this.$emit("open-connectivity", data);
|
|
76
|
+
|
|
77
|
+
EventBus.emit('trackEvent', {
|
|
78
|
+
'event_name': `portal_maps_connectivity_open`,
|
|
79
|
+
'category': data.id || '',
|
|
80
|
+
'location': 'map_sidebar_connectivity',
|
|
81
|
+
});
|
|
74
82
|
}
|
|
75
83
|
},
|
|
76
84
|
},
|
|
@@ -371,6 +371,12 @@ export default {
|
|
|
371
371
|
tabType: 'dataset',
|
|
372
372
|
type: 'reset-update',
|
|
373
373
|
})
|
|
374
|
+
|
|
375
|
+
EventBus.emit('trackEvent', {
|
|
376
|
+
'event_name': `portal_maps_action_filter`,
|
|
377
|
+
'category': `reset`,
|
|
378
|
+
'location': 'map_sidebar_connectivity',
|
|
379
|
+
});
|
|
374
380
|
},
|
|
375
381
|
openSearch: function (filter, search = "") {
|
|
376
382
|
this.searchInput = search;
|
|
@@ -509,15 +515,31 @@ export default {
|
|
|
509
515
|
},
|
|
510
516
|
numberPerPageUpdate: function (val) {
|
|
511
517
|
this.numberPerPage = val;
|
|
512
|
-
|
|
518
|
+
|
|
519
|
+
EventBus.emit('trackEvent', {
|
|
520
|
+
'event_name': `portal_maps_connectivity_perPage`,
|
|
521
|
+
'category': val,
|
|
522
|
+
'location': 'map_sidebar_connectivity',
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
const preventPaginationTracking = this.page === 1;
|
|
526
|
+
this.pageChange(1, preventPaginationTracking);
|
|
513
527
|
},
|
|
514
|
-
pageChange: function (page) {
|
|
528
|
+
pageChange: function (page, preventPaginationTracking = false) {
|
|
515
529
|
this.start = (page - 1) * this.numberPerPage;
|
|
516
530
|
this.page = page;
|
|
517
531
|
this.expanded = "";
|
|
518
532
|
this.expandedData = null;
|
|
519
533
|
this.scrollToTop();
|
|
520
534
|
// this.searchKnowledge(this.filter, this.searchInput);
|
|
535
|
+
|
|
536
|
+
if (!preventPaginationTracking) {
|
|
537
|
+
EventBus.emit('trackEvent', {
|
|
538
|
+
'event_name': `portal_maps_connectivity_pagination`,
|
|
539
|
+
'category': `page_${this.page}`,
|
|
540
|
+
'location': 'map_sidebar_connectivity',
|
|
541
|
+
});
|
|
542
|
+
}
|
|
521
543
|
},
|
|
522
544
|
scrollToTop: function () {
|
|
523
545
|
if (this.$refs.content) {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
Show connectivity on map
|
|
50
50
|
</span>
|
|
51
51
|
</el-popover>
|
|
52
|
-
<CopyToClipboard :content="updatedCopyContent" />
|
|
52
|
+
<CopyToClipboard @copied="onCopied" :content="updatedCopyContent" />
|
|
53
53
|
<template v-if="withCloseButton">
|
|
54
54
|
<el-popover
|
|
55
55
|
width="auto"
|
|
@@ -188,6 +188,7 @@
|
|
|
188
188
|
:resources="resources"
|
|
189
189
|
@references-loaded="onReferencesLoaded"
|
|
190
190
|
@show-reference-connectivities="onShowReferenceConnectivities"
|
|
191
|
+
@trackEvent="onTrackEvent"
|
|
191
192
|
/>
|
|
192
193
|
</div>
|
|
193
194
|
</div>
|
|
@@ -363,6 +364,19 @@ export default {
|
|
|
363
364
|
const featureIds = this.entry.featureId || [];
|
|
364
365
|
// connected to flatmapvuer > moveMap(featureIds) function
|
|
365
366
|
this.$emit('show-connectivity', featureIds);
|
|
367
|
+
|
|
368
|
+
EventBus.emit('trackEvent', {
|
|
369
|
+
'event_name': `portal_maps_show_connectivity_on_map`,
|
|
370
|
+
'category': this.entry.id || '',
|
|
371
|
+
'location': 'map_sidebar_connectivity',
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
onCopied: function () {
|
|
375
|
+
EventBus.emit('trackEvent', {
|
|
376
|
+
'event_name': `portal_maps_connectivity_copy`,
|
|
377
|
+
'category': this.entry.id || '',
|
|
378
|
+
'location': 'map_sidebar_connectivity',
|
|
379
|
+
});
|
|
366
380
|
},
|
|
367
381
|
switchConnectivityView: function (val) {
|
|
368
382
|
this.activeView = val;
|
|
@@ -374,6 +388,12 @@ export default {
|
|
|
374
388
|
this.graphViewLoaded = true;
|
|
375
389
|
});
|
|
376
390
|
}
|
|
391
|
+
|
|
392
|
+
EventBus.emit('trackEvent', {
|
|
393
|
+
'event_name': `portal_maps_connectivity_switch_view`,
|
|
394
|
+
'category': val,
|
|
395
|
+
'location': 'map_sidebar_connectivity',
|
|
396
|
+
});
|
|
377
397
|
},
|
|
378
398
|
onTapNode: function (data) {
|
|
379
399
|
// save selected state for list view
|
|
@@ -456,7 +476,7 @@ export default {
|
|
|
456
476
|
const transformedNerves = transformData(title, nerveLabels);
|
|
457
477
|
contentArray.push(transformedNerves);
|
|
458
478
|
}
|
|
459
|
-
|
|
479
|
+
|
|
460
480
|
// Origins
|
|
461
481
|
if (this.origins?.length) {
|
|
462
482
|
const title = 'Origin';
|
|
@@ -562,6 +582,12 @@ export default {
|
|
|
562
582
|
entry: this.entry,
|
|
563
583
|
connectivitySource: connectivitySource,
|
|
564
584
|
});
|
|
585
|
+
|
|
586
|
+
EventBus.emit('trackEvent', {
|
|
587
|
+
'event_name': `portal_maps_connectivity_source_change`,
|
|
588
|
+
'category': connectivitySource,
|
|
589
|
+
'location': 'map_sidebar_connectivity',
|
|
590
|
+
});
|
|
565
591
|
},
|
|
566
592
|
updateGraphConnectivity: function () {
|
|
567
593
|
if (this.connectivitySource === "map") {
|
|
@@ -605,6 +631,15 @@ export default {
|
|
|
605
631
|
},
|
|
606
632
|
closeConnectivity: function () {
|
|
607
633
|
this.$emit('close-connectivity');
|
|
634
|
+
|
|
635
|
+
EventBus.emit('trackEvent', {
|
|
636
|
+
'event_name': `portal_maps_connectivity_close`,
|
|
637
|
+
'category': this.entry.id || '',
|
|
638
|
+
'location': 'map_sidebar_connectivity',
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
onTrackEvent: function (data) {
|
|
642
|
+
EventBus.emit('trackEvent', data);
|
|
608
643
|
},
|
|
609
644
|
},
|
|
610
645
|
mounted: function () {
|
|
@@ -266,6 +266,12 @@ export default {
|
|
|
266
266
|
tabType: 'dataset',
|
|
267
267
|
type: 'reset-update',
|
|
268
268
|
})
|
|
269
|
+
|
|
270
|
+
EventBus.emit('trackEvent', {
|
|
271
|
+
'event_name': `portal_maps_action_filter`,
|
|
272
|
+
'category': `reset`,
|
|
273
|
+
'location': 'map_sidebar_dataset',
|
|
274
|
+
});
|
|
269
275
|
},
|
|
270
276
|
searchEvent: function (event = false) {
|
|
271
277
|
if (event.keyCode === 13 || event instanceof MouseEvent) {
|
|
@@ -330,9 +336,17 @@ export default {
|
|
|
330
336
|
},
|
|
331
337
|
numberPerPageUpdate: function (val) {
|
|
332
338
|
this.numberPerPage = val
|
|
333
|
-
|
|
339
|
+
|
|
340
|
+
EventBus.emit('trackEvent', {
|
|
341
|
+
'event_name': `portal_maps_dataset_perPage`,
|
|
342
|
+
'category': val + '',
|
|
343
|
+
'location': 'map_sidebar_dataset',
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
const preventPaginationTracking = this.page === 1;
|
|
347
|
+
this.pageChange(1, preventPaginationTracking)
|
|
334
348
|
},
|
|
335
|
-
pageChange: function (page) {
|
|
349
|
+
pageChange: function (page, preventPaginationTracking = false) {
|
|
336
350
|
this.start = (page - 1) * this.numberPerPage
|
|
337
351
|
this.page = page
|
|
338
352
|
this.searchAlgolia(
|
|
@@ -341,6 +355,14 @@ export default {
|
|
|
341
355
|
this.numberPerPage,
|
|
342
356
|
this.page
|
|
343
357
|
)
|
|
358
|
+
|
|
359
|
+
if (!preventPaginationTracking) {
|
|
360
|
+
EventBus.emit('trackEvent', {
|
|
361
|
+
'event_name': `portal_maps_dataset_pagination`,
|
|
362
|
+
'category': `page_${this.page}`,
|
|
363
|
+
'location': 'map_sidebar_dataset',
|
|
364
|
+
});
|
|
365
|
+
}
|
|
344
366
|
},
|
|
345
367
|
handleMissingData: function (doi) {
|
|
346
368
|
let i = this.results.findIndex((res) => res.doi === doi)
|
|
@@ -344,8 +344,22 @@ export default {
|
|
|
344
344
|
// Save updated data
|
|
345
345
|
localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory))
|
|
346
346
|
},
|
|
347
|
+
getParentComponentName: function () {
|
|
348
|
+
const isConnectivity = this.localStorageKey?.indexOf('connectivity') !== -1;
|
|
349
|
+
const isDataset = this.localStorageKey?.indexOf('dataset') !== -1;
|
|
350
|
+
const location = isConnectivity ? 'connectivity' : isDataset ? 'dataset' : '';
|
|
351
|
+
return location;
|
|
352
|
+
},
|
|
347
353
|
search: function (item) {
|
|
348
354
|
this.$emit('search', item)
|
|
355
|
+
|
|
356
|
+
// Event tracking
|
|
357
|
+
const location = this.getParentComponentName();
|
|
358
|
+
EventBus.emit('trackEvent', {
|
|
359
|
+
'event_name': `portal_maps_search_history_click`,
|
|
360
|
+
'category': item.longLabel || item.label,
|
|
361
|
+
'location': `map_sidebar_${location}`,
|
|
362
|
+
});
|
|
349
363
|
},
|
|
350
364
|
searchHistoryItemLabel: function (search, filters) {
|
|
351
365
|
let label = search ? `"${search.trim()}"` : '';
|
|
@@ -389,12 +403,27 @@ export default {
|
|
|
389
403
|
});
|
|
390
404
|
this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
|
|
391
405
|
this.updateSearchHistory();
|
|
406
|
+
|
|
407
|
+
const eventName = item.saved ? 'portal_maps_search_history_saved' : 'portal_maps_search_history_unsaved';
|
|
408
|
+
const location = this.getParentComponentName();
|
|
409
|
+
EventBus.emit('trackEvent', {
|
|
410
|
+
'event_name': eventName,
|
|
411
|
+
'category': item.longLabel || item.label,
|
|
412
|
+
'location': `map_sidebar_${location}`,
|
|
413
|
+
});
|
|
392
414
|
},
|
|
393
415
|
removeFromSavedSearch: function (item) {
|
|
394
416
|
const itemIndex = this.searchHistory.findIndex((_item) => _item.id === item.id);
|
|
395
417
|
this.searchHistory.splice(itemIndex, 1);
|
|
396
418
|
this.savedSearchHistory = this.searchHistory.filter((item) => item.saved);
|
|
397
419
|
this.updateSearchHistory();
|
|
420
|
+
|
|
421
|
+
const location = this.getParentComponentName();
|
|
422
|
+
EventBus.emit('trackEvent', {
|
|
423
|
+
'event_name': 'portal_maps_search_history_removed',
|
|
424
|
+
'category': item.longLabel || item.label,
|
|
425
|
+
'location': `map_sidebar_${location}`,
|
|
426
|
+
});
|
|
398
427
|
},
|
|
399
428
|
},
|
|
400
429
|
}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
:activeId="activeTabId"
|
|
28
28
|
@tabClicked="tabClicked"
|
|
29
29
|
@tabClosed="tabClosed"
|
|
30
|
+
@trackEvent="trackEvent"
|
|
30
31
|
/>
|
|
31
32
|
<template v-for="tab in tabs" key="tab.id">
|
|
32
33
|
<template v-if="tab.type === 'annotation'">
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
@cancel-create="$emit('cancel-create')"
|
|
41
42
|
@confirm-delete="$emit('confirm-delete', $event)"
|
|
42
43
|
@hover-changed="hoverChanged(tab.id, $event)"
|
|
44
|
+
@trackEvent="trackEvent"
|
|
43
45
|
/>
|
|
44
46
|
</template>
|
|
45
47
|
<template v-else-if="tab.type === 'connectivityExplorer'">
|
|
@@ -464,6 +466,19 @@ export default {
|
|
|
464
466
|
});
|
|
465
467
|
}
|
|
466
468
|
},
|
|
469
|
+
/**
|
|
470
|
+
* @public
|
|
471
|
+
* Track an event for analytics
|
|
472
|
+
* @param {Object} `data` - The event data
|
|
473
|
+
*/
|
|
474
|
+
trackEvent: function (data) {
|
|
475
|
+
const taggingData = {
|
|
476
|
+
'event': 'interaction_event',
|
|
477
|
+
'location': 'map_sidebar',
|
|
478
|
+
...data,
|
|
479
|
+
};
|
|
480
|
+
this.$emit('trackEvent', taggingData);
|
|
481
|
+
}
|
|
467
482
|
},
|
|
468
483
|
computed: {
|
|
469
484
|
// This should respect the information provided by the property
|
|
@@ -536,6 +551,11 @@ export default {
|
|
|
536
551
|
this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
|
|
537
552
|
this.storeAvailableAnatomyFacets(this.availableAnatomyFacets);
|
|
538
553
|
})
|
|
554
|
+
|
|
555
|
+
// Event tracking
|
|
556
|
+
EventBus.on('trackEvent', (data) => {
|
|
557
|
+
this.trackEvent(data);
|
|
558
|
+
});
|
|
539
559
|
},
|
|
540
560
|
}
|
|
541
561
|
</script>
|
package/src/components/Tabs.vue
CHANGED
|
@@ -59,6 +59,14 @@ export default {
|
|
|
59
59
|
methods: {
|
|
60
60
|
tabClicked: function (tab) {
|
|
61
61
|
this.$emit("tabClicked", { id: tab.id, type: tab.type });
|
|
62
|
+
|
|
63
|
+
// To track only direct tab click events
|
|
64
|
+
this.$emit('trackEvent', {
|
|
65
|
+
'event': 'interaction_event',
|
|
66
|
+
'event_name': 'portal_maps_sidebar_open_tab',
|
|
67
|
+
'category': tab.type,
|
|
68
|
+
'location': 'map_sidebar_tabs',
|
|
69
|
+
});
|
|
62
70
|
},
|
|
63
71
|
tabClosed: function (tab) {
|
|
64
72
|
this.$emit("tabClosed", { id: tab.id, type: tab.type });
|