@abi-software/map-side-bar 1.3.32 → 1.3.34

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.
@@ -1,515 +1,515 @@
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
- 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: Number,
62
- default: -1,
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
- window.entry = this.entry
219
- let index = 0;
220
- this.entry.scaffolds.forEach((scaffold, i) => {
221
- const filePath = scaffold.dataset.path;
222
- const id = scaffold.identifier;
223
- const thumbnail = this.getThumbnailForScaffold(
224
- scaffold,
225
- this.entry.scaffoldViews,
226
- this.entry.thumbnails,
227
- index
228
- );
229
- let mimetype = '';
230
- let thumbnailURL = undefined;
231
- if (thumbnail) {
232
- thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
233
- id,
234
- datasetId: this.datasetId,
235
- datasetVersion: this.datasetVersion,
236
- file_path: thumbnail.dataset.path,
237
- });
238
- mimetype = thumbnail.mimetype.name;
239
- }
240
- let action = {
241
- label: capitalise(this.label),
242
- resource: `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`,
243
- title: "View 3D scaffold",
244
- type: "Scaffold",
245
- discoverId: this.datasetId,
246
- apiLocation: this.envVars.API_LOCATION,
247
- version: this.datasetVersion,
248
- banner: this.datasetThumbnail,
249
- contextCardUrl: this.getContextCardUrl(i)
250
- };
251
- this.items['Scaffolds'].push({
252
- id,
253
- title: baseName(filePath),
254
- type: "Scaffold",
255
- thumbnail: thumbnailURL,
256
- userData: action,
257
- hideType: true,
258
- mimetype
259
- });
260
- });
261
- }
262
- },
263
- createSegmentationItems: function () {
264
- if (this.entry.segmentation) {
265
- this.entry.segmentation.forEach((segmentation) => {
266
- const id = segmentation.id;
267
- let filePath = segmentation.dataset.path;
268
- filePath = filePath.replaceAll(" ", "_");
269
- filePath = filePath.replaceAll(",", "_");
270
- const prefix = this.envVars.NL_LINK_PREFIX;
271
- const resource = {
272
- share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
273
- };
274
- let action = {
275
- label: capitalise(this.label),
276
- resource: resource,
277
- datasetId: this.datasetId,
278
- title: "View segmentation",
279
- type: "Segmentation",
280
- };
281
- const thumbnailURL = this.getSegmentationThumbnailURL(
282
- this.envVars.API_LOCATION,
283
- {
284
- id,
285
- datasetId: this.datasetId,
286
- datasetVersion: this.datasetVersion,
287
- segmentationFilePath: filePath,
288
- }
289
- );
290
- this.items['Segmentations'].push({
291
- id,
292
- title: baseName(filePath),
293
- type: "Segmentation",
294
- thumbnail: thumbnailURL,
295
- userData: action,
296
- hideType: true,
297
- mimetype: 'image/png',
298
- });
299
- });
300
- }
301
- },
302
- createSimulationItems: function () {
303
- if (this.entry.simulation && this.entry.simulation.length > 0) {
304
- let action = {
305
- label: undefined,
306
- apiLocation: this.envVars.API_LOCATION,
307
- version: this.datasetVersion,
308
- title: "View simulation",
309
- type: "Simulation",
310
- name: this.entry.name,
311
- description: this.entry.description,
312
- discoverId: this.datasetId,
313
- dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
314
- };
315
- this.items['Simulations'].push({
316
- id: "simulation",
317
- title: " ",
318
- type: "Simulation",
319
- hideType: true,
320
- hideTitle: true,
321
- userData: action,
322
- });
323
- }
324
- },
325
- createVideoItems: function () {
326
- if (this.entry.videos) {
327
- this.entry.videos.forEach((video) => {
328
- const filePath = this.getS3FilePath(
329
- this.datasetId,
330
- this.datasetVersion,
331
- video.dataset.path
332
- );
333
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
334
- this.items['Videos'].push({
335
- title: video.name,
336
- type: "Video",
337
- thumbnail: this.defaultVideoImg,
338
- hideType: true,
339
- link: linkUrl,
340
- });
341
- });
342
- }
343
- },
344
- onResize: function () {
345
- this.maxWidth = this.$el.clientWidth;
346
- // this.$emit('resize', this.$el.clientWidth)
347
- },
348
- getContextCardUrl(scaffoldIndex){
349
- if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
350
- return undefined
351
- } else {
352
- // 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.
353
- let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
354
- return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}`
355
- }
356
- }
357
- },
358
- computed: {
359
- galleryItems() {
360
- if (this.resetIndex) {
361
- this.$refs.gallery.indicatorClicked(0);
362
- }
363
- let items = [...this.items["Dataset"]];
364
- if (this.category === "All") {
365
- for (const [key, value] of Object.entries(this.items)) {
366
- if (key !== "Dataset")
367
- items = items.concat(value);
368
- }
369
- return items;
370
- }
371
- else
372
- return this.items[this.category];
373
- },
374
- },
375
- created: function () {
376
- this.createSciCurnchItems();
377
- },
378
- watch: {
379
- category: function() {
380
- this.resetIndex = true;
381
- },
382
- galleryItems: function() {
383
- this.resetIndex = false;
384
- },
385
- datasetBiolucida: {
386
- deep: true,
387
- immediate: true,
388
- handler: function (biolucidaData) {
389
- let items = [];
390
- if ("dataset_images" in biolucidaData) {
391
- items.push(
392
- ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
393
- const thumbnailURL = this.getThumbnailURLFromBiolucida(
394
- this.envVars.API_LOCATION,
395
- {
396
- id: dataset_image.image_id,
397
- }
398
- );
399
- const resource = {
400
- share_link: dataset_image.share_link,
401
- id: dataset_image.image_id,
402
- itemId: dataset_image.sourcepkg_id,
403
- };
404
- let action = {
405
- label: capitalise(this.label),
406
- resource: resource,
407
- datasetId: this.datasetId,
408
- title: "View image",
409
- name: capitalise(this.label),
410
- type: "Biolucida",
411
- };
412
- return {
413
- id: dataset_image.image_id,
414
- title: `Biolucida Image`,
415
- type: "Image",
416
- thumbnail: thumbnailURL,
417
- userData: action,
418
- mimetype: 'image/png',
419
- hideType: true,
420
- };
421
- })
422
- );
423
- }
424
- this.items['Biolucida Images'] = items;
425
- },
426
- },
427
- },
428
- mounted() {
429
- this.ro = new ResizeObserver(this.onResize).observe(this.$el);
430
- },
431
- destroyed() {
432
- delete this.ro;
433
- },
434
- };
435
- </script>
436
-
437
- <style scoped>
438
- .full-size {
439
- height: 100%;
440
- width: 244px;
441
- }
442
-
443
- .key-image-span.active {
444
- transform: scale(1.16);
445
- border: 4px #8300bf solid;
446
- }
447
-
448
- .key-image-span {
449
- display: flex;
450
- position: relative;
451
- }
452
-
453
- .overlay {
454
- position: absolute;
455
- right: 5px;
456
- top: 5px;
457
- width: 1.61em;
458
- height: 1em;
459
- border-radius: 3px;
460
- opacity: 0.8;
461
- }
462
-
463
- img {
464
- vertical-align: bottom;
465
- }
466
-
467
- a.prev,
468
- a.next {
469
- display: flex;
470
- font-size: 3em;
471
- }
472
-
473
- a.prev:not(.underline),
474
- a.next:not(.underline) {
475
- text-decoration: none;
476
- }
477
-
478
- a.prev {
479
- justify-content: flex-start;
480
- }
481
-
482
- a.next {
483
- justify-content: flex-end;
484
- }
485
-
486
- .standard-gallery {
487
- display: flex;
488
- flex-wrap: nowrap;
489
- justify-content: space-around;
490
- align-items: center;
491
- }
492
-
493
- .image-line {
494
- display: flex;
495
- margin-top: 1%;
496
- margin-bottom: 1%;
497
- flex-grow: 1;
498
- justify-content: space-between;
499
- }
500
- .disabled {
501
- opacity: 0.2;
502
- cursor: default;
503
- }
504
-
505
- .rectangle {
506
- height: 1em;
507
- width: 2em;
508
- border-radius: 3px;
509
- background-color: #555;
510
- }
511
-
512
- .full-size >>> .el-card {
513
- border: 0px;
514
- }
515
- </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 "@abi-software/gallery/src/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: Number,
62
+ default: -1,
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
+ //Use the Images instead for Biolucida Images
90
+ //"Biolucida Images": [],
91
+ 'Dataset': [],
92
+ 'Images': [],
93
+ 'Scaffolds': [],
94
+ 'Segmentations': [],
95
+ 'Simulations': [],
96
+ 'Videos': [],
97
+ 'Plots': [],
98
+ },
99
+ bodyStyle: { padding: '0px', background: '#ffffff' },
100
+ imageContainerStyle: {
101
+ width: '160px',
102
+ height: '160px',
103
+ display: 'flex',
104
+ alignItems: 'center',
105
+ justifyContent: 'center',
106
+ },
107
+ imageStyle: { maxWidth: '160px', maxHeight: '160px'},
108
+ shadow: "never",
109
+ bottomSpacer: { minHeight: '0rem' },
110
+ resetIndex: false
111
+ };
112
+ },
113
+ methods: {
114
+ cardClicked: function(payload) {
115
+ this.$emit('card-clicked', payload);
116
+ },
117
+ createSciCurnchItems: function () {
118
+ this.createDatasetItem();
119
+ this.createScaffoldItems();
120
+ this.createSimulationItems();
121
+ this.createPlotItems();
122
+ this.createSegmentationItems();
123
+ /* Disable these two
124
+ this.createImageItems();
125
+ this.createVideoItems();
126
+ */
127
+ },
128
+ createDatasetItem: function () {
129
+ const link = `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
130
+ if (this.datasetThumbnail) {
131
+ this.items['Dataset'].push({
132
+ id: -1,
133
+ //Work around gallery requires a truthy string
134
+ title: " ",
135
+ type: `Dataset ${this.datasetId}`,
136
+ thumbnail: this.datasetThumbnail,
137
+ link,
138
+ hideType: true,
139
+ hideTitle: true,
140
+ });
141
+ }
142
+ },
143
+ createImageItems: function () {
144
+ if (this.entry.images) {
145
+ this.entry.images.forEach((image) => {
146
+ const filePath = image.dataset.path;
147
+ const id = image.identifier;
148
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.datasetId}&dataset_version=${this.datasetVersion}&file_path=${filePath}&mimetype=${image.mimetype.name}`;
149
+ this.items['Images'].push({
150
+ id,
151
+ title: baseName(filePath),
152
+ type: "Image",
153
+ link: linkUrl,
154
+ hideType: true,
155
+ });
156
+ });
157
+ }
158
+ },
159
+ createPlotItems: function () {
160
+ if (this.entry.plots) {
161
+ this.entry.plots.forEach((plot) => {
162
+ const filePath = plot.dataset.path;
163
+ const id = plot.identifier;
164
+ const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
165
+ let thumbnailURL = undefined;
166
+ let mimetype = '';
167
+ if (thumbnail) {
168
+ thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
169
+ id,
170
+ datasetId: this.datasetId,
171
+ datasetVersion: this.datasetVersion,
172
+ file_path: thumbnail.dataset.path,
173
+ });
174
+ mimetype = thumbnail.mimetype.name;
175
+ }
176
+ const plotAnnotation = plot.datacite;
177
+ const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
178
+ const sourceUrl = filePathPrefix + plot.dataset.path;
179
+
180
+ const metadata = JSON.parse(
181
+ plotAnnotation.supplemental_json_metadata.description
182
+ );
183
+
184
+ let supplementalData = [];
185
+ if (plotAnnotation.isDescribedBy) {
186
+ supplementalData.push({
187
+ url: filePathPrefix + plotAnnotation.isDescribedBy.path
188
+ });
189
+ }
190
+
191
+ const resource = {
192
+ dataSource: {url: sourceUrl},
193
+ metadata,
194
+ supplementalData
195
+ }
196
+
197
+ let action = {
198
+ label: capitalise(this.label),
199
+ resource: resource,
200
+ title: "View plot",
201
+ type: "Plot",
202
+ discoverId: this.discoverId,
203
+ version: this.datasetVersion,
204
+ };
205
+ this.items['Plots'].push({
206
+ id,
207
+ title: baseName(filePath),
208
+ type: "Plot",
209
+ thumbnail: thumbnailURL,
210
+ userData: action,
211
+ hideType: true,
212
+ mimetype
213
+ });
214
+ });
215
+ }
216
+ },
217
+ createScaffoldItems: function () {
218
+ if (this.entry.scaffolds) {
219
+ let index = 0;
220
+ this.entry.scaffolds.forEach((scaffold, i) => {
221
+ const filePath = scaffold.dataset.path;
222
+ const id = scaffold.identifier;
223
+ const thumbnail = this.getThumbnailForScaffold(
224
+ scaffold,
225
+ this.entry.scaffoldViews,
226
+ this.entry.thumbnails,
227
+ index
228
+ );
229
+ let mimetype = '';
230
+ let thumbnailURL = undefined;
231
+ if (thumbnail) {
232
+ thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
233
+ id,
234
+ datasetId: this.datasetId,
235
+ datasetVersion: this.datasetVersion,
236
+ file_path: thumbnail.dataset.path,
237
+ });
238
+ mimetype = thumbnail.mimetype.name;
239
+ }
240
+ let action = {
241
+ label: capitalise(this.label),
242
+ resource: `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`,
243
+ title: "View 3D scaffold",
244
+ type: "Scaffold",
245
+ discoverId: this.datasetId,
246
+ apiLocation: this.envVars.API_LOCATION,
247
+ version: this.datasetVersion,
248
+ banner: this.datasetThumbnail,
249
+ contextCardUrl: this.getContextCardUrl(i)
250
+ };
251
+ this.items['Scaffolds'].push({
252
+ id,
253
+ title: baseName(filePath),
254
+ type: "Scaffold",
255
+ thumbnail: thumbnailURL,
256
+ userData: action,
257
+ hideType: true,
258
+ mimetype
259
+ });
260
+ });
261
+ }
262
+ },
263
+ createSegmentationItems: function () {
264
+ if (this.entry.segmentation) {
265
+ this.entry.segmentation.forEach((segmentation) => {
266
+ const id = segmentation.id;
267
+ let filePath = segmentation.dataset.path;
268
+ filePath = filePath.replaceAll(" ", "_");
269
+ filePath = filePath.replaceAll(",", "_");
270
+ const prefix = this.envVars.NL_LINK_PREFIX;
271
+ const resource = {
272
+ share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
273
+ };
274
+ let action = {
275
+ label: capitalise(this.label),
276
+ resource: resource,
277
+ datasetId: this.datasetId,
278
+ title: "View segmentation",
279
+ type: "Segmentation",
280
+ };
281
+ const thumbnailURL = this.getSegmentationThumbnailURL(
282
+ this.envVars.API_LOCATION,
283
+ {
284
+ id,
285
+ datasetId: this.datasetId,
286
+ datasetVersion: this.datasetVersion,
287
+ segmentationFilePath: filePath,
288
+ }
289
+ );
290
+ this.items['Segmentations'].push({
291
+ id,
292
+ title: baseName(filePath),
293
+ type: "Segmentation",
294
+ thumbnail: thumbnailURL,
295
+ userData: action,
296
+ hideType: true,
297
+ mimetype: 'image/png',
298
+ });
299
+ });
300
+ }
301
+ },
302
+ createSimulationItems: function () {
303
+ if (this.entry.simulation && this.entry.simulation.length > 0) {
304
+ let action = {
305
+ label: undefined,
306
+ apiLocation: this.envVars.API_LOCATION,
307
+ version: this.datasetVersion,
308
+ title: "View simulation",
309
+ type: "Simulation",
310
+ name: this.entry.name,
311
+ description: this.entry.description,
312
+ discoverId: this.datasetId,
313
+ dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
314
+ };
315
+ this.items['Simulations'].push({
316
+ id: "simulation",
317
+ title: " ",
318
+ type: "Simulation",
319
+ hideType: true,
320
+ hideTitle: true,
321
+ userData: action,
322
+ });
323
+ }
324
+ },
325
+ createVideoItems: function () {
326
+ if (this.entry.videos) {
327
+ this.entry.videos.forEach((video) => {
328
+ const filePath = this.getS3FilePath(
329
+ this.datasetId,
330
+ this.datasetVersion,
331
+ video.dataset.path
332
+ );
333
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
334
+ this.items['Videos'].push({
335
+ title: video.name,
336
+ type: "Video",
337
+ thumbnail: this.defaultVideoImg,
338
+ hideType: true,
339
+ link: linkUrl,
340
+ });
341
+ });
342
+ }
343
+ },
344
+ onResize: function () {
345
+ this.maxWidth = this.$el.clientWidth;
346
+ // this.$emit('resize', this.$el.clientWidth)
347
+ },
348
+ getContextCardUrl(scaffoldIndex){
349
+ if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
350
+ return undefined
351
+ } else {
352
+ // 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.
353
+ let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
354
+ return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}`
355
+ }
356
+ }
357
+ },
358
+ computed: {
359
+ galleryItems() {
360
+ if (this.resetIndex) {
361
+ this.$refs.gallery.indicatorClicked(0);
362
+ }
363
+ let items = [...this.items["Dataset"]];
364
+ if (this.category === "All") {
365
+ for (const [key, value] of Object.entries(this.items)) {
366
+ if (key !== "Dataset")
367
+ items = items.concat(value);
368
+ }
369
+ return items;
370
+ }
371
+ else
372
+ return this.items[this.category];
373
+ },
374
+ },
375
+ created: function () {
376
+ this.createSciCurnchItems();
377
+ },
378
+ watch: {
379
+ category: function() {
380
+ this.resetIndex = true;
381
+ },
382
+ galleryItems: function() {
383
+ this.resetIndex = false;
384
+ },
385
+ datasetBiolucida: {
386
+ deep: true,
387
+ immediate: true,
388
+ handler: function (biolucidaData) {
389
+ let items = [];
390
+ if ("dataset_images" in biolucidaData) {
391
+ items.push(
392
+ ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
393
+ const thumbnailURL = this.getThumbnailURLFromBiolucida(
394
+ this.envVars.API_LOCATION,
395
+ {
396
+ id: dataset_image.image_id,
397
+ }
398
+ );
399
+ const resource = {
400
+ share_link: dataset_image.share_link,
401
+ id: dataset_image.image_id,
402
+ itemId: dataset_image.sourcepkg_id,
403
+ };
404
+ let action = {
405
+ label: capitalise(this.label),
406
+ resource: resource,
407
+ datasetId: this.datasetId,
408
+ title: "View image",
409
+ name: capitalise(this.label),
410
+ type: "Biolucida",
411
+ };
412
+ return {
413
+ id: dataset_image.image_id,
414
+ title: `Image`,
415
+ type: "Image",
416
+ thumbnail: thumbnailURL,
417
+ userData: action,
418
+ mimetype: 'image/png',
419
+ hideType: true,
420
+ };
421
+ })
422
+ );
423
+ }
424
+ this.items['Images'] = items;
425
+ },
426
+ },
427
+ },
428
+ mounted() {
429
+ this.ro = new ResizeObserver(this.onResize).observe(this.$el);
430
+ },
431
+ destroyed() {
432
+ delete this.ro;
433
+ },
434
+ };
435
+ </script>
436
+
437
+ <style scoped>
438
+ .full-size {
439
+ height: 100%;
440
+ width: 244px;
441
+ }
442
+
443
+ .key-image-span.active {
444
+ transform: scale(1.16);
445
+ border: 4px #8300bf solid;
446
+ }
447
+
448
+ .key-image-span {
449
+ display: flex;
450
+ position: relative;
451
+ }
452
+
453
+ .overlay {
454
+ position: absolute;
455
+ right: 5px;
456
+ top: 5px;
457
+ width: 1.61em;
458
+ height: 1em;
459
+ border-radius: 3px;
460
+ opacity: 0.8;
461
+ }
462
+
463
+ img {
464
+ vertical-align: bottom;
465
+ }
466
+
467
+ a.prev,
468
+ a.next {
469
+ display: flex;
470
+ font-size: 3em;
471
+ }
472
+
473
+ a.prev:not(.underline),
474
+ a.next:not(.underline) {
475
+ text-decoration: none;
476
+ }
477
+
478
+ a.prev {
479
+ justify-content: flex-start;
480
+ }
481
+
482
+ a.next {
483
+ justify-content: flex-end;
484
+ }
485
+
486
+ .standard-gallery {
487
+ display: flex;
488
+ flex-wrap: nowrap;
489
+ justify-content: space-around;
490
+ align-items: center;
491
+ }
492
+
493
+ .image-line {
494
+ display: flex;
495
+ margin-top: 1%;
496
+ margin-bottom: 1%;
497
+ flex-grow: 1;
498
+ justify-content: space-between;
499
+ }
500
+ .disabled {
501
+ opacity: 0.2;
502
+ cursor: default;
503
+ }
504
+
505
+ .rectangle {
506
+ height: 1em;
507
+ width: 2em;
508
+ border-radius: 3px;
509
+ background-color: #555;
510
+ }
511
+
512
+ .full-size >>> .el-card {
513
+ border: 0px;
514
+ }
515
+ </style>