@abi-software/map-side-bar 1.3.37 → 1.3.38-staging

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 (37) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +146 -146
  3. package/babel.config.js +14 -14
  4. package/del.json +27 -0
  5. package/dist/map-side-bar.common.js +2082 -1229
  6. package/dist/map-side-bar.common.js.map +1 -1
  7. package/dist/map-side-bar.css +1 -1
  8. package/dist/map-side-bar.umd.js +2082 -1229
  9. package/dist/map-side-bar.umd.js.map +1 -1
  10. package/dist/map-side-bar.umd.min.js +3 -1
  11. package/dist/map-side-bar.umd.min.js.map +1 -1
  12. package/package-lock.json +13716 -13716
  13. package/package.json +67 -67
  14. package/public/index.html +17 -17
  15. package/scaffold_context_info.json +31 -0
  16. package/src/App.vue +149 -155
  17. package/src/algolia/algolia.js +182 -182
  18. package/src/algolia/utils.js +69 -69
  19. package/src/components/BadgesGroup.vue +141 -142
  20. package/src/components/Cascader.vue +49 -49
  21. package/src/components/ContextCard.vue +384 -391
  22. package/src/components/DatasetCard.vue +385 -325
  23. package/src/components/EventBus.js +3 -3
  24. package/src/components/ImageGallery.vue +509 -525
  25. package/src/components/SearchFilters.vue +609 -585
  26. package/src/components/SideBar.vue +245 -224
  27. package/src/components/SidebarContent.vue +511 -508
  28. package/src/components/Tabs.vue +78 -78
  29. package/src/components/hardcoded-context-info.js +79 -79
  30. package/src/components/index.js +8 -8
  31. package/src/components/processFilters.js +22 -0
  32. package/src/components/species-map.js +8 -8
  33. package/src/main.js +8 -8
  34. package/src/mixins/GalleryHelpers.js +104 -0
  35. package/static.json +6 -6
  36. package/vue.config.js +11 -11
  37. package/src/mixins/S3Bucket.vue +0 -31
