@abi-software/mapintegratedvuer 1.21.1 → 1.22.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/README.md +23 -5
- package/assets/location-icon.html +33 -1
- package/assets/styleguide.css +18 -18
- package/cypress.config.js +7 -9
- package/dist/{ConnectivityGraph-CZMROk9r.js → ConnectivityGraph-BBZ3Dgat.js} +3 -3
- package/dist/{ContentMixin-Vn34n5t2.js → ContentMixin-B-O_IwPg.js} +16 -18
- package/dist/{DynamicMarkerMixin-BS6t7w_i.js → DynamicMarkerMixin-B9iqtP_f.js} +1 -1
- package/dist/{Flatmap-BejxA0uz.js → Flatmap-BoEFI50b.js} +4 -4
- package/dist/{Iframe-BWbhTjCR.js → Iframe-Slj-LQTF.js} +4 -4
- package/dist/{MultiFlatmap-nlmsH-Ib.js → MultiFlatmap-l6aBn6x3.js} +17 -5
- package/dist/{Plot-ChbPsDZX.js → Plot-CIhEip5b.js} +2 -2
- package/dist/{Scaffold-C6f7c7Ha.js → Scaffold-D5ZGCDvt.js} +4 -4
- package/dist/{Simulation-DcJScRYo.js → Simulation-C5o5DXRb.js} +2 -2
- package/dist/{connectivities-UXTqf7_0.js → connectivities-Br3MpoAv.js} +154 -95
- package/dist/index.html +9 -6
- package/dist/mapintegratedvuer.js +5506 -5582
- package/dist/mapintegratedvuer.umd.cjs +196 -196
- package/dist/style.css +1 -1
- package/eslint.config.js +39 -15
- package/package.json +12 -6
- package/public/index.html +9 -6
- package/src/App.vue +224 -255
- package/src/assets/_variables.scss +12 -10
- package/src/assets/header-icon.scss +8 -9
- package/src/assets/mapicon-species-style.css +10 -8
- package/src/assets/styles.scss +1 -1
- package/src/components/ContentBar.vue +99 -106
- package/src/components/ContentVuer.vue +36 -39
- package/src/components/ContextCard.vue +238 -199
- package/src/components/ContextHelp.vue +22 -26
- package/src/components/CustomSplitter.vue +32 -43
- package/src/components/DatasetHeader.vue +37 -41
- package/src/components/DialogToolbarContent.vue +292 -256
- package/src/components/FlatmapContextCard.vue +52 -57
- package/src/components/MapContent.vue +111 -87
- package/src/components/ResizeSensor.vue +8 -13
- package/src/components/SearchControls.vue +26 -35
- package/src/components/SimulatedData.js +196 -219
- package/src/components/SplitDialog.vue +139 -129
- package/src/components/SplitFlow.vue +433 -239
- package/src/components/index.js +1 -3
- package/src/components/scripts/simulation_data.js +393 -397
- package/src/components/scripts/utilities.js +108 -78
- package/src/components/viewers/CellDLViewer.vue +9 -9
- package/src/components/viewers/ConnectivityGraph.vue +9 -12
- package/src/components/viewers/Flatmap.vue +23 -25
- package/src/components/viewers/Iframe.vue +8 -10
- package/src/components/viewers/MultiFlatmap.vue +73 -69
- package/src/components/viewers/Plot.vue +6 -7
- package/src/components/viewers/Scaffold.vue +73 -63
- package/src/components/viewers/Simulation.vue +10 -15
- package/src/main.js +16 -21
- package/src/mixins/ContentMixin.js +208 -178
- package/src/mixins/DynamicMarkerMixin.js +14 -18
- package/src/mixins/RetrieveContextCardMixin.js +35 -30
- package/src/mixins/S3Bucket.vue +10 -13
- package/src/services/knowledgeMapping.js +53 -53
- package/src/services/tagging.js +4 -4
- package/src/stores/connectivities.js +46 -8
- package/src/stores/entries.js +7 -9
- package/src/stores/index.js +7 -7
- package/src/stores/settings.js +23 -31
- package/src/stores/splitFlow.js +395 -298
- package/vite.bundle-build.js +24 -26
- package/vite.config.js +22 -21
- package/vite.static-build.js +4 -4
- package/vitest.workspace.js +1 -3
- package/vuese-generator.js +47 -55
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
import { mapStores } from 'pinia';
|
|
3
2
|
import { useSettingsStore } from '../stores/settings';
|
|
4
3
|
|
|
5
4
|
// remove duplicates by stringifying the objects
|
|
6
5
|
const removeDuplicates = function (arrayOfAnything) {
|
|
7
|
-
if (!arrayOfAnything) return []
|
|
8
|
-
return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
}
|
|
6
|
+
if (!arrayOfAnything) return [];
|
|
7
|
+
return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) => JSON.parse(e));
|
|
8
|
+
};
|
|
12
9
|
|
|
13
|
-
/* eslint-disable no-alert, no-console */
|
|
14
10
|
export default {
|
|
15
11
|
computed: {
|
|
16
12
|
...mapStores(useSettingsStore),
|
|
@@ -20,11 +16,11 @@ export default {
|
|
|
20
16
|
if (this.mouseHovered) {
|
|
21
17
|
const result = {
|
|
22
18
|
paneIndex: this.entry.id,
|
|
23
|
-
eventType:
|
|
19
|
+
eventType: 'panZoom',
|
|
24
20
|
payload: payload,
|
|
25
21
|
type: this.entry.type,
|
|
26
22
|
};
|
|
27
|
-
this.$emit(
|
|
23
|
+
this.$emit('resource-selected', result);
|
|
28
24
|
}
|
|
29
25
|
},
|
|
30
26
|
/**
|
|
@@ -35,34 +31,34 @@ export default {
|
|
|
35
31
|
if (!this.flatmapReady) return;
|
|
36
32
|
|
|
37
33
|
let flatmapImp = flatmap;
|
|
38
|
-
if (!flatmapImp)
|
|
39
|
-
flatmapImp = this.getFlatmapImp();
|
|
34
|
+
if (!flatmapImp) flatmapImp = this.getFlatmapImp();
|
|
40
35
|
|
|
41
36
|
if (flatmapImp) {
|
|
42
37
|
// Set the dataset markers
|
|
43
|
-
let markers = this.settingsStore.globalSettings.displayMarkers
|
|
38
|
+
let markers = this.settingsStore.globalSettings.displayMarkers
|
|
39
|
+
? this.settingsStore.markers
|
|
40
|
+
: [];
|
|
44
41
|
markers = removeDuplicates(markers);
|
|
45
42
|
flatmapImp.clearMarkers();
|
|
46
43
|
flatmapImp.clearClusteredAnatomicalMarkers();
|
|
47
44
|
flatmapImp.addClusteredAnatomicalMarkers(markers);
|
|
48
45
|
|
|
49
46
|
// Set the featured markers
|
|
50
|
-
if (this.entry.type ===
|
|
47
|
+
if (this.entry.type === 'MultiFlatmap') {
|
|
51
48
|
this.restoreFeaturedMarkers(flatmapImp);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
},
|
|
55
52
|
// removeMarkersNotOnFlatmap: rewrites the dataset marker list to only include markers that are on the flatmap
|
|
56
53
|
removeMarkersNotOnFlatmap(flatmapImp, datasets) {
|
|
57
|
-
|
|
58
54
|
// dataset markers are in the form [{id: "discoverId", terms: ["term1", "term2"]}, {id:....}]
|
|
59
55
|
let fma = flatmapImp.anatomicalIdentifiers;
|
|
60
|
-
let markersOnFlatmap = []
|
|
56
|
+
let markersOnFlatmap = [];
|
|
61
57
|
|
|
62
58
|
// the block below steps through each dataset and checks each term to see if it is in the flatmap
|
|
63
59
|
for (let i = 0; i < datasets.length; i++) {
|
|
64
60
|
let dataset = datasets[i];
|
|
65
|
-
let datasetAdjusted = {id: dataset.id, terms: []};
|
|
61
|
+
let datasetAdjusted = { id: dataset.id, terms: [] };
|
|
66
62
|
for (let j = 0; j < dataset.terms.length; j++) {
|
|
67
63
|
if (fma.includes(dataset.terms[j])) {
|
|
68
64
|
datasetAdjusted.terms.push(dataset.terms[j]);
|
|
@@ -80,5 +76,5 @@ export default {
|
|
|
80
76
|
this.flatmapMarkerUpdate(flatmapImp);
|
|
81
77
|
}
|
|
82
78
|
},
|
|
83
|
-
}
|
|
84
|
-
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable no-alert, no-console */
|
|
3
1
|
export default {
|
|
4
2
|
// Note that the setting store is included in MapContent.vue
|
|
5
3
|
methods: {
|
|
@@ -9,8 +7,8 @@ export default {
|
|
|
9
7
|
|
|
10
8
|
// get the context file from scicrunch
|
|
11
9
|
const sciResults = await this.getContextFileFromScicrunch(datasetId, scaffoldPath);
|
|
12
|
-
if (!sciResults.success){
|
|
13
|
-
return {} // return empty object if no context file is found (the empty object will be added to the entry)
|
|
10
|
+
if (!sciResults.success) {
|
|
11
|
+
return {}; // return empty object if no context file is found (the empty object will be added to the entry)
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
// return the context file
|
|
@@ -18,15 +16,15 @@ export default {
|
|
|
18
16
|
return {
|
|
19
17
|
s3uri: sciResults.s3uri,
|
|
20
18
|
contextCardUrl: fullPath,
|
|
21
|
-
}
|
|
19
|
+
};
|
|
22
20
|
},
|
|
23
21
|
splitInfoFromUrl: function (url) {
|
|
24
22
|
// example url: "https://mapcore-demo.org/current/sparc-api-v2/s3-resource/221/3/files/derivative/Scaffolds/mouse_colon_metadata.json",
|
|
25
|
-
// find the part after 's3-resource'
|
|
23
|
+
// find the part after 's3-resource'
|
|
26
24
|
let s3path = url.split('s3-resource')[1];
|
|
27
|
-
let basePath = url.split('files/')[0] + 'files/' // This gives us the base path for our relative path we will get from scicrunch
|
|
28
|
-
let scaffoldPath = url.split('files/')[1].split('?')[0] // This gives us the relative path to the file we want to get from scicrunch
|
|
29
|
-
let s3uri = '?' + url.split('?')[1] // This gives us the uri needed to get the file from s3
|
|
25
|
+
let basePath = url.split('files/')[0] + 'files/'; // This gives us the base path for our relative path we will get from scicrunch
|
|
26
|
+
let scaffoldPath = url.split('files/')[1].split('?')[0]; // This gives us the relative path to the file we want to get from scicrunch
|
|
27
|
+
let s3uri = '?' + url.split('?')[1]; // This gives us the uri needed to get the file from s3
|
|
30
28
|
|
|
31
29
|
// split the url by '/'
|
|
32
30
|
const parts = s3path.split('/');
|
|
@@ -39,45 +37,52 @@ export default {
|
|
|
39
37
|
},
|
|
40
38
|
getContextFileFromScicrunch: async function (datasetId, scaffoldPath) {
|
|
41
39
|
// get the context file from scicrunch
|
|
42
|
-
let results = await fetch(
|
|
43
|
-
.
|
|
44
|
-
|
|
40
|
+
let results = await fetch(
|
|
41
|
+
`${this.settingsStore.sparcApi}/dataset_info/using_multiple_discoverIds/?discoverIds=${datasetId}`,
|
|
42
|
+
)
|
|
43
|
+
.then((response) => response.json())
|
|
44
|
+
.then((data) => {
|
|
45
45
|
// get the context info from the response
|
|
46
|
-
if (data.numberOfHits === 1) {
|
|
47
|
-
|
|
46
|
+
if (data.numberOfHits === 1) {
|
|
47
|
+
// check if there is only one hit (We don't want to use the data if there are multiple hits)
|
|
48
|
+
const contextFile = data.results[0]['abi-contextual-information'];
|
|
48
49
|
|
|
49
50
|
// check if there is only one context file and if so return it
|
|
50
|
-
if (
|
|
51
|
+
if (contextFile && contextFile.length === 1) {
|
|
51
52
|
return {
|
|
52
53
|
success: true,
|
|
53
|
-
contextFile: contextFile[0],
|
|
54
|
-
s3uri: data.results[0]['s3uri']
|
|
55
|
-
}
|
|
54
|
+
contextFile: contextFile[0],
|
|
55
|
+
s3uri: data.results[0]['s3uri'],
|
|
56
|
+
};
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
// If there are multiple context files, find the one that matches the scaffold path
|
|
59
60
|
else if (contextFile && contextFile.length > 1) {
|
|
60
|
-
let search = this.findContextInforForFilePath(
|
|
61
|
+
let search = this.findContextInforForFilePath(
|
|
62
|
+
data.results[0]['abi-context-file'],
|
|
63
|
+
scaffoldPath,
|
|
64
|
+
);
|
|
61
65
|
if (search) {
|
|
62
66
|
return {
|
|
63
67
|
success: true,
|
|
64
|
-
contextFile: search,
|
|
65
|
-
s3uri: data.results[0]['s3uri']
|
|
66
|
-
}
|
|
68
|
+
contextFile: search,
|
|
69
|
+
s3uri: data.results[0]['s3uri'],
|
|
70
|
+
};
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
return {success: false};
|
|
71
|
-
})
|
|
74
|
+
return { success: false };
|
|
75
|
+
})
|
|
76
|
+
.catch((error) => {
|
|
72
77
|
console.error('Error:', error);
|
|
73
|
-
return {success: false};
|
|
78
|
+
return { success: false };
|
|
74
79
|
});
|
|
75
80
|
return results;
|
|
76
81
|
},
|
|
77
82
|
findContextInforForFilePath: function (dataciteInfo, filePath) {
|
|
78
83
|
// find the context file that matches the scaffold path
|
|
79
|
-
let result = dataciteInfo.find((info) => info.datacite.isDerivedFrom.path.includes(filePath))
|
|
80
|
-
return result?.dataset?.path
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
+
let result = dataciteInfo.find((info) => info.datacite.isDerivedFrom.path.includes(filePath));
|
|
85
|
+
return result?.dataset?.path;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
package/src/mixins/S3Bucket.vue
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
export default {
|
|
3
|
-
name:
|
|
3
|
+
name: 'S3Bucket',
|
|
4
4
|
data() {
|
|
5
5
|
return {
|
|
6
6
|
s3Bucket: undefined,
|
|
7
|
-
s3Prefix:
|
|
7
|
+
s3Prefix: '',
|
|
8
8
|
};
|
|
9
9
|
},
|
|
10
10
|
methods: {
|
|
11
|
-
updateS3Bucket: function(s3uri) {
|
|
11
|
+
updateS3Bucket: function (s3uri) {
|
|
12
12
|
this.s3Bucket = undefined;
|
|
13
13
|
if (s3uri) {
|
|
14
|
-
const substring = s3uri.split(
|
|
14
|
+
const substring = s3uri.split('//')[1];
|
|
15
15
|
if (substring) {
|
|
16
|
-
this.s3Bucket = substring.split(
|
|
16
|
+
this.s3Bucket = substring.split('/')[0];
|
|
17
17
|
const n = substring.indexOf('/');
|
|
18
18
|
this.s3Prefix = substring.substring(n + 1);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
getS3Args: function() {
|
|
23
|
+
getS3Args: function () {
|
|
24
24
|
if (this.s3Bucket) {
|
|
25
|
-
return `?s3BucketName=${this.s3Bucket}
|
|
25
|
+
return `?s3BucketName=${this.s3Bucket}`;
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return '';
|
|
28
28
|
},
|
|
29
|
-
getS3Prefix: function() {
|
|
29
|
+
getS3Prefix: function () {
|
|
30
30
|
return this.s3Prefix;
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
},
|
|
33
|
-
|
|
34
33
|
};
|
|
35
34
|
</script>
|
|
36
|
-
|
|
37
|
-
|
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
const knowledgeMap = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
classes: {
|
|
3
|
+
cardio_28: {
|
|
4
|
+
models: 'UBERON:0002165',
|
|
5
|
+
name: 'Endocardium',
|
|
6
|
+
},
|
|
7
|
+
cardio_29: {
|
|
8
|
+
models: 'UBERON:0002349',
|
|
9
|
+
name: 'Myocardium',
|
|
6
10
|
},
|
|
7
|
-
"cardio_29": {
|
|
8
|
-
"models": "UBERON:0002349",
|
|
9
|
-
"name": "Myocardium"
|
|
10
|
-
}
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
features: {
|
|
13
|
+
v_GLUT2_basal: {
|
|
14
|
+
name: 'Flow through GLUT2 transporter',
|
|
15
|
+
variable: 'main/v_GLUT2base',
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
v_SGLT1_apical: {
|
|
18
|
+
name: 'SGLT1 transporter',
|
|
19
|
+
variable: 'main/v_SGLT1',
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
v_Kir_basal: {
|
|
22
|
+
name: 'Kir channel',
|
|
23
|
+
models: 'UBERON:0001536',
|
|
24
|
+
variable: 'main/v_Kir',
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
v_NKA_basal: {
|
|
27
|
+
name: 'Na/K ATPase',
|
|
28
|
+
variable: 'main/v_NKA',
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
v_GLUT2_apical: {
|
|
31
|
+
name: 'GLUT2 transporter',
|
|
32
|
+
variable: 'main/v_GLUT2apex',
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
q_Na_lumen: {
|
|
35
|
+
name: '[Na+] in lumen',
|
|
36
|
+
variable: 'main/c_Na_gut',
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
q_Na_i: {
|
|
39
|
+
name: '[Na+] in intracellular space',
|
|
40
|
+
variable: 'main/c_Na_int',
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
q_Na_blood: {
|
|
43
|
+
name: '[Na+] in blood',
|
|
44
|
+
variable: 'main/c_Na_cap',
|
|
45
45
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
q_K_blood: {
|
|
47
|
+
name: '[K+] in blood',
|
|
48
|
+
variable: 'main/c_K_cap',
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
q_K_i: {
|
|
51
|
+
name: '[K+] in intracellular space',
|
|
52
|
+
variable: 'main/c_K_int',
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
q_Glc_lumen: {
|
|
55
|
+
name: '[Glucose] in lumen',
|
|
56
|
+
variable: 'main/c_Glc_gut',
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
q_Glc_i: {
|
|
59
|
+
name: '[Glucose] in intracellular space',
|
|
60
|
+
variable: 'main/c_Glc_int',
|
|
61
61
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}
|
|
62
|
+
q_Glc_blood: {
|
|
63
|
+
name: '[Glucose] in blood',
|
|
64
|
+
variable: 'main/c_Glc_cap',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const getVariableName = (name) => {
|
|
70
70
|
if (Object.hasOwn(knowledgeMap.features, name)) {
|
|
71
|
-
console.log(
|
|
71
|
+
console.log('pass');
|
|
72
72
|
const data = knowledgeMap.features[name];
|
|
73
73
|
return data;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
export { getVariableName }
|
|
77
|
+
export { getVariableName };
|
package/src/services/tagging.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventBus from '../components/EventBus';
|
|
2
2
|
export default {
|
|
3
|
-
sendEvent: function(data) {
|
|
3
|
+
sendEvent: function (data) {
|
|
4
4
|
const taggingData = {
|
|
5
5
|
event: data.event || '',
|
|
6
6
|
event_name: data.event_name || '',
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
version_id: data.version_id || '',
|
|
14
14
|
doi: data.doi || '',
|
|
15
15
|
citation_type: data.citation_type || '',
|
|
16
|
-
location: data.location || ''
|
|
16
|
+
location: data.location || '',
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// set debugging mode
|
|
@@ -23,5 +23,5 @@ export default {
|
|
|
23
23
|
|
|
24
24
|
// Emit data for GTM
|
|
25
25
|
EventBus.emit('trackEvent', taggingData);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { listsAreEqual } from
|
|
2
|
+
import { listsAreEqual } from '../components/scripts/utilities';
|
|
3
|
+
|
|
4
|
+
function mergeConnectivityEntries(existingEntries = [], incomingEntries = []) {
|
|
5
|
+
const merged = new Map();
|
|
6
|
+
|
|
7
|
+
[...existingEntries, ...incomingEntries].forEach((entry) => {
|
|
8
|
+
if (!entry || entry.id === undefined) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const existing = merged.get(entry.id);
|
|
13
|
+
merged.set(
|
|
14
|
+
entry.id,
|
|
15
|
+
existing
|
|
16
|
+
? {
|
|
17
|
+
...existing,
|
|
18
|
+
...entry,
|
|
19
|
+
'nerve-label': entry['nerve-label'] || existing['nerve-label'],
|
|
20
|
+
'long-label': entry['long-label'] || existing['long-label'],
|
|
21
|
+
'expert-consultants': entry['expert-consultants'] || existing['expert-consultants'],
|
|
22
|
+
}
|
|
23
|
+
: { ...entry },
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return Array.from(merged.values());
|
|
28
|
+
}
|
|
3
29
|
|
|
4
30
|
export const useConnectivitiesStore = defineStore('connectivities', {
|
|
5
31
|
state: () => {
|
|
@@ -20,9 +46,7 @@ export const useConnectivitiesStore = defineStore('connectivities', {
|
|
|
20
46
|
for (const connectivity of connectivities) {
|
|
21
47
|
const key = connectivity.id;
|
|
22
48
|
|
|
23
|
-
acc[key] = acc[key] ?
|
|
24
|
-
{ ...acc[key], ...connectivity } :
|
|
25
|
-
{ ...connectivity };
|
|
49
|
+
acc[key] = acc[key] ? { ...acc[key], ...connectivity } : { ...connectivity };
|
|
26
50
|
}
|
|
27
51
|
|
|
28
52
|
return acc;
|
|
@@ -38,7 +62,7 @@ export const useConnectivitiesStore = defineStore('connectivities', {
|
|
|
38
62
|
if (acc[filter.key]) {
|
|
39
63
|
const mergedChildren = [...acc[filter.key].children, ...filter.children];
|
|
40
64
|
const uniqueChildren = Array.from(
|
|
41
|
-
new Map(mergedChildren.map(child => [child.key, child])).values()
|
|
65
|
+
new Map(mergedChildren.map((child) => [child.key, child])).values(),
|
|
42
66
|
);
|
|
43
67
|
acc[filter.key].children = uniqueChildren;
|
|
44
68
|
} else {
|
|
@@ -76,15 +100,29 @@ export const useConnectivitiesStore = defineStore('connectivities', {
|
|
|
76
100
|
this.activeConnectivityKeys = activeConnectivityKeys;
|
|
77
101
|
return true;
|
|
78
102
|
} else if (this.connectivitiesUpdated) {
|
|
79
|
-
this.connectivitiesUpdated = !activeConnectivityKeys.every(
|
|
103
|
+
this.connectivitiesUpdated = !activeConnectivityKeys.every(
|
|
104
|
+
(ele) => ele in this.globalConnectivities,
|
|
105
|
+
);
|
|
80
106
|
return true;
|
|
81
107
|
}
|
|
82
108
|
return false;
|
|
83
109
|
},
|
|
84
110
|
updateGlobalConnectivities(globalConnectivities) {
|
|
85
111
|
if (globalConnectivities) {
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
// Each viewer (MultiFlatmap/Flatmap/Scaffold) only knows about its own
|
|
113
|
+
// uuid/sckanVersion key(s) when it calls this action, and its local
|
|
114
|
+
// snapshot may be stale for the same entry set. Merge by key and by id
|
|
115
|
+
// so a later flatmap update does not wipe richer scaffold metadata such
|
|
116
|
+
// as nerve-label.
|
|
117
|
+
const merged = { ...this.globalConnectivities };
|
|
118
|
+
|
|
119
|
+
Object.entries(globalConnectivities).forEach(([uuid, entries]) => {
|
|
120
|
+
const existingEntries = merged[uuid] || [];
|
|
121
|
+
merged[uuid] = mergeConnectivityEntries(existingEntries, entries || []);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (JSON.stringify(merged) !== JSON.stringify(this.globalConnectivities)) {
|
|
125
|
+
this.globalConnectivities = merged;
|
|
88
126
|
this.connectivitiesUpdated = true;
|
|
89
127
|
}
|
|
90
128
|
}
|
package/src/stores/entries.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { initialDefaultState } from
|
|
2
|
+
import { initialDefaultState } from '../components/scripts/utilities';
|
|
3
3
|
import { getKnowledgeSourceFromProvenance } from '@abi-software/flatmapvuer/src/services/flatmapKnowledge.js';
|
|
4
4
|
|
|
5
|
-
/* eslint-disable no-alert, no-console */
|
|
6
|
-
|
|
7
5
|
export const useEntriesStore = defineStore('entries', {
|
|
8
6
|
state: () => {
|
|
9
7
|
return initialDefaultState();
|
|
10
8
|
},
|
|
11
9
|
getters: {
|
|
12
|
-
findIndexOfId: (state) => id => {
|
|
10
|
+
findIndexOfId: (state) => (id) => {
|
|
13
11
|
for (let i = 0; i < state.entries.length; i++) {
|
|
14
12
|
if (state.entries[i].id == id) {
|
|
15
13
|
return i;
|
|
@@ -31,9 +29,9 @@ export const useEntriesStore = defineStore('entries', {
|
|
|
31
29
|
this.entries = [];
|
|
32
30
|
Object.assign(this.entries, newEntries);
|
|
33
31
|
},
|
|
34
|
-
updateViewForEntry(
|
|
32
|
+
updateViewForEntry({ id, viewUrl }) {
|
|
35
33
|
// Update the scaffold with a view url
|
|
36
|
-
const entry = this.entries.find(entry => entry.id === id);
|
|
34
|
+
const entry = this.entries.find((entry) => entry.id === id);
|
|
37
35
|
entry.viewUrl = viewUrl;
|
|
38
36
|
},
|
|
39
37
|
updateMapForEntry(entry, prov) {
|
|
@@ -44,16 +42,16 @@ export const useEntriesStore = defineStore('entries', {
|
|
|
44
42
|
}
|
|
45
43
|
},
|
|
46
44
|
updateLabelForEntry(targetEntry, label) {
|
|
47
|
-
const entryToAssign = this.entries.find(entry => entry.id === targetEntry.id);
|
|
45
|
+
const entryToAssign = this.entries.find((entry) => entry.id === targetEntry.id);
|
|
48
46
|
if (entryToAssign) {
|
|
49
47
|
entryToAssign['label'] = label;
|
|
50
48
|
}
|
|
51
49
|
},
|
|
52
50
|
updateTitleForEntry(targetEntry, title) {
|
|
53
|
-
const entryToAssign = this.entries.find(entry => entry.id === targetEntry.id);
|
|
51
|
+
const entryToAssign = this.entries.find((entry) => entry.id === targetEntry.id);
|
|
54
52
|
if (entryToAssign) {
|
|
55
53
|
entryToAssign['title'] = title;
|
|
56
54
|
}
|
|
57
55
|
},
|
|
58
|
-
}
|
|
56
|
+
},
|
|
59
57
|
});
|
package/src/stores/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Activate the store when run the application individually.
|
|
5
|
-
* If the store exist in parent application,
|
|
5
|
+
* If the store exist in parent application,
|
|
6
6
|
* instead of creating a new store it will access the parent main store.
|
|
7
7
|
*/
|
|
8
8
|
export const useMainStore = defineStore('main', {
|
|
9
9
|
state: () => ({
|
|
10
10
|
userProfile: {
|
|
11
|
-
token: ''
|
|
11
|
+
token: '',
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
getters: {
|
|
15
15
|
userToken(state) {
|
|
16
|
-
return state.userProfile.token
|
|
16
|
+
return state.userProfile.token;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
actions: {
|
|
20
20
|
setUserToken(value) {
|
|
21
|
-
this.userProfile.token = value
|
|
21
|
+
this.userProfile.token = value;
|
|
22
22
|
},
|
|
23
|
-
}
|
|
24
|
-
})
|
|
23
|
+
},
|
|
24
|
+
});
|