@abi-software/map-side-bar 2.18.0 → 2.19.1-demo.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.
Files changed (41) hide show
  1. package/.postcssrc.json +5 -5
  2. package/README.md +8 -9
  3. package/cypress.config.js +6 -7
  4. package/dist/map-side-bar.js +6890 -6026
  5. package/dist/map-side-bar.umd.cjs +65 -62
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +10 -3
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +89 -80
  11. package/src/algolia/algolia.js +173 -167
  12. package/src/algolia/utils.js +34 -38
  13. package/src/assets/_variables.scss +12 -10
  14. package/src/assets/connectivity-explorer.scss +1 -1
  15. package/src/assets/fonts.scss +0 -1
  16. package/src/assets/searchPopover.scss +1 -2
  17. package/src/components/AnnotationTool.vue +9 -32
  18. package/src/components/BadgesGroup.vue +29 -32
  19. package/src/components/CellCard.vue +992 -0
  20. package/src/components/CellCardExplorer.vue +879 -0
  21. package/src/components/ConnectivityCard.vue +22 -19
  22. package/src/components/ConnectivityExplorer.vue +109 -130
  23. package/src/components/ConnectivityInfo.vue +142 -171
  24. package/src/components/ContributorItem.vue +15 -11
  25. package/src/components/DatasetCard.vue +166 -201
  26. package/src/components/DatasetExplorer.vue +160 -201
  27. package/src/components/ImageGallery.vue +35 -36
  28. package/src/components/SearchFilters.vue +384 -407
  29. package/src/components/SearchHistory.vue +69 -103
  30. package/src/components/SideBar.vue +186 -94
  31. package/src/components/Tabs.vue +25 -21
  32. package/src/components/icons/IconOpenExternal.vue +23 -0
  33. package/src/components/index.js +3 -5
  34. package/src/components/species-map.js +7 -7
  35. package/src/components.d.ts +3 -0
  36. package/src/exampleConnectivityInput.js +310 -318
  37. package/src/main.js +6 -6
  38. package/src/mixins/S3Bucket.vue +10 -13
  39. package/src/utils/common.js +59 -0
  40. package/vite.config.js +62 -61
  41. package/vuese-generator.js +47 -55
@@ -30,14 +30,12 @@
30
30
  size="small"
31
31
  class="button"
32
32
  :icon="ElIconView"
33
- >View repository</el-button
34
33
  >
34
+ View repository
35
+ </el-button>
35
36
  </div>
36
37
  <div class="badges-container">
37
- <BadgesGroup
38
- :items="items"
39
- @categoryChanged="categoryChanged"
40
- />
38
+ <BadgesGroup :items="items" @categoryChanged="categoryChanged" />
41
39
  </div>
42
40
 
43
41
  <!-- Copy to clipboard button container -->
@@ -51,43 +49,26 @@
51
49
  </template>
52
50
 
53
51
  <script>
54
- /* eslint-disable no-alert, no-console */
55
52
  const baseName = (str) => {
56
- return str.split('\\').pop().split('/').pop()
57
- }
58
-
59
- const capitalise = function (string) {
60
- return string.replace(/\b\w/g, (v) => v.toUpperCase())
61
- }
62
-
63
- /* eslint-disable no-alert, no-console */
64
- import { View as ElIconView } from '@element-plus/icons-vue'
65
- import BadgesGroup from './BadgesGroup.vue'
66
- import {
67
- ElButton as Button,
68
- ElIcon as Icon
69
- } from 'element-plus'
70
- import EventBus from './EventBus.js'
71
- import speciesMap from './species-map.js'
72
- import ImageGallery from './ImageGallery.vue'
73
- import MissingImage from '@/../assets/missing-image.svg'
53
+ return str.split('\\').pop().split('/').pop();
54
+ };
55
+
56
+ import { View as ElIconView } from '@element-plus/icons-vue';
57
+ import BadgesGroup from './BadgesGroup.vue';
58
+ import EventBus from './EventBus.js';
59
+ import speciesMap from './species-map.js';
60
+ import ImageGallery from './ImageGallery.vue';
61
+ import MissingImage from '@/../assets/missing-image.svg';
74
62
  import { CopyToClipboard } from '@abi-software/map-utilities';
