@abi-software/map-side-bar 1.2.3 → 1.3.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.
@@ -24,11 +24,9 @@
24
24
  <div class="content scrollbar" v-loading="loadingCards" ref="content">
25
25
  <div
26
26
  class="error-feedback"
27
- v-if="results.length === 0 && !loadingCards && !sciCrunchError"
27
+ v-if="results.length === 0 && !loadingCards"
28
28
  >No results found - Please change your search / filter criteria.</div>
29
- <div class="error-feedback" v-if="sciCrunchError">{{sciCrunchError}}</div>
30
- <div v-if="loadingScicrunch" class="loading-icon" v-loading="loadingScicrunch"></div>
31
- <div v-for="result in results" :key="result.id" class="step-item">
29
+ <div v-for="result in results" :key="result.doi" class="step-item">
32
30
  <DatasetCard :entry="result" :envVars="envVars" @contextUpdate="contextCardUpdate"></DatasetCard>
33
31
  </div>
34
32
  <el-pagination
@@ -102,10 +100,8 @@ var initial_state = {
102
100
  pageModel: 1,
103
101
  start: 0,
104
102
  hasSearched: false,
105
- sciCrunchError: false,
106
103
  contextCardEntry: undefined,
107
104
  contextCardEnabled: true,
108
- loadingScicrunch: false,
109
105
  };
110
106
 
