@abi-software/map-side-bar 2.7.2 → 2.7.3-beta.0
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 +5386 -5382
- package/dist/map-side-bar.umd.cjs +62 -62
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +3 -2
- package/src/algolia/utils.js +1 -1
- package/src/components/ConnectivityInfo.vue +15 -14
- package/src/components/SidebarContent.vue +9 -3
- package/src/services/flatmapKnowledge.js +0 -94
- package/src/services/flatmapQueries.js +0 -498
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3-beta.0",
|
|
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.3-beta.3",
|
|
43
43
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
package/src/App.vue
CHANGED
|
@@ -213,10 +213,11 @@ export default {
|
|
|
213
213
|
facetPropPath: 'attributes.subject.sex.value',
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
|
-
facet: '
|
|
217
|
-
facet2: 'Heart',
|
|
216
|
+
facet: 'Heart',
|
|
218
217
|
term: 'Anatomical structure',
|
|
218
|
+
facetSubPropPath: "anatomy.organ.name",
|
|
219
219
|
facetPropPath: 'anatomy.organ.category.name',
|
|
220
|
+
label :'Heart',
|
|
220
221
|
AND: true,
|
|
221
222
|
},
|
|
222
223
|
{
|
package/src/algolia/utils.js
CHANGED
|
@@ -68,7 +68,7 @@ export function getFilters(selectedFacetArray=undefined) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Switch the 'term' attribute to 'label' if 'label' does not exist
|
|
71
|
-
selectedFacetArray.forEach(f=>f.label=f.facet)
|
|
71
|
+
selectedFacetArray.forEach(f=>f.label = f.facet2 ? f.facet2 : f.facet)
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
let facets = removeShowAllFacets(selectedFacetArray)
|
|
@@ -61,6 +61,21 @@
|
|
|
61
61
|
<div class="content-container population-display">
|
|
62
62
|
<div class="block attribute-title-container">
|
|
63
63
|
<span class="attribute-title">Population Display</span>
|
|
64
|
+
<el-popover
|
|
65
|
+
v-if="activeView === 'listView'"
|
|
66
|
+
width="250"
|
|
67
|
+
trigger="hover"
|
|
68
|
+
:teleported="false"
|
|
69
|
+
popper-class="popover-origin-help"
|
|
70
|
+
>
|
|
71
|
+
<template #reference>
|
|
72
|
+
<el-icon class="info"><el-icon-warning /></el-icon>
|
|
73
|
+
</template>
|
|
74
|
+
<span style="word-break: keep-all">
|
|
75
|
+
This list is ordered alphabetically,
|
|
76
|
+
switch to graph view for path details.
|
|
77
|
+
</span>
|
|
78
|
+
</el-popover>
|
|
64
79
|
</div>
|
|
65
80
|
<div class="block buttons-row">
|
|
66
81
|
<el-button
|
|
@@ -126,20 +141,6 @@
|
|
|
126
141
|
>
|
|
127
142
|
<div class="attribute-title-container">
|
|
128
143
|
<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>
|
|
143
144
|
</div>
|
|
144
145
|
<div
|
|
145
146
|
v-for="(component, i) in entry.components"
|
|
@@ -196,6 +196,7 @@ export default {
|
|
|
196
196
|
this.searchAlgolia(this.filter, search)
|
|
197
197
|
}
|
|
198
198
|
this.$refs.filtersRef.setCascader(this.filter)
|
|
199
|
+
this.searchHistoryUpdate(this.filter, search);
|
|
199
200
|
}
|
|
200
201
|
} else {
|
|
201
202
|
//cascader is not ready, perform search if no filter is set,
|
|
@@ -203,6 +204,7 @@ export default {
|
|
|
203
204
|
this.filter = filter
|
|
204
205
|
if ((!filter || filter.length == 0) && option.withSearch) {
|
|
205
206
|
this.searchAlgolia(this.filter, search)
|
|
207
|
+
this.searchHistoryUpdate(this.filter, search);
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
},
|
|
@@ -260,12 +262,16 @@ export default {
|
|
|
260
262
|
this.resetPageNavigation();
|
|
261
263
|
const transformedFilters = this.transformFiltersBeforeSearch(this.filters);
|
|
262
264
|
this.searchAlgolia(transformedFilters, this.searchInput);
|
|
265
|
+
this.searchHistoryUpdate(this.filters, this.searchInput);
|
|
266
|
+
},
|
|
267
|
+
searchHistoryUpdate: function (filters, search) {
|
|
263
268
|
this.$refs.searchHistory.selectValue = 'Search history';
|
|
264
269
|
// save history only if there has value
|
|
265
|
-
if (
|
|
270
|
+
if (filters.length || search?.trim()) {
|
|
271
|
+
const transformedFilters = this.transformFiltersBeforeSearch(filters);
|
|
266
272
|
this.$refs.searchHistory.addSearchToHistory(
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
transformedFilters,
|
|
274
|
+
search
|
|
269
275
|
);
|
|
270
276
|
}
|
|
271
277
|
},
|
|
@@ -1,94 +0,0 @@
|
|
|
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
|
-
}
|