75
63
  import S3Bucket from '../mixins/S3Bucket.vue';
76
64
  import '@abi-software/map-utilities/dist/style.css';
77
- import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js'
65
+ import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js';
78
66
 
79
67
  export default {
80
- data() {
81
- return {
82
- ElIconView,
83
- }
84
- },
85
68
  name: 'DatasetCard',
86
69
  components: {
87
70
  BadgesGroup,
88
71
  ImageGallery,
89
- Button,
90
- Icon,
91
72
  CopyToClipboard,
92
73
  },
93
74
  mixins: [GalleryHelper, S3Bucket],
@@ -107,12 +88,13 @@ export default {
107
88
  },
108
89
  data: function () {
109
90
  return {
91
+ ElIconView,
110
92
  thumbnail: MissingImage,
111
93
  dataLocation: this.entry.doi,
112
94
  discoverId: undefined,
113
95
  items: {
114
96
  Dataset: [],
115
- Flatmaps:[],
97
+ Flatmaps: [],
116
98
  Images: [],
117
99
  Scaffolds: [],
118
100
  Simulations: [],
@@ -124,56 +106,56 @@ export default {
124
106
  lastDoi: undefined,
125
107
  currentCategory: 'All',
126
108
  copyContent: '',
127
- }
109
+ };
128
110
  },
129
111
  computed: {
130
112
  contributors: function () {
131
- let text = ''
113
+ let text = '';
132
114
  if (this.entry.contributors) {
133
115
  if (this.entry.contributors.length === 1) {
134
- text = this.lastName(this.entry.contributors[0].name)
116
+ text = this.lastName(this.entry.contributors[0].name);
135
117
  } else if (this.entry.contributors.length === 2) {
136
118
  text =
137
119
  this.lastName(this.entry.contributors[0].name) +
138
120
  ' & ' +
139
- this.lastName(this.entry.contributors[1].name)
121
+ this.lastName(this.entry.contributors[1].name);
140
122
  } else if (this.entry.contributors.length > 2) {
141
- text = this.lastName(this.entry.contributors[0].name) + ' et al.'
123
+ text = this.lastName(this.entry.contributors[0].name) + ' et al.';
142
124
  }
143
125
  }
144
- return text
126
+ return text;
145
127
  },
146
128
  samples: function () {
147
- let text = ''
129
+ let text = '';
148
130
  if (this.entry.species) {
149
131
  if (speciesMap[this.entry.species[0].toLowerCase()]) {
150
- text = `${speciesMap[this.entry.species[0].toLowerCase()]}`
132
+ text = `${speciesMap[this.entry.species[0].toLowerCase()]}`;
151
133
  } else {
152
- text = `${this.entry.species}`
134
+ text = `${this.entry.species}`;
153
135
  }
154
136
  }
155
137
  if (this.entry.numberSamples > 0) {
156
- text += ' ('
138
+ text += ' (';
157
139
  if (this.entry.numberSamples === 1) {
158
- text += `${this.entry.numberSamples} sample`
140
+ text += `${this.entry.numberSamples} sample`;
159
141
  } else if (this.entry.numberSamples > 1) {
160
- text += `${this.entry.numberSamples} samples`
142
+ text += `${this.entry.numberSamples} samples`;
161
143
  }
162
144
  if (this.entry.numberSubjects === 1) {
163
- text += ` from ${this.entry.numberSubjects} subject`
145
+ text += ` from ${this.entry.numberSubjects} subject`;
164
146
  } else if (this.entry.numberSamples > 1) {
165
- text += ` from ${this.entry.numberSubjects} subjects`
147
+ text += ` from ${this.entry.numberSubjects} subjects`;
166
148
  }
167
- text += ')'
149
+ text += ')';
168
150
  }
169
151
 
170
- return text
152
+ return text;
171
153
  },
172
154
  label: function () {
173
- return this.entry.organs ? this.entry.organs[0] : this.entry.name
155
+ return this.entry.organs ? this.entry.organs[0] : this.entry.name;
174
156
  },
175
157
  publishYear: function () {
176
- return this.entry.publishDate.split('-')[0]
158
+ return this.entry.publishDate.split('-')[0];
177
159
  },
178
160
  },
179
161
  mounted: function () {
@@ -181,19 +163,19 @@ export default {
181
163
  },
182
164
  methods: {
183
165
  cardClicked: function () {
184
- this.openDataset()
166
+ this.openDataset();
185
167
  },
186
168
  categoryChanged: function (name) {
187
- this.currentCategory = name
169
+ this.currentCategory = name;
188
170
  },
189
171
  createSciCurnchItems: function () {
190
172
  if (this.entry.detailsReady) {
191
- this.updateS3Bucket(this.entry.s3uri)
192
- this.createDatasetItem()
193
- this.createFlatmapItems()
194
- this.createScaffoldItems()
195
- this.createSimulationItems()
196
- this.createPlotItems()
173
+ this.updateS3Bucket(this.entry.s3uri);
174
+ this.createDatasetItem();
175
+ this.createFlatmapItems();
176
+ this.createScaffoldItems();
177
+ this.createSimulationItems();
178
+ this.createPlotItems();
197
179
  }
198
180
  /* Disable these two
199
181
  this.createImageItems();
@@ -201,7 +183,7 @@ export default {
201
183
  */
202
184
  },
203
185
  createDatasetItem: function () {
204
- const link = `${this.envVars.ROOT_URL}/datasets/${this.discoverId}?type=dataset`
186
+ const link = `${this.envVars.ROOT_URL}/datasets/${this.discoverId}?type=dataset`;
205
187
  if (this.thumbnail) {
206
188
  this.items['Dataset'].push({
207
189
  id: -1,
@@ -212,30 +194,27 @@ export default {
212
194
  link,
213
195
  hideType: true,
214
196
  hideTitle: true,
215
- })
197
+ });
216
198
  }
217
199
  },
218
200
  createFlatmapItems: function () {
219
201
  if (this.entry.flatmaps) {
220
- const flatmaps = []
202
+ const flatmaps = [];
221
203
  this.entry.flatmaps.forEach((flatmap) => {
222
204
  if (flatmap.associated_flatmap?.identifier) {
223
- const filePath = flatmap.dataset.path
224
- const id = flatmap.identifier
225
- const thumbnail = this.getThumbnailForPlot(
226
- flatmap,
227
- this.entry.thumbnails
228
- )
229
- let thumbnailURL = undefined
230
- let mimetype = ''
205
+ const filePath = flatmap.dataset.path;
206
+ const id = flatmap.identifier;
207
+ const thumbnail = this.getThumbnailForPlot(flatmap, this.entry.thumbnails);
208
+ let thumbnailURL = undefined;
209
+ let mimetype = '';
231
210
  if (thumbnail) {
232
211
  thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
233
212
  id,
234
213
  prefix: this.getS3Prefix(),
235
214
  file_path: thumbnail.dataset.path,
236
215
  s3Bucket: this.s3Bucket,
237
- })
238
- mimetype = thumbnail.mimetype.name
216
+ });
217
+ mimetype = thumbnail.mimetype.name;
239
218
  }
240
219
  let action = {
241
220
  label: baseName(filePath),
@@ -245,7 +224,7 @@ export default {
245
224
  discoverId: this.discoverId,
246
225
  doi: this.entry.doi,
247
226
  version: this.version,
248
- }
227
+ };
249
228
  flatmaps.push({
250
229
  id,
251
230
  title: baseName(filePath),
@@ -254,49 +233,45 @@ export default {
254
233
  userData: action,
255
234
  hideType: true,
256
235
  mimetype,
257
- })
236
+ });
258
237
  }
259
- })
260
- this.items['Flatmaps'].push(...flatmaps.sort((a, b) => a.title.localeCompare(b.title)))
238
+ });
239
+ this.items['Flatmaps'].push(...flatmaps.sort((a, b) => a.title.localeCompare(b.title)));
261
240
  }
