@abi-software/mapintegratedvuer 0.7.2-vue3.0-alpha.0 → 1.0.1
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 -150
- package/assets/styleguide.css +19 -19
- package/cypress.config.js +23 -23
- package/dist/index.html +17 -17
- package/dist/mapintegratedvuer.js +74289 -73840
- package/dist/mapintegratedvuer.umd.cjs +878 -515
- package/dist/style.css +1 -1
- package/package.json +134 -135
- package/public/index.html +17 -17
- 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 +328 -333
- 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 +31 -31
- package/src/mixins/ContentMixin.js +438 -438
- package/src/mixins/DynamicMarkerMixin.js +88 -88
- package/src/mixins/S3Bucket.vue +37 -37
- package/src/stores/entries.js +40 -40
- package/src/stores/index.js +23 -23
- package/src/stores/settings.js +144 -144
- package/src/stores/splitFlow.js +523 -523
- package/static.json +7 -7
- package/vite.config.js +70 -70
- package/vite.static-build.js +12 -12
- package/vitest.workspace.js +3 -3
- package/vuese-generator.js +65 -65
- package/assets/gazelle-icons-no-background.css +0 -32
- package/dist/matterport.pdf +0 -0
- package/dist/test.txt +0 -0
- package/public/matterport.pdf +0 -0
- package/public/test.txt +0 -0
- package/q.json +0 -690
- package/src/mixins/RetrieveContextCardMixin.js +0 -82
- package/tsconfig.json +0 -19
@@ -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
|
+
}
|
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,24 +1,24 @@
|
|
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
|
-
}
|
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
24
|
})
|
package/src/stores/settings.js
CHANGED
@@ -1,144 +1,144 @@
|
|
1
|
-
import { defineStore } from 'pinia';
|
2
|
-
|
3
|
-
/* eslint-disable no-alert, no-console */
|
4
|
-
|
5
|
-
export const useSettingsStore = defineStore('settings', {
|
6
|
-
state: () => {
|
7
|
-
return {
|
8
|
-
shareLink: undefined,
|
9
|
-
sparcApi: undefined,
|
10
|
-
algoliaIndex: "k-core_dev_published_time_desc",
|
11
|
-
algoliaKey: undefined,
|
12
|
-
algoliaId: undefined,
|
13
|
-
pennsieveApi: undefined,
|
14
|
-
flatmapAPI: undefined,
|
15
|
-
nlLinkPrefix: undefined,
|
16
|
-
rootUrl: undefined,
|
17
|
-
facets: { species: [], gender: [], organ: [] },
|
18
|
-
facetLabels: [],
|
19
|
-
markers: [],
|
20
|
-
featuredMarkers: [],
|
21
|
-
featuredMarkerIdentifiers: [],
|
22
|
-
featuredMarkerDois: [],
|
23
|
-
featuredMarkerSpecies: [],
|
24
|
-
featuredDatasetIdentifiers: [],
|
25
|
-
helpDelay: 0,
|
26
|
-
}
|
27
|
-
},
|
28
|
-
getters: {
|
29
|
-
isFeaturedMarkerIdentifier: state => identifier => {
|
30
|
-
return state.featuredMarkerIdentifiers.includes(identifier);
|
31
|
-
},
|
32
|
-
featuredMarkerDoi: state => identifier => {
|
33
|
-
const index = state.featuredMarkerIdentifiers.findIndex(
|
34
|
-
element => element == identifier
|
35
|
-
);
|
36
|
-
return state.featuredMarkerDois[index];
|
37
|
-
},
|
38
|
-
},
|
39
|
-
actions: {
|
40
|
-
updateShareLink(newLink) {
|
41
|
-
this.shareLink = newLink;
|
42
|
-
},
|
43
|
-
updateSparcAPI(api) {
|
44
|
-
this.sparcApi = api;
|
45
|
-
},
|
46
|
-
updateAlgoliaIndex(algoliaIndex) {
|
47
|
-
this.algoliaIndex = algoliaIndex;
|
48
|
-
},
|
49
|
-
updateAlgoliaKey(algoliaKey) {
|
50
|
-
this.algoliaKey = algoliaKey;
|
51
|
-
},
|
52
|
-
updateAlgoliaId(algoliaId) {
|
53
|
-
this.algoliaId = algoliaId;
|
54
|
-
},
|
55
|
-
updatePennsieveApi(pennsieveApi) {
|
56
|
-
this.pennsieveApi = pennsieveApi;
|
57
|
-
},
|
58
|
-
updateFlatmapAPI(flatmapAPI) {
|
59
|
-
this.flatmapAPI = flatmapAPI;
|
60
|
-
},
|
61
|
-
updateNLLinkPrefix(nlLinkPrefix) {
|
62
|
-
this.nlLinkPrefix = nlLinkPrefix;
|
63
|
-
},
|
64
|
-
updateRootUrl(rootUrl) {
|
65
|
-
this.rootUrl = rootUrl;
|
66
|
-
},
|
67
|
-
updateMarkers(markers) {
|
68
|
-
this.markers = markers;
|
69
|
-
},
|
70
|
-
updateFeatured(datasetIdentifiers) {
|
71
|
-
this.featuredMarkerIdentifiers = new Array(datasetIdentifiers.length);
|
72
|
-
this.featuredMarkers = new Array(datasetIdentifiers.length);
|
73
|
-
this.featuredMarkerDois = new Array(datasetIdentifiers.length);
|
74
|
-
this.featuredMarkerSpecies = new Array(datasetIdentifiers.length);
|
75
|
-
this.featuredDatasetIdentifiers = datasetIdentifiers;
|
76
|
-
},
|
77
|
-
updateFeaturedMarker(payload) {
|
78
|
-
const index = this.featuredDatasetIdentifiers.findIndex(
|
79
|
-
element => element == payload.identifier
|
80
|
-
);
|
81
|
-
this.featuredMarkers[index] = payload.marker;
|
82
|
-
this.featuredMarkerDois[index] = payload.doi;
|
83
|
-
this.featuredMarkerSpecies[index] = payload.species;
|
84
|
-
},
|
85
|
-
updateFeaturedMarkerIdentifier(payload) {
|
86
|
-
this.featuredMarkerIdentifiers[payload.index] = payload.markerIdentifier;
|
87
|
-
},
|
88
|
-
resetFeaturedMarkerIdentifier() {
|
89
|
-
this.featuredMarkerIdentifiers = new Array(
|
90
|
-
this.featuredDatasetIdentifiers.length
|
91
|
-
);
|
92
|
-
},
|
93
|
-
updateFacets(facetsIn) {
|
94
|
-
// The following codes aim to minimise changes on the array
|
95
|
-
let facets = { species: [], gender: [], organ: [] };
|
96
|
-
//First add missing item
|
97
|
-
if (facetsIn) {
|
98
|
-
facetsIn.forEach(e => {
|
99
|
-
switch (e.term.toLowerCase()) {
|
100
|
-
case "species":
|
101
|
-
if (e.facet.toLowerCase() !== "show all") {
|
102
|
-
facets.species.push(e.facet);
|
103
|
-
if (!this.facets.species.includes(e.facet)) {
|
104
|
-
this.facets.species.push(e.facet);
|
105
|
-
}
|
106
|
-
} else {
|
107
|
-
this.facets.species = [];
|
108
|
-
}
|
109
|
-
break;
|
110
|
-
case "gender":
|
111
|
-
if (e.facet.toLowerCase() !== "show all") {
|
112
|
-
facets.gender.push(e.facet);
|
113
|
-
if (!this.facets.species.includes(e.facet))
|
114
|
-
this.facets.gender.push(e.facet);
|
115
|
-
}
|
116
|
-
break;
|
117
|
-
case "organ":
|
118
|
-
if (e.facet.toLowerCase() !== "show all") {
|
119
|
-
facets.organ.push(e.facet);
|
120
|
-
if (!this.facets.species.includes(e.facet))
|
121
|
-
this.facets.organ.push(e.facet);
|
122
|
-
}
|
123
|
-
break;
|
124
|
-
default:
|
125
|
-
break;
|
126
|
-
}
|
127
|
-
});
|
128
|
-
//Remove item not in list
|
129
|
-
for (const [key, arr] of Object.entries(this.facets)) {
|
130
|
-
let i = 0;
|
131
|
-
for (i = arr.length - 1; i >= 0; i -= 1) {
|
132
|
-
const index = facets[key].indexOf(arr[i]);
|
133
|
-
if (index == -1) {
|
134
|
-
arr.splice(i, 1);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
}
|
139
|
-
},
|
140
|
-
updateFacetLabels(facetLabels) {
|
141
|
-
this.facetLabels = facetLabels;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
});
|
1
|
+
import { defineStore } from 'pinia';
|
2
|
+
|
3
|
+
/* eslint-disable no-alert, no-console */
|
4
|
+
|
5
|
+
export const useSettingsStore = defineStore('settings', {
|
6
|
+
state: () => {
|
7
|
+
return {
|
8
|
+
shareLink: undefined,
|
9
|
+
sparcApi: undefined,
|
10
|
+
algoliaIndex: "k-core_dev_published_time_desc",
|
11
|
+
algoliaKey: undefined,
|
12
|
+
algoliaId: undefined,
|
13
|
+
pennsieveApi: undefined,
|
14
|
+
flatmapAPI: undefined,
|
15
|
+
nlLinkPrefix: undefined,
|
16
|
+
rootUrl: undefined,
|
17
|
+
facets: { species: [], gender: [], organ: [] },
|
18
|
+
facetLabels: [],
|
19
|
+
markers: [],
|
20
|
+
featuredMarkers: [],
|
21
|
+
featuredMarkerIdentifiers: [],
|
22
|
+
featuredMarkerDois: [],
|
23
|
+
featuredMarkerSpecies: [],
|
24
|
+
featuredDatasetIdentifiers: [],
|
25
|
+
helpDelay: 0,
|
26
|
+
}
|
27
|
+
},
|
28
|
+
getters: {
|
29
|
+
isFeaturedMarkerIdentifier: state => identifier => {
|
30
|
+
return state.featuredMarkerIdentifiers.includes(identifier);
|
31
|
+
},
|
32
|
+
featuredMarkerDoi: state => identifier => {
|
33
|
+
const index = state.featuredMarkerIdentifiers.findIndex(
|
34
|
+
element => element == identifier
|
35
|
+
);
|
36
|
+
return state.featuredMarkerDois[index];
|
37
|
+
},
|
38
|
+
},
|
39
|
+
actions: {
|
40
|
+
updateShareLink(newLink) {
|
41
|
+
this.shareLink = newLink;
|
42
|
+
},
|
43
|
+
updateSparcAPI(api) {
|
44
|
+
this.sparcApi = api;
|
45
|
+
},
|
46
|
+
updateAlgoliaIndex(algoliaIndex) {
|
47
|
+
this.algoliaIndex = algoliaIndex;
|
48
|
+
},
|
49
|
+
updateAlgoliaKey(algoliaKey) {
|
50
|
+
this.algoliaKey = algoliaKey;
|
51
|
+
},
|
52
|
+
updateAlgoliaId(algoliaId) {
|
53
|
+
this.algoliaId = algoliaId;
|
54
|
+
},
|
55
|
+
updatePennsieveApi(pennsieveApi) {
|
56
|
+
this.pennsieveApi = pennsieveApi;
|
57
|
+
},
|
58
|
+
updateFlatmapAPI(flatmapAPI) {
|
59
|
+
this.flatmapAPI = flatmapAPI;
|
60
|
+
},
|
61
|
+
updateNLLinkPrefix(nlLinkPrefix) {
|
62
|
+
this.nlLinkPrefix = nlLinkPrefix;
|
63
|
+
},
|
64
|
+
updateRootUrl(rootUrl) {
|
65
|
+
this.rootUrl = rootUrl;
|
66
|
+
},
|
67
|
+
updateMarkers(markers) {
|
68
|
+
this.markers = markers;
|
69
|
+
},
|
70
|
+
updateFeatured(datasetIdentifiers) {
|
71
|
+
this.featuredMarkerIdentifiers = new Array(datasetIdentifiers.length);
|
72
|
+
this.featuredMarkers = new Array(datasetIdentifiers.length);
|
73
|
+
this.featuredMarkerDois = new Array(datasetIdentifiers.length);
|
74
|
+
this.featuredMarkerSpecies = new Array(datasetIdentifiers.length);
|
75
|
+
this.featuredDatasetIdentifiers = datasetIdentifiers;
|
76
|
+
},
|
77
|
+
updateFeaturedMarker(payload) {
|
78
|
+
const index = this.featuredDatasetIdentifiers.findIndex(
|
79
|
+
element => element == payload.identifier
|
80
|
+
);
|
81
|
+
this.featuredMarkers[index] = payload.marker;
|
82
|
+
this.featuredMarkerDois[index] = payload.doi;
|
83
|
+
this.featuredMarkerSpecies[index] = payload.species;
|
84
|
+
},
|
85
|
+
updateFeaturedMarkerIdentifier(payload) {
|
86
|
+
this.featuredMarkerIdentifiers[payload.index] = payload.markerIdentifier;
|
87
|
+
},
|
88
|
+
resetFeaturedMarkerIdentifier() {
|
89
|
+
this.featuredMarkerIdentifiers = new Array(
|
90
|
+
this.featuredDatasetIdentifiers.length
|
91
|
+
);
|
92
|
+
},
|
93
|
+
updateFacets(facetsIn) {
|
94
|
+
// The following codes aim to minimise changes on the array
|
95
|
+
let facets = { species: [], gender: [], organ: [] };
|
96
|
+
//First add missing item
|
97
|
+
if (facetsIn) {
|
98
|
+
facetsIn.forEach(e => {
|
99
|
+
switch (e.term.toLowerCase()) {
|
100
|
+
case "species":
|
101
|
+
if (e.facet.toLowerCase() !== "show all") {
|
102
|
+
facets.species.push(e.facet);
|
103
|
+
if (!this.facets.species.includes(e.facet)) {
|
104
|
+
this.facets.species.push(e.facet);
|
105
|
+
}
|
106
|
+
} else {
|
107
|
+
this.facets.species = [];
|
108
|
+
}
|
109
|
+
break;
|
110
|
+
case "gender":
|
111
|
+
if (e.facet.toLowerCase() !== "show all") {
|
112
|
+
facets.gender.push(e.facet);
|
113
|
+
if (!this.facets.species.includes(e.facet))
|
114
|
+
this.facets.gender.push(e.facet);
|
115
|
+
}
|
116
|
+
break;
|
117
|
+
case "organ":
|
118
|
+
if (e.facet.toLowerCase() !== "show all") {
|
119
|
+
facets.organ.push(e.facet);
|
120
|
+
if (!this.facets.species.includes(e.facet))
|
121
|
+
this.facets.organ.push(e.facet);
|
122
|
+
}
|
123
|
+
break;
|
124
|
+
default:
|
125
|
+
break;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
//Remove item not in list
|
129
|
+
for (const [key, arr] of Object.entries(this.facets)) {
|
130
|
+
let i = 0;
|
131
|
+
for (i = arr.length - 1; i >= 0; i -= 1) {
|
132
|
+
const index = facets[key].indexOf(arr[i]);
|
133
|
+
if (index == -1) {
|
134
|
+
arr.splice(i, 1);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
},
|
140
|
+
updateFacetLabels(facetLabels) {
|
141
|
+
this.facetLabels = facetLabels;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
});
|