@abi-software/mapintegratedvuer 0.7.1-demo.0 → 0.7.2-vue3.0-alpha.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/LICENSE +201 -201
- package/README.md +150 -142
- package/assets/gazelle-icons-no-background.css +32 -0
- package/assets/styleguide.css +19 -19
- package/cypress.config.js +23 -23
- package/dist/index.html +17 -17
- package/dist/mapintegratedvuer.js +60394 -59859
- package/dist/mapintegratedvuer.umd.cjs +515 -907
- package/dist/matterport.pdf +0 -0
- package/dist/style.css +1 -1
- package/dist/test.txt +0 -0
- package/package.json +135 -136
- package/public/index.html +17 -17
- package/public/matterport.pdf +0 -0
- package/public/test.txt +0 -0
- package/q.json +690 -0
- package/reporter-config.json +9 -9
- package/src/App.vue +245 -245
- package/src/assets/_variables.scss +43 -43
- package/src/assets/fonts/mapicon-species.eot +0 -0
- package/src/assets/fonts/mapicon-species.ttf +0 -0
- package/src/assets/fonts/mapicon-species.woff +0 -0
- package/src/assets/header-icon.scss +67 -67
- package/src/assets/mapicon-species-style.css +41 -41
- package/src/assets/styles.scss +9 -9
- package/src/components/ContentBar.vue +376 -376
- package/src/components/ContentVuer.vue +217 -217
- package/src/components/ContextCard.vue +385 -385
- package/src/components/ContextHelp.vue +73 -73
- package/src/components/CustomSplitter.vue +151 -151
- package/src/components/DatasetHeader.vue +97 -97
- package/src/components/DialogToolbarContent.vue +464 -464
- package/src/components/EventBus.js +3 -3
- package/src/components/FlatmapContextCard.vue +134 -134
- package/src/components/MapContent.vue +333 -285
- package/src/components/ResizeSensor.vue +47 -47
- package/src/components/SearchControls.vue +115 -115
- package/src/components/SimulatedData.js +721 -721
- package/src/components/SplitDialog.vue +287 -287
- package/src/components/SplitFlow.vue +414 -414
- package/src/components/index.js +7 -7
- package/src/components/markerZoomLevelsHardCoded.js +255 -255
- package/src/components/scripts/utilities.js +173 -173
- package/src/components/viewers/Flatmap.vue +145 -145
- package/src/components/viewers/Iframe.vue +31 -31
- package/src/components/viewers/MultiFlatmap.vue +384 -384
- package/src/components/viewers/Plot.vue +23 -23
- package/src/components/viewers/Scaffold.vue +198 -198
- package/src/components/viewers/Simulation.vue +21 -21
- package/src/icons/yellowstar.js +1 -1
- package/src/main.js +32 -22
- package/src/mixins/ContentMixin.js +438 -438
- package/src/mixins/DynamicMarkerMixin.js +88 -88
- package/src/mixins/RetrieveContextCardMixin.js +82 -0
- package/src/mixins/S3Bucket.vue +37 -37
- package/src/stores/entries.js +40 -40
- package/src/stores/index.js +24 -16
- package/src/stores/settings.js +144 -144
- package/src/stores/splitFlow.js +523 -523
- package/static.json +7 -7
- package/tsconfig.json +19 -0
- package/vite.config.js +70 -66
- package/vite.static-build.js +12 -12
- package/vitest.workspace.js +3 -3
- package/vuese-generator.js +65 -0
@@ -1,88 +1,88 @@
|
|
1
|
-
|
2
|
-
import markerZoomLevels from "../components/markerZoomLevelsHardCoded.js";
|
3
|
-
import { mapStores } from 'pinia';
|
4
|
-
import { useSettingsStore } from '../stores/settings';
|
5
|
-
|
6
|
-
|
7
|
-
/*
|
8
|
-
* Function to check markers visibility at the given zoom level.
|
9
|
-
* I have modified it to make sure the marker is displayed
|
10
|
-
* if the uberon is not present in the hardcoded zoom-level list.
|
11
|
-
*/
|
12
|
-
const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel) => {
|
13
|
-
if (markers) {
|
14
|
-
markers.forEach(id => {
|
15
|
-
let foundInArray = false;
|
16
|
-
// First check if uberon is in the list, check for zoom level
|
17
|
-
// if true. Note: markerZoomLevels is imported.
|
18
|
-
for (let i = 0; i < markerZoomLevels.length; i++) {
|
19
|
-
if (markerZoomLevels[i].id === id) {
|
20
|
-
foundInArray = true;
|
21
|
-
if (zoomLevel >= markerZoomLevels[i].showAtZoom) {
|
22
|
-
flatmapImp.addMarker(id, {className: "standard-marker"});
|
23
|
-
}
|
24
|
-
break;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
// Did not match, add it regardless so we do not lose any
|
28
|
-
// markers.
|
29
|
-
if (!foundInArray) {
|
30
|
-
flatmapImp.addMarker(id, {className: "standard-marker"});
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
/* eslint-disable no-alert, no-console */
|
37
|
-
export default {
|
38
|
-
computed: {
|
39
|
-
...mapStores(useSettingsStore),
|
40
|
-
},
|
41
|
-
methods: {
|
42
|
-
flatmapPanZoomCallback: function (payload) {
|
43
|
-
if (this.mouseHovered) {
|
44
|
-
const result = {
|
45
|
-
paneIndex: this.entry.id,
|
46
|
-
eventType: "panZoom",
|
47
|
-
payload: payload,
|
48
|
-
type: this.entry.type,
|
49
|
-
};
|
50
|
-
this.flatmapMarkerZoomUpdate(false, undefined);
|
51
|
-
this.$emit("resource-selected", result);
|
52
|
-
}
|
53
|
-
},
|
54
|
-
/**
|
55
|
-
* Function used for updating the flatmap markers.
|
56
|
-
* It will only update the markers if zoom level has changed or
|
57
|
-
* the force flag is true.
|
58
|
-
*/
|
59
|
-
flatmapMarkerZoomUpdate(force, flatmap) {
|
60
|
-
if (!this.flatmapReady) return;
|
61
|
-
|
62
|
-
let flatmapImp = flatmap;
|
63
|
-
if (!flatmapImp)
|
64
|
-
flatmapImp = this.getFlatmapImp();
|
65
|
-
|
66
|
-
if (flatmapImp) {
|
67
|
-
let currentZoom = flatmapImp.getZoom()["zoom"];
|
68
|
-
if (force || this.zoomLevel !== currentZoom) {
|
69
|
-
this.zoomLevel = currentZoom;
|
70
|
-
flatmapImp.clearMarkers();
|
71
|
-
let markers = this.settingsStore.markers;
|
72
|
-
checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel);
|
73
|
-
if (this.entry.type === "MultiFlatmap") {
|
74
|
-
this.restoreFeaturedMarkers(flatmapImp);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
},
|
79
|
-
flatmapReadyForMarkerUpdates: function (flatmap) {
|
80
|
-
if (flatmap) {
|
81
|
-
flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
|
82
|
-
this.flatmapReady = true;
|
83
|
-
const flatmapImp = flatmap.mapImp;
|
84
|
-
this.flatmapMarkerZoomUpdate(true, flatmapImp);
|
85
|
-
}
|
86
|
-
},
|
87
|
-
}
|
88
|
-
}
|
1
|
+
|
2
|
+
import markerZoomLevels from "../components/markerZoomLevelsHardCoded.js";
|
3
|
+
import { mapStores } from 'pinia';
|
4
|
+
import { useSettingsStore } from '../stores/settings';
|
5
|
+
|
6
|
+
|
7
|
+
/*
|
8
|
+
* Function to check markers visibility at the given zoom level.
|
9
|
+
* I have modified it to make sure the marker is displayed
|
10
|
+
* if the uberon is not present in the hardcoded zoom-level list.
|
11
|
+
*/
|
12
|
+
const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel) => {
|
13
|
+
if (markers) {
|
14
|
+
markers.forEach(id => {
|
15
|
+
let foundInArray = false;
|
16
|
+
// First check if uberon is in the list, check for zoom level
|
17
|
+
// if true. Note: markerZoomLevels is imported.
|
18
|
+
for (let i = 0; i < markerZoomLevels.length; i++) {
|
19
|
+
if (markerZoomLevels[i].id === id) {
|
20
|
+
foundInArray = true;
|
21
|
+
if (zoomLevel >= markerZoomLevels[i].showAtZoom) {
|
22
|
+
flatmapImp.addMarker(id, {className: "standard-marker"});
|
23
|
+
}
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
// Did not match, add it regardless so we do not lose any
|
28
|
+
// markers.
|
29
|
+
if (!foundInArray) {
|
30
|
+
flatmapImp.addMarker(id, {className: "standard-marker"});
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
/* eslint-disable no-alert, no-console */
|
37
|
+
export default {
|
38
|
+
computed: {
|
39
|
+
...mapStores(useSettingsStore),
|
40
|
+
},
|
41
|
+
methods: {
|
42
|
+
flatmapPanZoomCallback: function (payload) {
|
43
|
+
if (this.mouseHovered) {
|
44
|
+
const result = {
|
45
|
+
paneIndex: this.entry.id,
|
46
|
+
eventType: "panZoom",
|
47
|
+
payload: payload,
|
48
|
+
type: this.entry.type,
|
49
|
+
};
|
50
|
+
this.flatmapMarkerZoomUpdate(false, undefined);
|
51
|
+
this.$emit("resource-selected", result);
|
52
|
+
}
|
53
|
+
},
|
54
|
+
/**
|
55
|
+
* Function used for updating the flatmap markers.
|
56
|
+
* It will only update the markers if zoom level has changed or
|
57
|
+
* the force flag is true.
|
58
|
+
*/
|
59
|
+
flatmapMarkerZoomUpdate(force, flatmap) {
|
60
|
+
if (!this.flatmapReady) return;
|
61
|
+
|
62
|
+
let flatmapImp = flatmap;
|
63
|
+
if (!flatmapImp)
|
64
|
+
flatmapImp = this.getFlatmapImp();
|
65
|
+
|
66
|
+
if (flatmapImp) {
|
67
|
+
let currentZoom = flatmapImp.getZoom()["zoom"];
|
68
|
+
if (force || this.zoomLevel !== currentZoom) {
|
69
|
+
this.zoomLevel = currentZoom;
|
70
|
+
flatmapImp.clearMarkers();
|
71
|
+
let markers = this.settingsStore.markers;
|
72
|
+
checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel);
|
73
|
+
if (this.entry.type === "MultiFlatmap") {
|
74
|
+
this.restoreFeaturedMarkers(flatmapImp);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
flatmapReadyForMarkerUpdates: function (flatmap) {
|
80
|
+
if (flatmap) {
|
81
|
+
flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
|
82
|
+
this.flatmapReady = true;
|
83
|
+
const flatmapImp = flatmap.mapImp;
|
84
|
+
this.flatmapMarkerZoomUpdate(true, flatmapImp);
|
85
|
+
}
|
86
|
+
},
|
87
|
+
}
|
88
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
/* eslint-disable no-alert, no-console */
|
3
|
+
export default {
|
4
|
+
// Note that the setting store is included in MapContent.vue
|
5
|
+
methods: {
|
6
|
+
retrieveContextCardFromUrl: async function (url) {
|
7
|
+
// split the url to get the datasetId
|
8
|
+
const [datasetId, basePath, scaffoldPath, s3uri] = this.splitInfoFromUrl(url);
|
9
|
+
|
10
|
+
// get the context file from scicrunch
|
11
|
+
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)
|
14
|
+
}
|
15
|
+
|
16
|
+
// return the context file
|
17
|
+
const fullPath = basePath + sciResults.contextFile + s3uri;
|
18
|
+
return {
|
19
|
+
s3uri: sciResults.s3uri,
|
20
|
+
contextCardUrl: fullPath,
|
21
|
+
}
|
22
|
+
},
|
23
|
+
splitInfoFromUrl: function (url) {
|
24
|
+
// 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'
|
26
|
+
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 full path to the file we want to get from scicrunch
|
30
|
+
|
31
|
+
// split the url by '/'
|
32
|
+
const parts = s3path.split('/');
|
33
|
+
// remove the first part
|
34
|
+
parts.shift();
|
35
|
+
// return the parts
|
36
|
+
const datasetId = parts[0];
|
37
|
+
|
38
|
+
return [datasetId, basePath, scaffoldPath, s3uri];
|
39
|
+
},
|
40
|
+
getContextFileFromScicrunch: async function (datasetId, scaffoldPath) {
|
41
|
+
// get the context file from scicrunch
|
42
|
+
let results = await fetch(`${this.settingsStore.sparcApi}/dataset_info/using_multiple_discoverIds/?discoverIds=${datasetId}`)
|
43
|
+
.then(response => response.json())
|
44
|
+
.then(data => {
|
45
|
+
// get the context file
|
46
|
+
if (data.numberOfHits === 1) { // chgeck if there is only one hit
|
47
|
+
const contextFile = data.results[0]['abi-contextual-information']
|
48
|
+
|
49
|
+
// check if there is only one context file
|
50
|
+
if ( contextFile && contextFile.length === 1) {
|
51
|
+
return {
|
52
|
+
success: true,
|
53
|
+
contextFile: contextFile[0],
|
54
|
+
s3uri: data.results[0]['s3uri']
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
// If there are multiple context files, find the one that matches the scaffold path
|
59
|
+
else if (contextFile && contextFile.length > 1) {
|
60
|
+
let search = this.findContextInforForFilePath(data.results[0]['abi-context-file'], scaffoldPath);
|
61
|
+
if (search) {
|
62
|
+
return {
|
63
|
+
success: true,
|
64
|
+
contextFile: search,
|
65
|
+
s3uri: data.results[0]['s3uri']
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return {success: false};
|
71
|
+
}).catch(error => {
|
72
|
+
console.error('Error:', error);
|
73
|
+
return {success: false};
|
74
|
+
});
|
75
|
+
return results;
|
76
|
+
},
|
77
|
+
findContextInforForFilePath: function (dataciteInfo, filePath) {
|
78
|
+
let result = dataciteInfo.find((info) => info.datacite.isDerivedFrom.path.includes(filePath))
|
79
|
+
return result?.dataset?.path
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
package/src/mixins/S3Bucket.vue
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
<script>
|
2
|
-
export default {
|
3
|
-
name: "S3Bucket",
|
4
|
-
data() {
|
5
|
-
return {
|
6
|
-
s3Bucket: undefined,
|
7
|
-
s3Prefix: "",
|
8
|
-
};
|
9
|
-
},
|
10
|
-
methods: {
|
11
|
-
updateS3Bucket: function(s3uri) {
|
12
|
-
this.s3Bucket = undefined;
|
13
|
-
if (s3uri) {
|
14
|
-
const substring = s3uri.split("//")[1];
|
15
|
-
if (substring) {
|
16
|
-
this.s3Bucket = substring.split("/")[0];
|
17
|
-
const n = substring.indexOf('/');
|
18
|
-
this.s3Prefix = substring.substring(n + 1);
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
},
|
23
|
-
getS3Args: function() {
|
24
|
-
if (this.s3Bucket) {
|
25
|
-
return `?s3BucketName=${this.s3Bucket}`
|
26
|
-
}
|
27
|
-
return "";
|
28
|
-
},
|
29
|
-
getS3Prefix: function() {
|
30
|
-
return this.s3Prefix;
|
31
|
-
}
|
32
|
-
},
|
33
|
-
|
34
|
-
};
|
35
|
-
</script>
|
36
|
-
|
37
|
-
|
1
|
+
<script>
|
2
|
+
export default {
|
3
|
+
name: "S3Bucket",
|
4
|
+
data() {
|
5
|
+
return {
|
6
|
+
s3Bucket: undefined,
|
7
|
+
s3Prefix: "",
|
8
|
+
};
|
9
|
+
},
|
10
|
+
methods: {
|
11
|
+
updateS3Bucket: function(s3uri) {
|
12
|
+
this.s3Bucket = undefined;
|
13
|
+
if (s3uri) {
|
14
|
+
const substring = s3uri.split("//")[1];
|
15
|
+
if (substring) {
|
16
|
+
this.s3Bucket = substring.split("/")[0];
|
17
|
+
const n = substring.indexOf('/');
|
18
|
+
this.s3Prefix = substring.substring(n + 1);
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
getS3Args: function() {
|
24
|
+
if (this.s3Bucket) {
|
25
|
+
return `?s3BucketName=${this.s3Bucket}`
|
26
|
+
}
|
27
|
+
return "";
|
28
|
+
},
|
29
|
+
getS3Prefix: function() {
|
30
|
+
return this.s3Prefix;
|
31
|
+
}
|
32
|
+
},
|
33
|
+
|
34
|
+
};
|
35
|
+
</script>
|
36
|
+
|
37
|
+
|
package/src/stores/entries.js
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
import { defineStore } from 'pinia';
|
2
|
-
import { initialDefaultState } from "../components/scripts/utilities";
|
3
|
-
|
4
|
-
/* eslint-disable no-alert, no-console */
|
5
|
-
|
6
|
-
export const useEntriesStore = defineStore('entries', {
|
7
|
-
state: () => {
|
8
|
-
return initialDefaultState();
|
9
|
-
},
|
10
|
-
getters: {
|
11
|
-
findIndexOfId: (state) => id => {
|
12
|
-
for (let i = 0; i < state.entries.length; i++) {
|
13
|
-
if (state.entries[i].id == id) {
|
14
|
-
return i;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
return -1;
|
18
|
-
},
|
19
|
-
},
|
20
|
-
actions: {
|
21
|
-
addNewEntry(entry) {
|
22
|
-
this.entries.push(entry);
|
23
|
-
},
|
24
|
-
destroyEntry(index) {
|
25
|
-
if (index > -1) {
|
26
|
-
this.entries.splice(index, 1);
|
27
|
-
}
|
28
|
-
},
|
29
|
-
setAll(newEntries) {
|
30
|
-
this.entries = [];
|
31
|
-
Object.assign(this.entries, newEntries);
|
32
|
-
},
|
33
|
-
updateViewForEntry( {id, viewUrl}) {
|
34
|
-
// Update the scaffold with a view url
|
35
|
-
const entry = this.entries.find(entry => entry.id === id);
|
36
|
-
entry.viewUrl = viewUrl;
|
37
|
-
},
|
38
|
-
|
39
|
-
}
|
40
|
-
});
|
1
|
+
import { defineStore } from 'pinia';
|
2
|
+
import { initialDefaultState } from "../components/scripts/utilities";
|
3
|
+
|
4
|
+
/* eslint-disable no-alert, no-console */
|
5
|
+
|
6
|
+
export const useEntriesStore = defineStore('entries', {
|
7
|
+
state: () => {
|
8
|
+
return initialDefaultState();
|
9
|
+
},
|
10
|
+
getters: {
|
11
|
+
findIndexOfId: (state) => id => {
|
12
|
+
for (let i = 0; i < state.entries.length; i++) {
|
13
|
+
if (state.entries[i].id == id) {
|
14
|
+
return i;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return -1;
|
18
|
+
},
|
19
|
+
},
|
20
|
+
actions: {
|
21
|
+
addNewEntry(entry) {
|
22
|
+
this.entries.push(entry);
|
23
|
+
},
|
24
|
+
destroyEntry(index) {
|
25
|
+
if (index > -1) {
|
26
|
+
this.entries.splice(index, 1);
|
27
|
+
}
|
28
|
+
},
|
29
|
+
setAll(newEntries) {
|
30
|
+
this.entries = [];
|
31
|
+
Object.assign(this.entries, newEntries);
|
32
|
+
},
|
33
|
+
updateViewForEntry( {id, viewUrl}) {
|
34
|
+
// Update the scaffold with a view url
|
35
|
+
const entry = this.entries.find(entry => entry.id === id);
|
36
|
+
entry.viewUrl = viewUrl;
|
37
|
+
},
|
38
|
+
|
39
|
+
}
|
40
|
+
});
|
package/src/stores/index.js
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
export const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
import { defineStore } from 'pinia'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Activate the store when run the application individually.
|
5
|
+
* If the store exist in parent application,
|
6
|
+
* instead of creating a new store it will access the parent main store.
|
7
|
+
*/
|
8
|
+
export const useMainStore = defineStore('main', {
|
9
|
+
state: () => ({
|
10
|
+
userProfile: {
|
11
|
+
token: ''
|
12
|
+
},
|
13
|
+
}),
|
14
|
+
getters: {
|
15
|
+
userToken(state) {
|
16
|
+
return state.userProfile.token
|
17
|
+
},
|
18
|
+
},
|
19
|
+
actions: {
|
20
|
+
setUserToken(value) {
|
21
|
+
this.userProfile.token = value
|
22
|
+
},
|
23
|
+
}
|
24
|
+
})
|