@abi-software/flatmapvuer 1.8.2 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.8.2",
3
+ "version": "1.8.3-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@abi-software/flatmap-viewer": "3.2.13",
47
- "@abi-software/map-utilities": "^1.4.2",
47
+ "@abi-software/map-utilities": "^1.4.3-beta.0",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
50
50
  "@element-plus/icons-vue": "^2.3.1",
@@ -589,6 +589,7 @@ Please use `const` to assign meaningful names to them...
589
589
  :tooltipEntry="tooltipEntry"
590
590
  :annotationDisplay="viewingMode === 'Annotation'"
591
591
  @annotation="commitAnnotationEvent"
592
+ @onActionClick="onActionClick"
592
593
  />
593
594
  </div>
594
595
  </div>
@@ -638,6 +639,7 @@ import { mapState } from 'pinia'
638
639
  import { useMainStore } from '@/store/index'
639
640
  import { DrawToolbar, Tooltip, TreeControls } from '@abi-software/map-utilities'
640
641
  import '@abi-software/map-utilities/dist/style.css'
642
+ import EventBus from './EventBus.js'
641
643
 
642
644
  const ERROR_MESSAGE = 'cannot be found on the map.';
643
645
 
@@ -1882,6 +1884,14 @@ export default {
1882
1884
  }
1883
1885
  });
1884
1886
  },
1887
+ changeConnectivitySource: function (payload) {
1888
+ const { featureId, connectivitySource } = payload;
1889
+ const newwPromise = this.flatmapQueries.queryForConnectivityNew(this.mapImp, featureId, null, connectivitySource);
1890
+ Promise.resolve(newwPromise).then((result) => {
1891
+ this.tooltipEntry = this.flatmapQueries.updateTooltipData(this.tooltipEntry);
1892
+ this.$emit('connectivity-info-open', this.tooltipEntry);
1893
+ })
1894
+ },
1885
1895
  /**
1886
1896
  * @public
1887
1897
  * Function to create/display tooltips from the provided ``data``.
@@ -2203,6 +2213,10 @@ export default {
2203
2213
  // Get connectivity knowledge source | SCKAN release
2204
2214
  if (this.mapImp.provenance?.connectivity) {
2205
2215
  this.tooltipEntry['knowledge-source'] = getKnowledgeSource(this.mapImp);
2216
+
2217
+ // Map id and uuid to load connectivity information from the map
2218
+ this.tooltipEntry['mapId'] = this.mapImp.provenance.id;
2219
+ this.tooltipEntry['mapuuid'] = this.mapImp.provenance.uuid;
2206
2220
  }
2207
2221
  this.$emit('connectivity-info-open', this.tooltipEntry);
2208
2222
  }
@@ -2688,6 +2702,7 @@ export default {
2688
2702
  provenanceTaxonomy: feature.taxons,
2689
2703
  }
2690
2704
  if (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") {
2705
+ this.featuresAlert = feature.alert
2691
2706
  this.checkAndCreatePopups(data)
2692
2707
  } else if (this.viewingMode === 'Neuron Connection') {
2693
2708
  setTimeout(() => {
@@ -2717,6 +2732,9 @@ export default {
2717
2732
  if (this.mapImp) return this.mapImp.search(term)
2718
2733
  return []
2719
2734
  },
2735
+ onActionClick: function (data) {
2736
+ EventBus.emit('onActionClick', data)
2737
+ },
2720
2738
  },
2721
2739
  props: {
2722
2740
  /**
@@ -46,12 +46,14 @@ function loadAndStoreKnowledge(mapImp, flatmapQueries) {
46
46
  where source="${knowledgeSource}"
47
47
  order by source desc`;
48
48
  const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
49
+ const flatmapKnowledgeSource = sessionStorage.getItem('flatmap-knowledge-source');
49
50
 
50
- if (!flatmapKnowledge) {
51
+ if (!flatmapKnowledge || flatmapKnowledgeSource !== knowledgeSource) {
51
52
  flatmapQueries.flatmapQuery(sql).then((response) => {
52
53
  const mappedData = response.values.map(x => x[0]);
53
54
  const parsedData = mappedData.map(x => JSON.parse(x));
54
55
  sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
56
+ sessionStorage.setItem('flatmap-knowledge-source', knowledgeSource);
55
57
  updateFlatmapKnowledgeCache();
56
58
  });
57
59
  }
@@ -69,6 +71,7 @@ function removeFlatmapKnowledgeCache() {
69
71
  const keys = [
70
72
  'flatmap-knowledge',
71
73
  'flatmap-knowledge-expiry',
74
+ 'flatmap-knowledge-source',
72
75
  ];
73
76
  keys.forEach((key) => {
74
77
  sessionStorage.removeItem(key);
@@ -125,6 +125,18 @@ let FlatmapQueries = function () {
125
125
  return tooltipData
126
126
  }
127
127
 
128
+ this.updateTooltipData = function (tooltipEntry) {
129
+ return {
130
+ ...tooltipEntry,
131
+ origins: this.origins,
132
+ originsWithDatasets: this.originsWithDatasets,
133
+ components: this.components,
134
+ componentsWithDatasets: this.componentsWithDatasets,
135
+ destinations: this.destinations,
136
+ destinationsWithDatasets: this.destinationsWithDatasets,
137
+ };
138
+ }
139
+
128
140
  this.createComponentsLabelList = function (components, lookUp) {
129
141
  let labelList = []
130
142
  components.forEach((n) => {
@@ -248,14 +260,22 @@ let FlatmapQueries = function () {
248
260
  this.rawURLs = []
249
261
  if (!keastIds || keastIds.length == 0 || !keastIds[0]) return
250
262
 
251
- let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal) // This on returns a promise so dont need 'await'
263
+ // set connectivity source if available
264
+ const connectivitySource = localStorage.getItem('connectivity-source');
265
+
266
+ let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal, connectivitySource) // This on returns a promise so dont need 'await'
252
267
  let results = await Promise.all([prom1])
253
268
  return results
254
269
  }
255
270
 
256
- this.queryForConnectivityNew = function (mapImp, keastIds, signal, processConnectivity=true) {
271
+ this.queryForConnectivityNew = function (mapImp, keastIds, signal, connectivitySource, processConnectivity=true) {
257
272
  return new Promise((resolve) => {
258
- mapImp.queryKnowledge(keastIds[0])
273
+ const mapuuid = mapImp.provenance.uuid;
274
+ const queryAPI = connectivitySource === 'map'
275
+ ? this.queryMapConnectivity(mapuuid, keastIds[0])
276
+ : mapImp.queryKnowledge(keastIds[0]);
277
+
278
+ queryAPI
259
279
  .then((response) => {
260
280
  if (this.checkConnectivityExists(response)) {
261
281
  let connectivity = response;
@@ -290,6 +310,21 @@ let FlatmapQueries = function () {
290
310
  })
291
311
  }
292
312
 
313
+ this.queryMapConnectivity = async function (mapuuid, pathId) {
314
+ const url = this.flatmapApi + `flatmap/${mapuuid}/connectivity/${pathId}`;
315
+
316
+ try {
317
+ const response = await fetch(url);
318
+ if (!response.ok) {
319
+ throw new Error(`Response status: ${response.status}`);
320
+ }
321
+
322
+ return await response.json();
323
+ } catch (error) {
324
+ throw new Error(error);
325
+ }
326
+ },
327
+
293
328
  this.queryForConnectivity = function (mapImp, keastIds, signal, processConnectivity=true) {
294
329
  const data = { sql: this.buildConnectivitySqlStatement(keastIds) }
295
330
  const headers = {