@abi-software/map-side-bar 1.3.34 → 1.3.36-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/img/logo-sparc-wave-primary.8ed83a51.svg +1 -0
  6. package/dist/map-side-bar.common.js +2043 -1145
  7. package/dist/map-side-bar.common.js.map +1 -1
  8. package/dist/map-side-bar.css +1 -1
  9. package/dist/map-side-bar.umd.js +2043 -1145
  10. package/dist/map-side-bar.umd.js.map +1 -1
  11. package/dist/map-side-bar.umd.min.js +3 -1
  12. package/dist/map-side-bar.umd.min.js.map +1 -1
  13. package/package-lock.json +13716 -13716
  14. package/package.json +67 -67
  15. package/public/index.html +17 -17
  16. package/scaffold_context_info.json +31 -0
  17. package/src/App.vue +149 -152
  18. package/src/algolia/algolia.js +182 -182
  19. package/src/algolia/utils.js +69 -69
  20. package/src/components/BadgesGroup.vue +141 -142
  21. package/src/components/Cascader.vue +49 -49
  22. package/src/components/ContextCard.vue +384 -381
  23. package/src/components/DatasetCard.vue +385 -325
  24. package/src/components/EventBus.js +3 -3
  25. package/src/components/ImageGallery.vue +509 -515
  26. package/src/components/SearchFilters.vue +609 -609
  27. package/src/components/SideBar.vue +245 -224
  28. package/src/components/SidebarContent.vue +511 -508
  29. package/src/components/Tabs.vue +78 -78
  30. package/src/components/hardcoded-context-info.js +79 -79
  31. package/src/components/index.js +8 -8
  32. package/src/components/processFilters.js +22 -0
  33. package/src/components/species-map.js +8 -8
  34. package/src/main.js +8 -8
  35. package/src/mixins/GalleryHelpers.js +104 -0
  36. package/static.json +6 -6
  37. package/vue.config.js +11 -11
@@ -1,515 +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
- 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 "../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>