@abi-software/mapintegratedvuer 1.12.1 → 1.12.2

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.12.1",
3
+ "version": "1.12.2",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -52,11 +52,11 @@
52
52
  "*.js"
53
53
  ],
54
54
  "dependencies": {
55
- "@abi-software/flatmapvuer": "1.11.1",
56
- "@abi-software/map-side-bar": "2.10.2",
57
- "@abi-software/map-utilities": "1.7.0",
55
+ "@abi-software/flatmapvuer": "1.11.2",
56
+ "@abi-software/map-side-bar": "2.10.3",
57
+ "@abi-software/map-utilities": "1.7.1",
58
58
  "@abi-software/plotvuer": "1.0.5",
59
- "@abi-software/scaffoldvuer": "1.11.2",
59
+ "@abi-software/scaffoldvuer": "1.11.3",
60
60
  "@abi-software/simulationvuer": "2.0.17",
61
61
  "@abi-software/sparc-annotation": "0.3.2",
62
62
  "@abi-software/svg-sprite": "1.0.2",
@@ -13,6 +13,31 @@
13
13
  </div>
14
14
  </div>
15
15
  <div class="card-bottom">
16
+ <div v-loading="loadingOriginalSource">
17
+ <el-collapse v-if="originalSource && originalSource.length" v-model="activeName">
18
+ <el-collapse-item title="View/Hide source data links" name="sourceDataLinks">
19
+ <ul class="source-data-list">
20
+ <template v-for="(source, i) in originalSource" :key="'source-'+ i">
21
+ <li>
22
+ <a v-if="source && source.path" :href="generateFileLink(source)" target="_blank">View {{source.name}}</a>
23
+ </li>
24
+ </template>
25
+ </ul>
26
+ </el-collapse-item>
27
+ </el-collapse>
28
+ </div>
29
+ <div v-if="flatmapSource && flatmapSource.length" class="flatmap-entry">
30
+ Associated flatmaps from source:
31
+ <ul class="source-data-list">
32
+ <template v-for="(source, i) in flatmapSource" :key="'flatmap-' + i">
33
+ <li>
34
+ <span @click="flatmapClick(source)">
35
+ For {{ source.name }}
36
+ </span>
37
+ </li>
38
+ </template>
39
+ </ul>
40
+ </div>
16
41
  <div>
17
42
  <!-- Show sampeles and views seperately if they do not match -->
18
43
  <template v-if="!samplesUnderViews">
@@ -63,7 +88,7 @@
63
88
 
64
89
  <!-- Copy to clipboard button container -->
65
90
  <div class="float-button-container">
66
- <CopyToClipboard :content="updatedCopyContent" @copied="onCopied" theme="light" />
91
+ <CopyToClipboard :content="copyContent" @copied="onCopied" theme="light" />
67
92
  </div>
68
93
  </div>
69
94
  </div>
@@ -73,11 +98,13 @@
73
98
  <script>
74
99
  /* eslint-disable no-alert, no-console */
75
100
  import { CopyToClipboard } from "@abi-software/map-utilities";
101
+ import { mapStores } from 'pinia';
76
102
  import tagging from '../services/tagging';
77
103
  import '@abi-software/map-utilities/dist/style.css';
78
-
104
+ import EventBus from './EventBus';
79
105
  //provide the s3Bucket related methods and data.
80
106
  import S3Bucket from "../mixins/S3Bucket.vue";
107
+ import { useSettingsStore } from '../stores/settings';
81
108
 
82
109
  import { marked } from 'marked'
83
110
  import xss from 'xss'
@@ -124,6 +151,11 @@ export default {
124
151
  showContextCard: true,
125
152
  sampleDetails: {},
126
153
  loading: false,
154
+ loadingOriginalSource: true,
155
+ originalSource: [],
156
+ flatmapSource: [],
157
+ activeName: "",
158
+ copyContent: "",
127
159
  };
128
160
  },
129
161
  watch: {
@@ -151,6 +183,10 @@ export default {
151
183
  }
152
184
  },
