@abi-software/map-side-bar 2.7.2-beta.6 → 2.7.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 +5580 -5620
- package/dist/map-side-bar.umd.cjs +62 -62
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/ConnectivityInfo.vue +32 -63
- package/src/components/SearchFilters.vue +0 -13
- package/src/components/SideBar.vue +4 -4
- package/src/exampleConnectivityInput.js +2 -2
- package/src/services/flatmapKnowledge.js +94 -0
- package/src/services/flatmapQueries.js +498 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.7.2
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/*",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@abi-software/gallery": "^1.1.2",
|
|
42
|
-
"@abi-software/map-utilities": "^1.4.
|
|
42
|
+
"@abi-software/map-utilities": "^1.4.2",
|
|
43
43
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="entry" class="main" v-loading="loading">
|
|
3
|
-
<div v-if="connectivityEntry.length > 1" class="button-container">
|
|
4
|
-
<el-popover
|
|
5
|
-
width="auto"
|
|
6
|
-
trigger="hover"
|
|
7
|
-
:teleported="false"
|
|
8
|
-
>
|
|
9
|
-
<template #reference>
|
|
10
|
-
<el-button class="button" @click="previous">Previous</el-button>
|
|
11
|
-
</template>
|
|
12
|
-
<span>{{ previousLabel }}</span>
|
|
13
|
-
</el-popover>
|
|
14
|
-
<el-popover
|
|
15
|
-
width="auto"
|
|
16
|
-
trigger="hover"
|
|
17
|
-
:teleported="false"
|
|
18
|
-
>
|
|
19
|
-
<template #reference>
|
|
20
|
-
<el-button class="button" @click="next">Next</el-button>
|
|
21
|
-
</template>
|
|
22
|
-
<span>{{ nextLabel }}</span>
|
|
23
|
-
</el-popover>
|
|
24
|
-
</div>
|
|
25
3
|
<!-- Connectivity Info Title -->
|
|
26
4
|
<div class="connectivity-info-title">
|
|
27
5
|
<div class="title-content">
|
|
@@ -66,7 +44,7 @@
|
|
|
66
44
|
popper-class="popover-map-pin"
|
|
67
45
|
>
|
|
68
46
|
<template #reference>
|
|
69
|
-
<el-button class="button-circle" circle @click="showConnectivity">
|
|
47
|
+
<el-button class="button-circle" circle @click="showConnectivity(entry)">
|
|
70
48
|
<el-icon color="white">
|
|
71
49
|
<el-icon-location />
|
|
72
50
|
</el-icon>
|
|
@@ -147,7 +125,21 @@
|
|
|
147
125
|
class="block"
|
|
148
126
|
>
|
|
149
127
|
<div class="attribute-title-container">
|
|
150
|
-
<
|
|
128
|
+
<span class="attribute-title">Components</span>
|
|
129
|
+
<el-popover
|
|
130
|
+
width="250"
|
|
131
|
+
trigger="hover"
|
|
132
|
+
:teleported="false"
|
|
133
|
+
popper-class="popover-origin-help"
|
|
134
|
+
>
|
|
135
|
+
<template #reference>
|
|
136
|
+
<el-icon class="info"><el-icon-warning /></el-icon>
|
|
137
|
+
</template>
|
|
138
|
+
<span style="word-break: keep-all">
|
|
139
|
+
The list is not in any specific order.<br>
|
|
140
|
+
Specific paths can be viewed using Graph View.
|
|
141
|
+
</span>
|
|
142
|
+
</el-popover>
|
|
151
143
|
</div>
|
|
152
144
|
<div
|
|
153
145
|
v-for="(component, i) in entry.components"
|
|
@@ -299,9 +291,18 @@ export default {
|
|
|
299
291
|
ConnectivityGraph,
|
|
300
292
|
},
|
|
301
293
|
props: {
|
|
302
|
-
|
|
303
|
-
type:
|
|
304
|
-
default:
|
|
294
|
+
entry: {
|
|
295
|
+
type: Object,
|
|
296
|
+
default: () => ({
|
|
297
|
+
destinations: [],
|
|
298
|
+
origins: [],
|
|
299
|
+
components: [],
|
|
300
|
+
destinationsWithDatasets: [],
|
|
301
|
+
originsWithDatasets: [],
|
|
302
|
+
componentsWithDatasets: [],
|
|
303
|
+
resource: undefined,
|
|
304
|
+
featuresAlert: undefined,
|
|
305
|
+
}),
|
|
305
306
|
},
|
|
306
307
|
envVars: {
|
|
307
308
|
type: Object,
|
|
@@ -332,7 +333,7 @@ export default {
|
|
|
332
333
|
timeoutID: undefined,
|
|
333
334
|
graphViewLoaded: false,
|
|
334
335
|
updatedCopyContent: '',
|
|
335
|
-
|
|
336
|
+
sckanVersion: '',
|
|
336
337
|
}
|
|
337
338
|
},
|
|
338
339
|
watch: {
|
|
@@ -345,9 +346,6 @@ export default {
|
|
|
345
346
|
},
|
|
346
347
|
},
|
|
347
348
|
computed: {
|
|
348
|
-
entry: function () {
|
|
349
|
-
return this.connectivityEntry[this.entryIndex];
|
|
350
|
-
},
|
|
351
349
|
resources: function () {
|
|
352
350
|
let resources = [];
|
|
353
351
|
if (this.entry && this.entry.hyperlinks) {
|
|
@@ -375,33 +373,8 @@ export default {
|
|
|
375
373
|
text += ' species'
|
|
376
374
|
return text
|
|
377
375
|
},
|
|
378
|
-
sckanVersion: function () {
|
|
379
|
-
return this.entry.knowledgeSource
|
|
380
|
-
},
|
|
381
|
-
previousLabel: function () {
|
|
382
|
-
if (this.entryIndex === 0) {
|
|
383
|
-
return "This is the first item"
|
|
384
|
-
}
|
|
385
|
-
return this.connectivityEntry[this.entryIndex - 1].title
|
|
386
|
-
},
|
|
387
|
-
nextLabel: function () {
|
|
388
|
-
if (this.entryIndex === this.connectivityEntry.length - 1) {
|
|
389
|
-
return "This is the last item"
|
|
390
|
-
}
|
|
391
|
-
return this.connectivityEntry[this.entryIndex + 1].title
|
|
392
|
-
}
|
|
393
376
|
},
|
|
394
377
|
methods: {
|
|
395
|
-
previous: function () {
|
|
396
|
-
if (this.entryIndex !== 0) {
|
|
397
|
-
this.entryIndex = this.entryIndex - 1;
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
next: function () {
|
|
401
|
-
if (this.entryIndex !== this.connectivityEntry.length - 1) {
|
|
402
|
-
this.entryIndex = this.entryIndex + 1;
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
378
|
titleCase: function (title) {
|
|
406
379
|
return titleCase(title)
|
|
407
380
|
},
|
|
@@ -451,9 +424,9 @@ export default {
|
|
|
451
424
|
pubmedSearchUrlUpdate: function (val) {
|
|
452
425
|
this.pubmedSearchUrl = val
|
|
453
426
|
},
|
|
454
|
-
showConnectivity: function () {
|
|
427
|
+
showConnectivity: function (entry) {
|
|
455
428
|
// move the map center to highlighted area
|
|
456
|
-
const featureIds =
|
|
429
|
+
const featureIds = entry.featureId || [];
|
|
457
430
|
// connected to flatmapvuer > moveMap(featureIds) function
|
|
458
431
|
this.$emit('show-connectivity', featureIds);
|
|
459
432
|
},
|
|
@@ -662,6 +635,7 @@ export default {
|
|
|
662
635
|
},
|
|
663
636
|
},
|
|
664
637
|
mounted: function () {
|
|
638
|
+
this.sckanVersion = this.entry['knowledge-source'];
|
|
665
639
|
this.updatedCopyContent = this.getUpdateCopyContent();
|
|
666
640
|
EventBus.on('connectivity-graph-error', (errorInfo) => {
|
|
667
641
|
this.pushConnectivityError(errorInfo);
|
|
@@ -690,11 +664,6 @@ export default {
|
|
|
690
664
|
}
|
|
691
665
|
}
|
|
692
666
|
|
|
693
|
-
.button-container {
|
|
694
|
-
display: flex;
|
|
695
|
-
justify-content: space-between;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
667
|
.title {
|
|
699
668
|
text-align: left;
|
|
700
669
|
// width: 16em;
|
|
@@ -788,24 +788,11 @@ export default {
|
|
|
788
788
|
if (filters) {
|
|
789
789
|
if (this.cascaderIsReady) {
|
|
790
790
|
const result = []
|
|
791
|
-
const terms = []
|
|
792
791
|
filters.forEach((filter) => {
|
|
793
792
|
const validatedFilter =
|
|
794
793
|
this.validateAndConvertFilterToHierarchical(filter)
|
|
795
794
|
if (validatedFilter) {
|
|
796
795
|
result.push(validatedFilter)
|
|
797
|
-
terms.push(validatedFilter.term)
|
|
798
|
-
}
|
|
799
|
-
})
|
|
800
|
-
// make sure unused filter terms' show all checkbox is always checked
|
|
801
|
-
this.options.forEach((option)=>{
|
|
802
|
-
if (!terms.includes(option.label)) {
|
|
803
|
-
result.push({
|
|
804
|
-
facet: "Show all",
|
|
805
|
-
facetPropPath: option.key,
|
|
806
|
-
label: "Show all",
|
|
807
|
-
term: option.label
|
|
808
|
-
})
|
|
809
796
|
}
|
|
810
797
|
})
|
|
811
798
|
return result
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<!-- Connectivity Info -->
|
|
33
33
|
<template v-if="tab.type === 'connectivity' && connectivityInfo">
|
|
34
34
|
<connectivity-info
|
|
35
|
-
:
|
|
35
|
+
:entry="connectivityInfo"
|
|
36
36
|
:availableAnatomyFacets="availableAnatomyFacets"
|
|
37
37
|
v-if="tab.id === activeTabId"
|
|
38
38
|
:envVars="envVars"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
@connectivity-component-click="onConnectivityComponentClick"
|
|
43
43
|
/>
|
|
44
44
|
</template>
|
|
45
|
-
<template v-
|
|
45
|
+
<template v-if="tab.type === 'annotation'">
|
|
46
46
|
<annotation-tool
|
|
47
47
|
:ref="'annotationTab_' + tab.id"
|
|
48
48
|
v-show="tab.id === activeTabId"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
@confirm-delete="$emit('confirm-delete', $event)"
|
|
55
55
|
/>
|
|
56
56
|
</template>
|
|
57
|
-
<template v-
|
|
57
|
+
<template v-if="tab.type === 'search'">
|
|
58
58
|
<SidebarContent
|
|
59
59
|
class="sidebar-content-container"
|
|
60
60
|
v-show="tab.id === activeTabId"
|
|
@@ -147,7 +147,7 @@ export default {
|
|
|
147
147
|
* The connectivity info data to show in sidebar.
|
|
148
148
|
*/
|
|
149
149
|
connectivityInfo: {
|
|
150
|
-
type:
|
|
150
|
+
type: Object,
|
|
151
151
|
default: null,
|
|
152
152
|
},
|
|
153
153
|
/**
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
async function getReferenceConnectivitiesFromStorage(resource) {
|
|
2
|
+
const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
|
|
3
|
+
|
|
4
|
+
if (flatmapKnowledgeRaw) {
|
|
5
|
+
const flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
|
|
6
|
+
const dataWithRefs = flatmapKnowledge.filter((x) => x.references && x.references.length);
|
|
7
|
+
const foundData = dataWithRefs.filter((x) => x.references.includes(resource));
|
|
8
|
+
|
|
9
|
+
if (foundData.length) {
|
|
10
|
+
const featureIds = foundData.map((x) => x.id);
|
|
11
|
+
return featureIds;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function getReferenceConnectivitiesByAPI(mapImp, resource, flatmapQueries) {
|
|
18
|
+
const knowledgeSource = getKnowledgeSource(mapImp);
|
|
19
|
+
const sql = `select knowledge from knowledge
|
|
20
|
+
where source="${knowledgeSource}" and
|
|
21
|
+
knowledge like "%${resource}%" order by source desc`;
|
|
22
|
+
console.log(sql)
|
|
23
|
+
const response = await flatmapQueries.flatmapQuery(sql);
|
|
24
|
+
const mappedData = response.values.map((x) => x[0]);
|
|
25
|
+
const parsedData = mappedData.map((x) => JSON.parse(x));
|
|
26
|
+
const featureIds = parsedData.map((x) => x.id);
|
|
27
|
+
return featureIds;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getKnowledgeSource(mapImp) {
|
|
31
|
+
let mapKnowledgeSource = '';
|
|
32
|
+
if (mapImp.provenance?.connectivity) {
|
|
33
|
+
const sckanProvenance = mapImp.provenance.connectivity;
|
|
34
|
+
if ('knowledge-source' in sckanProvenance) {
|
|
35
|
+
mapKnowledgeSource = sckanProvenance['knowledge-source'];
|
|
36
|
+
} else if ('npo' in sckanProvenance) {
|
|
37
|
+
mapKnowledgeSource = `${sckanProvenance.npo.release}-npo`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return mapKnowledgeSource;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function loadAndStoreKnowledge(mapImp, flatmapQueries) {
|
|
45
|
+
const knowledgeSource = getKnowledgeSource(mapImp);
|
|
46
|
+
const sql = `select knowledge from knowledge
|
|
47
|
+
where source="${knowledgeSource}"
|
|
48
|
+
order by source desc`;
|
|
49
|
+
const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
|
|
50
|
+
|
|
51
|
+
if (!flatmapKnowledge) {
|
|
52
|
+
flatmapQueries.flatmapQuery(sql).then((response) => {
|
|
53
|
+
const mappedData = response.values.map(x => x[0]);
|
|
54
|
+
const parsedData = mappedData.map(x => JSON.parse(x));
|
|
55
|
+
sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
|
|
56
|
+
updateFlatmapKnowledgeCache();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function updateFlatmapKnowledgeCache() {
|
|
62
|
+
const CACHE_LIFETIME = 24 * 60 * 60 * 1000; // One day
|
|
63
|
+
const now = new Date();
|
|
64
|
+
const expiry = now.getTime() + CACHE_LIFETIME;
|
|
65
|
+
|
|
66
|
+
sessionStorage.setItem('flatmap-knowledge-expiry', expiry);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function removeFlatmapKnowledgeCache() {
|
|
70
|
+
const keys = [
|
|
71
|
+
'flatmap-knowledge',
|
|
72
|
+
'flatmap-knowledge-expiry',
|
|
73
|
+
];
|
|
74
|
+
keys.forEach((key) => {
|
|
75
|
+
sessionStorage.removeItem(key);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function refreshFlatmapKnowledgeCache() {
|
|
80
|
+
const expiry = sessionStorage.getItem('flatmap-knowledge-expiry');
|
|
81
|
+
const now = new Date();
|
|
82
|
+
|
|
83
|
+
if (now.getTime() > expiry) {
|
|
84
|
+
removeFlatmapKnowledgeCache();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
getReferenceConnectivitiesFromStorage,
|
|
90
|
+
getReferenceConnectivitiesByAPI,
|
|
91
|
+
loadAndStoreKnowledge,
|
|
92
|
+
getKnowledgeSource,
|
|
93
|
+
refreshFlatmapKnowledgeCache,
|
|
94
|
+
}
|