@abi-software/map-side-bar 2.0.0-response.1 → 2.0.0
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 +21139 -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 +674 -289
- 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,21 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-card :body-style="bodyStyle" class="content-card">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
<template #header>
|
|
4
|
+
<div class="header">
|
|
5
|
+
<el-input
|
|
6
|
+
class="search-input"
|
|
7
|
+
placeholder="Search"
|
|
8
|
+
v-model="searchInput"
|
|
9
|
+
@keyup="searchEvent"
|
|
10
|
+
clearable
|
|
11
|
+
@clear="clearSearchClicked"
|
|
12
|
+
></el-input>
|
|
13
|
+
<el-button
|
|
14
|
+
type="primary"
|
|
15
|
+
class="button"
|
|
16
|
+
@click="searchEvent"
|
|
17
|
+
size="large"
|
|
18
|
+
>
|
|
19
|
+
Search
|
|
20
|
+
</el-button>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
19
23
|
<SearchFilters
|
|
20
24
|
class="filters"
|
|
21
25
|
ref="filtersRef"
|
|
@@ -26,20 +30,20 @@
|
|
|
26
30
|
@loading="filtersLoading"
|
|
27
31
|
@cascaderReady="cascaderReady"
|
|
28
32
|
></SearchFilters>
|
|
33
|
+
<SearchHistory
|
|
34
|
+
ref="searchHistory"
|
|
35
|
+
@search="searchHistorySearch"
|
|
36
|
+
></SearchHistory>
|
|
29
37
|
<div class="content scrollbar" v-loading="loadingCards" ref="content">
|
|
30
38
|
<div class="error-feedback" v-if="results.length === 0 && !loadingCards">
|
|
31
39
|
No results found - Please change your search / filter criteria.
|
|
32
40
|
</div>
|
|
33
41
|
<div v-for="result in results" :key="result.doi" class="step-item">
|
|
34
|
-
<DatasetCard
|
|
35
|
-
:entry="result"
|
|
36
|
-
:envVars="envVars"
|
|
37
|
-
@contextUpdate="contextCardUpdate"
|
|
38
|
-
></DatasetCard>
|
|
42
|
+
<DatasetCard :entry="result" :envVars="envVars"></DatasetCard>
|
|
39
43
|
</div>
|
|
40
44
|
<el-pagination
|
|
41
45
|
class="pagination"
|
|
42
|
-
:current-page
|
|
46
|
+
v-model:current-page="page"
|
|
43
47
|
hide-on-single-page
|
|
44
48
|
large
|
|
45
49
|
layout="prev, pager, next"
|
|
@@ -51,55 +55,41 @@
|
|
|
51
55
|
</el-card>
|
|
52
56
|
</template>
|
|
53
57
|
|
|
54
|
-
|
|
55
58
|
<script>
|
|
56
59
|
/* eslint-disable no-alert, no-console */
|
|
57
|
-
import Vue from "vue";
|
|
58
60
|
import {
|
|
59
|
-
Button,
|
|
60
|
-
Card,
|
|
61
|
-
Drawer,
|
|
62
|
-
Icon,
|
|
63
|
-
Input,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import DatasetCard from "./DatasetCard";
|
|
71
|
-
import ContextCard from "./ContextCard.vue";
|
|
72
|
-
import EventBus from "./EventBus";
|
|
61
|
+
ElButton as Button,
|
|
62
|
+
ElCard as Card,
|
|
63
|
+
ElDrawer as Drawer,
|
|
64
|
+
ElIcon as Icon,
|
|
65
|
+
ElInput as Input,
|
|
66
|
+
ElPagination as Pagination,
|
|
67
|
+
} from 'element-plus'
|
|
68
|
+
import SearchFilters from './SearchFilters.vue'
|
|
69
|
+
import SearchHistory from './SearchHistory.vue'
|
|
70
|
+
import DatasetCard from './DatasetCard.vue'
|
|
71
|
+
import EventBus from './EventBus.js'
|
|
73
72
|
|
|
74
|
-
import { AlgoliaClient } from
|
|
75
|
-
import { getFilters } from
|
|
76
|
-
|
|
77
|
-
locale.use(lang);
|
|
78
|
-
Vue.use(Button);
|
|
79
|
-
Vue.use(Card);
|
|
80
|
-
Vue.use(Drawer);
|
|
81
|
-
Vue.use(Icon);
|
|
82
|
-
Vue.use(Input);
|
|
83
|
-
Vue.use(Loading);
|
|
84
|
-
Vue.use(Pagination);
|
|
73
|
+
import { AlgoliaClient } from '../algolia/algolia.js'
|
|
74
|
+
import { getFilters, facetPropPathMapping } from '../algolia/utils.js'
|
|
85
75
|
|
|
86
76
|
// handleErrors: A custom fetch error handler to recieve messages from the server
|
|
87
77
|
// even when an error is found
|
|
88
78
|
var handleErrors = async function (response) {
|
|
89
79
|
if (!response.ok) {
|
|
90
|
-
let parse = await response.json()
|
|
80
|
+
let parse = await response.json()
|
|
91
81
|
if (parse) {
|
|
92
|
-
throw new Error(parse.message)
|
|
82
|
+
throw new Error(parse.message)
|
|
93
83
|
} else {
|
|
94
|
-
throw new Error(response)
|
|
84
|
+
throw new Error(response)
|
|
95
85
|
}
|
|
96
86
|
}
|
|
97
|
-
return response
|
|
98
|
-
}
|
|
87
|
+
return response
|
|
88
|
+
}
|
|
99
89
|
|
|
100
|
-
|
|
101
|
-
searchInput:
|
|
102
|
-
lastSearch:
|
|
90
|
+
var initial_state = {
|
|
91
|
+
searchInput: '',
|
|
92
|
+
lastSearch: '',
|
|
103
93
|
results: [],
|
|
104
94
|
numberOfHits: 0,
|
|
105
95
|
filter: [],
|
|
@@ -109,13 +99,22 @@ const initial_state = {
|
|
|
109
99
|
pageModel: 1,
|
|
110
100
|
start: 0,
|
|
111
101
|
hasSearched: false,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
102
|
+
contextCardEnabled: false,
|
|
103
|
+
}
|
|
115
104
|
|
|
116
105
|
export default {
|
|
117
|
-
components: {
|
|
118
|
-
|
|
106
|
+
components: {
|
|
107
|
+
SearchFilters,
|
|
108
|
+
DatasetCard,
|
|
109
|
+
SearchHistory,
|
|
110
|
+
Button,
|
|
111
|
+
Card,
|
|
112
|
+
Drawer,
|
|
113
|
+
Icon,
|
|
114
|
+
Input,
|
|
115
|
+
Pagination
|
|
116
|
+
},
|
|
117
|
+
name: 'SideBarContent',
|
|
119
118
|
props: {
|
|
120
119
|
visible: {
|
|
121
120
|
type: Boolean,
|
|
@@ -134,21 +133,16 @@ export default {
|
|
|
134
133
|
default: () => {},
|
|
135
134
|
},
|
|
136
135
|
},
|
|
137
|
-
|
|
138
|
-
'alternateSearch' : {
|
|
139
|
-
default: undefined,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
data: function() {
|
|
136
|
+
data: function () {
|
|
143
137
|
return {
|
|
144
138
|
...this.entry,
|
|
145
139
|
bodyStyle: {
|
|
146
|
-
flex:
|
|
147
|
-
|
|
148
|
-
display:
|
|
140
|
+
flex: '1 1 auto',
|
|
141
|
+
'flex-flow': 'column',
|
|
142
|
+
display: 'flex',
|
|
149
143
|
},
|
|
150
144
|
cascaderIsReady: false,
|
|
151
|
-
}
|
|
145
|
+
}
|
|
152
146
|
},
|
|
153
147
|
computed: {
|
|
154
148
|
// This computed property populates filter data's entry object with $data from this sidebar
|
|
@@ -156,25 +150,24 @@ export default {
|
|
|
156
150
|
return {
|
|
157
151
|
numberOfHits: this.numberOfHits,
|
|
158
152
|
filterFacets: this.filter,
|
|
159
|
-
}
|
|
153
|
+
}
|
|
160
154
|
},
|
|
161
155
|
},
|
|
162
156
|
methods: {
|
|
163
|
-
|
|
164
|
-
this.contextCardEntry = val;
|
|
165
|
-
},
|
|
166
|
-
resetSearch: function() {
|
|
157
|
+
resetSearch: function () {
|
|
167
158
|
this.numberOfHits = 0
|
|
159
|
+
this.discoverIds = []
|
|
168
160
|
this._dois = []
|
|
169
161
|
this.results = []
|
|
170
162
|
this.loadingCards = false
|
|
171
163
|
},
|
|
172
|
-
openSearch: function (filter, search =
|
|
173
|
-
this.searchInput = search
|
|
174
|
-
this.resetPageNavigation()
|
|
164
|
+
openSearch: function (filter, search = '') {
|
|
165
|
+
this.searchInput = search
|
|
166
|
+
this.resetPageNavigation()
|
|
175
167
|
//Proceed normally if cascader is ready
|
|
176
168
|
if (this.cascaderIsReady) {
|
|
177
|
-
this.filter =
|
|
169
|
+
this.filter =
|
|
170
|
+
this.$refs.filtersRef.getHierarchicalValidatedFilters(filter)
|
|
178
171
|
//Facets provided but cannot find at least one valid
|
|
179
172
|
//facet. Tell the users the search is invalid and reset
|
|
180
173
|
//facets check boxes.
|
|
@@ -184,174 +177,170 @@ export default {
|
|
|
184
177
|
this.filter &&
|
|
185
178
|
this.filter.length === 0
|
|
186
179
|
) {
|
|
187
|
-
this.$refs.filtersRef.checkShowAllBoxes()
|
|
188
|
-
this.resetSearch()
|
|
180
|
+
this.$refs.filtersRef.checkShowAllBoxes()
|
|
181
|
+
this.resetSearch()
|
|
189
182
|
} else if (this.filter) {
|
|
190
|
-
this.
|
|
191
|
-
this.$refs.filtersRef.setCascader(this.filter)
|
|
183
|
+
this.searchAlgolia(this.filter, search)
|
|
184
|
+
this.$refs.filtersRef.setCascader(this.filter)
|
|
192
185
|
}
|
|
193
186
|
} else {
|
|
194
187
|
//cascader is not ready, perform search if no filter is set,
|
|
195
188
|
//otherwise waith for cascader to be ready
|
|
196
|
-
this.filter = filter
|
|
189
|
+
this.filter = filter
|
|
197
190
|
if (!filter || filter.length == 0) {
|
|
198
|
-
this.
|
|
191
|
+
this.searchAlgolia(this.filter, search)
|
|
199
192
|
}
|
|
200
193
|
}
|
|
201
194
|
},
|
|
202
195
|
addFilter: function (filter) {
|
|
203
196
|
if (this.cascaderIsReady) {
|
|
204
|
-
this.resetPageNavigation()
|
|
197
|
+
this.resetPageNavigation()
|
|
205
198
|
if (filter) {
|
|
206
199
|
if (this.$refs.filtersRef.addFilter(filter))
|
|
207
|
-
this.$refs.filtersRef.initiateSearch()
|
|
200
|
+
this.$refs.filtersRef.initiateSearch()
|
|
208
201
|
}
|
|
209
202
|
} else {
|
|
210
203
|
if (Array.isArray(this.filter)) {
|
|
211
|
-
this.filter.push(filter)
|
|
204
|
+
this.filter.push(filter)
|
|
212
205
|
} else {
|
|
213
|
-
this.filter = [filter]
|
|
206
|
+
this.filter = [filter]
|
|
214
207
|
}
|
|
215
208
|
}
|
|
216
209
|
},
|
|
217
210
|
cascaderReady: function () {
|
|
218
|
-
this.cascaderIsReady = true
|
|
219
|
-
this.openSearch(this.filter, this.searchInput)
|
|
211
|
+
this.cascaderIsReady = true
|
|
212
|
+
this.openSearch(this.filter, this.searchInput)
|
|
220
213
|
},
|
|
221
214
|
clearSearchClicked: function () {
|
|
222
|
-
this.searchInput =
|
|
223
|
-
this.resetPageNavigation()
|
|
224
|
-
this.
|
|
215
|
+
this.searchInput = ''
|
|
216
|
+
this.resetPageNavigation()
|
|
217
|
+
this.searchAlgolia(this.filters, this.searchInput)
|
|
218
|
+
this.$refs.searchHistory.selectValue = 'Full search history'
|
|
225
219
|
},
|
|
226
220
|
searchEvent: function (event = false) {
|
|
227
221
|
if (event.keyCode === 13 || event instanceof MouseEvent) {
|
|
228
|
-
this.resetPageNavigation()
|
|
229
|
-
this.
|
|
222
|
+
this.resetPageNavigation()
|
|
223
|
+
this.searchAlgolia(this.filters, this.searchInput)
|
|
224
|
+
this.$refs.searchHistory.selectValue = 'Full search history'
|
|
225
|
+
this.$refs.searchHistory.addSearchToHistory(
|
|
226
|
+
this.filters,
|
|
227
|
+
this.searchInput
|
|
228
|
+
)
|
|
230
229
|
}
|
|
231
230
|
},
|
|
232
|
-
filterUpdate: function(filters) {
|
|
231
|
+
filterUpdate: function (filters) {
|
|
233
232
|
this.filters = [...filters]
|
|
234
233
|
this.resetPageNavigation()
|
|
235
|
-
this.
|
|
236
|
-
this.$emit(
|
|
234
|
+
this.searchAlgolia(filters, this.searchInput)
|
|
235
|
+
this.$emit('search-changed', {
|
|
237
236
|
value: filters,
|
|
238
|
-
type:
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
processSearchData: function(searchData) {
|
|
242
|
-
this.numberOfHits = searchData.total
|
|
243
|
-
this._dois = searchData.dois
|
|
244
|
-
this.results = searchData.items
|
|
245
|
-
this.loadingCards = false
|
|
246
|
-
this.scrollToTop()
|
|
247
|
-
this.$emit("search-changed", { value: this.searchInput, type: "query-update" })
|
|
248
|
-
},
|
|
249
|
-
alternateSearchCB: function(payload) {
|
|
250
|
-
this.loadingCards = false;
|
|
251
|
-
this.processSearchData(payload)
|
|
252
|
-
//console.log(payload)
|
|
253
|
-
},
|
|
254
|
-
performSearch(filters, query='') {
|
|
255
|
-
if (this.alternateSearch) {
|
|
256
|
-
this.loadingCards = true;
|
|
257
|
-
const payload = {
|
|
258
|
-
requestType: 'Search',
|
|
259
|
-
filters,
|
|
260
|
-
query,
|
|
261
|
-
numberPerPage: this.numberPerPage,
|
|
262
|
-
page: this.page
|
|
263
|
-
};
|
|
264
|
-
this.alternateSearch(payload, this.alternateSearchCB);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
this.searchAlgolia(filters, query);
|
|
268
|
-
}
|
|
237
|
+
type: 'filter-update',
|
|
238
|
+
})
|
|
269
239
|
},
|
|
270
|
-
searchAlgolia(filters, query=''){
|
|
240
|
+
searchAlgolia(filters, query = '') {
|
|
271
241
|
// Algolia search
|
|
272
242
|
this.loadingCards = true
|
|
273
|
-
this.algoliaClient
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
243
|
+
this.algoliaClient
|
|
244
|
+
.anatomyInSearch(getFilters(filters), query)
|
|
245
|
+
.then((anatomy) => {
|
|
246
|
+
EventBus.emit('available-facets', {
|
|
247
|
+
uberons: anatomy,
|
|
248
|
+
labels: this.algoliaClient.anatomyFacetLabels,
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
this.algoliaClient
|
|
252
|
+
.search(getFilters(filters), query, this.numberPerPage, this.page)
|
|
253
|
+
.then((searchData) => {
|
|
254
|
+
this.numberOfHits = searchData.total
|
|
255
|
+
this.discoverIds = searchData.discoverIds
|
|
256
|
+
this._dois = searchData.dois
|
|
257
|
+
this.results = searchData.items
|
|
258
|
+
this.loadingCards = false
|
|
259
|
+
this.scrollToTop()
|
|
260
|
+
this.$emit('search-changed', {
|
|
261
|
+
value: this.searchInput,
|
|
262
|
+
type: 'query-update',
|
|
263
|
+
})
|
|
264
|
+
if (this._abortController) this._abortController.abort()
|
|
265
|
+
this._abortController = new AbortController()
|
|
266
|
+
const signal = this._abortController.signal
|
|
267
|
+
//Search ongoing, let the current flow progress
|
|
268
|
+
this.perItemSearch(signal, { count: 0 })
|
|
269
|
+
})
|
|
285
270
|
},
|
|
286
271
|
filtersLoading: function (val) {
|
|
287
|
-
this.loadingCards = val
|
|
272
|
+
this.loadingCards = val
|
|
288
273
|
},
|
|
289
274
|
numberPerPageUpdate: function (val) {
|
|
290
|
-
this.numberPerPage = val
|
|
291
|
-
this.pageChange(1)
|
|
275
|
+
this.numberPerPage = val
|
|
276
|
+
this.pageChange(1)
|
|
292
277
|
},
|
|
293
278
|
pageChange: function (page) {
|
|
294
|
-
this.start = (page - 1) * this.numberPerPage
|
|
295
|
-
this.page = page
|
|
296
|
-
this.
|
|
279
|
+
this.start = (page - 1) * this.numberPerPage
|
|
280
|
+
this.page = page
|
|
281
|
+
this.searchAlgolia(
|
|
282
|
+
this.filters,
|
|
283
|
+
this.searchInput,
|
|
284
|
+
this.numberPerPage,
|
|
285
|
+
this.page
|
|
286
|
+
)
|
|
297
287
|
},
|
|
298
288
|
handleMissingData: function (doi) {
|
|
299
|
-
let i = this.results.findIndex((res) => res.doi === doi)
|
|
300
|
-
if (this.results[i]) this.results[i].detailsReady = true
|
|
289
|
+
let i = this.results.findIndex((res) => res.doi === doi)
|
|
290
|
+
if (this.results[i]) this.results[i].detailsReady = true
|
|
301
291
|
},
|
|
302
292
|
perItemSearch: function (signal, data) {
|
|
303
293
|
//Maximum 10 downloads at once to prevent long waiting time
|
|
304
294
|
//between unfinished search and new search
|
|
305
|
-
const maxDownloads = 10
|
|
295
|
+
const maxDownloads = 10
|
|
306
296
|
if (maxDownloads > data.count) {
|
|
307
|
-
const doi = this._dois.shift()
|
|
297
|
+
const doi = this._dois.shift()
|
|
308
298
|
if (doi) {
|
|
309
|
-
data.count
|
|
310
|
-
this.callSciCrunch(this.envVars.API_LOCATION, {
|
|
311
|
-
.then(result => {
|
|
312
|
-
if (result.numberOfHits === 0)
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
this.$refs.content.style["overflow-y"] = "scroll";
|
|
317
|
-
data.count--;
|
|
299
|
+
data.count++
|
|
300
|
+
this.callSciCrunch(this.envVars.API_LOCATION, { dois: [doi] }, signal)
|
|
301
|
+
.then((result) => {
|
|
302
|
+
if (result.numberOfHits === 0) this.handleMissingData(doi)
|
|
303
|
+
else this.resultsProcessing(result)
|
|
304
|
+
this.$refs.content.style['overflow-y'] = 'scroll'
|
|
305
|
+
data.count--
|
|
318
306
|
//Async::Download finished, get the next one
|
|
319
|
-
this.perItemSearch(signal, data)
|
|
307
|
+
this.perItemSearch(signal, data)
|
|
320
308
|
})
|
|
321
309
|
.catch((result) => {
|
|
322
|
-
if (result.name !==
|
|
323
|
-
this.handleMissingData(doi)
|
|
324
|
-
data.count
|
|
310
|
+
if (result.name !== 'AbortError') {
|
|
311
|
+
this.handleMissingData(doi)
|
|
312
|
+
data.count--
|
|
325
313
|
//Async::Download not aborted, get the next one
|
|
326
|
-
this.perItemSearch(signal, data)
|
|
314
|
+
this.perItemSearch(signal, data)
|
|
327
315
|
}
|
|
328
|
-
})
|
|
316
|
+
})
|
|
329
317
|
//Check and make another request until it gets to max downloads
|
|
330
|
-
this.perItemSearch(signal, data)
|
|
318
|
+
this.perItemSearch(signal, data)
|
|
331
319
|
}
|
|
332
320
|
}
|
|
333
321
|
},
|
|
334
322
|
scrollToTop: function () {
|
|
335
323
|
if (this.$refs.content) {
|
|
336
|
-
this.$refs.content.scroll({ top: 0, behavior:
|
|
324
|
+
this.$refs.content.scroll({ top: 0, behavior: 'smooth' })
|
|
337
325
|
}
|
|
338
326
|
},
|
|
339
327
|
resetPageNavigation: function () {
|
|
340
|
-
this.start = 0
|
|
341
|
-
this.page = 1
|
|
328
|
+
this.start = 0
|
|
329
|
+
this.page = 1
|
|
342
330
|
},
|
|
343
|
-
|
|
344
|
-
this.lastSearch = this.searchInput
|
|
331
|
+
resultsProcessing: function (data) {
|
|
332
|
+
this.lastSearch = this.searchInput
|
|
333
|
+
|
|
345
334
|
if (data.results.length === 0) {
|
|
346
|
-
return
|
|
335
|
+
return
|
|
347
336
|
}
|
|
348
337
|
data.results.forEach((element) => {
|
|
349
338
|
// match the scicrunch result with algolia result
|
|
350
339
|
let i = this.results.findIndex((res) =>
|
|
351
340
|
element.doi ? element.doi.includes(res.doi) : false
|
|
352
|
-
)
|
|
341
|
+
)
|
|
353
342
|
// Assign scicrunch results to the object
|
|
354
|
-
Object.assign(this.results[i], element)
|
|
343
|
+
Object.assign(this.results[i], element)
|
|
355
344
|
// Assign the attributes that need some processing
|
|
356
345
|
Object.assign(this.results[i], {
|
|
357
346
|
numberSamples: element.sampleSize ? parseInt(element.sampleSize) : 0,
|
|
@@ -360,8 +349,8 @@ export default {
|
|
|
360
349
|
: 0,
|
|
361
350
|
updated:
|
|
362
351
|
(element.updated && element.updated.length) > 0
|
|
363
|
-
? element.updated[0].timestamp.split(
|
|
364
|
-
:
|
|
352
|
+
? element.updated[0].timestamp.split('T')[0]
|
|
353
|
+
: '',
|
|
365
354
|
url: element.uri[0],
|
|
366
355
|
datasetId: element.dataset_identifier,
|
|
367
356
|
datasetRevision: element.dataset_revision,
|
|
@@ -381,89 +370,91 @@ export default {
|
|
|
381
370
|
]
|
|
382
371
|
: undefined
|
|
383
372
|
: undefined, // This processing only includes each gender once into 'sexes'
|
|
384
|
-
scaffolds: element[
|
|
385
|
-
thumbnails: element[
|
|
386
|
-
? element[
|
|
387
|
-
: element[
|
|
388
|
-
scaffoldViews: element[
|
|
373
|
+
scaffolds: element['abi-scaffold-metadata-file'],
|
|
374
|
+
thumbnails: element['abi-thumbnail']
|
|
375
|
+
? element['abi-thumbnail']
|
|
376
|
+
: element['abi-scaffold-thumbnail'],
|
|
377
|
+
scaffoldViews: element['abi-scaffold-view-file'],
|
|
389
378
|
videos: element.video,
|
|
390
|
-
plots: element[
|
|
391
|
-
images: element[
|
|
379
|
+
plots: element['abi-plot'],
|
|
380
|
+
images: element['common-images'],
|
|
392
381
|
contextualInformation:
|
|
393
|
-
element[
|
|
394
|
-
? element[
|
|
382
|
+
element['abi-contextual-information'].length > 0
|
|
383
|
+
? element['abi-contextual-information']
|
|
395
384
|
: undefined,
|
|
396
|
-
segmentation: element[
|
|
397
|
-
simulation: element[
|
|
385
|
+
segmentation: element['mbf-segmentation'],
|
|
386
|
+
simulation: element['abi-simulation-file'],
|
|
398
387
|
additionalLinks: element.additionalLinks,
|
|
399
388
|
detailsReady: true,
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
})
|
|
389
|
+
})
|
|
390
|
+
this.results[i] = this.results[i]
|
|
391
|
+
})
|
|
403
392
|
},
|
|
404
393
|
createfilterParams: function (params) {
|
|
405
|
-
let p = new URLSearchParams()
|
|
394
|
+
let p = new URLSearchParams()
|
|
406
395
|
//Check if field is array or value
|
|
407
396
|
for (const key in params) {
|
|
408
397
|
if (Array.isArray(params[key])) {
|
|
409
398
|
params[key].forEach((e) => {
|
|
410
|
-
p.append(key, e)
|
|
411
|
-
})
|
|
399
|
+
p.append(key, e)
|
|
400
|
+
})
|
|
412
401
|
} else {
|
|
413
|
-
p.append(key, params[key])
|
|
402
|
+
p.append(key, params[key])
|
|
414
403
|
}
|
|
415
404
|
}
|
|
416
|
-
return p.toString()
|
|
405
|
+
return p.toString()
|
|
417
406
|
},
|
|
418
407
|
callSciCrunch: function (apiLocation, params = {}, signal) {
|
|
419
408
|
return new Promise((resolve, reject) => {
|
|
420
409
|
// Add parameters if we are sent them
|
|
421
|
-
let fullEndpoint =
|
|
410
|
+
let fullEndpoint =
|
|
411
|
+
this.envVars.API_LOCATION +
|
|
412
|
+
this.searchEndpoint +
|
|
413
|
+
'?' +
|
|
414
|
+
this.createfilterParams(params)
|
|
422
415
|
fetch(fullEndpoint, { signal })
|
|
423
416
|
.then(handleErrors)
|
|
424
417
|
.then((response) => response.json())
|
|
425
418
|
.then((data) => resolve(data))
|
|
426
|
-
.catch((data) => reject(data))
|
|
427
|
-
})
|
|
419
|
+
.catch((data) => reject(data))
|
|
420
|
+
})
|
|
421
|
+
},
|
|
422
|
+
getAlgoliaFacets: async function () {
|
|
423
|
+
let facets = await this.algoliaClient.getAlgoliaFacets(
|
|
424
|
+
facetPropPathMapping
|
|
425
|
+
)
|
|
426
|
+
return facets
|
|
427
|
+
},
|
|
428
|
+
searchHistorySearch: function (item) {
|
|
429
|
+
this.searchInput = item.search
|
|
430
|
+
this.filters = item.filters
|
|
431
|
+
this.openSearch(item.filters, item.search)
|
|
428
432
|
},
|
|
429
433
|
},
|
|
430
|
-
mounted: function() {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
this.
|
|
434
|
-
this.
|
|
435
|
-
|
|
436
|
-
|
|
434
|
+
mounted: function () {
|
|
435
|
+
// initialise algolia
|
|
436
|
+
this.algoliaClient = new AlgoliaClient(
|
|
437
|
+
this.envVars.ALGOLIA_ID,
|
|
438
|
+
this.envVars.ALGOLIA_KEY,
|
|
439
|
+
this.envVars.PENNSIEVE_API_LOCATION
|
|
440
|
+
)
|
|
441
|
+
this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX)
|
|
442
|
+
this.openSearch(this.filter, this.searchInput)
|
|
437
443
|
},
|
|
438
444
|
created: function () {
|
|
439
445
|
//Create non-reactive local variables
|
|
440
|
-
this.searchEndpoint =
|
|
446
|
+
this.searchEndpoint = 'dataset_info/using_multiple_dois/'
|
|
441
447
|
},
|
|
442
|
-
}
|
|
448
|
+
}
|
|
443
449
|
</script>
|
|
444
450
|
|
|
445
|
-
|
|
446
|
-
<style scoped lang="scss">
|
|
447
|
-
@import "~element-ui/packages/theme-chalk/src/button";
|
|
448
|
-
@import "~element-ui/packages/theme-chalk/src/card";
|
|
449
|
-
@import "~element-ui/packages/theme-chalk/src/drawer";
|
|
450
|
-
@import "~element-ui/packages/theme-chalk/src/icon";
|
|
451
|
-
@import "~element-ui/packages/theme-chalk/src/input";
|
|
452
|
-
@import "~element-ui/packages/theme-chalk/src/loading";
|
|
453
|
-
@import "~element-ui/packages/theme-chalk/src/pagination";
|
|
454
|
-
|
|
451
|
+
<style lang="scss" scoped>
|
|
455
452
|
.content-card {
|
|
456
453
|
height: 100%;
|
|
457
454
|
flex-flow: column;
|
|
458
455
|
display: flex;
|
|
459
456
|
}
|
|
460
457
|
|
|
461
|
-
.button {
|
|
462
|
-
background-color: $app-primary-color;
|
|
463
|
-
border: $app-primary-color;
|
|
464
|
-
color: white;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
458
|
.step-item {
|
|
468
459
|
font-size: 14px;
|
|
469
460
|
margin-bottom: 18px;
|
|
@@ -486,16 +477,17 @@ export default {
|
|
|
486
477
|
.pagination {
|
|
487
478
|
padding-bottom: 16px;
|
|
488
479
|
background-color: white;
|
|
489
|
-
|
|
480
|
+
padding-left: 95px;
|
|
481
|
+
font-weight: bold;
|
|
490
482
|
}
|
|
491
483
|
|
|
492
|
-
.pagination
|
|
484
|
+
.pagination :deep(button) {
|
|
493
485
|
background-color: white !important;
|
|
494
486
|
}
|
|
495
|
-
.pagination
|
|
487
|
+
.pagination :deep(li) {
|
|
496
488
|
background-color: white !important;
|
|
497
489
|
}
|
|
498
|
-
.pagination
|
|
490
|
+
.pagination :deep(li.is-active) {
|
|
499
491
|
color: $app-primary-color;
|
|
500
492
|
}
|
|
501
493
|
|
|
@@ -506,18 +498,18 @@ export default {
|
|
|
506
498
|
padding-top: 15px;
|
|
507
499
|
}
|
|
508
500
|
|
|
509
|
-
.content-card
|
|
501
|
+
.content-card :deep(.el-card__header) {
|
|
510
502
|
background-color: #292b66;
|
|
511
503
|
border: solid 1px #292b66;
|
|
512
504
|
}
|
|
513
505
|
|
|
514
|
-
.content-card
|
|
506
|
+
.content-card :deep(.el-card__body) {
|
|
515
507
|
background-color: #f7faff;
|
|
516
508
|
overflow-y: hidden;
|
|
517
509
|
}
|
|
518
510
|
|
|
519
511
|
.content {
|
|
520
|
-
width:
|
|
512
|
+
width: 515px;
|
|
521
513
|
flex: 1 1 auto;
|
|
522
514
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
|
|
523
515
|
border: solid 1px #e4e7ed;
|
|
@@ -526,15 +518,15 @@ export default {
|
|
|
526
518
|
scrollbar-width: thin;
|
|
527
519
|
}
|
|
528
520
|
|
|
529
|
-
.content
|
|
521
|
+
.content :deep(.el-loading-spinner .path) {
|
|
530
522
|
stroke: $app-primary-color;
|
|
531
523
|
}
|
|
532
524
|
|
|
533
|
-
.content
|
|
525
|
+
.content :deep(.step-item:first-child .seperator-path) {
|
|
534
526
|
display: none;
|
|
535
527
|
}
|
|
536
528
|
|
|
537
|
-
.content
|
|
529
|
+
.content :deep(.step-item:not(:first-child) .seperator-path) {
|
|
538
530
|
width: 486px;
|
|
539
531
|
height: 0px;
|
|
540
532
|
border: solid 1px #e4e7ed;
|
|
@@ -558,11 +550,11 @@ export default {
|
|
|
558
550
|
background-color: #979797;
|
|
559
551
|
}
|
|
560
552
|
|
|
561
|
-
|
|
562
|
-
padding-right:
|
|
553
|
+
:deep(.el-input__suffix) {
|
|
554
|
+
padding-right: 0px;
|
|
563
555
|
}
|
|
564
556
|
|
|
565
|
-
|
|
557
|
+
:deep(.my-drawer) {
|
|
566
558
|
background: rgba(0, 0, 0, 0);
|
|
567
559
|
box-shadow: none;
|
|
568
560
|
}
|