@abi-software/map-side-bar 2.2.0 → 2.2.1-alpha-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/.eslintrc.js +12 -12
- package/.postcssrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +168 -168
- package/dist/map-side-bar.js +6982 -7170
- package/dist/map-side-bar.umd.cjs +50 -103
- package/dist/style.css +1 -1
- package/package.json +72 -72
- package/src/App.vue +233 -233
- package/src/algolia/algolia.js +242 -211
- package/src/algolia/utils.js +101 -101
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +6 -6
- package/src/components/BadgesGroup.vue +124 -124
- package/src/components/DatasetCard.vue +356 -356
- package/src/components/EventBus.js +3 -3
- package/src/components/ImageGallery.vue +542 -542
- package/src/components/SearchFilters.vue +1000 -1000
- package/src/components/SearchHistory.vue +175 -175
- package/src/components/SideBar.vue +347 -338
- package/src/components/SidebarContent.vue +576 -576
- package/src/components/Tabs.vue +78 -78
- package/src/components/index.js +8 -8
- package/src/components/species-map.js +8 -8
- package/src/main.js +9 -9
- package/src/mixins/S3Bucket.vue +37 -37
- package/static.json +6 -6
- package/vite.config.js +55 -55
- package/vuese-generator.js +65 -65
|
@@ -1,356 +1,356 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dataset-card-container" ref="container">
|
|
3
|
-
<div class="dataset-card" ref="card">
|
|
4
|
-
<div class="seperator-path"></div>
|
|
5
|
-
<div v-loading="loading" class="card">
|
|
6
|
-
<span class="card-left">
|
|
7
|
-
<ImageGallery
|
|
8
|
-
v-if="!loading && discoverId"
|
|
9
|
-
:datasetId="discoverId"
|
|
10
|
-
:datasetVersion="version"
|
|
11
|
-
:entry="entry"
|
|
12
|
-
:envVars="envVars"
|
|
13
|
-
:label="label"
|
|
14
|
-
:datasetThumbnail="thumbnail"
|
|
15
|
-
:dataset-biolucida="biolucidaData"
|
|
16
|
-
:category="currentCategory"
|
|
17
|
-
@card-clicked="galleryClicked"
|
|
18
|
-
@datalink-clicked="galleryDatalinkClicked"
|
|
19
|
-
/>
|
|
20
|
-
</span>
|
|
21
|
-
<div class="card-right">
|
|
22
|
-
<div class="title" @click="cardClicked">{{ entry.name }}</div>
|
|
23
|
-
<div class="details">
|
|
24
|
-
{{ contributors }} {{ entry.publishDate ? `(${publishYear})` : '' }}
|
|
25
|
-
</div>
|
|
26
|
-
<div class="details">{{ samples }}</div>
|
|
27
|
-
<div
|
|
28
|
-
v-if="!entry.detailsReady"
|
|
29
|
-
class="details loading-icon"
|
|
30
|
-
v-loading="!entry.detailsReady"
|
|
31
|
-
></div>
|
|
32
|
-
<div>
|
|
33
|
-
<el-button
|
|
34
|
-
v-if="entry.simulation"
|
|
35
|
-
@click="openRepository"
|
|
36
|
-
size="small"
|
|
37
|
-
class="button"
|
|
38
|
-
:icon="ElIconView"
|
|
39
|
-
>View repository</el-button
|
|
40
|
-
>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="badges-container">
|
|
43
|
-
<BadgesGroup
|
|
44
|
-
:entry="entry"
|
|
45
|
-
:dataset-biolucida="biolucidaData"
|
|
46
|
-
@categoryChanged="categoryChanged"
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script>
|
|
56
|
-
/* eslint-disable no-alert, no-console */
|
|
57
|
-
import { View as ElIconView } from '@element-plus/icons-vue'
|
|
58
|
-
import BadgesGroup from './BadgesGroup.vue'
|
|
59
|
-
import {
|
|
60
|
-
ElButton as Button,
|
|
61
|
-
ElIcon as Icon
|
|
62
|
-
} from 'element-plus'
|
|
63
|
-
import EventBus from './EventBus.js'
|
|
64
|
-
import speciesMap from './species-map.js'
|
|
65
|
-
import ImageGallery from './ImageGallery.vue'
|
|
66
|
-
import MissingImage from '@/../assets/missing-image.svg'
|
|
67
|
-
|
|
68
|
-
export default {
|
|
69
|
-
data() {
|
|
70
|
-
return {
|
|
71
|
-
ElIconView,
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
name: 'DatasetCard',
|
|
75
|
-
components: {
|
|
76
|
-
BadgesGroup,
|
|
77
|
-
ImageGallery,
|
|
78
|
-
Button,
|
|
79
|
-
Icon
|
|
80
|
-
},
|
|
81
|
-
props: {
|
|
82
|
-
/**
|
|
83
|
-
* Object containing information for
|
|
84
|
-
* the required viewing.
|
|
85
|
-
*/
|
|
86
|
-
entry: {
|
|
87
|
-
type: Object,
|
|
88
|
-
default: () => {},
|
|
89
|
-
},
|
|
90
|
-
envVars: {
|
|
91
|
-
type: Object,
|
|
92
|
-
default: () => {},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
data: function () {
|
|
96
|
-
return {
|
|
97
|
-
thumbnail: MissingImage,
|
|
98
|
-
dataLocation: this.entry.doi,
|
|
99
|
-
discoverId: undefined,
|
|
100
|
-
loading: true,
|
|
101
|
-
version: 1,
|
|
102
|
-
lastDoi: undefined,
|
|
103
|
-
biolucidaData: undefined,
|
|
104
|
-
currentCategory: 'All',
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
computed: {
|
|
108
|
-
contributors: function () {
|
|
109
|
-
let text = ''
|
|
110
|
-
if (this.entry.contributors) {
|
|
111
|
-
if (this.entry.contributors.length === 1) {
|
|
112
|
-
text = this.lastName(this.entry.contributors[0].name)
|
|
113
|
-
} else if (this.entry.contributors.length === 2) {
|
|
114
|
-
text =
|
|
115
|
-
this.lastName(this.entry.contributors[0].name) +
|
|
116
|
-
' & ' +
|
|
117
|
-
this.lastName(this.entry.contributors[1].name)
|
|
118
|
-
} else if (this.entry.contributors.length > 2) {
|
|
119
|
-
text = this.lastName(this.entry.contributors[0].name) + ' et al.'
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return text
|
|
123
|
-
},
|
|
124
|
-
samples: function () {
|
|
125
|
-
let text = ''
|
|
126
|
-
if (this.entry.species) {
|
|
127
|
-
if (speciesMap[this.entry.species[0].toLowerCase()]) {
|
|
128
|
-
text = `${speciesMap[this.entry.species[0].toLowerCase()]}`
|
|
129
|
-
} else {
|
|
130
|
-
text = `${this.entry.species}`
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (this.entry.numberSamples > 0) {
|
|
134
|
-
text += ' ('
|
|
135
|
-
if (this.entry.numberSamples === 1) {
|
|
136
|
-
text += `${this.entry.numberSamples} sample`
|
|
137
|
-
} else if (this.entry.numberSamples > 1) {
|
|
138
|
-
text += `${this.entry.numberSamples} samples`
|
|
139
|
-
}
|
|
140
|
-
if (this.entry.numberSubjects === 1) {
|
|
141
|
-
text += ` from ${this.entry.numberSubjects} subject`
|
|
142
|
-
} else if (this.entry.numberSamples > 1) {
|
|
143
|
-
text += ` from ${this.entry.numberSubjects} subjects`
|
|
144
|
-
}
|
|
145
|
-
text += ')'
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return text
|
|
149
|
-
},
|
|
150
|
-
label: function () {
|
|
151
|
-
return this.entry.organs ? this.entry.organs[0] : this.entry.name
|
|
152
|
-
},
|
|
153
|
-
publishYear: function () {
|
|
154
|
-
return this.entry.publishDate.split('-')[0]
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
methods: {
|
|
158
|
-
cardClicked: function () {
|
|
159
|
-
this.openDataset()
|
|
160
|
-
},
|
|
161
|
-
categoryChanged: function (name) {
|
|
162
|
-
this.currentCategory = name
|
|
163
|
-
},
|
|
164
|
-
galleryClicked: function (payload) {
|
|
165
|
-
this.propogateCardAction(payload)
|
|
166
|
-
},
|
|
167
|
-
galleryDatalinkClicked: function (payload) {
|
|
168
|
-
EventBus.emit('datalink-clicked', payload); // Pass to mapintegratedvuer
|
|
169
|
-
},
|
|
170
|
-
openDataset: function () {
|
|
171
|
-
window.open(this.dataLocation, '_blank')
|
|
172
|
-
},
|
|
173
|
-
openRepository: function () {
|
|
174
|
-
let apiLocation = this.envVars.API_LOCATION
|
|
175
|
-
this.entry.additionalLinks.forEach(function (el) {
|
|
176
|
-
if (el.description == 'Repository') {
|
|
177
|
-
let xmlhttp = new XMLHttpRequest()
|
|
178
|
-
xmlhttp.open('POST', apiLocation + '/pmr_latest_exposure', true)
|
|
179
|
-
xmlhttp.setRequestHeader('Content-type', 'application/json')
|
|
180
|
-
xmlhttp.onreadystatechange = () => {
|
|
181
|
-
if (xmlhttp.readyState === 4) {
|
|
182
|
-
let url = ''
|
|
183
|
-
if (xmlhttp.status === 200) {
|
|
184
|
-
url = JSON.parse(xmlhttp.responseText)['url']
|
|
185
|
-
}
|
|
186
|
-
if (url === '') {
|
|
187
|
-
url = el.uri
|
|
188
|
-
}
|
|
189
|
-
window.open(url, '_blank')
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
xmlhttp.send(JSON.stringify({ workspace_url: el.uri }))
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
},
|
|
196
|
-
propogateCardAction: function (action) {
|
|
197
|
-
EventBus.emit('PopoverActionClick', action)
|
|
198
|
-
EventBus.emit('contextUpdate', action) // Pass to mapintegratedvuer
|
|
199
|
-
},
|
|
200
|
-
splitDOI: function (doi) {
|
|
201
|
-
return [
|
|
202
|
-
doi.split('/')[doi.split('/').length - 2],
|
|
203
|
-
doi.split('/')[doi.split('/').length - 1],
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
getBanner: function () {
|
|
207
|
-
// Only load banner if card has changed
|
|
208
|
-
if (this.lastDoi !== this.entry.doi) {
|
|
209
|
-
this.lastDoi = this.entry.doi
|
|
210
|
-
this.loading = true
|
|
211
|
-
let doi = this.splitDOI(this.entry.doi)
|
|
212
|
-
fetch(
|
|
213
|
-
`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`
|
|
214
|
-
)
|
|
215
|
-
.then((response) => {
|
|
216
|
-
if (!response.ok) {
|
|
217
|
-
throw Error(response.statusText)
|
|
218
|
-
} else {
|
|
219
|
-
return response.json()
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
.then((data) => {
|
|
223
|
-
this.thumbnail = data.banner
|
|
224
|
-
this.discoverId = data.id
|
|
225
|
-
this.version = data.version
|
|
226
|
-
this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
|
|
227
|
-
this.getBiolucidaInfo(this.discoverId)
|
|
228
|
-
this.loading = false
|
|
229
|
-
})
|
|
230
|
-
.catch(() => {
|
|
231
|
-
//set defaults if we hit an error
|
|
232
|
-
this.thumbnail = MissingImage
|
|
233
|
-
this.discoverId = Number(this.entry.datasetId)
|
|
234
|
-
this.loading = false
|
|
235
|
-
})
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
lastName: function (fullName) {
|
|
239
|
-
return fullName.split(',')[0]
|
|
240
|
-
},
|
|
241
|
-
getBiolucidaInfo: function (id) {
|
|
242
|
-
let apiLocation = this.envVars.API_LOCATION
|
|
243
|
-
let endpoint = apiLocation + 'image_search/' + id
|
|
244
|
-
// Add parameters if we are sent them
|
|
245
|
-
fetch(endpoint)
|
|
246
|
-
.then((response) => response.json())
|
|
247
|
-
.then((data) => {
|
|
248
|
-
if (data.status == 'success') this.biolucidaData = data
|
|
249
|
-
})
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
created: function () {
|
|
253
|
-
this.getBanner()
|
|
254
|
-
},
|
|
255
|
-
watch: {
|
|
256
|
-
// currently not using card overflow
|
|
257
|
-
'entry.description': function () {
|
|
258
|
-
// watch it
|
|
259
|
-
this.getBanner()
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
}
|
|
263
|
-
</script>
|
|
264
|
-
|
|
265
|
-
<style lang="scss" scoped>
|
|
266
|
-
.dataset-card {
|
|
267
|
-
padding-left: 15px;
|
|
268
|
-
position: relative;
|
|
269
|
-
min-height: 17rem;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.title {
|
|
273
|
-
padding-bottom: 0.75rem;
|
|
274
|
-
font-family: Asap;
|
|
275
|
-
font-size: 14px;
|
|
276
|
-
font-weight: bold;
|
|
277
|
-
font-stretch: normal;
|
|
278
|
-
font-style: normal;
|
|
279
|
-
line-height: 1.5;
|
|
280
|
-
letter-spacing: 1.05px;
|
|
281
|
-
color: #484848;
|
|
282
|
-
cursor: pointer;
|
|
283
|
-
}
|
|
284
|
-
.card {
|
|
285
|
-
padding-top: 18px;
|
|
286
|
-
position: relative;
|
|
287
|
-
display: flex;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.card-left {
|
|
291
|
-
flex: 1;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.card-right {
|
|
295
|
-
flex: 1.3;
|
|
296
|
-
padding-left: 6px;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.button {
|
|
300
|
-
z-index: 10;
|
|
301
|
-
font-family: Asap;
|
|
302
|
-
font-size: 14px;
|
|
303
|
-
font-weight: normal;
|
|
304
|
-
font-stretch: normal;
|
|
305
|
-
font-style: normal;
|
|
306
|
-
line-height: normal;
|
|
307
|
-
letter-spacing: normal;
|
|
308
|
-
background-color: $app-primary-color;
|
|
309
|
-
border: $app-primary-color;
|
|
310
|
-
color: white;
|
|
311
|
-
cursor: pointer;
|
|
312
|
-
margin-top: 8px;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.button:hover {
|
|
316
|
-
background-color: $app-primary-color;
|
|
317
|
-
color: white;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.banner-img {
|
|
321
|
-
width: 128px;
|
|
322
|
-
height: 128px;
|
|
323
|
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
|
|
324
|
-
background-color: #ffffff;
|
|
325
|
-
cursor: pointer;
|
|
326
|
-
}
|
|
327
|
-
.details {
|
|
328
|
-
font-family: Asap;
|
|
329
|
-
font-size: 14px;
|
|
330
|
-
font-weight: normal;
|
|
331
|
-
font-stretch: normal;
|
|
332
|
-
font-style: normal;
|
|
333
|
-
line-height: 1.5;
|
|
334
|
-
letter-spacing: 1.05px;
|
|
335
|
-
color: #484848;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.badges-container {
|
|
339
|
-
margin-top: 0.75rem;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.loading-icon {
|
|
343
|
-
z-index: 20;
|
|
344
|
-
width: 40px;
|
|
345
|
-
height: 40px;
|
|
346
|
-
left: 80px;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.loading-icon :deep(.el-loading-mask) {
|
|
350
|
-
background-color: rgba(117, 190, 218, 0) !important;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.loading-icon :deep(.el-loading-spinner .path) {
|
|
354
|
-
stroke: $app-primary-color;
|
|
355
|
-
}
|
|
356
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dataset-card-container" ref="container">
|
|
3
|
+
<div class="dataset-card" ref="card">
|
|
4
|
+
<div class="seperator-path"></div>
|
|
5
|
+
<div v-loading="loading" class="card">
|
|
6
|
+
<span class="card-left">
|
|
7
|
+
<ImageGallery
|
|
8
|
+
v-if="!loading && discoverId"
|
|
9
|
+
:datasetId="discoverId"
|
|
10
|
+
:datasetVersion="version"
|
|
11
|
+
:entry="entry"
|
|
12
|
+
:envVars="envVars"
|
|
13
|
+
:label="label"
|
|
14
|
+
:datasetThumbnail="thumbnail"
|
|
15
|
+
:dataset-biolucida="biolucidaData"
|
|
16
|
+
:category="currentCategory"
|
|
17
|
+
@card-clicked="galleryClicked"
|
|
18
|
+
@datalink-clicked="galleryDatalinkClicked"
|
|
19
|
+
/>
|
|
20
|
+
</span>
|
|
21
|
+
<div class="card-right">
|
|
22
|
+
<div class="title" @click="cardClicked">{{ entry.name }}</div>
|
|
23
|
+
<div class="details">
|
|
24
|
+
{{ contributors }} {{ entry.publishDate ? `(${publishYear})` : '' }}
|
|
25
|
+
</div>
|
|
26
|
+
<div class="details">{{ samples }}</div>
|
|
27
|
+
<div
|
|
28
|
+
v-if="!entry.detailsReady"
|
|
29
|
+
class="details loading-icon"
|
|
30
|
+
v-loading="!entry.detailsReady"
|
|
31
|
+
></div>
|
|
32
|
+
<div>
|
|
33
|
+
<el-button
|
|
34
|
+
v-if="entry.simulation"
|
|
35
|
+
@click="openRepository"
|
|
36
|
+
size="small"
|
|
37
|
+
class="button"
|
|
38
|
+
:icon="ElIconView"
|
|
39
|
+
>View repository</el-button
|
|
40
|
+
>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="badges-container">
|
|
43
|
+
<BadgesGroup
|
|
44
|
+
:entry="entry"
|
|
45
|
+
:dataset-biolucida="biolucidaData"
|
|
46
|
+
@categoryChanged="categoryChanged"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
/* eslint-disable no-alert, no-console */
|
|
57
|
+
import { View as ElIconView } from '@element-plus/icons-vue'
|
|
58
|
+
import BadgesGroup from './BadgesGroup.vue'
|
|
59
|
+
import {
|
|
60
|
+
ElButton as Button,
|
|
61
|
+
ElIcon as Icon
|
|
62
|
+
} from 'element-plus'
|
|
63
|
+
import EventBus from './EventBus.js'
|
|
64
|
+
import speciesMap from './species-map.js'
|
|
65
|
+
import ImageGallery from './ImageGallery.vue'
|
|
66
|
+
import MissingImage from '@/../assets/missing-image.svg'
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
data() {
|
|
70
|
+
return {
|
|
71
|
+
ElIconView,
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
name: 'DatasetCard',
|
|
75
|
+
components: {
|
|
76
|
+
BadgesGroup,
|
|
77
|
+
ImageGallery,
|
|
78
|
+
Button,
|
|
79
|
+
Icon
|
|
80
|
+
},
|
|
81
|
+
props: {
|
|
82
|
+
/**
|
|
83
|
+
* Object containing information for
|
|
84
|
+
* the required viewing.
|
|
85
|
+
*/
|
|
86
|
+
entry: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: () => {},
|
|
89
|
+
},
|
|
90
|
+
envVars: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: () => {},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
data: function () {
|
|
96
|
+
return {
|
|
97
|
+
thumbnail: MissingImage,
|
|
98
|
+
dataLocation: this.entry.doi,
|
|
99
|
+
discoverId: undefined,
|
|
100
|
+
loading: true,
|
|
101
|
+
version: 1,
|
|
102
|
+
lastDoi: undefined,
|
|
103
|
+
biolucidaData: undefined,
|
|
104
|
+
currentCategory: 'All',
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
contributors: function () {
|
|
109
|
+
let text = ''
|
|
110
|
+
if (this.entry.contributors) {
|
|
111
|
+
if (this.entry.contributors.length === 1) {
|
|
112
|
+
text = this.lastName(this.entry.contributors[0].name)
|
|
113
|
+
} else if (this.entry.contributors.length === 2) {
|
|
114
|
+
text =
|
|
115
|
+
this.lastName(this.entry.contributors[0].name) +
|
|
116
|
+
' & ' +
|
|
117
|
+
this.lastName(this.entry.contributors[1].name)
|
|
118
|
+
} else if (this.entry.contributors.length > 2) {
|
|
119
|
+
text = this.lastName(this.entry.contributors[0].name) + ' et al.'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return text
|
|
123
|
+
},
|
|
124
|
+
samples: function () {
|
|
125
|
+
let text = ''
|
|
126
|
+
if (this.entry.species) {
|
|
127
|
+
if (speciesMap[this.entry.species[0].toLowerCase()]) {
|
|
128
|
+
text = `${speciesMap[this.entry.species[0].toLowerCase()]}`
|
|
129
|
+
} else {
|
|
130
|
+
text = `${this.entry.species}`
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (this.entry.numberSamples > 0) {
|
|
134
|
+
text += ' ('
|
|
135
|
+
if (this.entry.numberSamples === 1) {
|
|
136
|
+
text += `${this.entry.numberSamples} sample`
|
|
137
|
+
} else if (this.entry.numberSamples > 1) {
|
|
138
|
+
text += `${this.entry.numberSamples} samples`
|
|
139
|
+
}
|
|
140
|
+
if (this.entry.numberSubjects === 1) {
|
|
141
|
+
text += ` from ${this.entry.numberSubjects} subject`
|
|
142
|
+
} else if (this.entry.numberSamples > 1) {
|
|
143
|
+
text += ` from ${this.entry.numberSubjects} subjects`
|
|
144
|
+
}
|
|
145
|
+
text += ')'
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return text
|
|
149
|
+
},
|
|
150
|
+
label: function () {
|
|
151
|
+
return this.entry.organs ? this.entry.organs[0] : this.entry.name
|
|
152
|
+
},
|
|
153
|
+
publishYear: function () {
|
|
154
|
+
return this.entry.publishDate.split('-')[0]
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
methods: {
|
|
158
|
+
cardClicked: function () {
|
|
159
|
+
this.openDataset()
|
|
160
|
+
},
|
|
161
|
+
categoryChanged: function (name) {
|
|
162
|
+
this.currentCategory = name
|
|
163
|
+
},
|
|
164
|
+
galleryClicked: function (payload) {
|
|
165
|
+
this.propogateCardAction(payload)
|
|
166
|
+
},
|
|
167
|
+
galleryDatalinkClicked: function (payload) {
|
|
168
|
+
EventBus.emit('datalink-clicked', payload); // Pass to mapintegratedvuer
|
|
169
|
+
},
|
|
170
|
+
openDataset: function () {
|
|
171
|
+
window.open(this.dataLocation, '_blank')
|
|
172
|
+
},
|
|
173
|
+
openRepository: function () {
|
|
174
|
+
let apiLocation = this.envVars.API_LOCATION
|
|
175
|
+
this.entry.additionalLinks.forEach(function (el) {
|
|
176
|
+
if (el.description == 'Repository') {
|
|
177
|
+
let xmlhttp = new XMLHttpRequest()
|
|
178
|
+
xmlhttp.open('POST', apiLocation + '/pmr_latest_exposure', true)
|
|
179
|
+
xmlhttp.setRequestHeader('Content-type', 'application/json')
|
|
180
|
+
xmlhttp.onreadystatechange = () => {
|
|
181
|
+
if (xmlhttp.readyState === 4) {
|
|
182
|
+
let url = ''
|
|
183
|
+
if (xmlhttp.status === 200) {
|
|
184
|
+
url = JSON.parse(xmlhttp.responseText)['url']
|
|
185
|
+
}
|
|
186
|
+
if (url === '') {
|
|
187
|
+
url = el.uri
|
|
188
|
+
}
|
|
189
|
+
window.open(url, '_blank')
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
xmlhttp.send(JSON.stringify({ workspace_url: el.uri }))
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
},
|
|
196
|
+
propogateCardAction: function (action) {
|
|
197
|
+
EventBus.emit('PopoverActionClick', action)
|
|
198
|
+
EventBus.emit('contextUpdate', action) // Pass to mapintegratedvuer
|
|
199
|
+
},
|
|
200
|
+
splitDOI: function (doi) {
|
|
201
|
+
return [
|
|
202
|
+
doi.split('/')[doi.split('/').length - 2],
|
|
203
|
+
doi.split('/')[doi.split('/').length - 1],
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
getBanner: function () {
|
|
207
|
+
// Only load banner if card has changed
|
|
208
|
+
if (this.lastDoi !== this.entry.doi) {
|
|
209
|
+
this.lastDoi = this.entry.doi
|
|
210
|
+
this.loading = true
|
|
211
|
+
let doi = this.splitDOI(this.entry.doi)
|
|
212
|
+
fetch(
|
|
213
|
+
`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`
|
|
214
|
+
)
|
|
215
|
+
.then((response) => {
|
|
216
|
+
if (!response.ok) {
|
|
217
|
+
throw Error(response.statusText)
|
|
218
|
+
} else {
|
|
219
|
+
return response.json()
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
.then((data) => {
|
|
223
|
+
this.thumbnail = data.banner
|
|
224
|
+
this.discoverId = data.id
|
|
225
|
+
this.version = data.version
|
|
226
|
+
this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
|
|
227
|
+
this.getBiolucidaInfo(this.discoverId)
|
|
228
|
+
this.loading = false
|
|
229
|
+
})
|
|
230
|
+
.catch(() => {
|
|
231
|
+
//set defaults if we hit an error
|
|
232
|
+
this.thumbnail = MissingImage
|
|
233
|
+
this.discoverId = Number(this.entry.datasetId)
|
|
234
|
+
this.loading = false
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
lastName: function (fullName) {
|
|
239
|
+
return fullName.split(',')[0]
|
|
240
|
+
},
|
|
241
|
+
getBiolucidaInfo: function (id) {
|
|
242
|
+
let apiLocation = this.envVars.API_LOCATION
|
|
243
|
+
let endpoint = apiLocation + 'image_search/' + id
|
|
244
|
+
// Add parameters if we are sent them
|
|
245
|
+
fetch(endpoint)
|
|
246
|
+
.then((response) => response.json())
|
|
247
|
+
.then((data) => {
|
|
248
|
+
if (data.status == 'success') this.biolucidaData = data
|
|
249
|
+
})
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
created: function () {
|
|
253
|
+
this.getBanner()
|
|
254
|
+
},
|
|
255
|
+
watch: {
|
|
256
|
+
// currently not using card overflow
|
|
257
|
+
'entry.description': function () {
|
|
258
|
+
// watch it
|
|
259
|
+
this.getBanner()
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
}
|
|
263
|
+
</script>
|
|
264
|
+
|
|
265
|
+
<style lang="scss" scoped>
|
|
266
|
+
.dataset-card {
|
|
267
|
+
padding-left: 15px;
|
|
268
|
+
position: relative;
|
|
269
|
+
min-height: 17rem;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.title {
|
|
273
|
+
padding-bottom: 0.75rem;
|
|
274
|
+
font-family: Asap;
|
|
275
|
+
font-size: 14px;
|
|
276
|
+
font-weight: bold;
|
|
277
|
+
font-stretch: normal;
|
|
278
|
+
font-style: normal;
|
|
279
|
+
line-height: 1.5;
|
|
280
|
+
letter-spacing: 1.05px;
|
|
281
|
+
color: #484848;
|
|
282
|
+
cursor: pointer;
|
|
283
|
+
}
|
|
284
|
+
.card {
|
|
285
|
+
padding-top: 18px;
|
|
286
|
+
position: relative;
|
|
287
|
+
display: flex;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.card-left {
|
|
291
|
+
flex: 1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.card-right {
|
|
295
|
+
flex: 1.3;
|
|
296
|
+
padding-left: 6px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.button {
|
|
300
|
+
z-index: 10;
|
|
301
|
+
font-family: Asap;
|
|
302
|
+
font-size: 14px;
|
|
303
|
+
font-weight: normal;
|
|
304
|
+
font-stretch: normal;
|
|
305
|
+
font-style: normal;
|
|
306
|
+
line-height: normal;
|
|
307
|
+
letter-spacing: normal;
|
|
308
|
+
background-color: $app-primary-color;
|
|
309
|
+
border: $app-primary-color;
|
|
310
|
+
color: white;
|
|
311
|
+
cursor: pointer;
|
|
312
|
+
margin-top: 8px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.button:hover {
|
|
316
|
+
background-color: $app-primary-color;
|
|
317
|
+
color: white;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.banner-img {
|
|
321
|
+
width: 128px;
|
|
322
|
+
height: 128px;
|
|
323
|
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
|
|
324
|
+
background-color: #ffffff;
|
|
325
|
+
cursor: pointer;
|
|
326
|
+
}
|
|
327
|
+
.details {
|
|
328
|
+
font-family: Asap;
|
|
329
|
+
font-size: 14px;
|
|
330
|
+
font-weight: normal;
|
|
331
|
+
font-stretch: normal;
|
|
332
|
+
font-style: normal;
|
|
333
|
+
line-height: 1.5;
|
|
334
|
+
letter-spacing: 1.05px;
|
|
335
|
+
color: #484848;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.badges-container {
|
|
339
|
+
margin-top: 0.75rem;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.loading-icon {
|
|
343
|
+
z-index: 20;
|
|
344
|
+
width: 40px;
|
|
345
|
+
height: 40px;
|
|
346
|
+
left: 80px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.loading-icon :deep(.el-loading-mask) {
|
|
350
|
+
background-color: rgba(117, 190, 218, 0) !important;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.loading-icon :deep(.el-loading-spinner .path) {
|
|
354
|
+
stroke: $app-primary-color;
|
|
355
|
+
}
|
|
356
|
+
</style>
|