@abi-software/gallery 0.3.1 → 0.3.2-beta
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/.browserslistrc +3 -3
- package/.eslintrc.js +36 -31
- package/.prettierrc +6 -6
- package/LICENSE +201 -201
- package/Meeting-plan.txt +4 -0
- package/README.md +35 -35
- package/babel.config.js +12 -12
- package/dist/gallery.common.js +64 -61
- package/dist/gallery.common.js.map +1 -1
- package/dist/gallery.css +1 -1
- package/dist/gallery.umd.js +64 -61
- package/dist/gallery.umd.js.map +1 -1
- package/dist/gallery.umd.min.js +1 -1
- package/dist/gallery.umd.min.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +43 -43
- package/public/index.html +17 -17
- package/src/App.vue +28 -28
- package/src/components/Card.vue +324 -319
- package/src/components/Gallery.vue +250 -250
- package/src/components/IndexIndicator.vue +45 -45
- package/src/delete.json +39 -0
- package/src/index.js +2 -2
- package/src/main.js +2 -2
- package/src/mixins/GalleryHelpers.js +104 -104
- package/tests/unit/example.spec.js +12 -12
- package/vue.config.js +23 -23
- package/src/assets/data-icon.png +0 -0
- package/src/assets/flatmap-thumbnail.png +0 -0
- package/src/assets/scaffold-light.png +0 -0
- package/src/assets/video-default.png +0 -0
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
//this mixin is not used by this code base but it can be used by other
|
|
5
|
-
//projects to get a handle to various resources
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
defaultImg: require('../assets/logo-sparc-wave-primary.svg'),
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
methods: {
|
|
12
|
-
async getRequest(url, params, timeout) {
|
|
13
|
-
return await axios({
|
|
14
|
-
method: 'get',
|
|
15
|
-
url,
|
|
16
|
-
params,
|
|
17
|
-
timeout,
|
|
18
|
-
})
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* Returns a file path for S3.
|
|
22
|
-
* @param {String} dataset_id dataset id.
|
|
23
|
-
* @param {String} dataset_version dataset version.
|
|
24
|
-
* @param {String} file_path file path.
|
|
25
|
-
* @returns {String} full path to S3 file.
|
|
26
|
-
*/
|
|
27
|
-
getS3FilePath(dataset_id, dataset_version, file_path) {
|
|
28
|
-
const encoded_file_path = encodeURIComponent(file_path)
|
|
29
|
-
return `${dataset_id}/${dataset_version}/files/${encoded_file_path}`
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* Find data path in the array that matches the provide path
|
|
33
|
-
*/
|
|
34
|
-
findEntryWithPathInArray(array, path) {
|
|
35
|
-
if (path && array) {
|
|
36
|
-
for (let i = 0; i < array.length; i++) {
|
|
37
|
-
if (path === array[i].dataset.path) return array[i]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return undefined
|
|
41
|
-
},
|
|
42
|
-
getThumbnailForPlot(plot, thumbnails) {
|
|
43
|
-
if (thumbnails && plot) {
|
|
44
|
-
return this.findEntryWithPathInArray(thumbnails, plot.datacite.isSourceOf.path[0])
|
|
45
|
-
}
|
|
46
|
-
return undefined
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Use the scaffoldViews to help with finding the correct thumbnails.
|
|
50
|
-
* Use the index if the workflow stated above fails.
|
|
51
|
-
*/
|
|
52
|
-
getThumbnailForScaffold(scaffold, scaffoldViews, thumbnails, index) {
|
|
53
|
-
if (thumbnails && thumbnails.length > 0) {
|
|
54
|
-
let thumbnail = undefined
|
|
55
|
-
if (scaffold && scaffoldViews) {
|
|
56
|
-
const view = this.findEntryWithPathInArray(scaffoldViews, scaffold.datacite.isSourceOf.path[0])
|
|
57
|
-
if (view) {
|
|
58
|
-
thumbnail = this.findEntryWithPathInArray(thumbnails, view.datacite.isSourceOf.path[0])
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (thumbnail) {
|
|
62
|
-
return thumbnail
|
|
63
|
-
} else if (index < thumbnails.length) {
|
|
64
|
-
return thumbnails[index]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return undefined
|
|
68
|
-
},
|
|
69
|
-
getImageURLFromS3(apiEndpoint, info) {
|
|
70
|
-
return `${apiEndpoint}/s3-resource/${info.datasetId}/${info.datasetVersion}/files/${info.file_path}?encodeBase64=true`
|
|
71
|
-
},
|
|
72
|
-
getSegmentationThumbnailURL(apiEndpoint, info) {
|
|
73
|
-
let endpoint = `${apiEndpoint}/thumbnail/neurolucida`
|
|
74
|
-
endpoint = endpoint + `?datasetId=${info.datasetId}`
|
|
75
|
-
endpoint = endpoint + `&version=${info.datasetVersion}`
|
|
76
|
-
endpoint = endpoint + `&path=files/${info.segmentationFilePath}`
|
|
77
|
-
return endpoint
|
|
78
|
-
},
|
|
79
|
-
getThumbnailURLFromBiolucida(apiEndpoint, info) {
|
|
80
|
-
return `${apiEndpoint}/thumbnail/${info.id}`
|
|
81
|
-
},
|
|
82
|
-
getImageInfoFromBiolucida(apiEndpoint, items, info) {
|
|
83
|
-
const endpoint = `${apiEndpoint}/image/${info.id}`
|
|
84
|
-
const params = {}
|
|
85
|
-
this.getRequest(endpoint, params, 20000).then(
|
|
86
|
-
(response) => {
|
|
87
|
-
let item = items.find((x) => x.id === info.id)
|
|
88
|
-
const name = response.name
|
|
89
|
-
if (name) {
|
|
90
|
-
item.title = name
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
(reason) => {
|
|
94
|
-
if (reason.message.includes('timeout') && reason.message.includes('exceeded') && info.fetchAttempts < 3) {
|
|
95
|
-
info.fetchAttempts += 1
|
|
96
|
-
this.getImageInfoFromBiolucida(apiEndpoint, items, info)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return Promise.reject('Maximum iterations reached.')
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
}
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
//this mixin is not used by this code base but it can be used by other
|
|
5
|
+
//projects to get a handle to various resources
|
|
6
|
+
data() {
|
|
7
|
+
return {
|
|
8
|
+
defaultImg: require('../assets/logo-sparc-wave-primary.svg'),
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
async getRequest(url, params, timeout) {
|
|
13
|
+
return await axios({
|
|
14
|
+
method: 'get',
|
|
15
|
+
url,
|
|
16
|
+
params,
|
|
17
|
+
timeout,
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Returns a file path for S3.
|
|
22
|
+
* @param {String} dataset_id dataset id.
|
|
23
|
+
* @param {String} dataset_version dataset version.
|
|
24
|
+
* @param {String} file_path file path.
|
|
25
|
+
* @returns {String} full path to S3 file.
|
|
26
|
+
*/
|
|
27
|
+
getS3FilePath(dataset_id, dataset_version, file_path) {
|
|
28
|
+
const encoded_file_path = encodeURIComponent(file_path)
|
|
29
|
+
return `${dataset_id}/${dataset_version}/files/${encoded_file_path}`
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Find data path in the array that matches the provide path
|
|
33
|
+
*/
|
|
34
|
+
findEntryWithPathInArray(array, path) {
|
|
35
|
+
if (path && array) {
|
|
36
|
+
for (let i = 0; i < array.length; i++) {
|
|
37
|
+
if (path === array[i].dataset.path) return array[i]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined
|
|
41
|
+
},
|
|
42
|
+
getThumbnailForPlot(plot, thumbnails) {
|
|
43
|
+
if (thumbnails && plot) {
|
|
44
|
+
return this.findEntryWithPathInArray(thumbnails, plot.datacite.isSourceOf.path[0])
|
|
45
|
+
}
|
|
46
|
+
return undefined
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Use the scaffoldViews to help with finding the correct thumbnails.
|
|
50
|
+
* Use the index if the workflow stated above fails.
|
|
51
|
+
*/
|
|
52
|
+
getThumbnailForScaffold(scaffold, scaffoldViews, thumbnails, index) {
|
|
53
|
+
if (thumbnails && thumbnails.length > 0) {
|
|
54
|
+
let thumbnail = undefined
|
|
55
|
+
if (scaffold && scaffoldViews) {
|
|
56
|
+
const view = this.findEntryWithPathInArray(scaffoldViews, scaffold.datacite.isSourceOf.path[0])
|
|
57
|
+
if (view) {
|
|
58
|
+
thumbnail = this.findEntryWithPathInArray(thumbnails, view.datacite.isSourceOf.path[0])
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (thumbnail) {
|
|
62
|
+
return thumbnail
|
|
63
|
+
} else if (index < thumbnails.length) {
|
|
64
|
+
return thumbnails[index]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined
|
|
68
|
+
},
|
|
69
|
+
getImageURLFromS3(apiEndpoint, info) {
|
|
70
|
+
return `${apiEndpoint}/s3-resource/${info.datasetId}/${info.datasetVersion}/files/${info.file_path}?encodeBase64=true`
|
|
71
|
+
},
|
|
72
|
+
getSegmentationThumbnailURL(apiEndpoint, info) {
|
|
73
|
+
let endpoint = `${apiEndpoint}/thumbnail/neurolucida`
|
|
74
|
+
endpoint = endpoint + `?datasetId=${info.datasetId}`
|
|
75
|
+
endpoint = endpoint + `&version=${info.datasetVersion}`
|
|
76
|
+
endpoint = endpoint + `&path=files/${info.segmentationFilePath}`
|
|
77
|
+
return endpoint
|
|
78
|
+
},
|
|
79
|
+
getThumbnailURLFromBiolucida(apiEndpoint, info) {
|
|
80
|
+
return `${apiEndpoint}/thumbnail/${info.id}`
|
|
81
|
+
},
|
|
82
|
+
getImageInfoFromBiolucida(apiEndpoint, items, info) {
|
|
83
|
+
const endpoint = `${apiEndpoint}/image/${info.id}`
|
|
84
|
+
const params = {}
|
|
85
|
+
this.getRequest(endpoint, params, 20000).then(
|
|
86
|
+
(response) => {
|
|
87
|
+
let item = items.find((x) => x.id === info.id)
|
|
88
|
+
const name = response.name
|
|
89
|
+
if (name) {
|
|
90
|
+
item.title = name
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
(reason) => {
|
|
94
|
+
if (reason.message.includes('timeout') && reason.message.includes('exceeded') && info.fetchAttempts < 3) {
|
|
95
|
+
info.fetchAttempts += 1
|
|
96
|
+
this.getImageInfoFromBiolucida(apiEndpoint, items, info)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return Promise.reject('Maximum iterations reached.')
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils'
|
|
2
|
-
import HelloWorld from '@/components/HelloWorld.vue'
|
|
3
|
-
|
|
4
|
-
describe('HelloWorld.vue', () => {
|
|
5
|
-
it('renders props.msg when passed', () => {
|
|
6
|
-
const msg = 'new message'
|
|
7
|
-
const wrapper = shallowMount(HelloWorld, {
|
|
8
|
-
propsData: { msg },
|
|
9
|
-
})
|
|
10
|
-
expect(wrapper.text()).toMatch(msg)
|
|
11
|
-
})
|
|
12
|
-
})
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
|
3
|
+
|
|
4
|
+
describe('HelloWorld.vue', () => {
|
|
5
|
+
it('renders props.msg when passed', () => {
|
|
6
|
+
const msg = 'new message'
|
|
7
|
+
const wrapper = shallowMount(HelloWorld, {
|
|
8
|
+
propsData: { msg },
|
|
9
|
+
})
|
|
10
|
+
expect(wrapper.text()).toMatch(msg)
|
|
11
|
+
})
|
|
12
|
+
})
|
package/vue.config.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// vue.config.js
|
|
2
|
-
module.exports = {
|
|
3
|
-
chainWebpack: config => {
|
|
4
|
-
// vue svg inline loader for default svg
|
|
5
|
-
config.module
|
|
6
|
-
.rule('vue')
|
|
7
|
-
.use('vue-svg-inline-loader')
|
|
8
|
-
.loader('vue-svg-inline-loader')
|
|
9
|
-
.end()
|
|
10
|
-
const fontsRule = config.module.rule('fonts')
|
|
11
|
-
fontsRule.uses.clear()
|
|
12
|
-
config.module
|
|
13
|
-
.rule('fonts')
|
|
14
|
-
.test(/\.(ttf|otf|eot|woff|woff2)$/)
|
|
15
|
-
.use('base64-inline-loader')
|
|
16
|
-
.loader('base64-inline-loader')
|
|
17
|
-
.tap(options => {
|
|
18
|
-
// modify the options...
|
|
19
|
-
return options
|
|
20
|
-
})
|
|
21
|
-
.end()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
// vue.config.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
chainWebpack: config => {
|
|
4
|
+
// vue svg inline loader for default svg
|
|
5
|
+
config.module
|
|
6
|
+
.rule('vue')
|
|
7
|
+
.use('vue-svg-inline-loader')
|
|
8
|
+
.loader('vue-svg-inline-loader')
|
|
9
|
+
.end()
|
|
10
|
+
const fontsRule = config.module.rule('fonts')
|
|
11
|
+
fontsRule.uses.clear()
|
|
12
|
+
config.module
|
|
13
|
+
.rule('fonts')
|
|
14
|
+
.test(/\.(ttf|otf|eot|woff|woff2)$/)
|
|
15
|
+
.use('base64-inline-loader')
|
|
16
|
+
.loader('base64-inline-loader')
|
|
17
|
+
.tap(options => {
|
|
18
|
+
// modify the options...
|
|
19
|
+
return options
|
|
20
|
+
})
|
|
21
|
+
.end()
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/assets/data-icon.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|