@abi-software/map-side-bar 2.14.1-demo.0 → 2.14.1-simulation.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/dist/map-side-bar.js +4233 -4199
- package/dist/map-side-bar.umd.cjs +62 -62
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +1 -0
- package/src/components/DatasetCard.vue +7 -0
- package/src/components/DatasetExplorer.vue +22 -0
- package/src/components/ImageGallery.vue +48 -27
- package/src/components/SideBar.vue +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.14.1-
|
|
3
|
+
"version": "2.14.1-simulation.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@abi-software/gallery": "1.3.0",
|
|
47
|
-
"@abi-software/map-utilities": "
|
|
47
|
+
"@abi-software/map-utilities": "1.8.1",
|
|
48
48
|
"@abi-software/svg-sprite": "^1.0.2",
|
|
49
49
|
"@element-plus/icons-vue": "^2.3.1",
|
|
50
50
|
"algoliasearch": "^4.10.5",
|
package/src/App.vue
CHANGED
|
@@ -135,6 +135,7 @@ export default {
|
|
|
135
135
|
PENNSIEVE_API_LOCATION: import.meta.env.VITE_APP_PENNSIEVE_API_LOCATION,
|
|
136
136
|
BL_SERVER_URL: import.meta.env.VITE_APP_BL_SERVER_URL,
|
|
137
137
|
ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
|
|
138
|
+
TEST_DATA_LOCATION: import.meta.env.VITE_APP_TEST_DATA_LOCATION,
|
|
138
139
|
FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
|
|
139
140
|
},
|
|
140
141
|
connectivityEntry: [],
|
|
@@ -230,6 +230,9 @@ export default {
|
|
|
230
230
|
})
|
|
231
231
|
.then((data) => {
|
|
232
232
|
this.thumbnail = data.banner
|
|
233
|
+
if (this.entry.thumbnail) {
|
|
234
|
+
this.thumbnail = this.entry.thumbnail
|
|
235
|
+
}
|
|
233
236
|
this.discoverId = data.id
|
|
234
237
|
this.version = data.version
|
|
235
238
|
this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
|
|
@@ -239,6 +242,10 @@ export default {
|
|
|
239
242
|
.catch(() => {
|
|
240
243
|
//set defaults if we hit an error
|
|
241
244
|
this.thumbnail = MissingImage
|
|
245
|
+
if (this.entry.thumbnail) {
|
|
246
|
+
const resolved = new URL(this.entry.thumbnail, this.envVars.TEST_DATA_LOCATION);
|
|
247
|
+
this.thumbnail = resolved.href;
|
|
248
|
+
}
|
|
242
249
|
this.discoverId = Number(this.entry.datasetId)
|
|
243
250
|
this.loading = false
|
|
244
251
|
})
|
|
@@ -406,6 +406,23 @@ export default {
|
|
|
406
406
|
let i = this.results.findIndex((res) => res.doi === doi)
|
|
407
407
|
if (this.results[i]) this.results[i].detailsReady = true
|
|
408
408
|
},
|
|
409
|
+
readTestData: function () {
|
|
410
|
+
const endpoint = this.envVars.TEST_DATA_LOCATION
|
|
411
|
+
if (endpoint) {
|
|
412
|
+
fetch(endpoint)
|
|
413
|
+
.then(response => {
|
|
414
|
+
if (!response.ok) {
|
|
415
|
+
throw new Error(`Cannot download test data from server: ${response.status}`)
|
|
416
|
+
}
|
|
417
|
+
return response.json()
|
|
418
|
+
})
|
|
419
|
+
.then((data) => {
|
|
420
|
+
if (this.searchInput.toLowerCase().includes("reveal")) {
|
|
421
|
+
this.results.unshift(...data)
|
|
422
|
+
}
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
},
|
|
409
426
|
perItemSearch: function (signal, data) {
|
|
410
427
|
//Maximum 10 downloads at once to prevent long waiting time
|
|
411
428
|
//between unfinished search and new search
|
|
@@ -434,6 +451,11 @@ export default {
|
|
|
434
451
|
//Check and make another request until it gets to max downloads
|
|
435
452
|
this.perItemSearch(signal, data)
|
|
436
453
|
}
|
|
454
|
+
} else {
|
|
455
|
+
//Do some post downloading hacking
|
|
456
|
+
if (this.searchInput.toLowerCase().includes("reveal")) {
|
|
457
|
+
this.readTestData();
|
|
458
|
+
}
|
|
437
459
|
}
|
|
438
460
|
},
|
|
439
461
|
scrollToTop: function () {
|
|
@@ -25,10 +25,15 @@ const baseName = (str) => {
|
|
|
25
25
|
return str.split('\\').pop().split('/').pop()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const capitalise =
|
|
28
|
+
const capitalise = (string) => {
|
|
29
29
|
return string.replace(/\b\w/g, (v) => v.toUpperCase())
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const resolveURL = (relative, base) => {
|
|
33
|
+
const resolved = new URL(relative, base);
|
|
34
|
+
return resolved.href;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js'
|
|
33
38
|
import Gallery from "@abi-software/gallery";
|
|
34
39
|
import "@abi-software/gallery/dist/style.css";
|
|
@@ -145,20 +150,26 @@ export default {
|
|
|
145
150
|
if (flatmap.associated_flatmap?.identifier) {
|
|
146
151
|
const filePath = flatmap.dataset.path
|
|
147
152
|
const id = flatmap.identifier
|
|
148
|
-
const thumbnail = this.getThumbnailForPlot(
|
|
149
|
-
flatmap,
|
|
150
|
-
this.entry.thumbnails
|
|
151
|
-
)
|
|
152
153
|
let thumbnailURL = undefined
|
|
154
|
+
if (flatmap.thumbnail?.url) {
|
|
155
|
+
thumbnailURL = resolveURL(flatmap.thumbnail.url,
|
|
156
|
+
this.envVars.TEST_DATA_LOCATION)
|
|
157
|
+
}
|
|
153
158
|
let mimetype = ''
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
if (!thumbnailURL) {
|
|
160
|
+
let thumbnail = this.getThumbnailForPlot(
|
|
161
|
+
flatmap,
|
|
162
|
+
this.entry.thumbnails
|
|
163
|
+
)
|
|
164
|
+
if (thumbnail) {
|
|
165
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
166
|
+
id,
|
|
167
|
+
prefix: this.getS3Prefix(),
|
|
168
|
+
file_path: thumbnail.dataset.path,
|
|
169
|
+
s3Bucket: this.s3Bucket,
|
|
170
|
+
})
|
|
171
|
+
mimetype = thumbnail.mimetype.name
|
|
172
|
+
}
|
|
162
173
|
}
|
|
163
174
|
let action = {
|
|
164
175
|
label: capitalise(this.label),
|
|
@@ -343,22 +354,32 @@ export default {
|
|
|
343
354
|
const id = simulation.identifier
|
|
344
355
|
//Despite of the name, this method can be used to retreive
|
|
345
356
|
//the thumbnail information for any none scaffold type thumbnail
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
let thumbnailURL = undefined;
|
|
358
|
+
if (simulation.thumbnail?.url) {
|
|
359
|
+
thumbnailURL = resolveURL(simulation.thumbnail.url,
|
|
360
|
+
this.envVars.TEST_DATA_LOCATION)
|
|
361
|
+
}
|
|
351
362
|
let mimetype = ''
|
|
352
|
-
if (
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
363
|
+
if (!thumbnailURL) {
|
|
364
|
+
const thumbnail = this.getThumbnailForPlot(
|
|
365
|
+
simulation,
|
|
366
|
+
this.entry.thumbnails
|
|
367
|
+
)
|
|
368
|
+
if (thumbnail) {
|
|
369
|
+
thumbnailURL = this.getImageURL(this.envVars.API_LOCATION, {
|
|
370
|
+
id,
|
|
371
|
+
prefix: this.getS3Prefix(),
|
|
372
|
+
file_path: thumbnail.dataset.path,
|
|
373
|
+
s3Bucket: this.s3Bucket,
|
|
374
|
+
})
|
|
375
|
+
mimetype = thumbnail.mimetype.name
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
let resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`
|
|
379
|
+
if (simulation.resource?.url) {
|
|
380
|
+
resource = resolveURL(simulation.resource.url,
|
|
381
|
+
this.envVars.TEST_DATA_LOCATION)
|
|
360
382
|
}
|
|
361
|
-
const resource = `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${filePath}${this.getS3Args()}`
|
|
362
383
|
let action = {
|
|
363
384
|
label: capitalise(this.label),
|
|
364
385
|
resource: resource,
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
:connectivityEntry="connectivityEntry"
|
|
54
54
|
:availableAnatomyFacets="availableAnatomyFacets"
|
|
55
55
|
:showLongLabel="showLongLabel"
|
|
56
|
-
:connectivityFilterOptions="filterOptions"
|
|
57
56
|
@filter-visibility="$emit('filter-visibility', $event)"
|
|
57
|
+
:connectivityFilterOptions="filterOptions"
|
|
58
58
|
:showVisibilityFilter="showVisibilityFilter"
|
|
59
59
|
@search-changed="searchChanged(tab.id, $event)"
|
|
60
60
|
@hover-changed="hoverChanged(tab.id, $event)"
|