@abi-software/flatmapvuer 1.12.0-beta.1 → 1.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.12.0-beta.1",
3
+ "version": "1.12.1",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@abi-software/map-utilities": "^1.7.6",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
- "@abi-software/svg-sprite": "1.0.2",
49
+ "@abi-software/svg-sprite": "1.0.3",
50
50
  "@element-plus/icons-vue": "^2.3.1",
51
51
  "css-element-queries": "^1.2.2",
52
52
  "element-plus": "2.8.4",
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <div class="flatmap-error-message" v-if="flatmapError.messages">
13
13
  <div v-for="(message, index) in flatmapError.messages" :key="index">
14
- {{ message }}
14
+ <div v-html="message"></div>
15
15
  </div>
16
16
  </div>
17
17
  <div v-if="flatmapError.button">
@@ -2158,40 +2158,46 @@ export default {
2158
2158
  });
2159
2159
  } else {
2160
2160
  // clicking on paths
2161
- // do nothing for origin, destination, via
2162
2161
  const searchTerms = resources.join();
2163
2162
 
2163
+ // for neuron connection mode "all"
2164
2164
  if (this.connectionType.toLowerCase() === 'all') {
2165
2165
  this.$emit('neuron-connection-feature-click', {
2166
2166
  filters: [],
2167
2167
  search: searchTerms,
2168
2168
  });
2169
+ } else {
2170
+ // for neuron connection mode "origin", "via" and "destination"
2171
+ await this.openConnectivityInfo(data);
2169
2172
  }
2170
2173
  }
2171
2174
  } else {
2172
- // load and store knowledge
2173
- loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
2174
- let prom1 = []
2175
- // Emit placeholders first.
2176
- // This may contain invalid connectivity.
2177
- this.tooltipEntry = data
2178
- .filter(tooltip => tooltip.resource[0] in this.mapImp.pathways.paths)
2179
- .map((tooltip) => {
2180
- return { title: tooltip.label, featureId: tooltip.resource, ready: false }
2181
- })
2182
- // this should only for flatmap paths not all features
2183
- if (this.tooltipEntry.length) {
2184
- this.$emit('connectivity-info-open', this.tooltipEntry);
2175
+ await this.openConnectivityInfo(data);
2176
+ }
2177
+ },
2178
+ openConnectivityInfo: async function (data) {
2179
+ // load and store knowledge
2180
+ loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
2181
+ let prom1 = []
2182
+ // Emit placeholders first.
2183
+ // This may contain invalid connectivity.
2184
+ this.tooltipEntry = data
2185
+ .filter(tooltip => tooltip.resource[0] in this.mapImp.pathways.paths)
2186
+ .map((tooltip) => {
2187
+ return { title: tooltip.label, featureId: tooltip.resource, ready: false }
2188
+ })
2189
+ // this should only for flatmap paths not all features
2190
+ if (this.tooltipEntry.length) {
2191
+ this.$emit('connectivity-info-open', this.tooltipEntry);
2185
2192
 
2186
- // While having placeholders displayed, get details for all paths and then replace.
2187
- for (let index = 0; index < data.length; index++) {
2188
- prom1.push(await this.getKnowledgeTooltip(data[index]))
2189
- }
2190
- this.tooltipEntry = await Promise.all(prom1)
2191
- const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0])
2192
- if (featureIds.length > 0) {
2193
- this.displayTooltip(featureIds)
2194
- }
2193
+ // While having placeholders displayed, get details for all paths and then replace.
2194
+ for (let index = 0; index < data.length; index++) {
2195
+ prom1.push(await this.getKnowledgeTooltip(data[index]))
2196
+ }
2197
+ this.tooltipEntry = await Promise.all(prom1)
2198
+ const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0])
2199
+ if (featureIds.length > 0) {
2200
+ this.displayTooltip(featureIds)
2195
2201
  }
2196
2202
  }
2197
2203
  },