@@ -1,525 +1,509 @@
1
- <template>
2
- <div class="full-size">
3
- <gallery
4
- :bottomSpacer="bottomSpacer"
5
- :cardWidth="10"
6
- :items="galleryItems"
7
- :max-width="maxWidth"
8
- :show-indicator-bar="false"
9
- :show-card-details="true"
10
- :highlight-active="false"
11
- :image-style="imageStyle"
12
- :image-container-style="imageContainerStyle"
13
- :body-style="bodyStyle"
14
- :shadow="shadow"
15
- @card-clicked="cardClicked"
16
- ref="gallery"
17
- />
18
- </div>
19
- </template>
20
-
21
- <script>
22
- /* eslint-disable no-alert, no-console */
23
- const baseName = (str) => {
24
- return str.split("\\").pop().split("/").pop();
25
- };
26
-
27
- const capitalise = function (string) {
28
- return string.replace(/\b\w/g, (v) => v.toUpperCase());
29
- };
30
-
31
- import GalleryHelper from "@abi-software/gallery/src/mixins/GalleryHelpers";
32
- import Gallery from "@abi-software/gallery";
33
- //provide the s3Bucket related methods and data.
34
- import S3Bucket from "../mixins/S3Bucket";
35
- import "@abi-software/gallery/dist/gallery.css";
36
-
37
- export default {
38
- name: "ImageGallery",
39
- components: { Gallery },
40
- mixins: [GalleryHelper, S3Bucket],
41
- props: {
42
- datasetBiolucida: {
43
- type: Object,
44
- default: () => {
45
- return {};
46
- },
47
- },
48
- envVars: {
49
- type: Object,
50
- default: () => {},
51
- },
52
- label: {
53
- type: String,
54
- default: "",
55
- },
56
- plots: {
57
- type: Array,
58
- default: () => {
59
- return [];
60
- },
61
- },
62
- datasetId: {
63
- type: Number,
64
- default: -1,
65
- },
66
- datasetVersion: {
67
- type: Number,
68
- default: -1,
69
- },
70
- datasetThumbnail: {
71
- type: String,
72
- default: "",
73
- },
74
- category: {
75
- type: String,
76
- default: "All",
77
- },
78
- entry: {
79
- type: Object,
80
- default: () => {
81
- return {};
82
- },
83
- },
84
- },
85
- data() {
86
- return {
87
- currentIndex: 0,
88
- ro: null,
89
- maxWidth: 3,
90
- items: {
91
- //Use the Images instead for Biolucida Images
92
- //"Biolucida Images": [],
93
- 'Dataset': [],
94
- 'Images': [],
95
- 'Scaffolds': [],
96
- 'Segmentations': [],
97
- 'Simulations': [],
98
- 'Videos': [],
99
- 'Plots': [],
100
- },
101
- bodyStyle: { padding: '0px', background: '#ffffff' },
102
- imageContainerStyle: {
103
- width: '160px',
104
- height: '160px',
105
- display: 'flex',
106
- alignItems: 'center',
107
- justifyContent: 'center',
108
- },
109
- imageStyle: { maxWidth: '160px', maxHeight: '160px'},
110
- shadow: "never",
111
- bottomSpacer: { minHeight: '0rem' },
112
- resetIndex: false,
113
- };
114
- },
115
- methods: {
116
- cardClicked: function(payload) {
117
- this.$emit('card-clicked', payload);
118
- },
119
- createSciCurnchItems: function () {
120
- this.updateS3Bucket(this.entry.s3uri);
121
- this.createDatasetItem();
122
- this.createScaffoldItems();
123
- this.createSimulationItems();
124
- this.createPlotItems();
125
- this.createSegmentationItems();
126
- /* Disable these two
127
- this.createImageItems();
128
- this.createVideoItems();
129
- */
130
- },
131
- createDatasetItem: function () {
132
- const link = `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
133
- if (this.datasetThumbnail) {
134
- this.items['Dataset'].push({
135
- id: -1,
136
- //Work around gallery requires a truthy string
137
- title: " ",
138
- type: `Dataset ${this.datasetId}`,
139
- thumbnail: this.datasetThumbnail,
140
- link,
141
- hideType: true,
142
- hideTitle: true,
143
- });
144
- }
145
- },
146
- createImageItems: function () {
147
- if (this.entry.images) {
148
- this.entry.images.forEach((image) => {
149
- const filePath = image.dataset.path;
150
- const id = image.identifier;
151
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.datasetId}&dataset_version=${this.datasetVersion}&file_path=${filePath}&mimetype=${image.mimetype.name}`;
152
- this.items['Images'].push({
153
- id,
154
- title: baseName(filePath),
155
- type: "Image",
156
- link: linkUrl,
157
- hideType: true,
158
- });
159
- });
160
- }
161
- },
162
- createPlotItems: function () {
163
- if (this.entry.plots) {
164
- this.entry.plots.forEach((plot) => {
165
- const filePath = plot.dataset.path;
166
- const id = plot.identifier;
167
- const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
168
- let thumbnailURL = undefined;
169
- let mimetype = '';
170
- if (thumbnail) {
171
- thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
172
- id,
173
- datasetId: this.datasetId,
174
- datasetVersion: this.datasetVersion,
175
- file_path: thumbnail.dataset.path,
176
- s3Bucket: this.s3Bucket,
177
- });
178
- mimetype = thumbnail.mimetype.name;
179
- }
180
- const plotAnnotation = plot.datacite;
181
- const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
182
- const sourceUrl = filePathPrefix + plot.dataset.path + this.getS3Args();
183
-
184
- const metadata = JSON.parse(
185
- plotAnnotation.supplemental_json_metadata.description
186
- );
187
-
188
- let supplementalData = [];
189
- if (plotAnnotation.isDescribedBy) {
190
- supplementalData.push({
191
- url: filePathPrefix + plotAnnotation.isDescribedBy.path
192
- });
193
- }
194
-
195
- const resource = {
196
- dataSource: {url: sourceUrl},
197
- metadata,
198
- supplementalData
199
- }
200
-
201
- let action = {
202
- label: capitalise(this.label),
203
- resource: resource,
204
- s3uri: this.entry.s3uri,
205
- title: "View plot",
206
- type: "Plot",
207
- discoverId: this.discoverId,
208
- version: this.datasetVersion,
209
- };
210
- this.items['Plots'].push({
211
- id,
212
- title: baseName(filePath),
213
- type: "Plot",
214
- thumbnail: thumbnailURL,
215
- userData: action,
216
- hideType: true,
217
- mimetype
218
- });
219
- });
220
- }
221
- },
222
- createScaffoldItems: function () {
223
- if (this.entry.scaffolds) {
224
- let index = 0;
225
- this.entry.scaffolds.forEach((scaffold, i) => {
226
- const filePath = scaffold.dataset.path;
227
- const id = scaffold.identifier;
228
- const thumbnail = this.getThumbnailForScaffold(
229
- scaffold,
230
- this.entry.scaffoldViews,
231
- this.entry.thumbnails,
232
- index
233
- );
234
- let mimetype = '';
235
- let thumbnailURL = undefined;
236
- if (thumbnail) {
237
- thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
238
- id,
239
- datasetId: this.datasetId,
240
- datasetVersion: this.datasetVersion,
241
- file_path: thumbnail.dataset.path,
242
- s3Bucket: this.s3Bucket,
243
- });
244
- mimetype = thumbnail.mimetype.name;
245
- }
246
- let action = {
247
- label: capitalise(this.label),
248
- resource: `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}${this.getS3Args()}`,
249
- title: "View 3D scaffold",
250
- type: "Scaffold",
251
- discoverId: this.datasetId,
252
- apiLocation: this.envVars.API_LOCATION,
253
- version: this.datasetVersion,
254
- banner: this.datasetThumbnail,
255
- s3uri: this.entry.s3uri,
256
- contextCardUrl: this.getContextCardUrl(i)
257
- };
258
- this.items['Scaffolds'].push({
259
- id,
260
- title: baseName(filePath),
261
- type: "Scaffold",
262
- thumbnail: thumbnailURL,
263
- userData: action,
264
- hideType: true,
265
- mimetype
266
- });
267
- });
268
- }
269
- },
270
- createSegmentationItems: function () {
271
- if (this.entry.segmentation) {
272
- this.entry.segmentation.forEach((segmentation) => {
273
- const id = segmentation.id;
274
- let filePath = segmentation.dataset.path;
275
- filePath = filePath.replaceAll(" ", "_");
276
- filePath = filePath.replaceAll(",", "_");
277
- const prefix = this.envVars.NL_LINK_PREFIX;
278
- const resource = {
279
- share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
280
- };
281
- let action = {
282
- label: capitalise(this.label),
283
- resource: resource,
284
- datasetId: this.datasetId,
285
- s3uri: this.entry.s3uri,
286
- title: "View segmentation",
287
- type: "Segmentation",
288
- };
289
- const thumbnailURL = this.getSegmentationThumbnailURL(
290
- this.envVars.API_LOCATION,
291
- {
292
- id,
293
- datasetId: this.datasetId,
294
- datasetVersion: this.datasetVersion,
295
- segmentationFilePath: filePath,
296
- s3Bucket: this.s3Bucket,
297
- }
298
- );
299
- this.items['Segmentations'].push({
300
- id,
301
- title: baseName(filePath),
302
- type: "Segmentation",
303
- thumbnail: thumbnailURL,
304
- userData: action,
305
- hideType: true,
306
- mimetype: 'image/png',
307
- });
308
- });
309
- }
310
- },
311
- createSimulationItems: function () {
312
- if (this.entry.simulation && this.entry.simulation.length > 0) {
313
- let action = {
314
- label: undefined,
315
- apiLocation: this.envVars.API_LOCATION,
316
- s3uri: this.entry.s3uri,
317
- version: this.datasetVersion,
318
- title: "View simulation",
319
- type: "Simulation",
320
- name: this.entry.name,
321
- description: this.entry.description,
322
- discoverId: this.datasetId,
323
- dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
324
- };
325
- this.items['Simulations'].push({
326
- id: "simulation",
327
- title: " ",
328
- type: "Simulation",
329
- hideType: true,
330
- hideTitle: true,
331
- userData: action,
332
- });
333
- }
334
- },
335
- createVideoItems: function () {
336
- if (this.entry.videos) {
337
- this.entry.videos.forEach((video) => {
338
- const filePath = this.getS3FilePath(
339
- this.datasetId,
340
- this.datasetVersion,
341
- video.dataset.path
342
- );
343
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
344
- this.items['Videos'].push({
345
- title: video.name,
346
- type: "Video",
347
- thumbnail: this.defaultVideoImg,
348
- hideType: true,
349
- link: linkUrl,
350
- });
351
- });
352
- }
353
- },
354
- onResize: function () {
355
- this.maxWidth = this.$el.clientWidth;
356
- // this.$emit('resize', this.$el.clientWidth)
357
- },
358
- getContextCardUrl(scaffoldIndex){
359
- if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
360
- return undefined
361
- } else {
362
- // 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.
363
- let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
364
- return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}${this.getS3Args()}`
365
- }
366
- }
367
- },
368
- computed: {
369
- galleryItems() {
370
- if (this.resetIndex) {
371
- this.$refs.gallery.indicatorClicked(0);
372
- }
373
- let items = [...this.items["Dataset"]];
374
- if (this.category === "All") {
375
- for (const [key, value] of Object.entries(this.items)) {
376
- if (key !== "Dataset")
377
- items = items.concat(value);
378
- }
379
- return items;
380
- }
381
- else
382
- return this.items[this.category];
383
- },
384
- },
385
- created: function () {
386
- this.createSciCurnchItems();
387
- },
388
- watch: {
389
- category: function() {
390
- this.resetIndex = true;
391
- },
392
- galleryItems: function() {
393
- this.resetIndex = false;
394
- },
395
- datasetBiolucida: {
396
- deep: true,
397
- immediate: true,
398
- handler: function (biolucidaData) {
399
- let items = [];
400
- if ("dataset_images" in biolucidaData) {
401
- items.push(
402
- ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
403
- const thumbnailURL = this.getThumbnailURLFromBiolucida(
404
- this.envVars.API_LOCATION,
405
- {
406
- id: dataset_image.image_id,
407
- }
408
- );
409
- const resource = {
410
- share_link: dataset_image.share_link,
411
- id: dataset_image.image_id,
412
- itemId: dataset_image.sourcepkg_id,
413
- };
414
- let action = {
415
- label: capitalise(this.label),
416
- resource: resource,
417
- datasetId: this.datasetId,
418
- title: "View image",
419
- name: capitalise(this.label),
420
- type: "Biolucida",
421
- };
422
- return {
423
- id: dataset_image.image_id,
424
- title: `Image`,
425
- type: "Image",
426
- thumbnail: thumbnailURL,
427
- userData: action,
428
- mimetype: 'image/png',
429
- hideType: true,
430
- };
431
- })
432
- );
433
- }
434
- this.items['Images'] = items;
435
- },
436
- },
437
- },
438
- mounted() {
439
- this.ro = new ResizeObserver(this.onResize).observe(this.$el);
440
- },
441
- destroyed() {
442
- delete this.ro;
443
- },
444
- };
445
- </script>
446
-
447
- <style scoped>
448
- .full-size {
449
- height: 100%;
450
- width: 244px;
451
- }
452
-
453
- .key-image-span.active {
454
- transform: scale(1.16);
455
- border: 4px #8300bf solid;
456
- }
457
-
458
- .key-image-span {
459
- display: flex;
460
- position: relative;
461
- }
462
-
463
- .overlay {
464
- position: absolute;
465
- right: 5px;
466
- top: 5px;
467
- width: 1.61em;
468
- height: 1em;
469
- border-radius: 3px;
470
- opacity: 0.8;
471
- }
472
-
473
- img {
474
- vertical-align: bottom;
475
- }
476
-
477
- a.prev,
478
- a.next {
479
- display: flex;
480
- font-size: 3em;
481
- }
482
-
483
- a.prev:not(.underline),
484
- a.next:not(.underline) {
485
- text-decoration: none;
486
- }
487
-
488
- a.prev {
489
- justify-content: flex-start;
490
- }
491
-
492
- a.next {
493
- justify-content: flex-end;
494
- }
495
-
496
- .standard-gallery {
497
- display: flex;
498
- flex-wrap: nowrap;
499
- justify-content: space-around;
500
- align-items: center;
501
- }
502
-
503
- .image-line {
504
- display: flex;
505
- margin-top: 1%;
506
- margin-bottom: 1%;
507
- flex-grow: 1;
508
- justify-content: space-between;
509
- }
510
- .disabled {
511
- opacity: 0.2;
512
- cursor: default;
513
- }
514
-
515
- .rectangle {
516
- height: 1em;
517
- width: 2em;
518
- border-radius: 3px;
519
- background-color: #555;
520
- }
521
-
522
- .full-size >>> .el-card {
523
- border: 0px;
524
- }
525
- </style>
1
+ <template>
2
+ <div class="full-size">
3
+ <gallery
4
+ :bottomSpacer="bottomSpacer"
5
+ :cardWidth="10"
6
+ :items="galleryItems"
7
+ :max-width="maxWidth"
8
+ :show-indicator-bar="false"
9
+ :show-card-details="true"
10
+ :highlight-active="false"
11
+ :image-style="imageStyle"
12
+ :image-container-style="imageContainerStyle"
13
+ :body-style="bodyStyle"
14
+ :shadow="shadow"
15
+ @card-clicked="cardClicked"
16
+ ref="gallery"
17
+ />
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ /* eslint-disable no-alert, no-console */
23
+ const baseName = (str) => {
24
+ return str.split("\\").pop().split("/").pop();
25
+ };
26
+
27
+ const capitalise = function (string) {
28
+ return string.replace(/\b\w/g, (v) => v.toUpperCase());
29
+ };
30
+
31
+ import GalleryHelper from "../mixins/GalleryHelpers";
32
+ import Gallery from "@abi-software/gallery";
33
+ import "@abi-software/gallery/dist/gallery.css";
34
+
35
+ export default {
36
+ name: "ImageGallery",
37
+ components: { Gallery },
38
+ mixins: [GalleryHelper],
39
+ props: {
40
+ datasetBiolucida: {
41
+ type: Object,
42
+ default: () => {
43
+ return {};
44
+ },
45
+ },
46
+ envVars: {
47
+ type: Object,
48
+ default: () => {},
49
+ },
50
+ label: {
51
+ type: String,
52
+ default: "",
53
+ },
54
+ plots: {
55
+ type: Array,
56
+ default: () => {
57
+ return [];
58
+ },
59
+ },
60
+ datasetId: {
61
+ type: String,
62
+ default: "",
63
+ },
64
+ datasetVersion: {
65
+ type: Number,
66
+ default: -1,
67
+ },
68
+ datasetThumbnail: {
69
+ type: String,
70
+ default: "",
71
+ },
72
+ category: {
73
+ type: String,
74
+ default: "All",
75
+ },
76
+ entry: {
77
+ type: Object,
78
+ default: () => {
79
+ return {};
80
+ },
81
+ },
82
+ },
83
+ data() {
84
+ return {
85
+ currentIndex: 0,
86
+ ro: null,
87
+ maxWidth: 3,
88
+ items: {
89
+ "Biolucida Images": [],
90
+ 'Dataset': [],
91
+ 'Images': [],
92
+ 'Scaffolds': [],
93
+ 'Segmentations': [],
94
+ 'Simulations': [],
95
+ 'Videos': [],
96
+ 'Plots': [],
97
+ },
98
+ bodyStyle: { padding: '0px', background: '#ffffff' },
99
+ imageContainerStyle: {
100
+ width: '160px',
101
+ height: '160px',
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ justifyContent: 'center',
105
+ },
106
+ imageStyle: { maxWidth: '160px', maxHeight: '160px'},
107
+ shadow: "never",
108
+ bottomSpacer: { minHeight: '0rem' },
109
+ resetIndex: false
110
+ };
111
+ },
112
+ methods: {
113
+ cardClicked: function(payload) {
114
+ this.$emit('card-clicked', payload);
115
+ },
116
+ createSciCurnchItems: function () {
117
+ this.createDatasetItem();
118
+ this.createScaffoldItems();
119
+ this.createSimulationItems();
120
+ this.createPlotItems();
121
+ this.createSegmentationItems();
122
+ /* Disable these two
123
+ this.createImageItems();
124
+ this.createVideoItems();
125
+ */
126
+ },
127
+ createDatasetItem: function () {
128
+ const link = `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
129
+ if (this.datasetThumbnail) {
130
+ this.items['Dataset'].push({
131
+ id: -1,
132
+ //Work around gallery requires a truthy string
133
+ title: " ",
134
+ type: `Dataset ${this.datasetId}`,
135
+ thumbnail: this.datasetThumbnail,
136
+ link,
137
+ hideType: true,
138
+ hideTitle: true,
139
+ });
140
+ }
141
+ },
142
+ createImageItems: function () {
143
+ if (this.entry.images) {
144
+ this.entry.images.forEach((image) => {
145
+ const filePath = image.dataset.path;
146
+ const id = image.identifier;
147
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.datasetId}&dataset_version=${this.datasetVersion}&file_path=${filePath}&mimetype=${image.mimetype.name}`;
148
+ this.items['Images'].push({
149
+ id,
150
+ title: baseName(filePath),
151
+ type: "Image",
152
+ link: linkUrl,
153
+ hideType: true,
154
+ });
155
+ });
156
+ }
157
+ },
158
+ createPlotItems: function () {
159
+ if (this.entry.plots) {
160
+ this.entry.plots.forEach((plot) => {
161
+ const filePath = plot.dataset.path;
162
+ const id = plot.identifier;
163
+ const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
164
+ let thumbnailURL = undefined;
165
+ let mimetype = '';
166
+ if (thumbnail) {
167
+ thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
168
+ id,
169
+ datasetId: this.datasetId,
170
+ datasetVersion: this.datasetVersion,
171
+ file_path: thumbnail.dataset.path,
172
+ });
173
+ mimetype = thumbnail.mimetype.name;
174
+ }
175
+ const plotAnnotation = plot.datacite;
176
+ const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
177
+ const sourceUrl = filePathPrefix + plot.dataset.path;
178
+
179
+ const metadata = JSON.parse(
180
+ plotAnnotation.supplemental_json_metadata.description
181
+ );
182
+
183
+ let supplementalData = [];
184
+ if (plotAnnotation.isDescribedBy) {
185
+ supplementalData.push({
186
+ url: filePathPrefix + plotAnnotation.isDescribedBy.path
187
+ });
188
+ }
189
+
190
+ const resource = {
191
+ dataSource: {url: sourceUrl},
192
+ metadata,
193
+ supplementalData
194
+ }
195
+
196
+ let action = {
197
+ label: capitalise(this.label),
198
+ resource: resource,
199
+ title: "View plot",
200
+ type: "Plot",
201
+ discoverId: this.discoverId,
202
+ version: this.datasetVersion,
203
+ };
204
+ this.items['Plots'].push({
205
+ id,
206
+ title: baseName(filePath),
207
+ type: "Plot",
208
+ thumbnail: thumbnailURL,
209
+ userData: action,
210
+ hideType: true,
211
+ mimetype
212
+ });
213
+ });
214
+ }
215
+ },
216
+ createScaffoldItems: function () {
217
+ if (this.entry.scaffolds) {
218
+ let index = 0;
219
+ this.entry.scaffolds.forEach((scaffold, i) => {
220
+ const filePath = scaffold.dataset.path;
221
+ const id = scaffold.identifier;
222
+ const thumbnail = this.getThumbnailForScaffold(
223
+ scaffold,
224
+ this.entry.scaffoldViews,
225
+ this.entry.thumbnails,
226
+ index
227
+ );
228
+ let mimetype = '';
229
+ let thumbnailURL = undefined;
230
+ if (thumbnail) {
231
+ thumbnailURL = `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`
232
+ mimetype = thumbnail.mimetype.name;
233
+ }
234
+ let action = {
235
+ label: capitalise(this.label),
236
+ resource: `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`,
237
+ title: "View 3D scaffold",
238
+ type: "Scaffold",
239
+ discoverId: this.datasetId,
240
+ apiLocation: this.envVars.API_LOCATION,
241
+ version: this.datasetVersion,
242
+ banner: this.datasetThumbnail,
243
+ contextCardUrl: this.getContextCardUrl(i)
244
+ };
245
+ this.items['Scaffolds'].push({
246
+ id,
247
+ title: baseName(filePath),
248
+ type: "Scaffold",
249
+ thumbnail: thumbnailURL,
250
+ userData: action,
251
+ hideType: true,
252
+ mimetype
253
+ });
254
+ });
255
+ }
256
+ },
257
+ createSegmentationItems: function () {
258
+ if (this.entry.segmentation) {
259
+ this.entry.segmentation.forEach((segmentation) => {
260
+ const id = segmentation.id;
261
+ let filePath = segmentation.dataset.path;
262
+ filePath = filePath.replaceAll(" ", "_");
263
+ filePath = filePath.replaceAll(",", "_");
264
+ const prefix = this.envVars.NL_LINK_PREFIX;
265
+ const resource = {
266
+ share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
267
+ };
268
+ let action = {
269
+ label: capitalise(this.label),
270
+ resource: resource,
271
+ datasetId: this.datasetId,
272
+ title: "View segmentation",
273
+ type: "Segmentation",
274
+ };
275
+ const thumbnailURL = this.getSegmentationThumbnailURL(
276
+ this.envVars.API_LOCATION,
277
+ {
278
+ id,
279
+ datasetId: this.datasetId,
280
+ datasetVersion: this.datasetVersion,
281
+ segmentationFilePath: filePath,
282
+ }
283
+ );
284
+ this.items['Segmentations'].push({
285
+ id,
286
+ title: baseName(filePath),
287
+ type: "Segmentation",
288
+ thumbnail: thumbnailURL,
289
+ userData: action,
290
+ hideType: true,
291
+ mimetype: 'image/png',
292
+ });
293
+ });
294
+ }
295
+ },
296
+ createSimulationItems: function () {
297
+ if (this.entry.simulation && this.entry.simulation.length > 0) {
298
+ let action = {
299
+ label: undefined,
300
+ apiLocation: this.envVars.API_LOCATION,
301
+ version: this.datasetVersion,
302
+ title: "View simulation",
303
+ type: "Simulation",
304
+ name: this.entry.name,
305
+ description: this.entry.description,
306
+ discoverId: this.datasetId,
307
+ dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
308
+ };
309
+ this.items['Simulations'].push({
310
+ id: "simulation",
311
+ title: " ",
312
+ type: "Simulation",
313
+ hideType: true,
314
+ hideTitle: true,
315
+ userData: action,
316
+ });
317
+ }
318
+ },
319
+ createVideoItems: function () {
320
+ if (this.entry.videos) {
321
+ this.entry.videos.forEach((video) => {
322
+ const filePath = this.getS3FilePath(
323
+ this.datasetId,
324
+ this.datasetVersion,
325
+ video.dataset.path
326
+ );
327
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
328
+ this.items['Videos'].push({
329
+ title: video.name,
330
+ type: "Video",
331
+ thumbnail: this.defaultVideoImg,
332
+ hideType: true,
333
+ link: linkUrl,
334
+ });
335
+ });
336
+ }
337
+ },
338
+ onResize: function () {
339
+ this.maxWidth = this.$el.clientWidth;
340
+ // this.$emit('resize', this.$el.clientWidth)
341
+ },
342
+ getContextCardUrl(scaffoldIndex){
343
+ if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
344
+ return undefined
345
+ } else {
346
+ // 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.
347
+ let contextIndex = this.entry.contextualInformation.length == this.entry.scaffolds.length ? scaffoldIndex : 0
348
+ return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}`
349
+ }
350
+ }
351
+ },
352
+ computed: {
353
+ galleryItems() {
354
+ if (this.resetIndex) {
355
+ this.$refs.gallery.indicatorClicked(0);
356
+ }
357
+ let items = [...this.items["Dataset"]];
358
+ if (this.category === "All") {
359
+ for (const [key, value] of Object.entries(this.items)) {
360
+ if (key !== "Dataset")
361
+ items = items.concat(value);
362
+ }
363
+ return items;
364
+ }
365
+ else
366
+ return this.items[this.category];
367
+ },
368
+ },
369
+ created: function () {
370
+ this.createSciCurnchItems();
371
+ },
372
+ watch: {
373
+ category: function() {
374
+ this.resetIndex = true;
375
+ },
376
+ galleryItems: function() {
377
+ this.resetIndex = false;
378
+ },
379
+ datasetBiolucida: {
380
+ deep: true,
381
+ immediate: true,
382
+ handler: function (biolucidaData) {
383
+ let items = [];
384
+ if ("dataset_images" in biolucidaData) {
385
+ items.push(
386
+ ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
387
+ const thumbnailURL = this.getThumbnailURLFromBiolucida(
388
+ this.envVars.API_LOCATION,
389
+ {
390
+ id: dataset_image.image_id,
391
+ }
392
+ );
393
+ const resource = {
394
+ share_link: dataset_image.share_link,
395
+ id: dataset_image.image_id,
396
+ itemId: dataset_image.sourcepkg_id,
397
+ };
398
+ let action = {
399
+ label: capitalise(this.label),
400
+ resource: resource,
401
+ datasetId: this.datasetId,
402
+ title: "View image",
403
+ name: capitalise(this.label),
404
+ type: "Biolucida",
405
+ };
406
+ return {
407
+ id: dataset_image.image_id,
408
+ title: `Biolucida Image`,
409
+ type: "Image",
410
+ thumbnail: thumbnailURL,
411
+ userData: action,
412
+ mimetype: 'image/png',
413
+ hideType: true,
414
+ };
415
+ })
416
+ );
417
+ }
418
+ this.items['Biolucida Images'] = items;
419
+ },
420
+ },
421
+ },
422
+ mounted() {
423
+ this.ro = new ResizeObserver(this.onResize).observe(this.$el);
424
+ },
425
+ destroyed() {
426
+ delete this.ro;
427
+ },
428
+ };
429
+ </script>
430
+
431
+ <style scoped>
432
+ .full-size {
433
+ height: 100%;
434
+ width: 244px;
435
+ }
436
+
437
+ .key-image-span.active {
438
+ transform: scale(1.16);
439
+ border: 4px #8300bf solid;
440
+ }
441
+
442
+ .key-image-span {
443
+ display: flex;
444
+ position: relative;
445
+ }
446
+
447
+ .overlay {
448
+ position: absolute;
449
+ right: 5px;
450
+ top: 5px;
451
+ width: 1.61em;
452
+ height: 1em;
453
+ border-radius: 3px;
454
+ opacity: 0.8;
455
+ }
456
+
457
+ img {
458
+ vertical-align: bottom;
459
+ }
460
+
461
+ a.prev,
462
+ a.next {
463
+ display: flex;
464
+ font-size: 3em;
465
+ }
466
+
467
+ a.prev:not(.underline),
468
+ a.next:not(.underline) {
469
+ text-decoration: none;
470
+ }
471
+
472
+ a.prev {
473
+ justify-content: flex-start;
474
+ }
475
+
476
+ a.next {
477
+ justify-content: flex-end;
478
+ }
479
+
480
+ .standard-gallery {
481
+ display: flex;
482
+ flex-wrap: nowrap;
483
+ justify-content: space-around;
484
+ align-items: center;
485
+ }
486
+
487
+ .image-line {
488
+ display: flex;
489
+ margin-top: 1%;
490
+ margin-bottom: 1%;
491
+ flex-grow: 1;
492
+ justify-content: space-between;
493
+ }
494
+ .disabled {
495
+ opacity: 0.2;
496
+ cursor: default;
497
+ }
498
+
499
+ .rectangle {
500
+ height: 1em;
501
+ width: 2em;
502
+ border-radius: 3px;
503
+ background-color: #555;
504
+ }
505
+
506
+ .full-size >>> .el-card {
507
+ border: 0px;
508
+ }
509
+ </style>