262
241
  },
263
242
  createImageItems: function () {
264
243
  if (this.entry.images) {
265
244
  this.entry.images.forEach((image) => {
266
- const filePath = image.dataset.path
267
- const id = image.identifier
268
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.discoverId}&dataset_version=${this.version}&file_path=${filePath}&mimetype=${image.mimetype.name}`
245
+ const filePath = image.dataset.path;
246
+ const id = image.identifier;
247
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.discoverId}&dataset_version=${this.version}&file_path=${filePath}&mimetype=${image.mimetype.name}`;
269
248
  this.items['Images'].push({
270
249
  id,
271
250
  title: baseName(filePath),
272
251
  type: 'Image',
273
252
  link: linkUrl,
274
253
  hideType: true,
275
- })
276
- })
254
+ });
255
+ });
277
256
  }
278
257
  },
279
258
  createPlotItems: function () {
280
259
  if (this.entry.plots) {
281
- const plots = []
260
+ const plots = [];
282
261
  this.entry.plots.forEach((plot) => {
283
- const filePath = plot.dataset.path
284
- const id = plot.identifier
285
- const thumbnail = this.getThumbnailForPlot(
286
- plot,
287
- this.entry.thumbnails
288
- )
289
- let thumbnailURL = undefined
290
- let mimetype = ''
262
+ const filePath = plot.dataset.path;
263
+ const id = plot.identifier;
264
+ const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
265
+ let thumbnailURL = undefined;
266
+ let mimetype = '';
291
267
  if (thumbnail) {
292
-
293
268
  thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
294
269
  id,
295
270
  prefix: this.getS3Prefix(),
296
271
  file_path: thumbnail.dataset.path,
297
272
  s3Bucket: this.s3Bucket,
298
- })
299
- mimetype = thumbnail.mimetype.name
273
+ });
274
+ mimetype = thumbnail.mimetype.name;
300
275
  }
