@abi-software/map-side-bar 2.7.2-beta.0 → 2.7.2-beta.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.
- package/dist/map-side-bar.js +6979 -6572
- package/dist/map-side-bar.umd.cjs +60 -60
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +95 -30
- package/src/components/ConnectivityCard.vue +78 -0
- package/src/components/ConnectivityExplorer.vue +518 -0
- package/src/components/ConnectivityInfo.vue +159 -83
- package/src/components/SearchFilters.vue +66 -51
- package/src/components/SideBar.vue +81 -108
- package/src/components/SidebarContent.vue +2 -1
- package/src/components/Tabs.vue +56 -95
- package/src/components.d.ts +2 -22
- package/src/exampleConnectivityInput.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.7.2-beta.
|
|
3
|
+
"version": "2.7.2-beta.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/*",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@abi-software/gallery": "^1.1.2",
|
|
42
|
-
"@abi-software/map-utilities": "^1.4.
|
|
42
|
+
"@abi-software/map-utilities": "^1.4.0",
|
|
43
43
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
package/src/App.vue
CHANGED
|
@@ -16,22 +16,23 @@
|
|
|
16
16
|
<el-button @click="keywordSearch">keyword search</el-button>
|
|
17
17
|
<el-button @click="getFacets">Get facets</el-button>
|
|
18
18
|
<el-button @click="toggleCreateData">Create Data/Annotation</el-button>
|
|
19
|
+
<el-button @click="openConnectivitySearch()">Connectivity Search</el-button>
|
|
19
20
|
</div>
|
|
20
21
|
<SideBar
|
|
21
22
|
:envVars="envVars"
|
|
22
23
|
class="side-bar"
|
|
23
24
|
ref="sideBar"
|
|
24
25
|
:visible="sideBarVisibility"
|
|
25
|
-
:tabs="tabs"
|
|
26
|
-
:activeTabId="activeId"
|
|
27
26
|
:annotationEntry="annotationEntry"
|
|
28
27
|
:createData="createData"
|
|
29
|
-
:
|
|
30
|
-
|
|
28
|
+
:connectivityEntry="connectivityEntry"
|
|
29
|
+
:connectivityKnowledge="connectivityKnowledge"
|
|
31
30
|
@search-changed="searchChanged($event)"
|
|
32
31
|
@hover-changed="hoverChanged($event)"
|
|
33
|
-
@connectivity-
|
|
32
|
+
@connectivity-clicked="openConnectivitySearch"
|
|
33
|
+
@connectivity-hovered="onConnectivityHovered"
|
|
34
34
|
@actionClick="action"
|
|
35
|
+
@connectivity-explorer-clicked="onConnectivityExplorerClicked"
|
|
35
36
|
/>
|
|
36
37
|
</div>
|
|
37
38
|
</template>
|
|
@@ -43,8 +44,24 @@ import SideBar from './components/SideBar.vue'
|
|
|
43
44
|
import EventBus from './components/EventBus.js'
|
|
44
45
|
import exampleConnectivityInput from './exampleConnectivityInput.js'
|
|
45
46
|
|
|
47
|
+
|
|
46
48
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
47
49
|
|
|
50
|
+
const flatmapQuery = (flatmapApi, sql) => {
|
|
51
|
+
const data = { sql: sql };
|
|
52
|
+
return fetch(`${flatmapApi}knowledge/query/`, {
|
|
53
|
+
method: "POST",
|
|
54
|
+
headers: {
|
|
55
|
+
"Content-Type": "application/json",
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify(data),
|
|
58
|
+
})
|
|
59
|
+
.then((response) => response.json())
|
|
60
|
+
.catch((error) => {
|
|
61
|
+
console.error("Error:", error);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
48
65
|
// let testContext = {
|
|
49
66
|
// "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.",
|
|
50
67
|
// "heading": "Digital tracings of enteric plexus",
|
|
@@ -94,27 +111,19 @@ export default {
|
|
|
94
111
|
components: {
|
|
95
112
|
SideBar,
|
|
96
113
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return temp
|
|
104
|
-
},
|
|
114
|
+
provide() {
|
|
115
|
+
return {
|
|
116
|
+
$annotator: undefined,
|
|
117
|
+
userApiKey: undefined,
|
|
118
|
+
}
|
|
105
119
|
},
|
|
106
120
|
data: function () {
|
|
107
121
|
return {
|
|
108
122
|
annotationEntry: {
|
|
109
|
-
featureId
|
|
110
|
-
resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
|
|
123
|
+
featureId: "epicardium",
|
|
124
|
+
resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
|
|
125
|
+
"resource": "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json"
|
|
111
126
|
},
|
|
112
|
-
contextArray: [null, null],
|
|
113
|
-
tabArray: [
|
|
114
|
-
{ title: 'Flatmap', id: 1, type: 'search'},
|
|
115
|
-
{ title: 'Connectivity', id: 2, type: 'connectivity' },
|
|
116
|
-
{ title: 'Annotation', id: 3, type: 'annotation' },
|
|
117
|
-
],
|
|
118
127
|
sideBarVisibility: true,
|
|
119
128
|
envVars: {
|
|
120
129
|
API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
|
|
@@ -127,8 +136,7 @@ export default {
|
|
|
127
136
|
ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
|
|
128
137
|
FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
|
|
129
138
|
},
|
|
130
|
-
|
|
131
|
-
activeId: 1,
|
|
139
|
+
connectivityEntry: {},
|
|
132
140
|
createData: {
|
|
133
141
|
toBeConfirmed: false,
|
|
134
142
|
points: [],
|
|
@@ -137,17 +145,66 @@ export default {
|
|
|
137
145
|
y: 0,
|
|
138
146
|
},
|
|
139
147
|
createDataSet: false,
|
|
148
|
+
sckanVersion: 'sckan-2024-09-21-npo',
|
|
149
|
+
flatmapKnowledge: [],
|
|
150
|
+
connectivityKnowledge: [],
|
|
151
|
+
query: '',
|
|
152
|
+
filter: [],
|
|
153
|
+
target: [],
|
|
140
154
|
}
|
|
141
155
|
},
|
|
142
156
|
methods: {
|
|
157
|
+
loadConnectivityKnowledge: async function () {
|
|
158
|
+
const sql = `select knowledge from knowledge
|
|
159
|
+
where source="${this.sckanVersion}"
|
|
160
|
+
order by source desc`;
|
|
161
|
+
const response = await flatmapQuery(this.envVars.FLATMAPAPI_LOCATION, sql);
|
|
162
|
+
const mappedData = response.values.map(x => x[0]);
|
|
163
|
+
const knowledge = mappedData.map(x => JSON.parse(x));
|
|
164
|
+
this.flatmapKnowledge = knowledge.filter((item) => {
|
|
165
|
+
if (item.source === this.sckanVersion && item.connectivity?.length) return true;
|
|
166
|
+
return false;
|
|
167
|
+
});
|
|
168
|
+
this.connectivityKnowledge = this.flatmapKnowledge;
|
|
169
|
+
},
|
|
170
|
+
connectivityQueryFilter: async function (payload) {
|
|
171
|
+
let results = this.flatmapKnowledge;
|
|
172
|
+
if (payload.type === "query-update") {
|
|
173
|
+
if (this.query !== payload.value) this.target = [];
|
|
174
|
+
this.query = payload.value;
|
|
175
|
+
} else if (payload.type === "filter-update") {
|
|
176
|
+
this.filter = payload.value;
|
|
177
|
+
this.target = [];
|
|
178
|
+
} else if (payload.type === "query-filter-update") {
|
|
179
|
+
this.query = payload.query;
|
|
180
|
+
this.filter = payload.filter;
|
|
181
|
+
this.target = payload.data;
|
|
182
|
+
}
|
|
183
|
+
if (this.query) {
|
|
184
|
+
let flag = "", order = [], paths = [];
|
|
185
|
+
const labels = ['neuron type aacar 11'];
|
|
186
|
+
flag = 'label';
|
|
187
|
+
order = labels;
|
|
188
|
+
if (labels.length === 1) {
|
|
189
|
+
paths =['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
|
|
190
|
+
flag = 'id';
|
|
191
|
+
order = [this.query, ...paths.filter(item => item !== this.query)];
|
|
192
|
+
}
|
|
193
|
+
results = results.filter(item => paths.includes(item.id) || labels.includes(item.label));
|
|
194
|
+
results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
|
|
195
|
+
}
|
|
196
|
+
this.connectivityKnowledge = results;
|
|
197
|
+
},
|
|
143
198
|
hoverChanged: function (data) {
|
|
144
199
|
console.log('hoverChanged', data)
|
|
145
200
|
},
|
|
146
201
|
searchChanged: function (data) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
202
|
+
if (!this.flatmapKnowledge.length) {
|
|
203
|
+
this.loadConnectivityKnowledge();
|
|
204
|
+
}
|
|
205
|
+
if (data.id === 2) {
|
|
206
|
+
this.connectivityQueryFilter(data)
|
|
207
|
+
}
|
|
151
208
|
},
|
|
152
209
|
// For connectivity input actions
|
|
153
210
|
action: function (action) {
|
|
@@ -279,11 +336,19 @@ export default {
|
|
|
279
336
|
this.createDataSet = false
|
|
280
337
|
}
|
|
281
338
|
},
|
|
282
|
-
|
|
283
|
-
console.log("
|
|
339
|
+
onConnectivityHovered: function(data) {
|
|
340
|
+
console.log("onConnectivityHovered" , data)
|
|
341
|
+
},
|
|
342
|
+
openConnectivitySearch: function (entry) {
|
|
343
|
+
const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5'
|
|
344
|
+
const filter = entry ? entry.filter : []
|
|
345
|
+
this.$refs.sideBar.openConnectivitySearch(filter, query)
|
|
346
|
+
},
|
|
347
|
+
onConnectivityExplorerClicked: function () {
|
|
348
|
+
this.connectivityEntry = {...exampleConnectivityInput}
|
|
284
349
|
}
|
|
285
350
|
},
|
|
286
|
-
mounted: function () {
|
|
351
|
+
mounted: async function () {
|
|
287
352
|
console.log('mounted app')
|
|
288
353
|
EventBus.on('contextUpdate', (payLoad) => {
|
|
289
354
|
console.log('contextUpdate', payLoad)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="connectivity-card-container" ref="container">
|
|
3
|
+
<div class="connectivity-card" ref="card">
|
|
4
|
+
<div class="seperator-path"></div>
|
|
5
|
+
<div class="card" @click="cardClicked(entry)">
|
|
6
|
+
<div class="title">{{ entry.label }}</div>
|
|
7
|
+
<template v-for="field in displayFields" :key="field">
|
|
8
|
+
<div class="details" v-if="entry[field]">
|
|
9
|
+
<strong>{{ field }}:</strong> {{ entry[field] }}
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: "ConnectivityCard",
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
displayFields: ["id"],
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
/**
|
|
27
|
+
* Object containing information for
|
|
28
|
+
* the required viewing.
|
|
29
|
+
*/
|
|
30
|
+
entry: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => {},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
cardClicked: function (data) {
|
|
37
|
+
this.$emit("connectivity-explorer-clicked", data);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
.connectivity-card {
|
|
45
|
+
padding-left: 5px;
|
|
46
|
+
position: relative;
|
|
47
|
+
min-height: 5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.card {
|
|
51
|
+
padding-top: 18px;
|
|
52
|
+
padding-left: 6px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.title {
|
|
57
|
+
padding-bottom: 0.75rem;
|
|
58
|
+
font-weight: bold;
|
|
59
|
+
line-height: 1.5;
|
|
60
|
+
letter-spacing: 1.05px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.details {
|
|
64
|
+
line-height: 1.5;
|
|
65
|
+
letter-spacing: 1.05px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.button {
|
|
69
|
+
margin-right: 3.5rem;
|
|
70
|
+
font-family: Asap;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
font-weight: normal;
|
|
73
|
+
background-color: $app-primary-color;
|
|
74
|
+
border: $app-primary-color;
|
|
75
|
+
color: white;
|
|
76
|
+
margin-top: 8px;
|
|
77
|
+
}
|
|
78
|
+
</style>
|