@abi-software/map-side-bar 1.3.23 → 1.3.24-isan-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.
@@ -1,507 +1,520 @@
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
- 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.getImageURLFromS3(this.envVars.API_LOCATION, {
232
- id,
233
- datasetId: this.datasetId,
234
- datasetVersion: this.datasetVersion,
235
- file_path: thumbnail.dataset.path,
236
- });
237
- mimetype = thumbnail.mimetype.name;
238
- }
239
- // 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.
240
- let contextIndex = this.entry.contextualInformation.length == this.entry.scaffolds.length ? i : 0
241
- let action = {
242
- label: capitalise(this.label),
243
- resource: `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${filePath}`,
244
- title: "View 3D scaffold",
245
- type: "Scaffold",
246
- discoverId: this.datasetId,
247
- apiLocation: this.envVars.API_LOCATION,
248
- version: this.datasetVersion,
249
- banner: this.datasetThumbnail,
250
- contextCardUrl: this.entry.contextualInformation[contextIndex] ? `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}` : undefined,
251
- };
252
- this.items['Scaffolds'].push({
253
- id,
254
- title: baseName(filePath),
255
- type: "Scaffold",
256
- thumbnail: thumbnailURL,
257
- userData: action,
258
- hideType: true,
259
- mimetype
260
- });
261
- });
262
- }
263
- },
264
- createSegmentationItems: function () {
265
- if (this.entry.segmentation) {
266
- this.entry.segmentation.forEach((segmentation) => {
267
- const id = segmentation.id;
268
- let filePath = segmentation.dataset.path;
269
- filePath = filePath.replaceAll(" ", "_");
270
- filePath = filePath.replaceAll(",", "_");
271
- const prefix = this.envVars.NL_LINK_PREFIX;
272
- const resource = {
273
- share_link: `${prefix}/dataviewer?datasetId=${this.datasetId}&version=${this.datasetVersion}&path=files/${filePath}`,
274
- };
275
- let action = {
276
- label: capitalise(this.label),
277
- resource: resource,
278
- datasetId: this.datasetId,
279
- title: "View segmentation",
280
- type: "Segmentation",
281
- };
282
- const thumbnailURL = this.getSegmentationThumbnailURL(
283
- this.envVars.API_LOCATION,
284
- {
285
- id,
286
- datasetId: this.datasetId,
287
- datasetVersion: this.datasetVersion,
288
- segmentationFilePath: filePath,
289
- }
290
- );
291
- this.items['Segmentations'].push({
292
- id,
293
- title: baseName(filePath),
294
- type: "Segmentation",
295
- thumbnail: thumbnailURL,
296
- userData: action,
297
- hideType: true,
298
- mimetype: 'image/png',
299
- });
300
- });
301
- }
302
- },
303
- createSimulationItems: function () {
304
- if (this.entry.simulation && this.entry.simulation.length > 0) {
305
- let action = {
306
- label: undefined,
307
- apiLocation: this.envVars.API_LOCATION,
308
- version: this.datasetVersion,
309
- title: "View simulation",
310
- type: "Simulation",
311
- name: this.entry.name,
312
- description: this.entry.description,
313
- discoverId: this.datasetId,
314
- dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
315
- };
316
- this.items['Simulations'].push({
317
- id: "simulation",
318
- title: " ",
319
- type: "Simulation",
320
- hideType: true,
321
- hideTitle: true,
322
- userData: action,
323
- });
324
- }
325
- },
326
- createVideoItems: function () {
327
- if (this.entry.videos) {
328
- this.entry.videos.forEach((video) => {
329
- const filePath = this.getS3FilePath(
330
- this.datasetId,
331
- this.datasetVersion,
332
- video.dataset.path
333
- );
334
- const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
335
- this.items['Videos'].push({
336
- title: video.name,
337
- type: "Video",
338
- thumbnail: this.defaultVideoImg,
339
- hideType: true,
340
- link: linkUrl,
341
- });
342
- });
343
- }
344
- },
345
- onResize: function () {
346
- this.maxWidth = this.$el.clientWidth;
347
- // this.$emit('resize', this.$el.clientWidth)
348
- },
349
- },
350
- computed: {
351
- galleryItems() {
352
- if (this.resetIndex) {
353
- this.$refs.gallery.indicatorClicked(0);
354
- }
355
- let items = [...this.items["Dataset"]];
356
- if (this.category === "All") {
357
- for (const [key, value] of Object.entries(this.items)) {
358
- if (key !== "Dataset")
359
- items = items.concat(value);
360
- }
361
- return items;
362
- }
363
- else
364
- return this.items[this.category];
365
- },
366
- },
367
- created: function () {
368
- this.createSciCurnchItems();
369
- },
370
- watch: {
371
- category: function() {
372
- this.resetIndex = true;
373
- },
374
- galleryItems: function() {
375
- this.resetIndex = false;
376
- },
377
- datasetBiolucida: {
378
- deep: true,
379
- immediate: true,
380
- handler: function (biolucidaData) {
381
- let items = [];
382
- if ("dataset_images" in biolucidaData) {
383
- items.push(
384
- ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
385
- const thumbnailURL = this.getThumbnailURLFromBiolucida(
386
- this.envVars.API_LOCATION,
387
- {
388
- id: dataset_image.image_id,
389
- }
390
- );
391
- const resource = {
392
- share_link: dataset_image.share_link,
393
- id: dataset_image.image_id,
394
- itemId: dataset_image.sourcepkg_id,
395
- };
396
- let action = {
397
- label: capitalise(this.label),
398
- resource: resource,
399
- datasetId: this.datasetId,
400
- title: "View image",
401
- name: capitalise(this.label),
402
- type: "Biolucida",
403
- };
404
- return {
405
- id: dataset_image.image_id,
406
- title: `Biolucida Image`,
407
- type: "Image",
408
- thumbnail: thumbnailURL,
409
- userData: action,
410
- mimetype: 'image/png',
411
- hideType: true,
412
- };
413
- })
414
- );
415
- }
416
- this.items['Biolucida Images'] = items;
417
- },
418
- },
419
- },
420
- mounted() {
421
- this.ro = new ResizeObserver(this.onResize).observe(this.$el);
422
- },
423
- destroyed() {
424
- delete this.ro;
425
- },
426
- };
427
- </script>
428
-
429
- <style scoped>
430
- .full-size {
431
- height: 100%;
432
- width: 244px;
433
- }
434
-
435
- .key-image-span.active {
436
- transform: scale(1.16);
437
- border: 4px #8300bf solid;
438
- }
439
-
440
- .key-image-span {
441
- display: flex;
442
- position: relative;
443
- }
444
-
445
- .overlay {
446
- position: absolute;
447
- right: 5px;
448
- top: 5px;
449
- width: 1.61em;
450
- height: 1em;
451
- border-radius: 3px;
452
- opacity: 0.8;
453
- }
454
-
455
- img {
456
- vertical-align: bottom;
457
- }
458
-
459
- a.prev,
460
- a.next {
461
- display: flex;
462
- font-size: 3em;
463
- }
464
-
465
- a.prev:not(.underline),
466
- a.next:not(.underline) {
467
- text-decoration: none;
468
- }
469
-
470
- a.prev {
471
- justify-content: flex-start;
472
- }
473
-
474
- a.next {
475
- justify-content: flex-end;
476
- }
477
-
478
- .standard-gallery {
479
- display: flex;
480
- flex-wrap: nowrap;
481
- justify-content: space-around;
482
- align-items: center;
483
- }
484
-
485
- .image-line {
486
- display: flex;
487
- margin-top: 1%;
488
- margin-bottom: 1%;
489
- flex-grow: 1;
490
- justify-content: space-between;
491
- }
492
- .disabled {
493
- opacity: 0.2;
494
- cursor: default;
495
- }
496
-
497
- .rectangle {
498
- height: 1em;
499
- width: 2em;
500
- border-radius: 3px;
501
- background-color: #555;
502
- }
503
-
504
- .full-size >>> .el-card {
505
- border: 0px;
506
- }
507
- </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
+ "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.datasetId === 4)
304
+ || (this.datasetId === 17)
305
+ || (this.datasetId === 78)
306
+ || (this.datasetId === 135)
307
+ || (this.datasetId === 157)
308
+ || (this.entry.simulation && this.entry.simulation.length > 0)) {
309
+ let action = {
310
+ label: undefined,
311
+ apiLocation: this.envVars.API_LOCATION,
312
+ version: this.datasetVersion,
313
+ title: "View simulation",
314
+ type: "Simulation",
315
+ name: this.entry.name,
316
+ description: this.entry.description,
317
+ discoverId: this.datasetId,
318
+ dataset: `${this.envVars.ROOT_URL}/datasets/${this.datasetId}?type=dataset`
319
+ };
320
+ this.items['Simulations'].push({
321
+ id: "simulation",
322
+ title: " ",
323
+ type: "Simulation",
324
+ hideType: true,
325
+ hideTitle: true,
326
+ userData: action,
327
+ });
328
+ }
329
+ },
330
+ createVideoItems: function () {
331
+ if (this.entry.videos) {
332
+ this.entry.videos.forEach((video) => {
333
+ const filePath = this.getS3FilePath(
334
+ this.datasetId,
335
+ this.datasetVersion,
336
+ video.dataset.path
337
+ );
338
+ const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.datasetVersion}&dataset_id=${this.datasetId}&file_path=${filePath}&mimetype=${video.mimetype.name}`;
339
+ this.items['Videos'].push({
340
+ title: video.name,
341
+ type: "Video",
342
+ thumbnail: this.defaultVideoImg,
343
+ hideType: true,
344
+ link: linkUrl,
345
+ });
346
+ });
347
+ }
348
+ },
349
+ onResize: function () {
350
+ this.maxWidth = this.$el.clientWidth;
351
+ // this.$emit('resize', this.$el.clientWidth)
352
+ },
353
+ getContextCardUrl(scaffoldIndex){
354
+ if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
355
+ return undefined
356
+ } else {
357
+ // 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.
358
+ let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
359
+ return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}`
360
+ }
361
+ }
362
+ },
363
+ computed: {
364
+ galleryItems() {
365
+ if (this.resetIndex) {
366
+ this.$refs.gallery.indicatorClicked(0);
367
+ }
368
+ let items = [...this.items["Dataset"]];
369
+ if (this.category === "All") {
370
+ for (const [key, value] of Object.entries(this.items)) {
371
+ if (key !== "Dataset")
372
+ items = items.concat(value);
373
+ }
374
+ return items;
375
+ }
376
+ else
377
+ return this.items[this.category];
378
+ },
379
+ },
380
+ created: function () {
381
+ this.createSciCurnchItems();
382
+ },
383
+ watch: {
384
+ category: function() {
385
+ this.resetIndex = true;
386
+ },
387
+ galleryItems: function() {
388
+ this.resetIndex = false;
389
+ },
390
+ datasetBiolucida: {
391
+ deep: true,
392
+ immediate: true,
393
+ handler: function (biolucidaData) {
394
+ let items = [];
395
+ if ("dataset_images" in biolucidaData) {
396
+ items.push(
397
+ ...Array.from(biolucidaData.dataset_images, (dataset_image) => {
398
+ const thumbnailURL = this.getThumbnailURLFromBiolucida(
399
+ this.envVars.API_LOCATION,
400
+ {
401
+ id: dataset_image.image_id,
402
+ }
403
+ );
404
+ const resource = {
405
+ share_link: dataset_image.share_link,
406
+ id: dataset_image.image_id,
407
+ itemId: dataset_image.sourcepkg_id,
408
+ };
409
+ let action = {
410
+ label: capitalise(this.label),
411
+ resource: resource,
412
+ datasetId: this.datasetId,
413
+ title: "View image",
414
+ name: capitalise(this.label),
415
+ type: "Biolucida",
416
+ };
417
+ return {
418
+ id: dataset_image.image_id,
419
+ title: `Biolucida Image`,
420
+ type: "Image",
421
+ thumbnail: thumbnailURL,
422
+ userData: action,
423
+ mimetype: 'image/png',
424
+ hideType: true,
425
+ };
426
+ })
427
+ );
428
+ }
429
+ this.items['Biolucida Images'] = items;
430
+ },
431
+ },
432
+ },
433
+ mounted() {
434
+ this.ro = new ResizeObserver(this.onResize).observe(this.$el);
435
+ },
436
+ destroyed() {
437
+ delete this.ro;
438
+ },
439
+ };
440
+ </script>
441
+
442
+ <style scoped>
443
+ .full-size {
444
+ height: 100%;
445
+ width: 244px;
446
+ }
447
+
448
+ .key-image-span.active {
449
+ transform: scale(1.16);
450
+ border: 4px #8300bf solid;
451
+ }
452
+
453
+ .key-image-span {
454
+ display: flex;
455
+ position: relative;
456
+ }
457
+
458
+ .overlay {
459
+ position: absolute;
460
+ right: 5px;
461
+ top: 5px;
462
+ width: 1.61em;
463
+ height: 1em;
464
+ border-radius: 3px;
465
+ opacity: 0.8;
466
+ }
467
+
468
+ img {
469
+ vertical-align: bottom;
470
+ }
471
+
472
+ a.prev,
473
+ a.next {
474
+ display: flex;
475
+ font-size: 3em;
476
+ }
477
+
478
+ a.prev:not(.underline),
479
+ a.next:not(.underline) {
480
+ text-decoration: none;
481
+ }
482
+
483
+ a.prev {
484
+ justify-content: flex-start;
485
+ }
486
+
487
+ a.next {
488
+ justify-content: flex-end;
489
+ }
490
+
491
+ .standard-gallery {
492
+ display: flex;
493
+ flex-wrap: nowrap;
494
+ justify-content: space-around;
495
+ align-items: center;
496
+ }
497
+
498
+ .image-line {
499
+ display: flex;
500
+ margin-top: 1%;
501
+ margin-bottom: 1%;
502
+ flex-grow: 1;
503
+ justify-content: space-between;
504
+ }
505
+ .disabled {
506
+ opacity: 0.2;
507
+ cursor: default;
508
+ }
509
+
510
+ .rectangle {
511
+ height: 1em;
512
+ width: 2em;
513
+ border-radius: 3px;
514
+ background-color: #555;
515
+ }
516
+
517
+ .full-size >>> .el-card {
518
+ border: 0px;
519
+ }
520
+ </style>