301
276
  const plotAnnotation = plot.datacite;
302
277
  const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.getS3Prefix()}files/`;
@@ -304,27 +279,25 @@ export default {
304
279
 
305
280
  //plotAnnotation.supplemental_json_metadata.description can be undefined or
306
281
  //contain an empty string causing an error with JSON.parse
307
- let metadata = {}
282
+ let metadata = {};
308
283
  try {
309
- metadata = JSON.parse(
310
- plotAnnotation.supplemental_json_metadata.description
311
- )
284
+ metadata = JSON.parse(plotAnnotation.supplemental_json_metadata.description);
312
285
  } catch (error) {
313
- console.warn(error)
286
+ console.warn(error);
314
287
  }
315
288
 
316
- let supplementalData = []
289
+ let supplementalData = [];
317
290
  if (plotAnnotation.isDescribedBy) {
318
291
  supplementalData.push({
319
292
  url: filePathPrefix + plotAnnotation.isDescribedBy.path,
320
- })
293
+ });
321
294
  }
322
295
 
323
296
  const resource = {
324
297
  dataSource: { url: sourceUrl },
325
298
  metadata,
326
299
  supplementalData,
327
- }
300
+ };
328
301
 
329
302
  let action = {
330
303
  label: baseName(filePath),
@@ -335,7 +308,7 @@ export default {
335
308
  doi: this.entry.doi,
336
309
  discoverId: this.discoverId,
337
310
  version: this.version,
338
- }
311
+ };
339
312
  plots.push({
340
313
  id,
341
314
  title: baseName(filePath),
@@ -344,41 +317,40 @@ export default {
344
317
  userData: action,
345
318
  hideType: true,
346
319
  mimetype,
347
- })
348
- })
349
- this.items['Plots'].push(...plots.sort((a, b) => a.title.localeCompare(b.title)))
350
-
320
+ });
321
+ });
322
+ this.items['Plots'].push(...plots.sort((a, b) => a.title.localeCompare(b.title)));
351
323
  }
352
324
  },
353
325
  createScaffoldItems: function () {
354
326
  if (this.entry.scaffolds) {
355
- let index = 0
356
- const scaffolds = []
327
+ let index = 0;
328
+ const scaffolds = [];
357
329
  this.entry.scaffolds.forEach((scaffold, i) => {
358
- const filePath = scaffold.dataset.path
359
- const id = scaffold.identifier
330
+ const filePath = scaffold.dataset.path;
331
+ const id = scaffold.identifier;
360
332
  const thumbnail = this.getThumbnailForScaffold(
361
333
  scaffold,
362
334
  this.entry.scaffoldViews,
363
335
  this.entry.thumbnails,
364
- index
365
- )
366
- let mimetype = ''
367
- let thumbnailURL = undefined
336
+ index,
337
+ );
338
+ let mimetype = '';
339
+ let thumbnailURL = undefined;
368
340
  if (thumbnail) {
369
341
  thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
370
342
  id,
371
343
  prefix: this.getS3Prefix(),
372
344
  file_path: thumbnail.dataset.path,
373
345
  s3Bucket: this.s3Bucket,
374
- })
375
- mimetype = thumbnail.mimetype.name
346
+ });
347
+ mimetype = thumbnail.mimetype.name;
376
348
  }
377
349
  let action = {
378
350
  label: baseName(filePath),
379
351
  resource: `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`,
380
- title: "View 3D scaffold",
381
- type: "Scaffold",
352
+ title: 'View 3D scaffold',
353
+ type: 'Scaffold',
382
354
  discoverId: this.discoverId,
383
355
  doi: this.entry.doi,
384
356
  apiLocation: this.envVars.API_LOCATION,
@@ -386,7 +358,7 @@ export default {
386
358
  banner: this.thumbnail,
387
359
  s3uri: this.entry.s3uri,
388
360
  contextCardUrl: this.getContextCardUrl(i),
389
- }
361
+ };
390
362
  scaffolds.push({
391
363
  id,
392
364
  title: baseName(filePath),
@@ -395,16 +367,16 @@ export default {
395
367
  userData: action,
396
368
  hideType: true,
397
369
  mimetype,
398
- })
399
- })
400
- this.items['Scaffolds'].push(...scaffolds.sort((a, b) => a.title.localeCompare(b.title)))
370
+ });
371
+ });
372
+ this.items['Scaffolds'].push(...scaffolds.sort((a, b) => a.title.localeCompare(b.title)));
401
373
  }
402
374
  },
403
375
  createSimulationItems: function () {
404
376
  if (this.entry.simulation) {
405
- const simulations = []
377
+ const simulations = [];
406
378
  this.entry.simulation.forEach((simulation) => {
407
- if (simulation.additional_mimetype.name === "application/x.vnd.abi.simulation+json") {
379
+ if (simulation.additional_mimetype.name === 'application/x.vnd.abi.simulation+json') {
408
380
  let action = {
409
381
  label: undefined,
410
382
  apiLocation: this.envVars.API_LOCATION,
@@ -416,7 +388,7 @@ export default {
416
388
  description: this.entry.description,
417
389
  discoverId: this.discoverId,
418
390
  dataset: `${this.envVars.ROOT_URL}/datasets/${this.discoverId}?type=dataset`,
419
- }
391
+ };
420
392
  simulations.push({
421
393
  id: 'simulation',
422
394
  title: ' ',
@@ -424,28 +396,25 @@ export default {
424
396
  hideType: true,
425
397
  hideTitle: true,
426
398
  userData: action,
427
- })
399
+ });
428
400
  } else {
429
- const filePath = simulation.dataset.path
430
- const id = simulation.identifier
401
+ const filePath = simulation.dataset.path;
402
+ const id = simulation.identifier;
431
403
  //Despite of the name, this method can be used to retreive
432
404
  //the thumbnail information for any none scaffold type thumbnail
433
- const thumbnail = this.getThumbnailForPlot(
434
- simulation,
435
- this.entry.thumbnails
436
- )
437
- let thumbnailURL = undefined
438
- let mimetype = ''
405
+ const thumbnail = this.getThumbnailForPlot(simulation, this.entry.thumbnails);
406
+ let thumbnailURL = undefined;
407
+ let mimetype = '';
439
408
  if (thumbnail) {
440
409
  thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
441
410
  id,
442
411
  prefix: this.getS3Prefix(),
443
412
  file_path: thumbnail.dataset.path,
444
413
  s3Bucket: this.s3Bucket,
445
- })
446
- mimetype = thumbnail.mimetype.name
414
+ });
415
+ mimetype = thumbnail.mimetype.name;
447
416
  }
448
- const resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`
417
+ const resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`;
449
418
  let action = {
450
419
  label: baseName(filePath),
451
420
  resource: resource,
@@ -455,7 +424,7 @@ export default {
455
424
  discoverId: this.discoverId,
456
425
  doi: this.entry.doi,
457
426
  version: this.version,
458
- }
427
+ };
459
428
  simulations.push({
460
429
  id,
461
430
  title: baseName(filePath),
@@ -464,126 +433,122 @@ export default {
464
433
  userData: action,
465
434
  hideType: true,
466
435
  mimetype,
467
- })
436
+ });
468
437
  }
469
- })
470
- this.items['Simulations'].push(...simulations.sort((a, b) => a.title.localeCompare(b.title)))
438
+ });
439
+ this.items['Simulations'].push(
440
+ ...simulations.sort((a, b) => a.title.localeCompare(b.title)),
441
+ );
471
442
  }
472
443
  },
473
444
  createVideoItems: function () {
474
445
  if (this.entry.videos) {
475
446
  this.entry.videos.forEach((video) => {
476
- const filePath = this.getS3FilePath(
477
- this.discoverId,
478
- this.version,
479
- video.dataset.path
480
- )
481
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.version}&dataset_id=${this.discoverId}&file_path=${filePath}&mimetype=${video.mimetype.name}`
447
+ const filePath = this.getS3FilePath(this.discoverId, this.version, video.dataset.path);
448
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.version}&dataset_id=${this.discoverId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
482
449
  this.items['Videos'].push({
483
450
  title: video.name,
484
451
  type: 'Video',
485
452
  thumbnail: this.defaultVideoImg,
486
453
  hideType: true,
487
454
  link: linkUrl,
488
- })
489
- })
455
+ });
456
+ });
490
457
  }
