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