@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
package/src/App.vue
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="app">
|
|
3
|
-
<link
|
|
4
|
-
|
|
3
|
+
<link
|
|
4
|
+
rel="stylesheet"
|
|
5
|
+
href="https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap"
|
|
6
|
+
/>
|
|
5
7
|
Click arrow to open sidebar
|
|
6
8
|
<el-button @click="openSearch">search Uberon from refs</el-button>
|
|
7
9
|
<el-button @click="singleFacets">Add heart to Filter</el-button>
|
|
@@ -10,20 +12,27 @@
|
|
|
10
12
|
<el-button @click="multiFacets">multiple facets</el-button>
|
|
11
13
|
<el-button @click="neuronSearch">open neuron search</el-button>
|
|
12
14
|
<el-button @click="keywordSearch">keyword search</el-button>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<el-button @click="getFacets">Get facets</el-button>
|
|
16
|
+
<SideBar
|
|
17
|
+
:envVars="envVars"
|
|
18
|
+
class="side-bar"
|
|
19
|
+
ref="sideBar"
|
|
20
|
+
:visible="sideBarVisibility"
|
|
21
|
+
:tabs="tabs"
|
|
22
|
+
:activeId="activeId"
|
|
23
|
+
@tabClicked="tabClicked"
|
|
24
|
+
@search-changed="searchChanged($event)"
|
|
25
|
+
@actionClick="action"
|
|
26
|
+
/>
|
|
17
27
|
</div>
|
|
18
28
|
</template>
|
|
19
29
|
|
|
20
30
|
<script>
|
|
21
31
|
/* eslint-disable no-alert, no-console */
|
|
22
32
|
// optionally import default styles
|
|
23
|
-
import SideBar from './components/SideBar'
|
|
24
|
-
import
|
|
33
|
+
import SideBar from './components/SideBar.vue'
|
|
34
|
+
import EventBus from './components/EventBus.js'
|
|
25
35
|
|
|
26
|
-
console.log(mySearch)
|
|
27
36
|
// let testContext = {
|
|
28
37
|
// "description": "3D digital tracings of the enteric plexus obtained from seven subjects (M11, M16, M162, M163, M164, M168) are mapped randomly on mouse proximal colon. The data depicts individual neural wiring patterns in enteric microcircuits, and revealed both neuron and fiber units wired in a complex organization.",
|
|
29
38
|
// "heading": "Digital tracings of enteric plexus",
|
|
@@ -71,88 +80,145 @@ console.log(mySearch)
|
|
|
71
80
|
export default {
|
|
72
81
|
name: 'app',
|
|
73
82
|
components: {
|
|
74
|
-
SideBar
|
|
83
|
+
SideBar,
|
|
75
84
|
},
|
|
76
85
|
computed: {
|
|
77
|
-
tabs: function(){
|
|
86
|
+
tabs: function () {
|
|
78
87
|
let temp = [...this.tabArray]
|
|
79
|
-
for(let i in this.tabArray){
|
|
88
|
+
for (let i in this.tabArray) {
|
|
80
89
|
temp[i].contextCard = this.contextArray[i]
|
|
81
90
|
}
|
|
82
91
|
return temp
|
|
83
|
-
}
|
|
92
|
+
},
|
|
84
93
|
},
|
|
85
|
-
data: function(){
|
|
94
|
+
data: function () {
|
|
86
95
|
return {
|
|
87
|
-
tabArray: [{title: 'Flatmap', id:1}],
|
|
88
|
-
contextArray: [null,null,null],
|
|
96
|
+
tabArray: [{ title: 'Flatmap', id: 1 }],
|
|
97
|
+
contextArray: [null, null, null],
|
|
89
98
|
sideBarVisibility: true,
|
|
90
99
|
envVars: {
|
|
91
|
-
API_LOCATION:
|
|
92
|
-
ALGOLIA_KEY:
|
|
93
|
-
ALGOLIA_ID:
|
|
94
|
-
ALGOLIA_INDEX:
|
|
95
|
-
PENNSIEVE_API_LOCATION:
|
|
96
|
-
BL_SERVER_URL:
|
|
97
|
-
NL_LINK_PREFIX:
|
|
98
|
-
ROOT_URL:
|
|
100
|
+
API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
|
|
101
|
+
ALGOLIA_KEY: import.meta.env.VITE_APP_ALGOLIA_KEY,
|
|
102
|
+
ALGOLIA_ID: import.meta.env.VITE_APP_ALGOLIA_ID,
|
|
103
|
+
ALGOLIA_INDEX: import.meta.env.VITE_APP_ALGOLIA_INDEX,
|
|
104
|
+
PENNSIEVE_API_LOCATION: import.meta.env.VITE_APP_PENNSIEVE_API_LOCATION,
|
|
105
|
+
BL_SERVER_URL: import.meta.env.VITE_APP_BL_SERVER_URL,
|
|
106
|
+
NL_LINK_PREFIX: import.meta.env.VITE_APP_NL_LINK_PREFIX,
|
|
107
|
+
ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
|
|
99
108
|
},
|
|
100
109
|
activeId: 1,
|
|
101
|
-
mySearch: mySearch,
|
|
102
|
-
//mySearch: undefined,
|
|
103
110
|
}
|
|
104
111
|
},
|
|
105
|
-
methods:{
|
|
106
|
-
searchChanged: function(data){
|
|
107
|
-
console.log(data)
|
|
112
|
+
methods: {
|
|
113
|
+
searchChanged: function (data) {
|
|
114
|
+
console.log(data)
|
|
108
115
|
},
|
|
109
|
-
tabClicked: function(id){
|
|
116
|
+
tabClicked: function (id) {
|
|
110
117
|
this.activeId = id
|
|
111
118
|
},
|
|
112
|
-
action: function(val){
|
|
113
|
-
console.log(
|
|
119
|
+
action: function (val) {
|
|
120
|
+
console.log('action fired: ', val)
|
|
114
121
|
},
|
|
115
|
-
openSearch: function(){
|
|
116
|
-
this.$refs.sideBar.openSearch(
|
|
122
|
+
openSearch: function () {
|
|
123
|
+
this.$refs.sideBar.openSearch(
|
|
124
|
+
[],
|
|
125
|
+
'http://purl.obolibrary.org/obo/UBERON_0001103'
|
|
126
|
+
)
|
|
117
127
|
},
|
|
118
|
-
singleFacets: function(){
|
|
119
|
-
this.$refs.sideBar.addFilter({
|
|
128
|
+
singleFacets: function () {
|
|
129
|
+
this.$refs.sideBar.addFilter({
|
|
130
|
+
facet: 'Cardiovascular system',
|
|
131
|
+
facet2: 'Heart',
|
|
132
|
+
term: 'Anatomical structure',
|
|
133
|
+
facetPropPath: 'anatomy.organ.category.name',
|
|
134
|
+
AND: true,
|
|
135
|
+
})
|
|
120
136
|
},
|
|
121
|
-
addStomach: function(){
|
|
122
|
-
this.$refs.sideBar.addFilter({
|
|
137
|
+
addStomach: function () {
|
|
138
|
+
this.$refs.sideBar.addFilter({
|
|
139
|
+
facet: 'Stomach',
|
|
140
|
+
term: 'Anatomical structure',
|
|
141
|
+
facetPropPath: 'anatomy.organ.category.name',
|
|
142
|
+
AND: true,
|
|
143
|
+
})
|
|
123
144
|
},
|
|
124
|
-
addInvalidTerm: function(){
|
|
125
|
-
this.$refs.sideBar.addFilter({
|
|
145
|
+
addInvalidTerm: function () {
|
|
146
|
+
this.$refs.sideBar.addFilter({
|
|
147
|
+
facet: 'Invalid',
|
|
148
|
+
term: 'Anatomical structure',
|
|
149
|
+
facetPropPath: 'anatomy.organ.name',
|
|
150
|
+
AND: true,
|
|
151
|
+
})
|
|
126
152
|
},
|
|
127
|
-
multiFacets: function(){
|
|
128
|
-
this.$refs.sideBar.openSearch(
|
|
129
|
-
|
|
153
|
+
multiFacets: function () {
|
|
154
|
+
this.$refs.sideBar.openSearch(
|
|
155
|
+
[
|
|
156
|
+
{
|
|
157
|
+
facet: 'Male',
|
|
158
|
+
term: 'Sex',
|
|
159
|
+
facetPropPath: 'attributes.subject.sex.value',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
facet: 'Cardiovascular system',
|
|
163
|
+
facet2: 'Heart',
|
|
164
|
+
term: 'Anatomical structure',
|
|
165
|
+
facetPropPath: 'anatomy.organ.category.name',
|
|
166
|
+
AND: true,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
facet: 'Not correct',
|
|
170
|
+
term: 'Anatomical structure',
|
|
171
|
+
facetPropPath: 'anatomy.organ.name',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
''
|
|
175
|
+
)
|
|
130
176
|
},
|
|
131
|
-
keywordSearch: function(){
|
|
132
|
-
this.$refs.sideBar.addFilter({
|
|
177
|
+
keywordSearch: function () {
|
|
178
|
+
this.$refs.sideBar.addFilter({
|
|
179
|
+
type: 'Facet',
|
|
180
|
+
label: undefined,
|
|
181
|
+
facet: '3d model',
|
|
182
|
+
facetPropPath: 'item.keywords.keyword',
|
|
183
|
+
term: 'Keywords',
|
|
184
|
+
AND: true,
|
|
185
|
+
})
|
|
133
186
|
},
|
|
134
|
-
markerFromFlatmap: function(){
|
|
135
|
-
this.$refs.sideBar.openSearch([
|
|
187
|
+
markerFromFlatmap: function () {
|
|
188
|
+
this.$refs.sideBar.openSearch([
|
|
189
|
+
{
|
|
190
|
+
facet: 'http://purl.obolibrary.org/obo/UBERON_0001103',
|
|
191
|
+
term: 'Keywords',
|
|
192
|
+
facetPropPath: 'item.keywords.keyword',
|
|
193
|
+
},
|
|
194
|
+
])
|
|
136
195
|
},
|
|
137
|
-
neuronSearch: function(){
|
|
196
|
+
neuronSearch: function () {
|
|
138
197
|
this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10')
|
|
139
|
-
}
|
|
198
|
+
},
|
|
199
|
+
getFacets: async function () {
|
|
200
|
+
let facets = await this.$refs.sideBar.getAlgoliaFacets()
|
|
201
|
+
console.log('Algolia facets:', facets)
|
|
202
|
+
},
|
|
140
203
|
},
|
|
141
|
-
mounted: function() {
|
|
142
|
-
console.log(
|
|
204
|
+
mounted: function () {
|
|
205
|
+
console.log('mounted app')
|
|
206
|
+
EventBus.on('contextUpdate', (payLoad) => {
|
|
207
|
+
console.log('contextUpdate', payLoad)
|
|
208
|
+
})
|
|
143
209
|
},
|
|
144
210
|
}
|
|
145
211
|
</script>
|
|
146
212
|
|
|
147
213
|
<style lang="scss">
|
|
148
214
|
#app {
|
|
149
|
-
height:100%;
|
|
215
|
+
height: 100%;
|
|
150
216
|
width: 100%;
|
|
151
|
-
position:absolute;
|
|
152
|
-
font-family:
|
|
217
|
+
position: absolute;
|
|
218
|
+
font-family: 'Asap', sans-serif;
|
|
153
219
|
}
|
|
154
220
|
body {
|
|
155
|
-
margin:0px;
|
|
221
|
+
margin: 0px;
|
|
156
222
|
}
|
|
157
223
|
.map-icon {
|
|
158
224
|
color: $app-primary-color;
|
package/src/algolia/algolia.js
CHANGED
|
@@ -9,40 +9,62 @@ export class AlgoliaClient {
|
|
|
9
9
|
algoliaKey
|
|
10
10
|
)
|
|
11
11
|
this.PENNSIEVE_API_LOCATION = PENNSIEVE_API_LOCATION
|
|
12
|
+
this.anatomyFacetLabels = []
|
|
12
13
|
}
|
|
13
14
|
initIndex(ALGOLIA_INDEX) {
|
|
14
15
|
this.index = this.client.initIndex(ALGOLIA_INDEX);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
getAlgoliaFacets(propPathMapping) {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
19
|
+
const facetPropPaths = propPathMapping.map(facet => facet.facetPropPath)
|
|
20
|
+
const facetSubpropPaths = propPathMapping.map(item => item.facetSubpropPath)
|
|
20
21
|
let facetData = []
|
|
21
22
|
let facetId = 0
|
|
22
23
|
return this.index
|
|
23
24
|
.search('', {
|
|
24
25
|
sortFacetValuesBy: 'alpha',
|
|
25
|
-
facets: facetPropPaths
|
|
26
|
+
facets: facetPropPaths.concat(facetSubpropPaths),
|
|
26
27
|
})
|
|
27
28
|
.then(response => {
|
|
28
29
|
facetPropPaths.map((facetPropPath) => {
|
|
30
|
+
const parentFacet = propPathMapping.find(item => item.facetPropPath == facetPropPath)
|
|
29
31
|
var children = []
|
|
30
32
|
const responseFacets = response.facets
|
|
31
|
-
if (responseFacets === undefined) {
|
|
33
|
+
if (responseFacets === undefined) {return}
|
|
32
34
|
const responseFacetChildren =
|
|
33
|
-
responseFacets[facetPropPath] == undefined
|
|
35
|
+
responseFacets[facetPropPath] == undefined // if no facets, return empty object
|
|
34
36
|
? {}
|
|
35
37
|
: responseFacets[facetPropPath]
|
|
38
|
+
const allPossibleChildrenSubfacets = parentFacet && responseFacets[parentFacet.facetSubpropPath] ? Object.keys(responseFacets[parentFacet.facetSubpropPath]) : []
|
|
39
|
+
// Loop through all subfacets and find the ones that are children of the current facet
|
|
36
40
|
Object.keys(responseFacetChildren).map(facet => {
|
|
37
|
-
|
|
41
|
+
const childrenSubfacets = allPossibleChildrenSubfacets.reduce((filtered, childFacetInfo) => {
|
|
42
|
+
const info = childFacetInfo.split('.');
|
|
43
|
+
if (info.length !== 2) {
|
|
44
|
+
return filtered;
|
|
45
|
+
}
|
|
46
|
+
if (facet === info[0]) {
|
|
47
|
+
filtered.push({
|
|
48
|
+
label: info[1],
|
|
49
|
+
id: facetId++,
|
|
50
|
+
facetPropPath: `${parentFacet ? parentFacet.facetSubpropPath : undefined}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return filtered;
|
|
54
|
+
}, []); // Provide an empty array as the initial value
|
|
55
|
+
let newChild = {
|
|
38
56
|
label: facet,
|
|
39
57
|
id: facetId++,
|
|
40
58
|
facetPropPath: facetPropPath
|
|
41
|
-
}
|
|
59
|
+
}
|
|
60
|
+
if (childrenSubfacets.length > 0) {
|
|
61
|
+
newChild.children = childrenSubfacets
|
|
62
|
+
}
|
|
63
|
+
children.push(newChild)
|
|
42
64
|
})
|
|
43
65
|
if (children.length > 0) {
|
|
44
66
|
facetData.push({
|
|
45
|
-
label:
|
|
67
|
+
label: parentFacet ? parentFacet.label : '',
|
|
46
68
|
id: facetId++,
|
|
47
69
|
children: children,
|
|
48
70
|
key: facetPropPath
|
|
@@ -93,6 +115,8 @@ export class AlgoliaClient {
|
|
|
93
115
|
|
|
94
116
|
_processAnatomy(hits) {
|
|
95
117
|
let foundKeyWords = []
|
|
118
|
+
let foundLabels = []
|
|
119
|
+
let uniqueLabels = []
|
|
96
120
|
let uniqueKeywords = []
|
|
97
121
|
hits.forEach(hit => {
|
|
98
122
|
if (hit.item && hit.item.keywords) {
|
|
@@ -107,11 +131,14 @@ export class AlgoliaClient {
|
|
|
107
131
|
hit.anatomy.organ.forEach(anatomy => {
|
|
108
132
|
if (anatomy.curie) {
|
|
109
133
|
foundKeyWords.push(anatomy.curie)
|
|
134
|
+
foundLabels.push(anatomy.name)
|
|
110
135
|
}
|
|
111
136
|
})
|
|
112
137
|
}
|
|
113
138
|
})
|
|
114
|
-
uniqueKeywords = [...new Set(foundKeyWords)]
|
|
139
|
+
uniqueKeywords = [...new Set(foundKeyWords) ]
|
|
140
|
+
uniqueLabels = [...new Set(foundLabels) ]
|
|
141
|
+
this.anatomyFacetLabels = uniqueLabels
|
|
115
142
|
return uniqueKeywords
|
|
116
143
|
}
|
|
117
144
|
|
package/src/algolia/utils.js
CHANGED
|
@@ -2,14 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
// Mapping between display categories and their Algolia index property path
|
|
4
4
|
// Used for populating the Dataset Search Results facet menu dynamically
|
|
5
|
-
export const facetPropPathMapping =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
export const facetPropPathMapping = [
|
|
6
|
+
{
|
|
7
|
+
label: 'Data Type',
|
|
8
|
+
id: 'item.types',
|
|
9
|
+
facetPropPath: 'item.types.name',
|
|
10
|
+
facetSubpropPath: 'item.types.subcategory.name'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
label: 'Anatomical Structure',
|
|
14
|
+
id: 'anatomy.organ.category',
|
|
15
|
+
facetPropPath: 'anatomy.organ.category.name',
|
|
16
|
+
facetSubpropPath: 'anatomy.organ.subcategory.name',
|
|
17
|
+
facetFilterPath: 'anatomy.organ.name'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Species',
|
|
21
|
+
id: 'organisms.primary.species',
|
|
22
|
+
facetPropPath: 'organisms.primary.species.name',
|
|
23
|
+
facetSubpropPath: 'organisms.primary.species.subcategory.name'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Experimental Approach',
|
|
27
|
+
id: 'item.modalities',
|
|
28
|
+
facetPropPath: 'item.modalities.keyword',
|
|
29
|
+
facetSubpropPath: 'item.modalities.subcategory.name'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Sex',
|
|
33
|
+
id: 'attributes.subject.sex',
|
|
34
|
+
facetPropPath: 'attributes.subject.sex.value',
|
|
35
|
+
facetSubpropPath: 'attributes.subject.sex.subcategory.name'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Age Categories',
|
|
39
|
+
id: 'attributes.subject.ageCategory',
|
|
40
|
+
facetPropPath: 'attributes.subject.ageCategory.value',
|
|
41
|
+
facetSubpropPath: 'attributes.subject.ageCategory.subcategory.name'
|
|
42
|
+
},
|
|
43
|
+
]
|
|
13
44
|
|
|
14
45
|
// Same as above, but these show on the sidebar filters
|
|
15
46
|
export const shownFilters = {
|
|
@@ -37,19 +68,19 @@ export function getFilters(selectedFacetArray=undefined) {
|
|
|
37
68
|
|
|
38
69
|
let filters = "NOT item.published.status:embargo";
|
|
39
70
|
filters = `(${filters}) AND `;
|
|
40
|
-
|
|
41
|
-
const facetPropPaths = Object.keys(facetPropPathMapping);
|
|
71
|
+
const facetPropPaths = facetPropPathMapping.map((f) => f.facetPropPath);
|
|
42
72
|
facetPropPaths.map((facetPropPath) => {
|
|
43
|
-
|
|
73
|
+
let facetsToBool = facets.filter(
|
|
44
74
|
(facet) => facet.facetPropPath == facetPropPath
|
|
45
75
|
);
|
|
46
76
|
let orFilters = "";
|
|
47
77
|
let andFilters = "";
|
|
48
78
|
facetsToBool.map((facet) => {
|
|
79
|
+
let facetPropPathToUse = facet.facetSubPropPath ? facet.facetSubPropPath : facetPropPath // Check if we have a subpath
|
|
49
80
|
if (facet.AND){
|
|
50
|
-
andFilters += `AND "${
|
|
81
|
+
andFilters += `AND "${facetPropPathToUse}":"${facet.label}"`;
|
|
51
82
|
} else {
|
|
52
|
-
orFilters += `"${
|
|
83
|
+
orFilters += `"${facetPropPathToUse}":"${facet.label}" OR `;
|
|
53
84
|
}
|
|
54
85
|
});
|
|
55
86
|
if (orFilters == "" && andFilters =="") {
|
|
@@ -62,6 +93,7 @@ export function getFilters(selectedFacetArray=undefined) {
|
|
|
62
93
|
|
|
63
94
|
filters = filters.split('()AND ').join(''); // Handle case where there where no OR facets
|
|
64
95
|
});
|
|
96
|
+
console.log('filters about to be applied:', filters)
|
|
65
97
|
return filters.substring(0, filters.lastIndexOf(" AND "));
|
|
66
98
|
}
|
|
67
99
|
|
package/src/assets/styles.scss
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="categories['All'].size > 1" class="container"
|
|
3
|
-
<div>
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
<template v-for="(item, key) in categories" >
|
|
2
|
+
<div v-if="categories['All'].size > 1" class="container" ref="container">
|
|
3
|
+
<div>View data types:</div>
|
|
4
|
+
<template v-for="(item, key) in categories">
|
|
7
5
|
<el-button
|
|
8
6
|
v-if="item.size > 0"
|
|
9
|
-
:class="[{
|
|
7
|
+
:class="[{ active: key == active }, 'tag-button']"
|
|
10
8
|
@click="categoryClicked(key)"
|
|
11
|
-
size="small"
|
|
9
|
+
size="small"
|
|
10
|
+
:key="key"
|
|
11
|
+
>{{ key + ' (' + item.size + ')' }}
|
|
12
12
|
</el-button>
|
|
13
13
|
</template>
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
<script>
|
|
19
18
|
/* eslint-disable no-alert, no-console */
|
|
20
|
-
import
|
|
21
|
-
import { Button } from "element-ui";
|
|
22
|
-
import lang from "element-ui/lib/locale/lang/en";
|
|
23
|
-
import locale from "element-ui/lib/locale";
|
|
24
|
-
|
|
25
|
-
locale.use(lang);
|
|
26
|
-
Vue.use(Button);
|
|
19
|
+
import { ElButton as Button } from 'element-plus'
|
|
27
20
|
|
|
28
21
|
export default {
|
|
29
|
-
name:
|
|
22
|
+
name: 'BadgesGroup',
|
|
23
|
+
components: { Button },
|
|
30
24
|
props: {
|
|
31
25
|
/**
|
|
32
26
|
* Object containing information for
|
|
@@ -35,49 +29,46 @@ export default {
|
|
|
35
29
|
additionalLinks: {
|
|
36
30
|
type: Array,
|
|
37
31
|
default: () => {
|
|
38
|
-
return []
|
|
32
|
+
return []
|
|
39
33
|
},
|
|
40
34
|
},
|
|
41
35
|
datasetBiolucida: {
|
|
42
36
|
type: Object,
|
|
43
37
|
default: () => {
|
|
44
|
-
return {}
|
|
38
|
+
return {}
|
|
45
39
|
},
|
|
46
40
|
},
|
|
47
|
-
entry:
|
|
41
|
+
entry: {
|
|
48
42
|
type: Object,
|
|
49
43
|
default: () => {
|
|
50
|
-
return {}
|
|
44
|
+
return {}
|
|
51
45
|
},
|
|
52
46
|
},
|
|
53
47
|
},
|
|
54
48
|
data: function () {
|
|
55
49
|
return {
|
|
56
50
|
//Always start with 1 image - the dataset thumbnail itself
|
|
57
|
-
categories: {
|
|
58
|
-
active:
|
|
59
|
-
}
|
|
51
|
+
categories: { All: { size: 1 }, Dataset: { size: 1 } },
|
|
52
|
+
active: 'All',
|
|
53
|
+
}
|
|
60
54
|
},
|
|
61
55
|
methods: {
|
|
62
56
|
addToCategories: function (array, name) {
|
|
63
57
|
if (array && array.length > 0) {
|
|
64
|
-
this.categories[name] = { size: array.length }
|
|
65
|
-
this.categories[
|
|
58
|
+
this.categories[name] = { size: array.length }
|
|
59
|
+
this.categories['All'].size += array.length
|
|
66
60
|
}
|
|
67
61
|
},
|
|
68
62
|
addSimulationsToCategories: function (array) {
|
|
69
63
|
if (array && array.length > 0) {
|
|
70
|
-
const size = 1
|
|
71
|
-
this.categories[
|
|
72
|
-
this.categories[
|
|
64
|
+
const size = 1
|
|
65
|
+
this.categories['Simulations'] = { size }
|
|
66
|
+
this.categories['All'].size += size
|
|
73
67
|
}
|
|
74
68
|
},
|
|
75
|
-
categoryClicked: function(name) {
|
|
76
|
-
this.active = name
|
|
77
|
-
this.$emit(
|
|
78
|
-
},
|
|
79
|
-
resetCategory: function() {
|
|
80
|
-
this.categories = { All: { size: 1 }, Dataset: { size: 1 } };
|
|
69
|
+
categoryClicked: function (name) {
|
|
70
|
+
this.active = name
|
|
71
|
+
this.$emit('categoryChanged', name)
|
|
81
72
|
},
|
|
82
73
|
},
|
|
83
74
|
watch: {
|
|
@@ -85,64 +76,49 @@ export default {
|
|
|
85
76
|
deep: true,
|
|
86
77
|
immediate: true,
|
|
87
78
|
handler: function (biolucidaData) {
|
|
88
|
-
if (
|
|
89
|
-
this.addToCategories(biolucidaData[
|
|
79
|
+
if ('dataset_images' in biolucidaData) {
|
|
80
|
+
this.addToCategories(biolucidaData['dataset_images'], 'Images')
|
|
90
81
|
}
|
|
91
|
-
}
|
|
82
|
+
},
|
|
92
83
|
},
|
|
93
84
|
entry: {
|
|
94
85
|
deep: true,
|
|
95
86
|
immediate: true,
|
|
96
87
|
handler: function () {
|
|
97
|
-
this.
|
|
98
|
-
this.addToCategories(this.entry.
|
|
99
|
-
this.addToCategories(this.entry.
|
|
100
|
-
this.
|
|
101
|
-
this.addSimulationsToCategories(this.entry.simulation);
|
|
88
|
+
this.addToCategories(this.entry.scaffolds, 'Scaffolds')
|
|
89
|
+
this.addToCategories(this.entry.segmentation, 'Segmentations')
|
|
90
|
+
this.addToCategories(this.entry.plots, 'Plots')
|
|
91
|
+
this.addSimulationsToCategories(this.entry.simulation)
|
|
102
92
|
/** disable the following
|
|
103
93
|
this.addToCategories(this.entry.images, 'Images');
|
|
104
94
|
this.addToCategories(this.entry.videos, 'Videos');
|
|
105
95
|
**/
|
|
106
|
-
}
|
|
107
|
-
}
|
|
96
|
+
},
|
|
97
|
+
},
|
|
108
98
|
},
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
111
|
-
|
|
112
|
-
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
113
|
-
<style scoped lang="scss">
|
|
114
|
-
@import "~element-ui/packages/theme-chalk/src/button";
|
|
115
|
-
|
|
116
|
-
.tag-button,
|
|
117
|
-
.tag-button:hover,
|
|
118
|
-
.tag-button:focus,
|
|
119
|
-
.tag-button.active
|
|
120
|
-
{
|
|
121
|
-
border-radius: 4px;
|
|
122
|
-
font-size: 0.75rem;
|
|
123
|
-
padding: 0.2rem 0.2rem;
|
|
124
|
-
margin: 0.5rem 0 0 0;
|
|
125
|
-
margin-right: 0.75rem!important;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.tag-button,
|
|
129
|
-
.tag-button:hover,
|
|
130
|
-
.tag-button:focus
|
|
131
|
-
{
|
|
132
|
-
background: #f9f2fc;
|
|
133
|
-
border: 1px solid $app-primary-color;
|
|
134
|
-
color: $app-primary-color;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.tag-button.active
|
|
138
|
-
{
|
|
139
|
-
background: $app-primary-color;
|
|
140
|
-
border: 1px solid $app-primary-color;
|
|
141
|
-
color: #fff;
|
|
142
99
|
}
|
|
100
|
+
</script>
|
|
143
101
|
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
|
|
102
|
+
<style lang="scss" scoped>
|
|
103
|
+
.container {
|
|
104
|
+
.tag-button.el-button {
|
|
105
|
+
border-radius: 4px!important;
|
|
106
|
+
font-size: 0.75rem!important;
|
|
107
|
+
padding: 0.2rem 0.2rem!important;
|
|
108
|
+
margin: 0.5rem 0 0 0!important;
|
|
109
|
+
margin-right: 0.75rem !important;
|
|
110
|
+
background: #f9f2fc!important;
|
|
111
|
+
border: 1px solid $app-primary-color!important;
|
|
112
|
+
color: $app-primary-color!important;
|
|
113
|
+
&.active {
|
|
114
|
+
background: $app-primary-color!important;
|
|
115
|
+
border: 1px solid $app-primary-color!important;
|
|
116
|
+
color: #fff!important;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.tag-button + .tag-button {
|
|
121
|
+
margin-left: 0!important;
|
|
122
|
+
}
|
|
147
123
|
}
|
|
148
124
|
</style>
|