491
458
  },
492
459
  galleryClicked: function (payload) {
493
- this.propogateCardAction(payload)
460
+ this.propogateCardAction(payload);
494
461
  },
495
462
  galleryDatalinkClicked: function (payload) {
496
463
  EventBus.emit('datalink-clicked', payload); // Pass to mapintegratedvuer
497
464
  },
498
- getContextCardUrl: function(scaffoldIndex){
499
- if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
500
- return undefined
465
+ getContextCardUrl: function (scaffoldIndex) {
466
+ if (!this.entry.contextualInformation || this.entry.contextualInformation.length == 0) {
467
+ return undefined;
501
468
  } else {
502
469
  // The line below checks if there is a context file for each scaffold. If there is not, we use the first context card for each scaffold.
503
- let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
504
- return `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${this.entry.contextualInformation[contextIndex]}${this.getS3Args()}`
470
+ let contextIndex =
471
+ this.entry['abi-contextual-information'].length == this.entry.scaffolds.length
472
+ ? scaffoldIndex
473
+ : 0;
474
+ return `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${this.entry.contextualInformation[contextIndex]}${this.getS3Args()}`;
505
475
  }
506
476
  },
507
- getImageURL: function(apiEndpoint, info) {
508
- let url = `${apiEndpoint}/s3-resource/${info.prefix}files/${info.file_path}?encodeBase64=true`
477
+ getImageURL: function (apiEndpoint, info) {
478
+ let url = `${apiEndpoint}/s3-resource/${info.prefix}files/${info.file_path}?encodeBase64=true`;
509
479
  if (info.s3Bucket) {
510
- url = url + `&s3BucketName=${info.s3Bucket}`
480
+ url = url + `&s3BucketName=${info.s3Bucket}`;
511
481
  }
512
- return url
482
+ return url;
513
483
  },
514
484
  openDataset: function () {
515
- window.open(this.dataLocation, '_blank')
485
+ window.open(this.dataLocation, '_blank');
516
486
  },
517
487
  openRepository: function () {
518
- let apiLocation = this.envVars.API_LOCATION
488
+ let apiLocation = this.envVars.API_LOCATION;
519
489
  this.entry.additionalLinks.forEach(function (el) {
520
490
  if (el.description == 'Repository') {
521
- let xmlhttp = new XMLHttpRequest()
522
- xmlhttp.open('POST', apiLocation + '/pmr_latest_exposure', true)
523
- xmlhttp.setRequestHeader('Content-type', 'application/json')
491
+ let xmlhttp = new XMLHttpRequest();
492
+ xmlhttp.open('POST', apiLocation + '/pmr_latest_exposure', true);
493
+ xmlhttp.setRequestHeader('Content-type', 'application/json');
524
494
  xmlhttp.onreadystatechange = () => {
525
495
  if (xmlhttp.readyState === 4) {
526
- let url = ''
496
+ let url = '';
527
497
  if (xmlhttp.status === 200) {
528
- url = JSON.parse(xmlhttp.responseText)['url']
498
+ url = JSON.parse(xmlhttp.responseText)['url'];
529
499
  }
530
500
  if (url === '') {
531
- url = el.uri
501
+ url = el.uri;
532
502
  }
533
- window.open(url, '_blank')
503
+ window.open(url, '_blank');
534
504
  }
535
- }
536
- xmlhttp.send(JSON.stringify({ workspace_url: el.uri }))
505
+ };
506
+ xmlhttp.send(JSON.stringify({ workspace_url: el.uri }));
537
507
  }
538
- })
508
+ });
539
509
  },