111
107
  export default {
@@ -194,13 +190,21 @@ export default {
194
190
  },
195
191
  searchAlgolia(filters, query=''){
196
192
  // Algolia search
193
+ this.loadingCards = true
197
194
  this.algoliaClient.search(getFilters(filters), query, this.numberPerPage, this.page).then(searchData => {
198
195
  this.numberOfHits = searchData.total
199
196
  this.discoverIds = searchData.discoverIds
200
- this.dois = searchData.dois
197
+ this._dois = searchData.dois
201
198
  this.results = searchData.items
202
199
  this.loadingCards = false
203
- this.searchSciCrunch({'dois': this.dois})
200
+ this.scrollToTop()
201
+ this.$emit("search-changed", { value: this.searchInput, type: "query-update" })
202
+ if (this._abortController)
203
+ this._abortController.abort()
204
+ this._abortController = new AbortController()
205
+ const signal = this._abortController.signal
206
+ //Search ongoing, let the current flow progress
207
+ this.perItemSearch(signal, { count: 0 })
204
208
  })
205
209
  },
206
210
  filtersLoading: function (val) {
@@ -215,27 +219,42 @@ export default {
215
219
  this.page = page
216
220
  this.searchAlgolia(this.filters, this.searchInput, this.numberPerPage, this.page)
217
221
  },
218
- searchSciCrunch: function(params) {
219
- this.loadingScicrunch = true
220
- this.scrollToTop();
221
- this.$emit("search-changed", { value: this.searchInput, type: "query-update" });
222
- this.callSciCrunch(this.envVars.API_LOCATION, params)
223
- .then(result => {
224
- //Only process if the search term is the same as the last search term.
225
- //This avoid old search being displayed.
226
- this.sciCrunchError = false;
227
- this.resultsProcessing(result);
228
- this.$refs.content.style["overflow-y"] = "scroll";
229
- this.loadingCards = false;
230
- this.loadingScicrunch = false
231
- })
232
- .catch(result => {
233
- if (result.name !== 'AbortError') {
234
- this.loadingCards = false;
235
- this.loadingScicrunch = false
236
- this.sciCrunchError = result.message;
237
- }
238
- })
222
+ handleMissingData: function(doi) {
223
+ let i = this.results.findIndex(res=> res.doi === doi)
224
+ if (this.results[i])
225
+ this.results[i].detailsReady = true;
226
+ },
227
+ perItemSearch: function(signal, data) {
228
+ //Maximum 10 downloads at once to prevent long waiting time
229
+ //between unfinished search and new search
230
+ const maxDownloads = 10;
231
+ if (maxDownloads > data.count) {
232
+ const doi = this._dois.shift();
233
+ if (doi) {
234
+ data.count++;
235
+ this.callSciCrunch(this.envVars.API_LOCATION, {'dois': [doi]}, signal)
236
+ .then(result => {
237
+ if (result.numberOfHits === 0)
238
+ this.handleMissingData(doi);
239
+ else
240
+ this.resultsProcessing(result);
241
+ this.$refs.content.style["overflow-y"] = "scroll";
242
+ data.count--;
243
+ //Async::Download finished, get the next one
244
+ this.perItemSearch(signal, data);
245
+ })
246
+ .catch(result => {
247
+ if (result.name !== 'AbortError') {
248
+ this.handleMissingData(doi);
249
+ data.count--;
250
+ //Async::Download not aborted, get the next one
251
+ this.perItemSearch(signal, data);
252
+ }
253
+ });
254
+ //Check and make another request until it gets to max downloads
255
+ this.perItemSearch(signal, data);
256
+ }
257
+ }
239
258
  },
240
259
  scrollToTop: function() {
241
260
  if (this.$refs.content) {
@@ -253,14 +272,10 @@ export default {
253
272
  return;
254
273
  }
255
274
  data.results.forEach(element => {
256
-
257
275
  // match the scicrunch result with algolia result
258
276
  let i = this.results.findIndex(res=> res.name === element.name)
259
-
260
-
261
277
  // Assign scicrunch results to the object
262
278
  Object.assign(this.results[i], element)
263
-
264
279
  // Assign the attributes that need some processing
265
280
  Object.assign(this.results[i],{
266
281
  numberSamples: element.sampleSize
@@ -271,7 +286,9 @@ export default {
271
286
  : 0,
272
287
  updated: element.updated[0].timestamp.split("T")[0],
273
288
  url: element.uri[0],
274
- datasetId: element.identifier,
289
+ datasetId: element.dataset_identifier,
290
+ datasetRevision: element.dataset_revision,
291
+ datasetVersion: element.dataset_version,
275
292
  organs: (element.organs && element.organs.length > 0)
276
293
  ? [...new Set(element.organs.map(v => v.name))]
277
294
  : undefined,
@@ -280,11 +297,18 @@ export default {
280
297
  ? [...new Set(element.organisms.map((v) =>v.species ? v.species.name : null))]
281
298
  : undefined
282
299
  : undefined, // This processing only includes each gender once into 'sexes'
283
- scaffolds: element['abi-scaffold-metadata-file'] ? element['abi-scaffold-metadata-file'] : undefined,
300
+ scaffolds: element['abi-scaffold-metadata-file'],
301
+ thumbnails: element['abi-thumbnail'] ? element['abi-thumbnail']: element['abi-scaffold-thumbnail'],
302
+ scaffoldViews: element['abi-scaffold-view-file'],
303
+ videos: element.video,
304
+ plots: element['abi-plot'],
305
+ images: element['common-images'],
284
306
  contextualInformation: element['abi-contextual-information'].length > 0 ? element['abi-contextual-information'] : undefined,
307
+ segmentation: element['mbf-segmentation'],
285
308
  simulation: element['abi-simulation-file'],
286
- });
287
-
309
+ additionalLinks: element.additionalLinks,
310
+ detailsReady: true,
311
+ })
288
312
  Vue.set(this.results, i, this.results[i])
289
313
  });
290
314
  },
@@ -302,28 +326,22 @@ export default {
302
326
  }
303
327
  return p.toString();
304
328
  },
305
- callSciCrunch: function(apiLocation, params = {}) {
329
+ callSciCrunch: function(apiLocation, params = {}, signal) {
306
330
  return new Promise((resolve, reject) => {
307
- // the following controller will abort current search
308
- // if a new one has been started
309
- if (this._controller) this._controller.abort();
310
- this._controller = new AbortController();
311
- let signal = this._controller.signal;
312
331
  // Add parameters if we are sent them
313
332
  let fullEndpoint = this.envVars.API_LOCATION + this.searchEndpoint + "?" + this.createfilterParams(params);
314
- fetch(fullEndpoint, { signal })
333
+ fetch(fullEndpoint, {signal})
315
334
  .then(handleErrors)
316
335
  .then(response => response.json())
317
336
  .then(data => resolve(data))
318
337
  .catch(data => reject(data));
319
338
  });
320
- }
339
+ },
321
340
  },
322
341
  mounted: function() {
323
342
  // initialise algolia
324
343
  this.algoliaClient = new AlgoliaClient(this.envVars.ALGOLIA_ID, this.envVars.ALGOLIA_KEY, this.envVars.PENNSIEVE_API_LOCATION);
325
344
  this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
326
- console.log('Algolia initialised in sidebar')
327
345
 
328
346
  // temporarily disable flatmap search since there are no datasets
329
347
  if (this.firstSearch === "Flatmap" || this.firstSearch === "flatmap") {
@@ -378,20 +396,6 @@ export default {
378
396
  text-align: center;
379
397
  }
380
398
 
381
- .loading-icon {
382
- position: absolute;
383
- display: flex;
384
- float: right;
385
- right: 40px;
386
- z-index: 20;
387
- width: 40px;
388
- height: 40px;
389
- }
390
-
391
- .loading-icon >>> .el-loading-mask {
392
- background-color: rgba(117, 190, 218, 0.0) !important;
393
- }
394
-
395
399
  .pagination >>> button {
396
400
  background-color: white !important;
397
401
  }
@@ -429,6 +433,21 @@ export default {
429
433
  scrollbar-width: thin;
430
434
  }
431
435
 
436
+ .content >>> .el-loading-spinner .path {
437
+ stroke: #8300bf;
438
+ }
439
+
440
+ .content >>> .step-item:first-child .seperator-path{
441
+ display: none;
442
+ }
443
+
444
+ .content >>> .step-item:not(:first-child) .seperator-path{
445
+ width: 486px;
446
+ height: 0px;
447
+ border: solid 1px #e4e7ed;
448
+ background-color: #e4e7ed;
449
+ }
450
+
432
451
  .scrollbar::-webkit-scrollbar-track {
433
452
  border-radius: 10px;
434
453
  background-color: #f5f5f5;
@@ -1,29 +0,0 @@
1
- export default {
2
- 77: {
3
- version: 2, meta_file: 'integrated_metadata.json', contextCard: {
4
- title: "ICN fitted Scaffold",
5
- description: "Points are mapped to their positions on a 3d heart that is mapped to the data.",
6
- bannerImage: 'https://raw.githubusercontent.com/Tehsurfer/map-sidebar/tabs/assets/temp-pics/icn.png',
7
- keys: [{
8
- image: "https://raw.githubusercontent.com/Tehsurfer/map-sidebar/tabs/assets/temp-pics/orange.png",
9
- text: "ICN Subject 54-8"
10
- }, {
11
- image: "https://raw.githubusercontent.com/Tehsurfer/map-sidebar/tabs/assets/temp-pics/teal.png",
12
- text: "ICN Subject 54-5"
13
- }
14
- ]
15
- },
16
- },
17
- 76: { version: 2, meta_file: 'mouseColon_metadata.json' },
18
- 32: {
19
- version: 3, meta_file: 'mouse-heart-071020_metadata.json', contextCard: {
20
- title: "Neural paths mapped to a heart scaffold",
21
- description: "Points are mapped to their positions on a 3d heart that is mapped to the data.",
22
- bannerImage: 'https://raw.githubusercontent.com/Tehsurfer/map-sidebar/tabs/assets/temp-pics/aNIksBFARaKwlKhpnDCKbA.png',
23
- keys: [{
24
- image: "https://raw.githubusercontent.com/Tehsurfer/map-sidebar/tabs/assets/temp-pics/VqNcZ8fSQJu5TJEf9ahwvA.png",
25
- text: "Neural path"
26
- }],
27
- }
28
- }
29
- }