@abi-software/map-side-bar 1.3.35 → 1.3.37

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/dist/map-side-bar.common.js +306 -231
  5. package/dist/map-side-bar.common.js.map +1 -1
  6. package/dist/map-side-bar.css +1 -1
  7. package/dist/map-side-bar.umd.js +306 -231
  8. package/dist/map-side-bar.umd.js.map +1 -1
  9. package/dist/map-side-bar.umd.min.js +1 -1
  10. package/dist/map-side-bar.umd.min.js.map +1 -1
  11. package/package-lock.json +13716 -13716
  12. package/package.json +67 -67
  13. package/public/index.html +17 -17
  14. package/src/App.vue +155 -152
  15. package/src/algolia/algolia.js +182 -182
  16. package/src/algolia/utils.js +69 -69
  17. package/src/components/BadgesGroup.vue +142 -142
  18. package/src/components/Cascader.vue +49 -49
  19. package/src/components/ContextCard.vue +391 -381
  20. package/src/components/DatasetCard.vue +325 -325
  21. package/src/components/EventBus.js +3 -3
  22. package/src/components/ImageGallery.vue +525 -515
  23. package/src/components/SearchFilters.vue +585 -586
  24. package/src/components/SideBar.vue +224 -224
  25. package/src/components/SidebarContent.vue +508 -508
  26. package/src/components/Tabs.vue +78 -78
  27. package/src/components/hardcoded-context-info.js +79 -79
  28. package/src/components/index.js +8 -8
  29. package/src/components/species-map.js +8 -8
  30. package/src/main.js +8 -8
  31. package/src/mixins/S3Bucket.vue +31 -0
  32. package/static.json +6 -6
  33. package/vue.config.js +11 -11
  34. package/del.json +0 -27
  35. package/delte.json +0 -30
  36. package/scaffold_context_info.json +0 -31
  37. package/src/components/processFilters.js +0 -22
@@ -1,515 +1,525 @@
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>
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>