@abi-software/map-side-bar 2.18.0 → 2.19.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/.postcssrc.json +5 -5
- package/README.md +8 -9
- package/cypress.config.js +6 -7
- package/dist/map-side-bar.js +5878 -5991
- package/dist/map-side-bar.umd.cjs +58 -58
- package/dist/style.css +1 -1
- package/eslint.config.js +44 -9
- package/package.json +10 -3
- package/reporter-config.json +1 -1
- package/src/App.vue +79 -78
- package/src/algolia/algolia.js +173 -167
- package/src/algolia/utils.js +34 -38
- package/src/assets/_variables.scss +12 -10
- package/src/assets/connectivity-explorer.scss +1 -1
- package/src/assets/fonts.scss +0 -1
- package/src/assets/searchPopover.scss +1 -2
- package/src/components/AnnotationTool.vue +9 -32
- package/src/components/BadgesGroup.vue +29 -32
- package/src/components/ConnectivityCard.vue +21 -18
- package/src/components/ConnectivityExplorer.vue +109 -130
- package/src/components/ConnectivityInfo.vue +143 -145
- package/src/components/ContributorItem.vue +15 -11
- package/src/components/DatasetCard.vue +166 -201
- package/src/components/DatasetExplorer.vue +160 -201
- package/src/components/ImageGallery.vue +35 -36
- package/src/components/SearchFilters.vue +377 -403
- package/src/components/SearchHistory.vue +61 -89
- package/src/components/SideBar.vue +83 -89
- package/src/components/Tabs.vue +10 -15
- package/src/components/index.js +3 -5
- package/src/components/species-map.js +7 -7
- package/src/exampleConnectivityInput.js +310 -318
- package/src/main.js +6 -6
- package/src/mixins/S3Bucket.vue +10 -13
- package/vite.config.js +62 -61
- package/vuese-generator.js +47 -55
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<el-card :body-style="bodyStyle" class="content-card">
|
|
3
3
|
<template #header>
|
|
4
4
|
<div class="header">
|
|
5
|
-
<div class="search-input-container" :class="{'is-focus': searchInput}">
|
|
5
|
+
<div class="search-input-container" :class="{ 'is-focus': searchInput }">
|
|
6
6
|
<el-input
|
|
7
7
|
class="search-input"
|
|
8
8
|
placeholder="Search"
|
|
@@ -11,11 +11,7 @@
|
|
|
11
11
|
clearable
|
|
12
12
|
@clear="clearSearchClicked"
|
|
13
13
|
></el-input>
|
|
14
|
-
<el-popover
|
|
15
|
-
width="350"
|
|
16
|
-
trigger="hover"
|
|
17
|
-
popper-class="filter-help-popover"
|
|
18
|
-
>
|
|
14
|
+
<el-popover width="350" trigger="hover" popper-class="filter-help-popover">
|
|
19
15
|
<template #reference>
|
|
20
16
|
<MapSvgIcon icon="help" class="help" />
|
|
21
17
|
</template>
|
|
@@ -23,44 +19,45 @@
|
|
|
23
19
|
<strong>Search rules:</strong>
|
|
24
20
|
<ul>
|
|
25
21
|
<li>
|
|
26
|
-
<strong>Multiple Terms:</strong>
|
|
27
|
-
|
|
22
|
+
<strong>Multiple Terms:</strong>
|
|
23
|
+
Separate terms with a comma (
|
|
24
|
+
<code>,</code>
|
|
25
|
+
). This will find datasets that match any of the terms (an "OR" search).
|
|
28
26
|
</li>
|
|
29
27
|
<li>
|
|
30
|
-
<strong>Exact Phrase:</strong>
|
|
28
|
+
<strong>Exact Phrase:</strong>
|
|
29
|
+
Terms within a comma block will be matched as an exact phrase.
|
|
31
30
|
</li>
|
|
32
31
|
</ul>
|
|
33
|
-
<br/>
|
|
32
|
+
<br />
|
|
34
33
|
<strong>Examples:</strong>
|
|
35
34
|
<ul>
|
|
36
35
|
<li>
|
|
37
36
|
<strong>To find by exact phrase:</strong>
|
|
38
|
-
Searching for
|
|
37
|
+
Searching for
|
|
38
|
+
<code>vagus nerve</code>
|
|
39
|
+
will find any dataset containing
|
|
40
|
+
<code>"vagus nerve"</code>
|
|
41
|
+
.
|
|
39
42
|
</li>
|
|
40
43
|
<li>
|
|
41
44
|
<strong>To find by multiple terms:</strong>
|
|
42
|
-
Searching for
|
|
45
|
+
Searching for
|
|
46
|
+
<code>nerve, vagus</code>
|
|
47
|
+
will find data that contains either
|
|
48
|
+
<code>nerve</code>
|
|
49
|
+
OR
|
|
50
|
+
<code>vagus</code>
|
|
51
|
+
.
|
|
43
52
|
</li>
|
|
44
53
|
</ul>
|
|
45
54
|
</div>
|
|
46
55
|
</el-popover>
|
|
47
56
|
</div>
|
|
48
|
-
<el-button
|
|
49
|
-
type="primary"
|
|
50
|
-
class="button"
|
|
51
|
-
@click="searchEvent"
|
|
52
|
-
size="large"
|
|
53
|
-
>
|
|
57
|
+
<el-button type="primary" class="button" @click="searchEvent" size="large">
|
|
54
58
|
Search
|
|
55
59
|
</el-button>
|
|
56
|
-
<el-button
|
|
57
|
-
link
|
|
58
|
-
class="el-button-link"
|
|
59
|
-
@click="onResetClick"
|
|
60
|
-
size="large"
|
|
61
|
-
>
|
|
62
|
-
Reset
|
|
63
|
-
</el-button>
|
|
60
|
+
<el-button link class="el-button-link" @click="onResetClick" size="large">Reset</el-button>
|
|
64
61
|
</div>
|
|
65
62
|
</template>
|
|
66
63
|
<SearchFilters
|
|
@@ -106,40 +103,31 @@
|
|
|
106
103
|
</template>
|
|
107
104
|
|
|
108
105
|
<script>
|
|
109
|
-
/* eslint-disable no-alert, no-console */
|
|
110
|
-
import {
|
|
111
|
-
ElButton as Button,
|
|
112
|
-
ElCard as Card,
|
|
113
|
-
ElDrawer as Drawer,
|
|
114
|
-
ElIcon as Icon,
|
|
115
|
-
ElInput as Input,
|
|
116
|
-
ElPagination as Pagination,
|
|
117
|
-
ElMessage as Message,
|
|
118
|
-
} from 'element-plus'
|
|
119
106
|
import 'element-plus/es/components/message/style/css';
|
|
120
|
-
import
|
|
121
|
-
import
|
|
122
|
-
import
|
|
123
|
-
import
|
|
107
|
+
import { ElMessage } from 'element-plus';
|
|
108
|
+
import SearchFilters from './SearchFilters.vue';
|
|
109
|
+
import SearchHistory from './SearchHistory.vue';
|
|
110
|
+
import DatasetCard from './DatasetCard.vue';
|
|
111
|
+
import EventBus from './EventBus.js';
|
|
124
112
|
|
|
125
|
-
import { AlgoliaClient } from '../algolia/algolia.js'
|
|
126
|
-
import { getFilters, facetPropPathMapping } from '../algolia/utils.js'
|
|
127
|
-
import { markRaw } from 'vue'
|
|
128
|
-
import { MapSvgIcon
|
|
113
|
+
import { AlgoliaClient } from '../algolia/algolia.js';
|
|
114
|
+
import { getFilters, facetPropPathMapping } from '../algolia/utils.js';
|
|
115
|
+
import { markRaw } from 'vue';
|
|
116
|
+
import { MapSvgIcon } from '@abi-software/svg-sprite';
|
|
129
117
|
|
|
130
118
|
// handleErrors: A custom fetch error handler to recieve messages from the server
|
|
131
119
|
// even when an error is found
|
|
132
120
|
var handleErrors = async function (response) {
|
|
133
121
|
if (!response.ok) {
|
|
134
|
-
let parse = await response.json()
|
|
122
|
+
let parse = await response.json();
|
|
135
123
|
if (parse) {
|
|
136
|
-
throw new Error(parse.message)
|
|
124
|
+
throw new Error(parse.message);
|
|
137
125
|
} else {
|
|
138
|
-
throw new Error(response)
|
|
126
|
+
throw new Error(response);
|
|
139
127
|
}
|
|
140
128
|
}
|
|
141
|
-
return response
|
|
142
|
-
}
|
|
129
|
+
return response;
|
|
130
|
+
};
|
|
143
131
|
|
|
144
132
|
var initial_state = {
|
|
145
133
|
searchInput: '',
|
|
@@ -154,21 +142,14 @@ var initial_state = {
|
|
|
154
142
|
start: 0,
|
|
155
143
|
hasSearched: false,
|
|
156
144
|
contextCardEnabled: false,
|
|
157
|
-
}
|
|
145
|
+
};
|
|
158
146
|
|
|
159
147
|
export default {
|
|
160
148
|
components: {
|
|
161
149
|
SearchFilters,
|
|
162
150
|
DatasetCard,
|
|
163
151
|
SearchHistory,
|
|
164
|
-
Button,
|
|
165
|
-
Card,
|
|
166
|
-
Drawer,
|
|
167
|
-
Icon,
|
|
168
|
-
Input,
|
|
169
|
-
Pagination,
|
|
170
152
|
MapSvgIcon,
|
|
171
|
-
MapSvgSpriteColor
|
|
172
153
|
},
|
|
173
154
|
name: 'DatasetExplorer',
|
|
174
155
|
props: {
|
|
@@ -199,7 +180,7 @@ export default {
|
|
|
199
180
|
display: 'flex',
|
|
200
181
|
},
|
|
201
182
|
cascaderIsReady: false,
|
|
202
|
-
}
|
|
183
|
+
};
|
|
203
184
|
},
|
|
204
185
|
computed: {
|
|
205
186
|
// This computed property populates filter data's entry object with $data from this sidebar
|
|
@@ -210,37 +191,37 @@ export default {
|
|
|
210
191
|
showFilters: true,
|
|
211
192
|
helper: {
|
|
212
193
|
within: "'heart' OR 'colon'",
|
|
213
|
-
between: "'rat' AND 'lung'"
|
|
214
|
-
}
|
|
215
|
-
}
|
|
194
|
+
between: "'rat' AND 'lung'",
|
|
195
|
+
},
|
|
196
|
+
};
|
|
216
197
|
},
|
|
217
198
|
},
|
|
218
199
|
methods: {
|
|
219
200
|
hoverChanged: function (data) {
|
|
220
|
-
const payload = data ? { ...data, tabType: 'dataset' } : { tabType: 'dataset' }
|
|
221
|
-
this.$emit('hover-changed', payload)
|
|
201
|
+
const payload = data ? { ...data, tabType: 'dataset' } : { tabType: 'dataset' };
|
|
202
|
+
this.$emit('hover-changed', payload);
|
|
222
203
|
},
|
|
223
204
|
resetSearch: function () {
|
|
224
|
-
this.numberOfHits = 0
|
|
225
|
-
this.discoverIds = []
|
|
226
|
-
this._dois = []
|
|
227
|
-
this.results = []
|
|
228
|
-
this.loadingCards = false
|
|
205
|
+
this.numberOfHits = 0;
|
|
206
|
+
this.discoverIds = [];
|
|
207
|
+
this._dois = [];
|
|
208
|
+
this.results = [];
|
|
209
|
+
this.loadingCards = false;
|
|
229
210
|
},
|
|
230
211
|
openSearch: function (filter, search = '') {
|
|
231
|
-
this.searchInput = search
|
|
232
|
-
this.resetPageNavigation()
|
|
212
|
+
this.searchInput = search;
|
|
213
|
+
this.resetPageNavigation();
|
|
233
214
|
//Proceed normally if cascader is ready
|
|
234
215
|
if (this.cascaderIsReady) {
|
|
235
216
|
const validatedFilters = this.$refs.filtersRef.getHierarchicalValidatedFilters(filter);
|
|
236
217
|
const notFoundItems = validatedFilters.notFound
|
|
237
|
-
? validatedFilters.notFound.filter(item => item.facet.toLowerCase() !== 'show all')
|
|
218
|
+
? validatedFilters.notFound.filter((item) => item.facet.toLowerCase() !== 'show all')
|
|
238
219
|
: [];
|
|
239
220
|
this.filter = validatedFilters.result;
|
|
240
221
|
|
|
241
222
|
// Show not found filter items warning message
|
|
242
223
|
notFoundItems.forEach((notFoundItem) => {
|
|
243
|
-
|
|
224
|
+
ElMessage({
|
|
244
225
|
message: `${notFoundItem.facet} cannot be found in ${notFoundItem.term}!`,
|
|
245
226
|
appendTo: this.$el,
|
|
246
227
|
showClose: true,
|
|
@@ -251,64 +232,58 @@ export default {
|
|
|
251
232
|
//Facets provided but cannot find at least one valid
|
|
252
233
|
//facet. Tell the users the search is invalid and reset
|
|
253
234
|
//facets check boxes.
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.filter &&
|
|
258
|
-
this.filter.length === 0
|
|
259
|
-
) {
|
|
260
|
-
this.$refs.filtersRef.checkShowAllBoxes()
|
|
261
|
-
this.resetSearch()
|
|
235
|
+
if (filter && filter.length > 0 && this.filter && this.filter.length === 0) {
|
|
236
|
+
this.$refs.filtersRef.checkShowAllBoxes();
|
|
237
|
+
this.resetSearch();
|
|
262
238
|
} else if (this.filter) {
|
|
263
|
-
this.searchAlgolia(this.filter, search)
|
|
264
|
-
this.$refs.filtersRef.setCascader(this.filter)
|
|
239
|
+
this.searchAlgolia(this.filter, search);
|
|
240
|
+
this.$refs.filtersRef.setCascader(this.filter);
|
|
265
241
|
this.searchHistoryUpdate(this.filter, search);
|
|
266
242
|
}
|
|
267
243
|
} else {
|
|
268
244
|
//cascader is not ready, perform search if no filter is set,
|
|
269
245
|
//otherwise waith for cascader to be ready
|
|
270
|
-
this.filter = filter
|
|
246
|
+
this.filter = filter;
|
|
271
247
|
if (!filter || filter.length == 0) {
|
|
272
|
-
this.searchAlgolia(this.filter, search)
|
|
248
|
+
this.searchAlgolia(this.filter, search);
|
|
273
249
|
this.searchHistoryUpdate(this.filter, search);
|
|
274
250
|
}
|
|
275
251
|
}
|
|
276
252
|
},
|
|
277
253
|
addFilter: function (filter) {
|
|
278
254
|
if (this.cascaderIsReady) {
|
|
279
|
-
this.resetPageNavigation()
|
|
255
|
+
this.resetPageNavigation();
|
|
280
256
|
if (filter) {
|
|
281
|
-
if (this.$refs.filtersRef.addFilters(filter))
|
|
282
|
-
this.$refs.filtersRef.initiateSearch()
|
|
257
|
+
if (this.$refs.filtersRef.addFilters(filter)) this.$refs.filtersRef.initiateSearch();
|
|
283
258
|
}
|
|
284
259
|
} else {
|
|
285
260
|
if (Array.isArray(this.filter)) {
|
|
286
|
-
this.filter.push(...filter)
|
|
261
|
+
this.filter.push(...filter);
|
|
287
262
|
} else {
|
|
288
|
-
this.filter = [...filter]
|
|
263
|
+
this.filter = [...filter];
|
|
289
264
|
}
|
|
290
265
|
}
|
|
291
266
|
},
|
|
292
267
|
cascaderReady: function () {
|
|
293
|
-
this.cascaderIsReady = true
|
|
294
|
-
this.openSearch(this.filter, this.searchInput)
|
|
268
|
+
this.cascaderIsReady = true;
|
|
269
|
+
this.openSearch(this.filter, this.searchInput);
|
|
295
270
|
},
|
|
296
271
|
clearSearchClicked: function () {
|
|
297
272
|
this.searchInput = '';
|
|
298
273
|
this.searchAndFilterUpdate();
|
|
299
274
|
},
|
|
300
275
|
onResetClick: function () {
|
|
301
|
-
this.openSearch([], '')
|
|
276
|
+
this.openSearch([], '');
|
|
302
277
|
this.$emit('search-changed', {
|
|
303
278
|
value: this.searchInput,
|
|
304
279
|
tabType: 'dataset',
|
|
305
280
|
type: 'reset-update',
|
|
306
|
-
})
|
|
281
|
+
});
|
|
307
282
|
|
|
308
283
|
EventBus.emit('trackEvent', {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
284
|
+
event_name: `portal_maps_action_filter`,
|
|
285
|
+
category: `reset`,
|
|
286
|
+
location: 'map_sidebar_dataset',
|
|
312
287
|
});
|
|
313
288
|
},
|
|
314
289
|
searchEvent: function (event = false) {
|
|
@@ -318,13 +293,13 @@ export default {
|
|
|
318
293
|
}
|
|
319
294
|
},
|
|
320
295
|
filterUpdate: function (filters) {
|
|
321
|
-
this.filter = [...filters]
|
|
296
|
+
this.filter = [...filters];
|
|
322
297
|
this.searchAndFilterUpdate();
|
|
323
298
|
this.$emit('search-changed', {
|
|
324
299
|
value: filters,
|
|
325
|
-
tabType:
|
|
300
|
+
tabType: 'dataset',
|
|
326
301
|
type: 'filter-update',
|
|
327
|
-
})
|
|
302
|
+
});
|
|
328
303
|
},
|
|
329
304
|
searchAndFilterUpdate: function () {
|
|
330
305
|
this.resetPageNavigation();
|
|
@@ -340,130 +315,121 @@ export default {
|
|
|
340
315
|
},
|
|
341
316
|
searchAlgolia(filters, query = '') {
|
|
342
317
|
// Algolia search
|
|
343
|
-
this.loadingCards = true
|
|
344
|
-
this.algoliaClient
|
|
345
|
-
|
|
346
|
-
.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
EventBus.emit('number-of-datasets-for-anatomies', r.forScaffold)
|
|
350
|
-
})
|
|
318
|
+
this.loadingCards = true;
|
|
319
|
+
this.algoliaClient.anatomyInSearch(getFilters(filters), query).then((r) => {
|
|
320
|
+
// Send result anatomy to the scaffold and flatmap
|
|
321
|
+
EventBus.emit('anatomy-in-datasets', r.forFlatmap);
|
|
322
|
+
EventBus.emit('number-of-datasets-for-anatomies', r.forScaffold);
|
|
323
|
+
});
|
|
351
324
|
this.algoliaClient
|
|
352
325
|
.search(getFilters(filters), query, this.numberPerPage, this.page)
|
|
353
326
|
.then((searchData) => {
|
|
354
|
-
this.numberOfHits = searchData.total
|
|
355
|
-
this.discoverIds = searchData.discoverIds
|
|
356
|
-
this._dois = searchData.dois
|
|
357
|
-
this.results = searchData.items
|
|
358
|
-
this.loadingCards = false
|
|
359
|
-
this.scrollToTop()
|
|
327
|
+
this.numberOfHits = searchData.total;
|
|
328
|
+
this.discoverIds = searchData.discoverIds;
|
|
329
|
+
this._dois = searchData.dois;
|
|
330
|
+
this.results = searchData.items;
|
|
331
|
+
this.loadingCards = false;
|
|
332
|
+
this.scrollToTop();
|
|
360
333
|
this.$emit('search-changed', {
|
|
361
334
|
value: this.searchInput,
|
|
362
|
-
tabType:
|
|
335
|
+
tabType: 'dataset',
|
|
363
336
|
type: 'query-update',
|
|
364
|
-
})
|
|
365
|
-
if (this._abortController) this._abortController.abort()
|
|
366
|
-
this._abortController = new AbortController()
|
|
367
|
-
const signal = this._abortController.signal
|
|
337
|
+
});
|
|
338
|
+
if (this._abortController) this._abortController.abort();
|
|
339
|
+
this._abortController = new AbortController();
|
|
340
|
+
const signal = this._abortController.signal;
|
|
368
341
|
//Search ongoing, let the current flow progress
|
|
369
|
-
this.perItemSearch(signal, { count: 0 })
|
|
370
|
-
})
|
|
342
|
+
this.perItemSearch(signal, { count: 0 });
|
|
343
|
+
});
|
|
371
344
|
},
|
|
372
345
|
filtersLoading: function (val) {
|
|
373
|
-
this.loadingCards = val
|
|
346
|
+
this.loadingCards = val;
|
|
374
347
|
},
|
|
375
348
|
numberPerPageUpdate: function (val) {
|
|
376
|
-
this.numberPerPage = val
|
|
349
|
+
this.numberPerPage = val;
|
|
377
350
|
|
|
378
351
|
EventBus.emit('trackEvent', {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
352
|
+
event_name: `portal_maps_dataset_perPage`,
|
|
353
|
+
category: val + '',
|
|
354
|
+
location: 'map_sidebar_dataset',
|
|
382
355
|
});
|
|
383
356
|
|
|
384
357
|
const preventPaginationTracking = this.page === 1;
|
|
385
|
-
this.pageChange(1, preventPaginationTracking)
|
|
358
|
+
this.pageChange(1, preventPaginationTracking);
|
|
386
359
|
},
|
|
387
360
|
pageChange: function (page, preventPaginationTracking = false) {
|
|
388
|
-
this.start = (page - 1) * this.numberPerPage
|
|
389
|
-
this.page = page
|
|
390
|
-
this.searchAlgolia(
|
|
391
|
-
this.filter,
|
|
392
|
-
this.searchInput,
|
|
393
|
-
this.numberPerPage,
|
|
394
|
-
this.page
|
|
395
|
-
)
|
|
361
|
+
this.start = (page - 1) * this.numberPerPage;
|
|
362
|
+
this.page = page;
|
|
363
|
+
this.searchAlgolia(this.filter, this.searchInput, this.numberPerPage, this.page);
|
|
396
364
|
|
|
397
365
|
if (!preventPaginationTracking) {
|
|
398
366
|
EventBus.emit('trackEvent', {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
367
|
+
event_name: `portal_maps_dataset_pagination`,
|
|
368
|
+
category: `page_${this.page}`,
|
|
369
|
+
location: 'map_sidebar_dataset',
|
|
402
370
|
});
|
|
403
371
|
}
|
|
404
372
|
},
|
|
405
373
|
handleMissingData: function (doi) {
|
|
406
|
-
let i = this.results.findIndex((res) => res.doi === doi)
|
|
407
|
-
if (this.results[i]) this.results[i].detailsReady = true
|
|
374
|
+
let i = this.results.findIndex((res) => res.doi === doi);
|
|
375
|
+
if (this.results[i]) this.results[i].detailsReady = true;
|
|
408
376
|
},
|
|
409
377
|
perItemSearch: function (signal, data) {
|
|
410
378
|
//Maximum 10 downloads at once to prevent long waiting time
|
|
411
379
|
//between unfinished search and new search
|
|
412
|
-
const maxDownloads = 10
|
|
380
|
+
const maxDownloads = 10;
|
|
413
381
|
if (maxDownloads > data.count) {
|
|
414
|
-
const doi = this._dois.shift()
|
|
382
|
+
const doi = this._dois.shift();
|
|
415
383
|
if (doi) {
|
|
416
|
-
data.count
|
|
384
|
+
data.count++;
|
|
417
385
|
this.callSciCrunch(this.envVars.API_LOCATION, { dois: [doi] }, signal)
|
|
418
386
|
.then((result) => {
|
|
419
|
-
if (result.numberOfHits === 0) this.handleMissingData(doi)
|
|
420
|
-
else this.resultsProcessing(result)
|
|
421
|
-
this.$refs.content.style['overflow-y'] = 'scroll'
|
|
422
|
-
data.count
|
|
387
|
+
if (result.numberOfHits === 0) this.handleMissingData(doi);
|
|
388
|
+
else this.resultsProcessing(result);
|
|
389
|
+
this.$refs.content.style['overflow-y'] = 'scroll';
|
|
390
|
+
data.count--;
|
|
423
391
|
//Async::Download finished, get the next one
|
|
424
|
-
this.perItemSearch(signal, data)
|
|
392
|
+
this.perItemSearch(signal, data);
|
|
425
393
|
})
|
|
426
394
|
.catch((result) => {
|
|
427
395
|
if (result.name !== 'AbortError') {
|
|
428
|
-
this.handleMissingData(doi)
|
|
429
|
-
data.count
|
|
396
|
+
this.handleMissingData(doi);
|
|
397
|
+
data.count--;
|
|
430
398
|
//Async::Download not aborted, get the next one
|
|
431
|
-
this.perItemSearch(signal, data)
|
|
399
|
+
this.perItemSearch(signal, data);
|
|
432
400
|
}
|
|
433
|
-
})
|
|
401
|
+
});
|
|
434
402
|
//Check and make another request until it gets to max downloads
|
|
435
|
-
this.perItemSearch(signal, data)
|
|
403
|
+
this.perItemSearch(signal, data);
|
|
436
404
|
}
|
|
437
405
|
}
|
|
438
406
|
},
|
|
439
407
|
scrollToTop: function () {
|
|
440
408
|
if (this.$refs.content) {
|
|
441
|
-
this.$refs.content.scroll({ top: 0, behavior: 'smooth' })
|
|
409
|
+
this.$refs.content.scroll({ top: 0, behavior: 'smooth' });
|
|
442
410
|
}
|
|
443
411
|
},
|
|
444
412
|
resetPageNavigation: function () {
|
|
445
|
-
this.start = 0
|
|
446
|
-
this.page = 1
|
|
413
|
+
this.start = 0;
|
|
414
|
+
this.page = 1;
|
|
447
415
|
},
|
|
448
416
|
resultsProcessing: function (data) {
|
|
449
|
-
this.lastSearch = this.searchInput
|
|
417
|
+
this.lastSearch = this.searchInput;
|
|
450
418
|
|
|
451
419
|
if (data.results.length === 0) {
|
|
452
|
-
return
|
|
420
|
+
return;
|
|
453
421
|
}
|
|
454
422
|
data.results.forEach((element) => {
|
|
455
423
|
// match the scicrunch result with algolia result
|
|
456
424
|
let i = this.results.findIndex((res) =>
|
|
457
|
-
element.doi ? element.doi.includes(res.doi) : false
|
|
458
|
-
)
|
|
425
|
+
element.doi ? element.doi.includes(res.doi) : false,
|
|
426
|
+
);
|
|
459
427
|
// Assign scicrunch results to the object
|
|
460
|
-
Object.assign(this.results[i], element)
|
|
428
|
+
Object.assign(this.results[i], element);
|
|
461
429
|
// Assign the attributes that need some processing
|
|
462
430
|
Object.assign(this.results[i], {
|
|
463
431
|
numberSamples: element.sampleSize ? parseInt(element.sampleSize) : 0,
|
|
464
|
-
numberSubjects: element.subjectSize
|
|
465
|
-
? parseInt(element.subjectSize)
|
|
466
|
-
: 0,
|
|
432
|
+
numberSubjects: element.subjectSize ? parseInt(element.subjectSize) : 0,
|
|
467
433
|
updated:
|
|
468
434
|
(element.updated && element.updated.length) > 0
|
|
469
435
|
? element.updated[0].timestamp.split('T')[0]
|
|
@@ -478,13 +444,7 @@ export default {
|
|
|
478
444
|
: undefined,
|
|
479
445
|
species: element.organisms
|
|
480
446
|
? element.organisms[0].species
|
|
481
|
-
? [
|
|
482
|
-
...new Set(
|
|
483
|
-
element.organisms.map((v) =>
|
|
484
|
-
v.species ? v.species.name : null
|
|
485
|
-
)
|
|
486
|
-
),
|
|
487
|
-
]
|
|
447
|
+
? [...new Set(element.organisms.map((v) => (v.species ? v.species.name : null)))]
|
|
488
448
|
: undefined
|
|
489
449
|
: undefined, // This processing only includes each gender once into 'sexes'
|
|
490
450
|
scaffolds: element['abi-scaffold-metadata-file'],
|
|
@@ -500,55 +460,52 @@ export default {
|
|
|
500
460
|
? element['abi-contextual-information']
|
|
501
461
|
: undefined,
|
|
502
462
|
//omex format will be the preferred mimetype
|
|
503
|
-
simulation: element['abi-simulation-omex-file']
|
|
463
|
+
simulation: element['abi-simulation-omex-file']
|
|
464
|
+
? element['abi-simulation-omex-file']
|
|
465
|
+
: element['abi-simulation-file'],
|
|
504
466
|
flatmaps: element['abi-flatmap-file'],
|
|
505
467
|
additionalLinks: element.additionalLinks,
|
|
506
468
|
detailsReady: true,
|
|
507
|
-
})
|
|
508
|
-
})
|
|
469
|
+
});
|
|
470
|
+
});
|
|
509
471
|
},
|
|
510
472
|
createfilterParams: function (params) {
|
|
511
|
-
let p = new URLSearchParams()
|
|
473
|
+
let p = new URLSearchParams();
|
|
512
474
|
//Check if field is array or value
|
|
513
475
|
for (const key in params) {
|
|
514
476
|
if (Array.isArray(params[key])) {
|
|
515
477
|
params[key].forEach((e) => {
|
|
516
|
-
p.append(key, e)
|
|
517
|
-
})
|
|
478
|
+
p.append(key, e);
|
|
479
|
+
});
|
|
518
480
|
} else {
|
|
519
|
-
p.append(key, params[key])
|
|
481
|
+
p.append(key, params[key]);
|
|
520
482
|
}
|
|
521
483
|
}
|
|
522
|
-
return p.toString()
|
|
484
|
+
return p.toString();
|
|
523
485
|
},
|
|
524
486
|
callSciCrunch: function (apiLocation, params = {}, signal) {
|
|
525
487
|
return new Promise((resolve, reject) => {
|
|
526
488
|
// Add parameters if we are sent them
|
|
527
489
|
let fullEndpoint =
|
|
528
|
-
this.envVars.API_LOCATION +
|
|
529
|
-
this.searchEndpoint +
|
|
530
|
-
'?' +
|
|
531
|
-
this.createfilterParams(params)
|
|
490
|
+
this.envVars.API_LOCATION + this.searchEndpoint + '?' + this.createfilterParams(params);
|
|
532
491
|
fetch(fullEndpoint, { signal })
|
|
533
492
|
.then(handleErrors)
|
|
534
493
|
.then((response) => response.json())
|
|
535
494
|
.then((data) => resolve(data))
|
|
536
|
-
.catch((data) => reject(data))
|
|
537
|
-
})
|
|
495
|
+
.catch((data) => reject(data));
|
|
496
|
+
});
|
|
538
497
|
},
|
|
539
498
|
getAlgoliaFacets: async function () {
|
|
540
|
-
let facets = await this.algoliaClient.getAlgoliaFacets(
|
|
541
|
-
|
|
542
|
-
)
|
|
543
|
-
return facets
|
|
499
|
+
let facets = await this.algoliaClient.getAlgoliaFacets(facetPropPathMapping);
|
|
500
|
+
return facets;
|
|
544
501
|
},
|
|
545
502
|
searchHistorySearch: function (item) {
|
|
546
|
-
this.searchInput = item.search
|
|
547
|
-
this.filter = item.filters
|
|
503
|
+
this.searchInput = item.search;
|
|
504
|
+
this.filter = item.filters;
|
|
548
505
|
this.openSearch([...item.filters], item.search);
|
|
549
506
|
},
|
|
550
507
|
getSearch: function () {
|
|
551
|
-
return this.searchInput
|
|
508
|
+
return this.searchInput;
|
|
552
509
|
},
|
|
553
510
|
getFilters: function () {
|
|
554
511
|
const hasFilters = this.filter.some((f) => f.facet.toLowerCase() !== 'show all');
|
|
@@ -557,19 +514,21 @@ export default {
|
|
|
557
514
|
},
|
|
558
515
|
mounted: function () {
|
|
559
516
|
// initialise algolia
|
|
560
|
-
this.algoliaClient = markRaw(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
517
|
+
this.algoliaClient = markRaw(
|
|
518
|
+
new AlgoliaClient(
|
|
519
|
+
this.envVars.ALGOLIA_ID,
|
|
520
|
+
this.envVars.ALGOLIA_KEY,
|
|
521
|
+
this.envVars.PENNSIEVE_API_LOCATION,
|
|
522
|
+
),
|
|
523
|
+
);
|
|
524
|
+
this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
|
|
525
|
+
this.openSearch(this.filter, this.searchInput);
|
|
567
526
|
},
|
|
568
527
|
created: function () {
|
|
569
528
|
//Create non-reactive local variables
|
|
570
|
-
this.searchEndpoint = 'dataset_info/using_multiple_dois/'
|
|
529
|
+
this.searchEndpoint = 'dataset_info/using_multiple_dois/';
|
|
571
530
|
},
|
|
572
|
-
}
|
|
531
|
+
};
|
|
573
532
|
</script>
|
|
574
533
|
|
|
575
534
|
<style lang="scss" scoped>
|
|
@@ -580,7 +539,7 @@ export default {
|
|
|
580
539
|
position: relative;
|
|
581
540
|
|
|
582
541
|
&::before {
|
|
583
|
-
content:
|
|
542
|
+
content: '';
|
|
584
543
|
display: block;
|
|
585
544
|
width: calc(100% - 15px);
|
|
586
545
|
height: 100%;
|