153
185
  computed: {
186
+ ...mapStores(useSettingsStore),
187
+ flatmapAPI: function() {
188
+ return this.settingsStore.flatmapAPI;
189
+ },
154
190
  samplesUnderViews: function(){
155
191
  if (this.contextData){
156
192
  if (this.contextData.samplesUnderViews){
@@ -180,7 +216,17 @@ export default {
180
216
  }
181
217
  return this.entry.banner
182
218
  },
183
- updatedCopyContent: function () {
219
+ },
220
+ methods: {
221
+ flatmapClick: function(source) {
222
+ const newView = {
223
+ type: "Flatmap",
224
+ resource: source.flatmapUUID,
225
+ label: this.contextData.heading
226
+ };
227
+ EventBus.emit("CreateNewEntry", newView);
228
+ },
229
+ updateCopyContent: function () {
184
230
  const contentArray = [];
185
231
 
186
232
  // Use <div> instead of <h1>..<h6> or <p>
@@ -194,6 +240,40 @@ export default {
194
240
  contentArray.push(`<div>${this.contextData.description}</div>`);
195
241
  }
196
242
 
243
+ if (this.originalSource && this.originalSource.length) {
244
+ let sourceDataLinks = '<div><strong>Source data links</strong></div>';
245
+ const sourceLinks = [];
246
+
247
+ this.originalSource.forEach((source, i) => {
248
+ const path = this.generateFileLink(source);
249
+ let sourceContent = `<div>${source.name}</div>`;
250
+ sourceContent += `\n`;
251
+ sourceContent += `<div><a href="${path}">${path}</a></div>`;
252
+ sourceLinks.push(`<li>${sourceContent}</li>`);
253
+ });
254
+ sourceDataLinks += '\n\n';
255
+ sourceDataLinks += `<ul>${sourceLinks.join('\n')}</ul>`;
256
+ contentArray.push(sourceDataLinks);
257
+ }
258
+
259
+ if (this.flatmapSource && this.flatmapSource.length) {
260
+ let flatmapDataLinks = '<div><strong>Associated flatmaps from source</strong></div>';
261
+ const flatmapLinks = [];
262
+
263
+ this.flatmapSource.forEach((source, i) => {
264
+ const path = this.generateFileLink(source);
265
+ let flatmapContent = `<div>${source.name}</div>`;
266
+ let flatmapSource = this.flatmapAPI ?
267
+ `${this.flatmapAPI}viewer?id=${source.flatmapUUID}` : source.flatmapUUID;
268
+ flatmapContent += `\n`;
269
+ flatmapContent += `<div><a href="${flatmapSource}">${flatmapSource}</a></div>`;
270
+ flatmapLinks.push(`<li>${flatmapContent}</li>`);
271
+ });
272
+ flatmapDataLinks += '\n\n';
273
+ flatmapDataLinks += `<ul>${flatmapLinks.join('\n')}</ul>`;
274
+ contentArray.push(flatmapDataLinks);
275
+ }
276
+
197
277
  if (this.contextData.views?.length) {
198
278
  let scaffoldViews = '<div><strong>Scaffold Views</strong></div>';
199
279
  const views = [];
@@ -250,8 +330,6 @@ export default {
250
330
 
251
331
  return contentArray.join('\n\n<br>');
252
332
  },
253
- },
254
- methods: {
255
333
  samplesMatching: function(viewId){
256
334
  if (this.contextData && this.contextData.samples){
257
335
  return this.contextData.samples.filter(s=>s.view == viewId)[0]
@@ -280,7 +358,6 @@ export default {
280
358
  .catch((err) => {
281
359
  //set defaults if we hit an error
282
360
  console.error('caught error!', err)
283
- this.discoverId = undefined
284
361
  this.loading = false
285
362
  });
286
363
  },
@@ -336,7 +413,7 @@ export default {
336
413
  },
337
414
  generateFileLink(sample){
338
415
  const path = this.processPathForUrl(sample.path);
339
- let link = `${this.envVars.ROOT_URL}/file/${sample.discoverId}/${sample.version}` + '?path=';
416
+ let link = `${this.envVars.ROOT_URL}/datasets/file/${sample.discoverId}/${sample.version}` + '?path=';
340
417
  link = link + path;
341
418
  return link;
342
419
  },
@@ -350,6 +427,47 @@ export default {
350
427
  const viewUrl = this.getFileFromPath(view.path)
351
428
  this.$emit("scaffold-view-clicked", viewUrl);
352
429
  },
430
+ getOriginalSource: function() {
431
+ const discoverId = this.entry.discoverId
432
+ const filesPos = 'files/'.length
433
+ const path = this.entry.resource.substring(
434
+ this.entry.resource.indexOf("files/") + filesPos,
435
+ this.entry.resource.lastIndexOf("?"))
436
+ const params = new URLSearchParams({
437
+ discoverId,
438
+ path
439
+ });
440
+ const url = `${this.envVars.API_LOCATION}/file_info/get_original_source?${params.toString()}`
441
+ fetch(url)
442
+ .then((response) =>{
443
+ if (!response.ok){
444
+ throw Error(response.statusText)
445
+ } else {
446
+ return response.json()
447
+ }
448
+ })
449
+ .then((data) => {
450
+ this.loadingOriginalSource = false
451
+ if (data.result) {
452
+ data.result.forEach(result => {
453
+ if (result.flatmapUUID) {
454
+ this.flatmapSource.push(result)
455
+ } else {
456
+ this.originalSource.push(result)
457
+ }
458
+ })
459
+ if (this.flatmapSource.length || this.originalSource.length) {
460
+ this.copyContent = this.updateCopyContent()
461
+ }
462
+ }
463
+ this.loadingOriginalSource = false
464
+ })
465
+ .catch((err) => {
466
+ //set defaults if we hit an error
467
+ console.error('caught error!', err)
468
+ this.loadingOriginalSource = false
469
+ });
470
+ },
353
471
  onCopied: function () {
354
472
  const { label, type, discoverId } = this.entry;
355
473
  const category = type ? `${label} ${type}` : label;
@@ -361,6 +479,10 @@ export default {
361
479
  'dataset_id': discoverId ? discoverId + '' : '',
362
480
  });
363
481
  }
482
+ },
483
+ mounted: function() {
484
+ this.copyContent = this.updateCopyContent()
485
+ this.getOriginalSource()
364
486
  }
365
487
  };
366
488
  </script>
@@ -506,4 +628,19 @@ export default {
506
628
  visibility: visible;
507
629
  }
508
630
  }
631
+
632
+ .flatmap-entry {
633
+ margin-top: 16px;
634
+ }
635
+
636
+ .source-data-list {
637
+ a {
638
+ color: #8300BF;
639
+ }
640
+ span {
641
+ color: #8300BF;
642
+ text-decoration: underline;
643
+ cursor: pointer;
644
+ }
645
+ }
509
646
  </style>
@@ -65,15 +65,17 @@ export default {
65
65
  sckanReleaseDisplay: function() {
66
66
  let sckanRelease = "Unknown"
67
67
  if(this.mapImpProv){
68
- sckanRelease = this.mapImpProv.connectivity?.npo.date
68
+ sckanRelease = this.mapImpProv.connectivity?.npo?.date
69
69
  if (!sckanRelease) {
70
70
  let sckanCreated = this.mapImpProv.sckan?.created ? this.mapImpProv.sckan.created : this.mapImpProv.sckan
71
- let isoTime = sckanCreated.replace(',', '.') // Date time does not accept commas but Sckan uses them
72
- sckanRelease = new Date(isoTime).toLocaleDateString('en-US', {
73
- day: '2-digit',
74
- month: 'long',
75
- year: 'numeric',
76
- })
71
+ if (sckanCreated) {
72
+ let isoTime = sckanCreated.replace(',', '.') // Date time does not accept commas but Sckan uses them
73
+ sckanRelease = new Date(isoTime).toLocaleDateString('en-US', {
74
+ day: '2-digit',
75
+ month: 'long',
76
+ year: 'numeric',
77
+ })
78
+ }
77
79
  }
78
80
  if (!sckanRelease) {
79
81
  sckanRelease = "Unknown";
@@ -84,7 +86,7 @@ export default {
84
86
  sckanReleaseLink: function() {
85
87
  let sckanLink = "Unknown"
86
88
  if(this.mapImpProv){
87
- sckanLink = this.mapImpProv.connectivity?.npo.path
89
+ sckanLink = this.mapImpProv.connectivity?.npo?.path
88
90
  if (!sckanLink) {
89
91
  sckanLink = this.mapImpProv.sckan?.release
90
92
  }
@@ -845,6 +845,9 @@ export default {
845
845
  this._externalStateSet = false;
846
846
  },
847
847
  mounted: function () {
848
+ EventBus.on("CreateNewEntry", newView => {
849
+ this.createNewEntry(newView);
850
+ });
848
851
  EventBus.on("RemoveEntryRequest", id => {
849
852
  this.removeEntry(id);
850
853
  });
@@ -18,6 +18,8 @@ declare module 'vue' {
18
18
  ElButton: typeof import('element-plus/es')['ElButton']
19
19
  ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
20
20
  ElCol: typeof import('element-plus/es')['ElCol']
21
+ ElCollapse: typeof import('element-plus/es')['ElCollapse']
22
+ ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
21
23
  ElContainer: typeof import('element-plus/es')['ElContainer']
22
24
  ElDropdown: typeof import('element-plus/es')['ElDropdown']
23
25
  ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']