@abi-software/flatmapvuer 0.5.5-beta.1 → 0.5.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 +21 -1
- package/dist/flatmapvuer.common.js +5611 -837
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +5611 -837
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +2 -2
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package-lock.json +14 -16
- package/package.json +2 -2
- package/src/App.vue +2 -0
- package/src/components/FlatmapVuer.vue +110 -21
- package/src/components/SelectionsGroup.vue +2 -1
- package/src/components/Tooltip.vue +12 -3
- package/src/components/TreeControls.vue +231 -0
- package/src/components/legends/SvgLegends.vue +1 -1
- package/src/services/flatmapQueries.js +40 -2
|
@@ -4,6 +4,34 @@ const removeDuplicates = function(arrayOfAnything){
|
|
|
4
4
|
return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
const cachedLabels = {};
|
|
8
|
+
|
|
9
|
+
const findTaxonomyLabel = async function(flatmapAPI, taxonomy){
|
|
10
|
+
if (cachedLabels && cachedLabels.hasOwnProperty(taxonomy)) {
|
|
11
|
+
return cachedLabels[taxonomy];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return new Promise(resolve=>{
|
|
15
|
+
fetch(`${flatmapAPI}knowledge/label/${taxonomy}`, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
})
|
|
18
|
+
.then(response => response.json())
|
|
19
|
+
.then(data => {
|
|
20
|
+
let label = data.label;
|
|
21
|
+
if (label === "Mammalia") {
|
|
22
|
+
label = "Mammalia not otherwise specified";
|
|
23
|
+
}
|
|
24
|
+
cachedLabels[taxonomy] = label;
|
|
25
|
+
resolve(label);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
console.error('Error:', error);
|
|
29
|
+
cachedLabels[taxonomy] = taxonomy;
|
|
30
|
+
resolve(taxonomy);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
7
35
|
const inArray = function(ar1, ar2){
|
|
8
36
|
let as1 = JSON.stringify(ar1)
|
|
9
37
|
let as2 = JSON.stringify(ar2)
|
|
@@ -24,13 +52,21 @@ let FlatmapQueries = function(){
|
|
|
24
52
|
this.lookUp = []
|
|
25
53
|
}
|
|
26
54
|
|
|
27
|
-
this.createTooltipData = function (eventData) {
|
|
55
|
+
this.createTooltipData = async function (eventData) {
|
|
28
56
|
let hyperlinks = []
|
|
29
57
|
if (eventData.feature.hyperlinks && eventData.feature.hyperlinks.length > 0) {
|
|
30
58
|
hyperlinks = eventData.feature.hyperlinks
|
|
31
59
|
} else {
|
|
32
60
|
hyperlinks = this.urls.map(url=>({url: url, id: "pubmed"}))
|
|
33
61
|
}
|
|
62
|
+
let taxonomyLabel = undefined;
|
|
63
|
+
if (eventData.provenanceTaxonomy) {
|
|
64
|
+
taxonomyLabel = [];
|
|
65
|
+
for (let i = 0; eventData.provenanceTaxonomy.length > i; i++) {
|
|
66
|
+
taxonomyLabel.push(await findTaxonomyLabel(this.flatmapAPI, eventData.provenanceTaxonomy[i]))
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
34
70
|
let tooltipData = {
|
|
35
71
|
destinations: this.destinations,
|
|
36
72
|
origins: this.origins,
|
|
@@ -41,6 +77,8 @@ let FlatmapQueries = function(){
|
|
|
41
77
|
title: eventData.label,
|
|
42
78
|
featureId: eventData.resource,
|
|
43
79
|
hyperlinks: hyperlinks,
|
|
80
|
+
provenanceTaxonomy: eventData.provenanceTaxonomy,
|
|
81
|
+
provenanceTaxonomyLabel: taxonomyLabel
|
|
44
82
|
}
|
|
45
83
|
return tooltipData
|
|
46
84
|
}
|
|
@@ -371,4 +409,4 @@ let FlatmapQueries = function(){
|
|
|
371
409
|
}
|
|
372
410
|
}
|
|
373
411
|
|
|
374
|
-
export {FlatmapQueries}
|
|
412
|
+
export {FlatmapQueries, findTaxonomyLabel}
|