@abi-software/mapintegratedvuer 1.18.4-beta.0 → 1.18.4

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/mapintegratedvuer",
3
- "version": "1.18.4-beta.0",
3
+ "version": "1.18.4",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -57,7 +57,7 @@
57
57
  "@abi-software/map-utilities": "1.8.3",
58
58
  "@abi-software/plotvuer": "1.0.7",
59
59
  "@abi-software/scaffoldvuer": "1.15.6",
60
- "@abi-software/simulationvuer": "3.2.0",
60
+ "@abi-software/simulationvuer": "3.2.6",
61
61
  "@abi-software/sparc-annotation": "0.3.2",
62
62
  "@abi-software/svg-sprite": "1.0.4",
63
63
  "@element-plus/icons-vue": "^2.3.1",
@@ -263,7 +263,7 @@ export default {
263
263
  this.flatmapSource.forEach((source, i) => {
264
264
  const path = this.generateFileLink(source);
265
265
  let flatmapContent = `<div>${source.name}</div>`;
266
- let flatmapSource = this.flatmapAPI ?
266
+ let flatmapSource = this.flatmapAPI ?
267
267
  `${this.flatmapAPI}viewer?id=${source.flatmapUUID}` : source.flatmapUUID;
268
268
  flatmapContent += `\n`;
269
269
  flatmapContent += `<div><a href="${flatmapSource}">${flatmapSource}</a></div>`;
@@ -413,8 +413,16 @@ export default {
413
413
  },
414
414
  generateFileLink(sample){
415
415
  const path = this.processPathForUrl(sample.path);
416
- let link = `${this.envVars.ROOT_URL}/datasets/file/${sample.discoverId}/${sample.version}` + '?path=';
417
- link = link + path;
416
+ const version = sample.version || '';
417
+ let link = '';
418
+
419
+ if (sample.datasetURL) {
420
+ const datasetFileURL = sample.datasetURL.replace(/datasets\/(\d+)\/version\/(\d+)/, "datasets/file/$1/$2");
421
+ link = `${datasetFileURL}?path=${path}`;
422
+ } else if (sample.discoverId) {
423
+ link = `${this.envVars.ROOT_URL}/datasets/file/${sample.discoverId}/${version}?path=${path}`;
424
+ }
425
+
418
426
  return link;
419
427
  },
420
428
  parseMarkdown(markdown){
@@ -427,6 +435,28 @@ export default {
427
435
  const viewUrl = this.getFileFromPath(view.path)
428
436
  this.$emit("scaffold-view-clicked", viewUrl);
429
437
  },
438
+ fetchDOIURL: async function (doi) {
439
+ const doiKey = doi.includes('https://doi.org/') ? this.splitDoiFromUrl(doi) : doi;
440
+ const apiURL = `https://doi.org/api/handles/${doiKey}?noredirect`;
441
+
442
+ try {
443
+ const response = await fetch(apiURL);
444
+ if (!response.ok) {
445
+ throw new Error(`Response status: ${response.status}`);
446
+ }
447
+ const data = await response.json();
448
+
449
+ const urlEntry = data.values?.find(item => item.type === 'URL');
450
+
451
+ if (urlEntry && urlEntry.data && urlEntry.data.value) {
452
+ return urlEntry.data.value;
453
+ }
454
+
455
+ throw new Error("Redirect URL not found in DOI metadata");
456
+ } catch (error) {
457
+ throw new Error(error);
458
+ }
459
+ },
430
460
  getOriginalSource: function() {
431
461
  const discoverId = this.entry.discoverId
432
462
  const filesPos = 'files/'.length
@@ -449,7 +479,12 @@ export default {
449
479
  .then((data) => {
450
480
  this.loadingOriginalSource = false
451
481
  if (data.result) {
452
- data.result.forEach(result => {
482
+ data.result.forEach(async (result) => {
483
+ if (result.doi) {
484
+ const datasetURL = await this.fetchDOIURL(result.doi);
485
+ result.datasetURL = datasetURL
486
+ result.name = result.name || result.path.split('/').pop()
487
+ }
453
488
  if (result.flatmapUUID) {
454
489
  this.flatmapSource.push(result)
455
490
  } else {
@@ -636,7 +671,7 @@ export default {
636
671
  visibility: visible;
637
672
  }
638
673
  }
639
-
674
+
640
675
  .flatmap-entry {
641
676
  margin-top: 16px;
642
677
  }