@abi-software/map-side-bar 2.14.1-simulation.0 → 2.14.1-simulation.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/map-side-bar",
3
- "version": "2.14.1-simulation.0",
3
+ "version": "2.14.1-simulation.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -243,7 +243,8 @@ export default {
243
243
  //set defaults if we hit an error
244
244
  this.thumbnail = MissingImage
245
245
  if (this.entry.thumbnail) {
246
- this.thumbnail = this.entry.thumbnail
246
+ const resolved = new URL(this.entry.thumbnail, this.envVars.TEST_DATA_LOCATION);
247
+ this.thumbnail = resolved.href;
247
248
  }
248
249
  this.discoverId = Number(this.entry.datasetId)
249
250
  this.loading = false
@@ -25,10 +25,15 @@ const baseName = (str) => {
25
25
  return str.split('\\').pop().split('/').pop()
26
26
  }
27
27
 
28
- const capitalise = function (string) {
28
+ const capitalise = (string) => {
29
29
  return string.replace(/\b\w/g, (v) => v.toUpperCase())
30
30
  }
31
31
 
32
+ const resolveURL = (relative, base) => {
33
+ const resolved = new URL(relative, base);
34
+ return resolved.href;
35
+ }
36
+
32
37
  import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js'
33
38
  import Gallery from "@abi-software/gallery";
34
39
  import "@abi-software/gallery/dist/style.css";
@@ -145,7 +150,11 @@ export default {
145
150
  if (flatmap.associated_flatmap?.identifier) {
146
151
  const filePath = flatmap.dataset.path
147
152
  const id = flatmap.identifier
148
- let thumbnailURL = flatmap.thumbnail?.url
153
+ let thumbnailURL = undefined
154
+ if (flatmap.thumbnail?.url) {
155
+ thumbnailURL = resolveURL(flatmap.thumbnail.url,
156
+ this.envVars.TEST_DATA_LOCATION)
157
+ }
149
158
  let mimetype = ''
150
159
  if (!thumbnailURL) {
151
160
  let thumbnail = this.getThumbnailForPlot(
@@ -345,7 +354,11 @@ export default {
345
354
  const id = simulation.identifier
346
355
  //Despite of the name, this method can be used to retreive
347
356
  //the thumbnail information for any none scaffold type thumbnail
348
- let thumbnailURL = simulation.thumbnail?.url
357
+ let thumbnailURL = undefined;
358
+ if (simulation.thumbnail?.url) {
359
+ thumbnailURL = resolveURL(simulation.thumbnail.url,
360
+ this.envVars.TEST_DATA_LOCATION)
361
+ }
349
362
  let mimetype = ''
350
363
  if (!thumbnailURL) {
351
364
  const thumbnail = this.getThumbnailForPlot(
@@ -364,7 +377,8 @@ export default {
364
377
  }
365
378
  let resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`
366
379
  if (simulation.resource?.url) {
367
- resource = simulation.resource.url
380
+ resource = resolveURL(simulation.resource.url,
381
+ this.envVars.TEST_DATA_LOCATION)
368
382
  }
369
383
  let action = {
370
384
  label: capitalise(this.label),