@abi-software/map-utilities 1.3.3-beta.1 → 1.3.3-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-utilities.js +1586 -1576
- package/dist/map-utilities.umd.cjs +31 -31
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ConnectivityGraph/ConnectivityGraph.vue +67 -53
- package/src/components.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="connectivity-graph" v-loading="loading" ref="connectivityGraphRef">
|
|
3
3
|
|
|
4
|
-
<div class="sckan-version">
|
|
5
|
-
SCKAN Release: {{ this.selectedSource }}
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
4
|
<div ref="graphCanvas" class="graph-canvas"></div>
|
|
9
5
|
|
|
10
6
|
<div class="control-panel control-panel-tools">
|
|
@@ -121,12 +117,15 @@
|
|
|
121
117
|
{{ connectivityError.errorMessage }}
|
|
122
118
|
</div>
|
|
123
119
|
|
|
120
|
+
<div v-if="loadingError" class="loading-error">
|
|
121
|
+
{{ loadingError }}
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
124
|
</div>
|
|
125
125
|
</template>
|
|
126
126
|
|
|
127
127
|
<script>
|
|
128
128
|
import { ConnectivityGraph } from './graph';
|
|
129
|
-
import { capitalise } from '../utilities';
|
|
130
129
|
|
|
131
130
|
const MIN_SCHEMA_VERSION = 1.3;
|
|
132
131
|
const CACHE_LIFETIME = 24 * 60 * 60 * 1000; // One day
|
|
@@ -165,8 +164,10 @@ export default {
|
|
|
165
164
|
data: function () {
|
|
166
165
|
return {
|
|
167
166
|
loading: true,
|
|
167
|
+
loadingError: '',
|
|
168
168
|
connectivityGraph: null,
|
|
169
169
|
selectedSource: '',
|
|
170
|
+
availableSources: [],
|
|
170
171
|
pathList: [],
|
|
171
172
|
schemaVersion: '',
|
|
172
173
|
knowledgeByPath: new Map(),
|
|
@@ -184,45 +185,62 @@ export default {
|
|
|
184
185
|
};
|
|
185
186
|
},
|
|
186
187
|
mounted() {
|
|
188
|
+
this.showSpinner();
|
|
187
189
|
this.updateTooltipContainer();
|
|
188
190
|
this.refreshCache();
|
|
189
191
|
this.loadCacheData();
|
|
190
|
-
this.run()
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
this.run()
|
|
193
|
+
.then((res) => {
|
|
194
|
+
if (res?.success) {
|
|
195
|
+
this.showGraph(this.entry);
|
|
196
|
+
} else if (res?.error) {
|
|
197
|
+
this.loadingError = res.error;
|
|
198
|
+
} else {
|
|
199
|
+
this.loadingError = 'Loading error!';
|
|
200
|
+
}
|
|
201
|
+
this.hideSpinner();
|
|
202
|
+
})
|
|
203
|
+
.catch((error) => {
|
|
204
|
+
this.loadingError = 'Loading error!';
|
|
205
|
+
this.hideSpinner();
|
|
206
|
+
});
|
|
193
207
|
},
|
|
194
208
|
methods: {
|
|
195
209
|
updateTooltipContainer: function () {
|
|
196
210
|
this.connectivityGraphContainer = this.$refs.connectivityGraphRef;
|
|
197
211
|
},
|
|
198
212
|
loadCacheData: function () {
|
|
199
|
-
const
|
|
213
|
+
const availableSources = sessionStorage.getItem('connectivity-graph-sources');
|
|
200
214
|
const labelCache = sessionStorage.getItem('connectivity-graph-labels');
|
|
201
215
|
const pathList = sessionStorage.getItem('connectivity-graph-pathlist');
|
|
202
216
|
const schemaVersion = sessionStorage.getItem('connectivity-graph-schema-version');
|
|
203
217
|
|
|
204
|
-
|
|
205
|
-
this.selectedSource = selectedSource;
|
|
206
|
-
}
|
|
207
|
-
// Update knowledge source if SCKAN version is provided
|
|
218
|
+
// Use provided SCKAN version for the knowledge source
|
|
208
219
|
if (this.sckanVersion) {
|
|
209
220
|
this.selectedSource = this.sckanVersion;
|
|
210
|
-
sessionStorage.setItem('connectivity-graph-source', this.selectedSource);
|
|
211
|
-
this.updateCacheExpiry();
|
|
212
221
|
}
|
|
222
|
+
sessionStorage.setItem('connectivity-graph-selected-source', this.selectedSource);
|
|
223
|
+
this.updateCacheExpiry();
|
|
224
|
+
|
|
225
|
+
if (availableSources) {
|
|
226
|
+
this.availableSources = JSON.parse(availableSources);
|
|
227
|
+
}
|
|
228
|
+
|
|
213
229
|
if (pathList) {
|
|
214
230
|
this.pathList = JSON.parse(pathList);
|
|
215
231
|
}
|
|
232
|
+
|
|
216
233
|
if (labelCache) {
|
|
217
234
|
const labelCacheObj = JSON.parse(labelCache);
|
|
218
235
|
this.labelCache = new Map(Object.entries(labelCacheObj));
|
|
219
236
|
}
|
|
237
|
+
|
|
220
238
|
if (schemaVersion) {
|
|
221
239
|
this.schemaVersion = schemaVersion;
|
|
222
240
|
}
|
|
223
241
|
},
|
|
224
242
|
isValidKnowledgeSource: function () {
|
|
225
|
-
const selectedSource = sessionStorage.getItem('connectivity-graph-source');
|
|
243
|
+
const selectedSource = sessionStorage.getItem('connectivity-graph-selected-source');
|
|
226
244
|
if (this.sckanVersion && (this.sckanVersion !== selectedSource)) {
|
|
227
245
|
return false;
|
|
228
246
|
}
|
|
@@ -231,7 +249,9 @@ export default {
|
|
|
231
249
|
removeAllCacheData: function () {
|
|
232
250
|
const keys = [
|
|
233
251
|
'connectivity-graph-expiry',
|
|
234
|
-
'connectivity-graph-source',
|
|
252
|
+
'connectivity-graph-selected-source',
|
|
253
|
+
'connectivity-graph-source', // to clear old data
|
|
254
|
+
'connectivity-graph-sources',
|
|
235
255
|
'connectivity-graph-labels',
|
|
236
256
|
'connectivity-graph-pathlist',
|
|
237
257
|
'connectivity-graph-schema-version',
|
|
@@ -262,28 +282,32 @@ export default {
|
|
|
262
282
|
this.updateCacheExpiry();
|
|
263
283
|
}
|
|
264
284
|
if (this.schemaVersion < MIN_SCHEMA_VERSION) {
|
|
265
|
-
|
|
266
|
-
|
|
285
|
+
return {
|
|
286
|
+
error: `No server available for schema-version ${this.schemaVersion}.`,
|
|
287
|
+
};
|
|
267
288
|
}
|
|
268
|
-
|
|
269
|
-
if (!this.
|
|
270
|
-
this.
|
|
271
|
-
sessionStorage.setItem('connectivity-graph-source', this.selectedSource);
|
|
272
|
-
this.updateCacheExpiry();
|
|
289
|
+
|
|
290
|
+
if (!this.availableSources.length) {
|
|
291
|
+
this.availableSources = await this.loadAvailableSources();
|
|
273
292
|
}
|
|
293
|
+
|
|
294
|
+
if (!this.isSCKANVersionAvailable()) {
|
|
295
|
+
return {
|
|
296
|
+
error: `No data available for SCKAN version ${this.selectedSource}.`,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
274
300
|
await this.setPathList(this.selectedSource);
|
|
275
|
-
|
|
301
|
+
return {
|
|
302
|
+
success: true,
|
|
303
|
+
};
|
|
276
304
|
},
|
|
277
305
|
showGraph: async function (neuronPath) {
|
|
278
306
|
const graphCanvas = this.$refs.graphCanvas;
|
|
279
307
|
|
|
280
|
-
this.showSpinner();
|
|
281
|
-
|
|
282
308
|
this.connectivityGraph = new ConnectivityGraph(this.labelCache, graphCanvas);
|
|
283
309
|
await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(neuronPath));
|
|
284
310
|
|
|
285
|
-
this.hideSpinner();
|
|
286
|
-
|
|
287
311
|
this.connectivityGraph.showConnectivity(graphCanvas);
|
|
288
312
|
|
|
289
313
|
// saved state from list view
|
|
@@ -325,25 +349,16 @@ export default {
|
|
|
325
349
|
};
|
|
326
350
|
}
|
|
327
351
|
},
|
|
328
|
-
|
|
352
|
+
isSCKANVersionAvailable: function () {
|
|
353
|
+
return this.availableSources.includes(this.selectedSource);
|
|
354
|
+
},
|
|
355
|
+
loadAvailableSources: async function () {
|
|
329
356
|
const data = await this.getJsonData(`${this.mapServer}knowledge/sources`);
|
|
330
357
|
const sources = data ? (data.sources || []) : [];
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
for (const source of sources) {
|
|
337
|
-
if (source) {
|
|
338
|
-
sourceList.push(source);
|
|
339
|
-
|
|
340
|
-
if (firstSource === '') {
|
|
341
|
-
firstSource = source;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return firstSource;
|
|
358
|
+
const filteredSources = sources.filter((source) => source); // filter null values
|
|
359
|
+
sessionStorage.setItem('connectivity-graph-sources', JSON.stringify(filteredSources));
|
|
360
|
+
this.updateCacheExpiry();
|
|
361
|
+
return filteredSources;
|
|
347
362
|
},
|
|
348
363
|
loadPathData: async function (source) {
|
|
349
364
|
const data = await this.query(
|
|
@@ -664,14 +679,13 @@ export default {
|
|
|
664
679
|
width: 1px;
|
|
665
680
|
}
|
|
666
681
|
|
|
667
|
-
.
|
|
682
|
+
.loading-error {
|
|
668
683
|
position: absolute;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
color: gray;
|
|
684
|
+
inset: 0;
|
|
685
|
+
display: flex;
|
|
686
|
+
align-items: center;
|
|
687
|
+
justify-content: center;
|
|
688
|
+
background-color: var(--el-mask-color);
|
|
675
689
|
}
|
|
676
690
|
</style>
|
|
677
691
|
|
package/src/components.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare module 'vue' {
|
|
|
15
15
|
DrawToolbar: typeof import('./components/DrawToolbar/DrawToolbar.vue')['default']
|
|
16
16
|
ElButton: typeof import('element-plus/es')['ElButton']
|
|
17
17
|
ElCol: typeof import('element-plus/es')['ElCol']
|
|
18
|
+
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
|
|
18
19
|
ElContainer: typeof import('element-plus/es')['ElContainer']
|
|
19
20
|
ElHeader: typeof import('element-plus/es')['ElHeader']
|
|
20
21
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
|
@@ -28,6 +29,7 @@ declare module 'vue' {
|
|
|
28
29
|
ElIconFinished: typeof import('@element-plus/icons-vue')['Finished']
|
|
29
30
|
ElIconLock: typeof import('@element-plus/icons-vue')['Lock']
|
|
30
31
|
ElIconUnlock: typeof import('@element-plus/icons-vue')['Unlock']
|
|
32
|
+
ElIconWarning: typeof import('@element-plus/icons-vue')['Warning']
|
|
31
33
|
ElIconZoomIn: typeof import('@element-plus/icons-vue')['ZoomIn']
|
|
32
34
|
ElIconZoomOut: typeof import('@element-plus/icons-vue')['ZoomOut']
|
|
33
35
|
ElInput: typeof import('element-plus/es')['ElInput']
|
|
@@ -37,6 +39,7 @@ declare module 'vue' {
|
|
|
37
39
|
ElRow: typeof import('element-plus/es')['ElRow']
|
|
38
40
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
|
39
41
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
|
42
|
+
ElTree: typeof import('element-plus/es')['ElTree']
|
|
40
43
|
ExternalResourceCard: typeof import('./components/Tooltip/ExternalResourceCard.vue')['default']
|
|
41
44
|
HelpModeDialog: typeof import('./components/HelpModeDialog/HelpModeDialog.vue')['default']
|
|
42
45
|
ProvenancePopup: typeof import('./components/Tooltip/ProvenancePopup.vue')['default']
|