@abi-software/map-side-bar 1.1.14 → 1.1.17
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.common.js +246 -139
- package/dist/map-side-bar.common.js.map +1 -1
- package/dist/map-side-bar.css +1 -1
- package/dist/map-side-bar.umd.js +246 -139
- package/dist/map-side-bar.umd.js.map +1 -1
- package/dist/map-side-bar.umd.min.js +1 -1
- package/dist/map-side-bar.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/components/ContextCard.vue +56 -20
- package/src/components/DatasetCard.vue +0 -17
- package/src/components/SearchFilters.vue +120 -5
- package/src/components/SidebarContent.vue +3 -2
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="context-card-container" ref="container">
|
|
3
|
-
<div v-show="
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<div class="
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
<div v-show="showContextCard">
|
|
4
|
+
<div v-show="showDetails" class="hide" @click="showDetails = !showDetails">Hide information<i class="el-icon-arrow-up"></i></div>
|
|
5
|
+
<div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
|
|
6
|
+
<el-card v-if="showDetails && Object.keys(contextData).length !== 0" class="context-card card" >
|
|
7
|
+
<img :src="entry.banner" class="context-image card-left">
|
|
8
|
+
<div class="card-right">
|
|
9
|
+
<div class="title">{{contextData.heading}}</div>
|
|
10
|
+
<div>{{contextData.description}}</div>
|
|
11
|
+
<template v-for="(view, i) in contextData.views">
|
|
12
|
+
<br v-bind:key="i"/>
|
|
13
|
+
<span v-bind:key="i+'_1'" @click="openViewFile(view)" class="scaffold-view"><img :src="getFileFromPath(view.thumbnail)"> {{view.description}}</span>
|
|
14
|
+
</template>
|
|
15
|
+
</div>
|
|
16
|
+
</el-card>
|
|
17
|
+
</div>
|
|
16
18
|
</div>
|
|
17
19
|
</template>
|
|
18
20
|
|
|
@@ -23,6 +25,7 @@ import Vue from "vue";
|
|
|
23
25
|
import { Link, Icon, Card, Button, Select, Input } from "element-ui";
|
|
24
26
|
import lang from "element-ui/lib/locale/lang/en";
|
|
25
27
|
import locale from "element-ui/lib/locale";
|
|
28
|
+
import EventBus from "./EventBus"
|
|
26
29
|
|
|
27
30
|
locale.use(lang);
|
|
28
31
|
Vue.use(Link);
|
|
@@ -46,11 +49,22 @@ export default {
|
|
|
46
49
|
data: function () {
|
|
47
50
|
return {
|
|
48
51
|
contextData: {},
|
|
49
|
-
showDetails: true
|
|
52
|
+
showDetails: true,
|
|
53
|
+
showContextCard: true
|
|
50
54
|
};
|
|
51
55
|
},
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
watch: {
|
|
57
|
+
'entry.contextCardUrl': {
|
|
58
|
+
handler(val){
|
|
59
|
+
if (val) {
|
|
60
|
+
this.getContextFile(val)
|
|
61
|
+
this.showContextCard = true
|
|
62
|
+
} else {
|
|
63
|
+
this.showContextCard = false
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
immediate: true
|
|
67
|
+
}
|
|
54
68
|
},
|
|
55
69
|
methods: {
|
|
56
70
|
getContextFile: function (contextFileUrl) {
|
|
@@ -64,7 +78,6 @@ export default {
|
|
|
64
78
|
})
|
|
65
79
|
.then((data) => {
|
|
66
80
|
this.contextData = data
|
|
67
|
-
console.log(this.contextData)
|
|
68
81
|
})
|
|
69
82
|
.catch(() => {
|
|
70
83
|
//set defaults if we hit an error
|
|
@@ -72,12 +85,24 @@ export default {
|
|
|
72
85
|
this.discoverId = undefined
|
|
73
86
|
});
|
|
74
87
|
},
|
|
88
|
+
removeDoubleFilesPath: function(path){
|
|
89
|
+
if (path.includes('files/files/')){
|
|
90
|
+
return path.replace('files/files/', 'files/')
|
|
91
|
+
} else {
|
|
92
|
+
return path
|
|
93
|
+
}
|
|
94
|
+
},
|
|
75
95
|
getFileFromPath: function(path){
|
|
96
|
+
path = this.removeDoubleFilesPath(path)
|
|
76
97
|
return `${this.entry.apiLocation}s3-resource/${this.entry.discoverId}/${this.entry.version}/files/${path}`
|
|
77
98
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
openViewFile: function(view){
|
|
100
|
+
|
|
101
|
+
// note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
|
|
102
|
+
this.entry.viewUrl = view.path.split('/')[view.path.split('/').length-1]
|
|
103
|
+
this.entry.type = 'Scaffold View'
|
|
104
|
+
EventBus.$emit("PopoverActionClick", this.entry)
|
|
105
|
+
}
|
|
81
106
|
}
|
|
82
107
|
};
|
|
83
108
|
</script>
|
|
@@ -94,6 +119,12 @@ export default {
|
|
|
94
119
|
background-color: white;
|
|
95
120
|
}
|
|
96
121
|
|
|
122
|
+
.context-card >>> .el-card__body {
|
|
123
|
+
padding: 0px;
|
|
124
|
+
display: flex;
|
|
125
|
+
width: 516px;
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
.context-image{
|
|
98
129
|
width: 250px
|
|
99
130
|
}
|
|
@@ -115,6 +146,11 @@ export default {
|
|
|
115
146
|
padding-left: 6px;
|
|
116
147
|
}
|
|
117
148
|
|
|
149
|
+
.cursor-pointer {
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
height: 25px;
|
|
152
|
+
}
|
|
153
|
+
|
|
118
154
|
.title{
|
|
119
155
|
font-weight: bold;
|
|
120
156
|
}
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
<div>
|
|
18
18
|
<el-button v-if="entry.scaffolds" @click="openScaffold" size="mini" class="button" icon="el-icon-view">View scaffold</el-button>
|
|
19
19
|
</div>
|
|
20
|
-
<div>
|
|
21
|
-
<el-button v-if="entry.contextualInformation" @click="openContext" size="mini" class="button" icon="el-icon-view">View context data</el-button>
|
|
22
|
-
</div>
|
|
23
20
|
<div>
|
|
24
21
|
<el-button v-if="hasCSVFile" @click="openPlot" size="mini" class="button" icon="el-icon-view">View plot</el-button>
|
|
25
22
|
</div>
|
|
@@ -149,20 +146,6 @@ export default {
|
|
|
149
146
|
}
|
|
150
147
|
this.propogateCardAction(action)
|
|
151
148
|
},
|
|
152
|
-
openContext: function(){
|
|
153
|
-
let action = {
|
|
154
|
-
label: capitalise(this.label),
|
|
155
|
-
resource: 'not used',
|
|
156
|
-
title: "View 3D scaffold",
|
|
157
|
-
type: "Scaffold",
|
|
158
|
-
discoverId: this.discoverId,
|
|
159
|
-
apiLocation: this.envVars.API_LOCATION,
|
|
160
|
-
version: this.version,
|
|
161
|
-
contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
|
|
162
|
-
banner: this.thumbnail
|
|
163
|
-
}
|
|
164
|
-
this.propogateCardAction(action)
|
|
165
|
-
},
|
|
166
149
|
openPlot: function(){
|
|
167
150
|
let action = {
|
|
168
151
|
label: capitalise(this.label),
|
|
@@ -18,9 +18,28 @@
|
|
|
18
18
|
@tags-changed="tagsChangedCallback"
|
|
19
19
|
></custom-cascader>
|
|
20
20
|
<div v-if="showFiltersText" class="filter-default-value">
|
|
21
|
-
<map-svg-icon icon="noun-filter" class="filter-icon-inside" />Apply
|
|
22
21
|
Filters
|
|
23
22
|
</div>
|
|
23
|
+
<el-popover
|
|
24
|
+
title="How do filters work?"
|
|
25
|
+
width="250"
|
|
26
|
+
trigger="hover"
|
|
27
|
+
:append-to-body=false
|
|
28
|
+
popper-class="popover"
|
|
29
|
+
>
|
|
30
|
+
<map-svg-icon slot="reference" icon="help" class="help"/>
|
|
31
|
+
<div >
|
|
32
|
+
<strong>Within categories:</strong> OR
|
|
33
|
+
<br/>
|
|
34
|
+
example: 'heart' OR 'colon'
|
|
35
|
+
<br/>
|
|
36
|
+
<br/>
|
|
37
|
+
<strong>Between categories:</strong> AND
|
|
38
|
+
<br/>
|
|
39
|
+
example: 'rat' AND 'lung'
|
|
40
|
+
</div>
|
|
41
|
+
</el-popover>
|
|
42
|
+
|
|
24
43
|
</span>
|
|
25
44
|
</transition>
|
|
26
45
|
|
|
@@ -45,7 +64,7 @@
|
|
|
45
64
|
<script>
|
|
46
65
|
/* eslint-disable no-alert, no-console */
|
|
47
66
|
import Vue from "vue";
|
|
48
|
-
import { Option, Select } from "element-ui";
|
|
67
|
+
import { Option, Select, Popover } from "element-ui";
|
|
49
68
|
import CustomCascader from "./Cascader";
|
|
50
69
|
import lang from "element-ui/lib/locale/lang/en";
|
|
51
70
|
import locale from "element-ui/lib/locale";
|
|
@@ -58,6 +77,7 @@ import { facetPropPathMapping } from "../algolia/utils.js";
|
|
|
58
77
|
locale.use(lang);
|
|
59
78
|
Vue.use(Option);
|
|
60
79
|
Vue.use(Select);
|
|
80
|
+
Vue.use(Popover)
|
|
61
81
|
|
|
62
82
|
const capitalise = function (txt) {
|
|
63
83
|
return txt.charAt(0).toUpperCase() + txt.slice(1);
|
|
@@ -157,6 +177,7 @@ export default {
|
|
|
157
177
|
this.createCascaderItemValue(facet.label, facetItem.label);
|
|
158
178
|
});
|
|
159
179
|
});
|
|
180
|
+
this.createDataTypeFacet()
|
|
160
181
|
})
|
|
161
182
|
.finally(() => {
|
|
162
183
|
resolve();
|
|
@@ -176,17 +197,28 @@ export default {
|
|
|
176
197
|
// Check for show all in selected cascade options
|
|
177
198
|
event = this.showAllEventModifier(event);
|
|
178
199
|
|
|
179
|
-
//
|
|
180
|
-
let
|
|
200
|
+
// Create results for the filter update
|
|
201
|
+
let filterKeys = event.filter( selection => selection !== undefined).map( fs => ({
|
|
181
202
|
facetPropPath: fs[0],
|
|
182
203
|
facet: fs[1].split("/")[1],
|
|
183
204
|
term: fs[1].split("/")[0],
|
|
184
205
|
}))
|
|
185
206
|
|
|
207
|
+
// Move results from arrays to object for use on scicrunch (note that we remove 'duplicate' as that is only needed for filter keys)
|
|
208
|
+
let filters = event.filter( selection => selection !== undefined).map( fs => {
|
|
209
|
+
let propPath = fs[0].includes('duplicate') ? fs[0].split('duplicate')[0] : fs[0]
|
|
210
|
+
return {
|
|
211
|
+
facetPropPath: propPath,
|
|
212
|
+
facet: fs[1].split("/")[1],
|
|
213
|
+
term: fs[1].split("/")[0],
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
|
|
186
218
|
this.$emit('loading', true) // let sidebarcontent wait for the requests
|
|
187
219
|
|
|
188
220
|
this.$emit("filterResults", filters); // emit filters for apps above sidebar
|
|
189
|
-
this.setCascader(
|
|
221
|
+
this.setCascader(filterKeys); //update our cascader v-model if we modified the event
|
|
190
222
|
this.makeCascadeLabelsClickable();
|
|
191
223
|
}
|
|
192
224
|
},
|
|
@@ -255,6 +287,28 @@ export default {
|
|
|
255
287
|
}
|
|
256
288
|
return event;
|
|
257
289
|
},
|
|
290
|
+
createDataTypeFacet: function(){
|
|
291
|
+
let dataFacet = {...this.facets[2]} // copy the 'Experiemental approach' facet
|
|
292
|
+
let count = this.facets.at(-1).id // get the last id count
|
|
293
|
+
|
|
294
|
+
// Step through the children that are valid data types, switch thier values
|
|
295
|
+
let newChildren = dataFacet.children.filter( el=> {
|
|
296
|
+
if (el.label === 'Scaffold' || el.label === 'Simulation' || el.label === 'Show all'){
|
|
297
|
+
el.key = el.label
|
|
298
|
+
el.id = count
|
|
299
|
+
el.value = el.value.replace('Experimental approach', 'Data type')
|
|
300
|
+
count++
|
|
301
|
+
return el
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
dataFacet.id = count
|
|
305
|
+
dataFacet.key = 'Data type'
|
|
306
|
+
// Add 'duplicate' so that the key is unique. This is removed in the cascade event for filtering
|
|
307
|
+
dataFacet.value += 'duplicate'
|
|
308
|
+
dataFacet.children = newChildren
|
|
309
|
+
dataFacet.label = 'Data type'
|
|
310
|
+
this.facets.push(dataFacet)
|
|
311
|
+
},
|
|
258
312
|
cascadeExpandChange: function (event) {
|
|
259
313
|
//work around as the expand item may change on modifying the cascade props
|
|
260
314
|
this.__expandItem__ = event;
|
|
@@ -358,6 +412,20 @@ export default {
|
|
|
358
412
|
padding-left: 16px;
|
|
359
413
|
}
|
|
360
414
|
|
|
415
|
+
.help {
|
|
416
|
+
width: 24px !important;
|
|
417
|
+
height: 24px;
|
|
418
|
+
transform: scale(1.1);
|
|
419
|
+
color: #8300bf;
|
|
420
|
+
cursor: pointer;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.popover {
|
|
424
|
+
color: rgb(48, 49, 51);
|
|
425
|
+
font-family: Asap;
|
|
426
|
+
margin: 12px;
|
|
427
|
+
}
|
|
428
|
+
|
|
361
429
|
.filter-icon-inside {
|
|
362
430
|
width: 12px !important;
|
|
363
431
|
height: 12px !important;
|
|
@@ -439,4 +507,51 @@ export default {
|
|
|
439
507
|
.cascader >>> .el-cascader-node__label {
|
|
440
508
|
text-align: left;
|
|
441
509
|
}
|
|
510
|
+
|
|
511
|
+
.filters >>> .el-popover {
|
|
512
|
+
background: #f3ecf6 !important;
|
|
513
|
+
border: 1px solid #8300BF;
|
|
514
|
+
border-radius: 4px;
|
|
515
|
+
color: #303133 !important;
|
|
516
|
+
font-size: 12px;
|
|
517
|
+
line-height: 18px;
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.filters >>> .el-popover[x-placement^="top"] .popper__arrow {
|
|
523
|
+
border-top-color: #8300BF;
|
|
524
|
+
border-bottom-width: 0;
|
|
525
|
+
}
|
|
526
|
+
.filters >>> .el-popover[x-placement^="top"] .popper__arrow::after {
|
|
527
|
+
border-top-color: #f3ecf6;
|
|
528
|
+
border-bottom-width: 0;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.filters >>> .el-popover[x-placement^="bottom"] .popper__arrow {
|
|
532
|
+
border-top-width: 0;
|
|
533
|
+
border-bottom-color: #8300BF;
|
|
534
|
+
}
|
|
535
|
+
.filters >>> .el-popover[x-placement^="bottom"] .popper__arrow::after {
|
|
536
|
+
border-top-width: 0;
|
|
537
|
+
border-bottom-color: #f3ecf6;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.filters >>> .el-popover[x-placement^="right"] .popper__arrow {
|
|
541
|
+
border-right-color: #8300BF;
|
|
542
|
+
border-left-width: 0;
|
|
543
|
+
}
|
|
544
|
+
.filters >>> .el-popover[x-placement^="right"] .popper__arrow::after {
|
|
545
|
+
border-right-color: #f3ecf6;
|
|
546
|
+
border-left-width: 0;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.filters >>> .el-popover[x-placement^="left"] .popper__arrow {
|
|
550
|
+
border-right-width: 0;
|
|
551
|
+
border-left-color: #8300BF;
|
|
552
|
+
}
|
|
553
|
+
.filters >>> .el-popover[x-placement^="left"] .popper__arrow::after {
|
|
554
|
+
border-right-width: 0;
|
|
555
|
+
border-left-color: #f3ecf6;
|
|
556
|
+
}
|
|
442
557
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-card :body-style="bodyStyle" class="content-card">
|
|
3
3
|
<div slot="header" class="header">
|
|
4
|
-
<context-card v-if="contextCardEntry" :entry="contextCardEntry" />
|
|
4
|
+
<context-card v-if="contextCardEntry && contextCardEnabled" :entry="contextCardEntry" />
|
|
5
5
|
<el-input
|
|
6
6
|
class="search-input"
|
|
7
7
|
placeholder="Search"
|
|
@@ -102,7 +102,8 @@ var initial_state = {
|
|
|
102
102
|
start: 0,
|
|
103
103
|
hasSearched: false,
|
|
104
104
|
sciCrunchError: false,
|
|
105
|
-
contextCardEntry: undefined
|
|
105
|
+
contextCardEntry: undefined,
|
|
106
|
+
contextCardEnabled: false
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
export default {
|