540
510
  propogateCardAction: function (action) {
541
- EventBus.emit('PopoverActionClick', action)
542
- EventBus.emit('contextUpdate', action) // Pass to mapintegratedvuer
511
+ EventBus.emit('PopoverActionClick', action);
512
+ EventBus.emit('contextUpdate', action); // Pass to mapintegratedvuer
543
513
  },
544
514
  splitDOI: function (doi) {
545
- return [
546
- doi.split('/')[doi.split('/').length - 2],
547
- doi.split('/')[doi.split('/').length - 1],
548
- ]
515
+ return [doi.split('/')[doi.split('/').length - 2], doi.split('/')[doi.split('/').length - 1]];
549
516
  },
550
517
  getBanner: function () {
551
518
  // Only load banner if card has changed
552
519
  if (this.lastDoi !== this.entry.doi) {
553
- this.lastDoi = this.entry.doi
554
- this.loading = true
555
- let doi = this.splitDOI(this.entry.doi)
556
- fetch(
557
- `${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`
558
- )
520
+ this.lastDoi = this.entry.doi;
521
+ this.loading = true;
522
+ let doi = this.splitDOI(this.entry.doi);
523
+ fetch(`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`)
559
524
  .then((response) => {
560
525
  if (!response.ok) {
561
- throw Error(response.statusText)
526
+ throw Error(response.statusText);
562
527
  } else {
563
- return response.json()
528
+ return response.json();
564
529
  }
565
530
  })
566
531
  .then((data) => {
567
- this.thumbnail = data.banner
568
- this.discoverId = data.id
569
- this.version = data.version
570
- this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
571
- this.loading = false
532
+ this.thumbnail = data.banner;
533
+ this.discoverId = data.id;
534
+ this.version = data.version;
535
+ this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`;
536
+ this.loading = false;
572
537
  this.updateCopyContent();
573
538
  })
574
539
  .catch(() => {
575
540
  //set defaults if we hit an error
576
- this.thumbnail = MissingImage
577
- this.discoverId = Number(this.entry.datasetId)
578
- this.loading = false
541
+ this.thumbnail = MissingImage;
542
+ this.discoverId = Number(this.entry.datasetId);
543
+ this.loading = false;
579
544
  })
580
545
  .finally(() => {
581
- this.createSciCurnchItems()
582
- })
546
+ this.createSciCurnchItems();
547
+ });
583
548
  }
584
549
  },
585
550
  lastName: function (fullName) {
586
- return fullName.split(',')[0]
551
+ return fullName.split(',')[0];
587
552
  },
588
553
  updateCopyContent: function () {
589
554
  const contentArray = [];
@@ -648,20 +613,20 @@ export default {
648
613
  },
649
614
  created: function () {
650
615
  if (this.entry.detailsReady) {
651
- this.getBanner()
616
+ this.getBanner();
652
617
  }
653
618
  },
654
619
  watch: {
655
- 'entry.detailsReady':{
620
+ 'entry.detailsReady': {
656
621
  immediate: true,
657
622
  handler: function (val) {
658
623
  if (val === true) {
659
- this.getBanner()
624
+ this.getBanner();
660
625
  }
661
626
  },
662
- }
627
+ },
663
628
  },
664
- }
629
+ };
665
630
  </script>
666
631
 
667
632
  <style lang="scss" scoped>