@@ -3028,7 +3034,11 @@ export default {
3028
3034
  this.lastViewport = markRaw(this.mapImp.getState())
3029
3035
  this.flatmapError = {};
3030
3036
  this.flatmapError['title'] = 'GL context lost!'
3031
- this.flatmapError['messages'] = [`GL context is lost due to too many concurrent GL contexts. Please try using the Restore Context button.`]
3037
+ this.flatmapError['messages'] = [`A display issue has occurred due
3038
+ to a limit on available WebGL contexts. You can restore the display
3039
+ using the Restore Context button. Please see the
3040
+ <a href="https://docs.sparc.science/docs/integrated-maps-viewer-overview#limit-on-available-webgl-contexts" target='_blank'>documentation</a>
3041
+ for more details.`]
3032
3042
  this.flatmapError['button'] = {
3033
3043
  text: 'Restore Context',
3034
3044
  callback: () => {
@@ -166,10 +166,35 @@ export default {
166
166
  if (this.requireInitialisation) {
167
167
  //It has not been initialised yet
168
168
  this.requireInitialisation = false
169
- fetch(this.flatmapAPI)
170
- .then((response) => response.json())
169
+ const controller = new AbortController();
170
+ const signal = controller.signal;
171
+ const timeoutId = setTimeout(() => controller.abort(), 5000);
172
+
173
+ fetch(this.flatmapAPI, {signal})
174
+ .then((response) => {
175
+ if (!response.ok) {
176
+ // HTTP-level errors
177
+ if (response.status === 404) {
178
+ this.multiflatmapError = {};
179
+ this.multiflatmapError['title'] = 'MultiFlatmap Error!';
180
+ this.multiflatmapError['messages'] = [
181
+ `Sorry, the component could not be loaded because the specified
182
+ flatmap API endpoint is incorrect. Please check the endpoint URL
183
+ or contact support if the problem persists.`
184
+ ];
185
+ this.initialised = true;
186
+ resolve();
187
+ this.resolveList.forEach((other) => other());
188
+
189
+ return Promise.reject({ handled: true });
190
+ }
191
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
192
+ }
193
+ return response.json()
194
+ })
171
195
  .then((data) => {
172
- if (data.status_code === 404) {
196
+ // Application-level 404 in a 200 response
197
+ if (data && data.status_code === 404) {
173
198
  console.error('Flatmap API endpoint is incorrect', data);
174
199
  this.multiflatmapError = {};
175
200
  this.multiflatmapError['title'] = 'MultiFlatmap Error!';
@@ -178,6 +203,11 @@ export default {
178
203
  flatmap API endpoint is incorrect. Please check the endpoint URL
179
204
  or contact support if the problem persists.`
180
205
  ];
206
+
207
+ this.initialised = true;
208
+ resolve();
209
+ this.resolveList.forEach((other) => other());
210
+ return;
181
211
  }
182
212
  //Check each key in the provided availableSpecies against the one
183
213
  Object.keys(this.availableSpecies).forEach((key) => {
@@ -237,6 +267,7 @@ export default {
237
267
  })
238
268
  })
239
269
  .catch((error) => {
270
+ if (error && error.handled) return;
240
271
  console.error('Error fetching flatmap:', error)
241
272
  this.initialised = true;
242
273
  this.multiflatmapError = {};
@@ -251,6 +282,9 @@ export default {
251
282
  other()
252
283
  })
253
284
  })
285
+ .finally(() => {
286
+ clearTimeout(timeoutId);
287
+ });
254
288
  } else if (this.initialised) {
255
289
  //resolve as it has been initialised
256
290
  resolve()
@@ -70,6 +70,7 @@ export default {
70
70
  const specifiedColour = this.item["color"] ? this.item["color"] : this.item["colour"];
71
71
  let colour = specifiedColour ? specifiedColour : "transparent";
72
72
  let borderColour = this.item.border ? this.item.border : "black";
73
+ let borderStyle = this.item.borderStyle ? this.item.borderStyle : "default";
73
74
  if (specifiedColour && !this.item.border) {
74
75
  borderColour = colour;
75
76
  }
@@ -82,7 +83,7 @@ export default {
82
83
  } else if (this.item[this.styleKey] === 'line') {
83
84
  return {'color': colour};
84
85
  } else {
85
- return { 'background-color': colour, 'border-color': borderColour};
86
+ return { 'background-color': colour, 'border-color': borderColour, 'border-style': borderStyle};
86
87
  }
87
88
  },
88
89
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * a single source for the flatmap-viewer library import
3
3
  */
4
- import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.4.1/+esm';
4
+ import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.4.3/+esm';
5
5
 
6
6
  export default flatmap;