@abi-software/map-side-bar 2.14.2-demo.0 → 2.14.2
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.
- package/dist/map-side-bar.js +10150 -10118
- package/dist/map-side-bar.umd.cjs +68 -72
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/BadgesGroup.vue +23 -15
- package/src/components/ConnectivityInfo.vue +30 -126
- package/src/components/DatasetCard.vue +332 -7
- package/src/components/ImageGallery.vue +14 -359
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="categories['All'].size > 1" class="container" ref="container">
|
|
3
|
-
<div>View data types:</div>
|
|
3
|
+
<div v-if="displayText">View data types:</div>
|
|
4
4
|
<template v-for="(item, key) in categories">
|
|
5
5
|
<el-button
|
|
6
6
|
v-if="item.size > 0"
|
|
@@ -32,7 +32,15 @@ export default {
|
|
|
32
32
|
return []
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
-
|
|
35
|
+
displayDataset: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true,
|
|
38
|
+
},
|
|
39
|
+
displayText: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
items: {
|
|
36
44
|
type: Object,
|
|
37
45
|
default: () => {
|
|
38
46
|
return {}
|
|
@@ -47,33 +55,33 @@ export default {
|
|
|
47
55
|
}
|
|
48
56
|
},
|
|
49
57
|
methods: {
|
|
50
|
-
addToCategories: function (
|
|
58
|
+
addToCategories: function (name) {
|
|
59
|
+
const array = this.items[name]
|
|
51
60
|
if (array && array.length > 0) {
|
|
52
61
|
this.categories[name] = { size: array.length }
|
|
53
62
|
this.categories['All'].size += array.length
|
|
54
63
|
}
|
|
55
64
|
},
|
|
56
|
-
addSimulationsToCategories: function (array) {
|
|
57
|
-
if (array && array.length > 0) {
|
|
58
|
-
const size = array.length
|
|
59
|
-
this.categories['Simulations'] = { size }
|
|
60
|
-
this.categories['All'].size += size
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
65
|
categoryClicked: function (name) {
|
|
64
66
|
this.active = name
|
|
65
67
|
this.$emit('categoryChanged', name)
|
|
66
68
|
},
|
|
67
69
|
},
|
|
68
70
|
watch: {
|
|
69
|
-
|
|
71
|
+
items: {
|
|
70
72
|
deep: true,
|
|
71
73
|
immediate: true,
|
|
72
74
|
handler: function () {
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
this.categories = {}
|
|
76
|
+
this.active = "All"
|
|
77
|
+
if (this.displayDataset) {
|
|
78
|
+
this.categories.All = { size: 1 }
|
|
79
|
+
this.categories.Dataset = { size: 1 }
|
|
80
|
+
} else {
|
|
81
|
+
this.categories.All = { size: 0 }
|
|
82
|
+
}
|
|
83
|
+
let keys = ['Flatmaps', 'Plots', 'Scaffolds', 'Simulations']
|
|
84
|
+
keys.forEach(key => this.addToCategories(key))
|
|
77
85
|
/** disable the following
|
|
78
86
|
this.addToCategories(this.entry.images, 'Images');
|
|
79
87
|
this.addToCategories(this.entry.videos, 'Videos');
|
|
@@ -12,6 +12,21 @@
|
|
|
12
12
|
@click="toggleTitleExpansion"
|
|
13
13
|
>
|
|
14
14
|
<span>{{ capitalise(displayTitle) }}</span>
|
|
15
|
+
<template v-if="entry.featuresAlert">
|
|
16
|
+
<el-popover
|
|
17
|
+
width="250"
|
|
18
|
+
trigger="hover"
|
|
19
|
+
:teleported="false"
|
|
20
|
+
popper-class="popover-origin-help"
|
|
21
|
+
>
|
|
22
|
+
<template #reference>
|
|
23
|
+
<el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
|
|
24
|
+
</template>
|
|
25
|
+
<span style="word-break: keep-all">
|
|
26
|
+
{{ entry.featuresAlert }}
|
|
27
|
+
</span>
|
|
28
|
+
</el-popover>
|
|
29
|
+
</template>
|
|
15
30
|
</div>
|
|
16
31
|
<button
|
|
17
32
|
v-if="showTitleToggle"
|
|
@@ -26,19 +41,7 @@
|
|
|
26
41
|
</el-icon>
|
|
27
42
|
</button>
|
|
28
43
|
</div>
|
|
29
|
-
<div class="subtitle">
|
|
30
|
-
<strong>Id: </strong>{{ entry.featureId[0] }}
|
|
31
|
-
<el-button
|
|
32
|
-
round
|
|
33
|
-
size="small"
|
|
34
|
-
class="alert-chip"
|
|
35
|
-
@click="showAlertMessage"
|
|
36
|
-
v-if="entry.featuresAlert"
|
|
37
|
-
>
|
|
38
|
-
<el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
|
|
39
|
-
Notes
|
|
40
|
-
</el-button>
|
|
41
|
-
</div>
|
|
44
|
+
<div class="subtitle"><strong>Id: </strong>{{ entry.featureId[0] }}</div>
|
|
42
45
|
<div v-if="hasProvenanceTaxonomyLabel" class="subtitle">
|
|
43
46
|
{{ provSpeciesDescription }}
|
|
44
47
|
</div>
|
|
@@ -287,22 +290,6 @@
|
|
|
287
290
|
@trackEvent="onTrackEvent"
|
|
288
291
|
/>
|
|
289
292
|
</div>
|
|
290
|
-
|
|
291
|
-
<div
|
|
292
|
-
ref="alertElement"
|
|
293
|
-
class="content-container content-container-alert"
|
|
294
|
-
v-if="entry.featuresAlert"
|
|
295
|
-
>
|
|
296
|
-
<div class="block attribute-title-container">
|
|
297
|
-
<span class="attribute-title">Alert</span>
|
|
298
|
-
</div>
|
|
299
|
-
<div class="block">
|
|
300
|
-
<div class="alert-block"
|
|
301
|
-
v-for="alert in entry.featuresAlert"
|
|
302
|
-
v-html="formatAlertText(alert)"
|
|
303
|
-
></div>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
293
|
</div>
|
|
307
294
|
</template>
|
|
308
295
|
|
|
@@ -604,6 +591,7 @@ export default {
|
|
|
604
591
|
...this.destinationsWithDatasets,
|
|
605
592
|
...this.originsWithDatasets,
|
|
606
593
|
],
|
|
594
|
+
connectivityInfo: this.entry,
|
|
607
595
|
};
|
|
608
596
|
EventBus.emit('show-connectivity-graph', payload);
|
|
609
597
|
},
|
|
@@ -797,14 +785,6 @@ export default {
|
|
|
797
785
|
contentArray.push(contentString);
|
|
798
786
|
}
|
|
799
787
|
|
|
800
|
-
// Alert
|
|
801
|
-
if (this.entry.featuresAlert) {
|
|
802
|
-
const alertContent = this.entry.featuresAlert
|
|
803
|
-
.map((alert) => this.formatAlertText(alert))
|
|
804
|
-
.join('\n');
|
|
805
|
-
contentArray.push(`<div><strong>Alert</strong></div>\n${alertContent}`);
|
|
806
|
-
}
|
|
807
|
-
|
|
808
788
|
return contentArray.join('\n\n<br>');
|
|
809
789
|
},
|
|
810
790
|
getConnectivityDatasets: function (label) {
|
|
@@ -931,51 +911,6 @@ export default {
|
|
|
931
911
|
onTrackEvent: function (data) {
|
|
932
912
|
EventBus.emit('trackEvent', data);
|
|
933
913
|
},
|
|
934
|
-
showAlertMessage: function () {
|
|
935
|
-
// scroll to alert message
|
|
936
|
-
this.$nextTick(() => {
|
|
937
|
-
const alertElement = this.$refs.alertElement;
|
|
938
|
-
if (alertElement) {
|
|
939
|
-
alertElement.scrollIntoView({
|
|
940
|
-
behavior: 'smooth',
|
|
941
|
-
block: 'start',
|
|
942
|
-
inline: 'nearest',
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
},
|
|
947
|
-
formatAlertText: function (text) {
|
|
948
|
-
if (!text) return '';
|
|
949
|
-
const escaped = text
|
|
950
|
-
.replace(/&/g, '&')
|
|
951
|
-
.replace(/</g, '<')
|
|
952
|
-
.replace(/>/g, '>');
|
|
953
|
-
const linkified = escaped.replace(
|
|
954
|
-
/(https?:\/\/[^\s"<>\[]+)/g,
|
|
955
|
-
(url) => {
|
|
956
|
-
const parts = url.match(/^(.*?)([\].,;:!?]*)$/);
|
|
957
|
-
const cleanUrl = parts ? parts[1] : url;
|
|
958
|
-
const suffix = parts ? parts[2] : '';
|
|
959
|
-
return `<a href="${cleanUrl}" target="_blank" rel="noopener noreferrer">${cleanUrl}</a>${suffix}`;
|
|
960
|
-
}
|
|
961
|
-
);
|
|
962
|
-
|
|
963
|
-
const normalised = linkified
|
|
964
|
-
.replace(/\\n/g, '\n')
|
|
965
|
-
.replace(/\r\n/g, '\n')
|
|
966
|
-
.replace(/\r/g, '\n');
|
|
967
|
-
|
|
968
|
-
return normalised
|
|
969
|
-
.split('\n')
|
|
970
|
-
.map((line) => {
|
|
971
|
-
const withBoldLabel = line.replace(
|
|
972
|
-
/^\s*([A-Za-z][^:<]{0,120}:)/,
|
|
973
|
-
'<strong>$1</strong>'
|
|
974
|
-
);
|
|
975
|
-
return `<div class="alert-line">${withBoldLabel}</div>`;
|
|
976
|
-
})
|
|
977
|
-
.join('\n');
|
|
978
|
-
},
|
|
979
914
|
},
|
|
980
915
|
mounted: function () {
|
|
981
916
|
this.updatedCopyContent = this.getUpdateCopyContent();
|
|
@@ -1154,6 +1089,15 @@ export default {
|
|
|
1154
1089
|
text-transform: uppercase;
|
|
1155
1090
|
}
|
|
1156
1091
|
|
|
1092
|
+
.main {
|
|
1093
|
+
.el-button.is-round {
|
|
1094
|
+
border-radius: 4px;
|
|
1095
|
+
padding: 9px 20px 10px 20px;
|
|
1096
|
+
display: flex;
|
|
1097
|
+
height: 36px;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1157
1101
|
.button {
|
|
1158
1102
|
margin-left: 0px !important;
|
|
1159
1103
|
margin-top: 0px !important;
|
|
@@ -1476,6 +1420,10 @@ export default {
|
|
|
1476
1420
|
|
|
1477
1421
|
.content-container-connectivity {
|
|
1478
1422
|
position: relative;
|
|
1423
|
+
|
|
1424
|
+
&:not([style*="display: none"]) ~ .content-container-references {
|
|
1425
|
+
margin-top: -1.25rem;
|
|
1426
|
+
}
|
|
1479
1427
|
}
|
|
1480
1428
|
|
|
1481
1429
|
.attribute-content {
|
|
@@ -1519,48 +1467,4 @@ export default {
|
|
|
1519
1467
|
margin-bottom: 0.5em;
|
|
1520
1468
|
}
|
|
1521
1469
|
}
|
|
1522
|
-
|
|
1523
|
-
.alert-block {
|
|
1524
|
-
background-color: var(--el-color-warning-light-9);
|
|
1525
|
-
border: 1px dashed var(--el-color-warning);
|
|
1526
|
-
padding: 0.75rem;
|
|
1527
|
-
border-radius: 4px;
|
|
1528
|
-
|
|
1529
|
-
:deep(.alert-line + .alert-line) {
|
|
1530
|
-
margin-top: 0.5rem;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
:deep(a) {
|
|
1534
|
-
color: $app-primary-color;
|
|
1535
|
-
word-break: break-all;
|
|
1536
|
-
|
|
1537
|
-
&:hover {
|
|
1538
|
-
opacity: 0.8;
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
.alert-chip {
|
|
1544
|
-
margin-left: 5px;
|
|
1545
|
-
background-color: $app-primary-color;
|
|
1546
|
-
border-color: $app-primary-color;
|
|
1547
|
-
color: #fff;
|
|
1548
|
-
|
|
1549
|
-
&:hover {
|
|
1550
|
-
color: #fff !important;
|
|
1551
|
-
background-color: #ac76c5 !important;
|
|
1552
|
-
border: 1px solid #ac76c5 !important;
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
:deep(> span) {
|
|
1556
|
-
gap: 2px;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
.alert {
|
|
1560
|
-
width: 1rem;
|
|
1561
|
-
height: 1rem;
|
|
1562
|
-
color: inherit;
|
|
1563
|
-
margin: 0;
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
1470
|
</style>
|
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
<span class="card-left">
|
|
7
7
|
<ImageGallery
|
|
8
8
|
v-if="!loading && discoverId"
|
|
9
|
-
:
|
|
10
|
-
:datasetVersion="version"
|
|
11
|
-
:entry="entry"
|
|
12
|
-
:envVars="envVars"
|
|
13
|
-
:label="label"
|
|
14
|
-
:datasetThumbnail="thumbnail"
|
|
9
|
+
:items="items"
|
|
15
10
|
:category="currentCategory"
|
|
16
11
|
@card-clicked="galleryClicked"
|
|
17
12
|
@datalink-clicked="galleryDatalinkClicked"
|
|
@@ -40,7 +35,7 @@
|
|
|
40
35
|
</div>
|
|
41
36
|
<div class="badges-container">
|
|
42
37
|
<BadgesGroup
|
|
43
|
-
:
|
|
38
|
+
:items="items"
|
|
44
39
|
@categoryChanged="categoryChanged"
|
|
45
40
|
/>
|
|
46
41
|
</div>
|
|
@@ -56,6 +51,15 @@
|
|
|
56
51
|
</template>
|
|
57
52
|
|
|
58
53
|
<script>
|
|
54
|
+
/* eslint-disable no-alert, no-console */
|
|
55
|
+
const baseName = (str) => {
|
|
56
|
+
return str.split('\\').pop().split('/').pop()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const capitalise = function (string) {
|
|
60
|
+
return string.replace(/\b\w/g, (v) => v.toUpperCase())
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
/* eslint-disable no-alert, no-console */
|
|
60
64
|
import { View as ElIconView } from '@element-plus/icons-vue'
|
|
61
65
|
import BadgesGroup from './BadgesGroup.vue'
|
|
@@ -68,7 +72,9 @@ import speciesMap from './species-map.js'
|
|
|
68
72
|
import ImageGallery from './ImageGallery.vue'
|
|
69
73
|
import MissingImage from '@/../assets/missing-image.svg'
|
|
70
74
|
import { CopyToClipboard } from '@abi-software/map-utilities';
|
|
75
|
+
import S3Bucket from '../mixins/S3Bucket.vue';
|
|
71
76
|
import '@abi-software/map-utilities/dist/style.css';
|
|
77
|
+
import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js'
|
|
72
78
|
|
|
73
79
|
export default {
|
|
74
80
|
data() {
|
|
@@ -84,6 +90,7 @@ export default {
|
|
|
84
90
|
Icon,
|
|
85
91
|
CopyToClipboard,
|
|
86
92
|
},
|
|
93
|
+
mixins: [GalleryHelper, S3Bucket],
|
|
87
94
|
props: {
|
|
88
95
|
/**
|
|
89
96
|
* Object containing information for
|
|
@@ -103,6 +110,15 @@ export default {
|
|
|
103
110
|
thumbnail: MissingImage,
|
|
104
111
|
dataLocation: this.entry.doi,
|
|
105
112
|
discoverId: undefined,
|
|
113
|
+
items: {
|
|
114
|
+
Dataset: [],
|
|
115
|
+
Flatmaps:[],
|
|
116
|
+
Images: [],
|
|
117
|
+
Scaffolds: [],
|
|
118
|
+
Simulations: [],
|
|
119
|
+
Videos: [],
|
|
120
|
+
Plots: [],
|
|
121
|
+
},
|
|
106
122
|
loading: true,
|
|
107
123
|
version: 1,
|
|
108
124
|
lastDoi: undefined,
|
|
@@ -170,12 +186,318 @@ export default {
|
|
|
170
186
|
categoryChanged: function (name) {
|
|
171
187
|
this.currentCategory = name
|
|
172
188
|
},
|
|
189
|
+
createSciCurnchItems: function () {
|
|
190
|
+
if (this.entry.detailsReady) {
|
|
191
|
+
this.updateS3Bucket(this.entry.s3uri)
|
|
192
|
+
this.createDatasetItem()
|
|
193
|
+
this.createFlatmapItems()
|
|
194
|
+
this.createScaffoldItems()
|
|
195
|
+
this.createSimulationItems()
|
|
196
|
+
this.createPlotItems()
|
|
197
|
+
}
|
|
198
|
+
/* Disable these two
|
|
199
|
+
this.createImageItems();
|
|
200
|
+
this.createVideoItems();
|
|
201
|
+
*/
|
|
202
|
+
},
|
|
203
|
+
createDatasetItem: function () {
|
|
204
|
+
const link = `${this.envVars.ROOT_URL}/datasets/${this.discoverId}?type=dataset`
|
|
205
|
+
if (this.thumbnail) {
|
|
206
|
+
this.items['Dataset'].push({
|
|
207
|
+
id: -1,
|
|
208
|
+
//Work around gallery requires a truthy string
|
|
209
|
+
title: ' ',
|
|
210
|
+
type: `Dataset ${this.discoverId}`,
|
|
211
|
+
thumbnail: this.thumbnail,
|
|
212
|
+
link,
|
|
213
|
+
hideType: true,
|
|
214
|
+
hideTitle: true,
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
createFlatmapItems: function () {
|
|
219
|
+
if (this.entry.flatmaps) {
|
|
220
|
+
this.entry.flatmaps.forEach((flatmap) => {
|
|
221
|
+
if (flatmap.associated_flatmap?.identifier) {
|
|
222
|
+
const filePath = flatmap.dataset.path
|
|
223
|
+
const id = flatmap.identifier
|
|
224
|
+
const thumbnail = this.getThumbnailForPlot(
|
|
225
|
+
flatmap,
|
|
226
|
+
this.entry.thumbnails
|
|
227
|
+
)
|
|
228
|
+
let thumbnailURL = undefined
|
|
229
|
+
let mimetype = ''
|
|
230
|
+
if (thumbnail) {
|
|
231
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
232
|
+
id,
|
|
233
|
+
prefix: this.getS3Prefix(),
|
|
234
|
+
file_path: thumbnail.dataset.path,
|
|
235
|
+
s3Bucket: this.s3Bucket,
|
|
236
|
+
})
|
|
237
|
+
mimetype = thumbnail.mimetype.name
|
|
238
|
+
}
|
|
239
|
+
let action = {
|
|
240
|
+
label: baseName(filePath),
|
|
241
|
+
resource: flatmap.associated_flatmap.identifier,
|
|
242
|
+
title: 'View Flatmap',
|
|
243
|
+
type: 'Flatmap',
|
|
244
|
+
discoverId: this.discoverId,
|
|
245
|
+
version: this.version,
|
|
246
|
+
}
|
|
247
|
+
this.items['Flatmaps'].push({
|
|
248
|
+
id,
|
|
249
|
+
title: baseName(filePath),
|
|
250
|
+
type: 'Flatmap',
|
|
251
|
+
thumbnail: thumbnailURL,
|
|
252
|
+
userData: action,
|
|
253
|
+
hideType: true,
|
|
254
|
+
mimetype,
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
createImageItems: function () {
|
|
261
|
+
if (this.entry.images) {
|
|
262
|
+
this.entry.images.forEach((image) => {
|
|
263
|
+
const filePath = image.dataset.path
|
|
264
|
+
const id = image.identifier
|
|
265
|
+
const linkUrl = `${this.envVars.ROOT_URL}/datasets/imageviewer?dataset_id=${this.discoverId}&dataset_version=${this.version}&file_path=${filePath}&mimetype=${image.mimetype.name}`
|
|
266
|
+
this.items['Images'].push({
|
|
267
|
+
id,
|
|
268
|
+
title: baseName(filePath),
|
|
269
|
+
type: 'Image',
|
|
270
|
+
link: linkUrl,
|
|
271
|
+
hideType: true,
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
createPlotItems: function () {
|
|
277
|
+
if (this.entry.plots) {
|
|
278
|
+
this.entry.plots.forEach((plot) => {
|
|
279
|
+
const filePath = plot.dataset.path
|
|
280
|
+
const id = plot.identifier
|
|
281
|
+
const thumbnail = this.getThumbnailForPlot(
|
|
282
|
+
plot,
|
|
283
|
+
this.entry.thumbnails
|
|
284
|
+
)
|
|
285
|
+
let thumbnailURL = undefined
|
|
286
|
+
let mimetype = ''
|
|
287
|
+
if (thumbnail) {
|
|
288
|
+
|
|
289
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
290
|
+
id,
|
|
291
|
+
prefix: this.getS3Prefix(),
|
|
292
|
+
file_path: thumbnail.dataset.path,
|
|
293
|
+
s3Bucket: this.s3Bucket,
|
|
294
|
+
})
|
|
295
|
+
mimetype = thumbnail.mimetype.name
|
|
296
|
+
}
|
|
297
|
+
const plotAnnotation = plot.datacite;
|
|
298
|
+
const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.getS3Prefix()}files/`;
|
|
299
|
+
const sourceUrl = filePathPrefix + plot.dataset.path + this.getS3Args();
|
|
300
|
+
|
|
301
|
+
//plotAnnotation.supplemental_json_metadata.description can be undefined or
|
|
302
|
+
//contain an empty string causing an error with JSON.parse
|
|
303
|
+
let metadata = {}
|
|
304
|
+
try {
|
|
305
|
+
metadata = JSON.parse(
|
|
306
|
+
plotAnnotation.supplemental_json_metadata.description
|
|
307
|
+
)
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.warn(error)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let supplementalData = []
|
|
313
|
+
if (plotAnnotation.isDescribedBy) {
|
|
314
|
+
supplementalData.push({
|
|
315
|
+
url: filePathPrefix + plotAnnotation.isDescribedBy.path,
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const resource = {
|
|
320
|
+
dataSource: { url: sourceUrl },
|
|
321
|
+
metadata,
|
|
322
|
+
supplementalData,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
let action = {
|
|
326
|
+
label: baseName(filePath),
|
|
327
|
+
resource: resource,
|
|
328
|
+
s3uri: this.entry.s3uri,
|
|
329
|
+
title: 'View plot',
|
|
330
|
+
type: 'Plot',
|
|
331
|
+
discoverId: this.discoverId,
|
|
332
|
+
version: this.version,
|
|
333
|
+
}
|
|
334
|
+
this.items['Plots'].push({
|
|
335
|
+
id,
|
|
336
|
+
title: baseName(filePath),
|
|
337
|
+
type: 'Plot',
|
|
338
|
+
thumbnail: thumbnailURL,
|
|
339
|
+
userData: action,
|
|
340
|
+
hideType: true,
|
|
341
|
+
mimetype,
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
createScaffoldItems: function () {
|
|
347
|
+
if (this.entry.scaffolds) {
|
|
348
|
+
let index = 0
|
|
349
|
+
this.entry.scaffolds.forEach((scaffold, i) => {
|
|
350
|
+
const filePath = scaffold.dataset.path
|
|
351
|
+
const id = scaffold.identifier
|
|
352
|
+
const thumbnail = this.getThumbnailForScaffold(
|
|
353
|
+
scaffold,
|
|
354
|
+
this.entry.scaffoldViews,
|
|
355
|
+
this.entry.thumbnails,
|
|
356
|
+
index
|
|
357
|
+
)
|
|
358
|
+
let mimetype = ''
|
|
359
|
+
let thumbnailURL = undefined
|
|
360
|
+
if (thumbnail) {
|
|
361
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
362
|
+
id,
|
|
363
|
+
prefix: this.getS3Prefix(),
|
|
364
|
+
file_path: thumbnail.dataset.path,
|
|
365
|
+
s3Bucket: this.s3Bucket,
|
|
366
|
+
})
|
|
367
|
+
mimetype = thumbnail.mimetype.name
|
|
368
|
+
}
|
|
369
|
+
let action = {
|
|
370
|
+
label: baseName(filePath),
|
|
371
|
+
resource: `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`,
|
|
372
|
+
title: "View 3D scaffold",
|
|
373
|
+
type: "Scaffold",
|
|
374
|
+
discoverId: this.discoverId,
|
|
375
|
+
apiLocation: this.envVars.API_LOCATION,
|
|
376
|
+
version: this.version,
|
|
377
|
+
banner: this.thumbnail,
|
|
378
|
+
s3uri: this.entry.s3uri,
|
|
379
|
+
contextCardUrl: this.getContextCardUrl(i),
|
|
380
|
+
}
|
|
381
|
+
this.items['Scaffolds'].push({
|
|
382
|
+
id,
|
|
383
|
+
title: baseName(filePath),
|
|
384
|
+
type: 'Scaffold',
|
|
385
|
+
thumbnail: thumbnailURL,
|
|
386
|
+
userData: action,
|
|
387
|
+
hideType: true,
|
|
388
|
+
mimetype,
|
|
389
|
+
})
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
createSimulationItems: function () {
|
|
394
|
+
if (this.entry.simulation) {
|
|
395
|
+
this.entry.simulation.forEach((simulation) => {
|
|
396
|
+
if (simulation.additional_mimetype.name === "application/x.vnd.abi.simulation+json") {
|
|
397
|
+
let action = {
|
|
398
|
+
label: undefined,
|
|
399
|
+
apiLocation: this.envVars.API_LOCATION,
|
|
400
|
+
s3uri: this.entry.s3uri,
|
|
401
|
+
version: this.version,
|
|
402
|
+
title: 'View simulation',
|
|
403
|
+
type: 'Simulation',
|
|
404
|
+
name: this.entry.name,
|
|
405
|
+
description: this.entry.description,
|
|
406
|
+
discoverId: this.discoverId,
|
|
407
|
+
dataset: `${this.envVars.ROOT_URL}/datasets/${this.discoverId}?type=dataset`,
|
|
408
|
+
}
|
|
409
|
+
this.items['Simulations'].push({
|
|
410
|
+
id: 'simulation',
|
|
411
|
+
title: ' ',
|
|
412
|
+
type: 'Simulation',
|
|
413
|
+
hideType: true,
|
|
414
|
+
hideTitle: true,
|
|
415
|
+
userData: action,
|
|
416
|
+
})
|
|
417
|
+
} else {
|
|
418
|
+
const filePath = simulation.dataset.path
|
|
419
|
+
const id = simulation.identifier
|
|
420
|
+
//Despite of the name, this method can be used to retreive
|
|
421
|
+
//the thumbnail information for any none scaffold type thumbnail
|
|
422
|
+
const thumbnail = this.getThumbnailForPlot(
|
|
423
|
+
simulation,
|
|
424
|
+
this.entry.thumbnails
|
|
425
|
+
)
|
|
426
|
+
let thumbnailURL = undefined
|
|
427
|
+
let mimetype = ''
|
|
428
|
+
if (thumbnail) {
|
|
429
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
430
|
+
id,
|
|
431
|
+
prefix: this.getS3Prefix(),
|
|
432
|
+
file_path: thumbnail.dataset.path,
|
|
433
|
+
s3Bucket: this.s3Bucket,
|
|
434
|
+
})
|
|
435
|
+
mimetype = thumbnail.mimetype.name
|
|
436
|
+
}
|
|
437
|
+
const resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`
|
|
438
|
+
let action = {
|
|
439
|
+
label: baseName(filePath),
|
|
440
|
+
resource: resource,
|
|
441
|
+
s3uri: this.entry.s3uri,
|
|
442
|
+
title: 'View simulation',
|
|
443
|
+
type: 'Simulation',
|
|
444
|
+
discoverId: this.discoverId,
|
|
445
|
+
version: this.version,
|
|
446
|
+
}
|
|
447
|
+
this.items['Simulations'].push({
|
|
448
|
+
id,
|
|
449
|
+
title: baseName(filePath),
|
|
450
|
+
type: 'Simulation',
|
|
451
|
+
thumbnail: thumbnailURL,
|
|
452
|
+
userData: action,
|
|
453
|
+
hideType: true,
|
|
454
|
+
mimetype,
|
|
455
|
+
})
|
|
456
|
+
}
|
|
457
|
+
})
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
createVideoItems: function () {
|
|
461
|
+
if (this.entry.videos) {
|
|
462
|
+
this.entry.videos.forEach((video) => {
|
|
463
|
+
const filePath = this.getS3FilePath(
|
|
464
|
+
this.discoverId,
|
|
465
|
+
this.version,
|
|
466
|
+
video.dataset.path
|
|
467
|
+
)
|
|
468
|
+
const linkUrl = `${this.envVars.ROOT_URL}/datasets/videoviewer?dataset_version=${this.version}&dataset_id=${this.discoverId}&file_path=${filePath}&mimetype=${video.mimetype.name}`
|
|
469
|
+
this.items['Videos'].push({
|
|
470
|
+
title: video.name,
|
|
471
|
+
type: 'Video',
|
|
472
|
+
thumbnail: this.defaultVideoImg,
|
|
473
|
+
hideType: true,
|
|
474
|
+
link: linkUrl,
|
|
475
|
+
})
|
|
476
|
+
})
|
|
477
|
+
}
|
|
478
|
+
},
|
|
173
479
|
galleryClicked: function (payload) {
|
|
174
480
|
this.propogateCardAction(payload)
|
|
175
481
|
},
|
|
176
482
|
galleryDatalinkClicked: function (payload) {
|
|
177
483
|
EventBus.emit('datalink-clicked', payload); // Pass to mapintegratedvuer
|
|
178
484
|
},
|
|
485
|
+
getContextCardUrl: function(scaffoldIndex){
|
|
486
|
+
if(!this.entry.contextualInformation || this.entry.contextualInformation.length == 0){
|
|
487
|
+
return undefined
|
|
488
|
+
} else {
|
|
489
|
+
// 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.
|
|
490
|
+
let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
|
|
491
|
+
return `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${this.entry.contextualInformation[contextIndex]}${this.getS3Args()}`
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
getImageURL: function(apiEndpoint, info) {
|
|
495
|
+
let url = `${apiEndpoint}/s3-resource/${info.prefix}files/${info.file_path}?encodeBase64=true`
|
|
496
|
+
if (info.s3Bucket) {
|
|
497
|
+
url = url + `&s3BucketName=${info.s3Bucket}`
|
|
498
|
+
}
|
|
499
|
+
return url
|
|
500
|
+
},
|
|
179
501
|
openDataset: function () {
|
|
180
502
|
window.open(this.dataLocation, '_blank')
|
|
181
503
|
},
|
|
@@ -242,6 +564,9 @@ export default {
|
|
|
242
564
|
this.discoverId = Number(this.entry.datasetId)
|
|
243
565
|
this.loading = false
|
|
244
566
|
})
|
|
567
|
+
.finally(() => {
|
|
568
|
+
this.createSciCurnchItems()
|
|
569
|
+
})
|
|
245
570
|
}
|
|
246
571
|
},
|
|
247
572
|
lastName: function (fullName) {
|