@abi-software/map-utilities 1.1.3-beta.5 → 1.1.3-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.1.3-beta.5",
3
+ "version": "1.1.3-beta.7",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="connectivity-graph" v-loading="loading">
3
+
3
4
  <div ref="graphCanvas" class="graph-canvas"></div>
5
+
4
6
  <div class="control-panel">
5
7
  <div class="node-key">
6
8
  <div class="key-head">Node type:</div>
@@ -53,6 +55,11 @@
53
55
  </el-tooltip>
54
56
  </div>
55
57
  </div>
58
+
59
+ <div class="connectivity-graph-error" v-if="errorMessage">
60
+ {{ errorMessage }}
61
+ </div>
62
+
56
63
  </div>
57
64
  </template>
58
65
 
@@ -95,6 +102,7 @@ export default {
95
102
  zoomLockLabel: ZOOM_LOCK_LABEL,
96
103
  iconColor: APP_PRIMARY_COLOR,
97
104
  zoomEnabled: false,
105
+ errorMessage: '',
98
106
  };
99
107
  },
100
108
  mounted() {
@@ -184,7 +192,7 @@ export default {
184
192
 
185
193
  this.connectivityGraph.on('tap-node', (event) => {
186
194
  const { label } = event.detail;
187
- const labels = label.split(`\n`);
195
+ const labels = label ? label.split(`\n`) : [];
188
196
  /**
189
197
  * This event is triggered after a node on the connectivity graph is clicked.
190
198
  */
@@ -296,14 +304,20 @@ export default {
296
304
  },
297
305
  getCachedTermLabels: async function () {
298
306
  if (this.labelledTerms.size) {
299
- const data = await this.query(`
300
- select entity, label from labels
301
- where entity in (?${', ?'.repeat(this.labelledTerms.size-1)})`,
307
+ const data = await this.query(
308
+ `select entity, knowledge from knowledge
309
+ where entity in (?${', ?'.repeat(this.labelledTerms.size-1)})
310
+ order by source desc`,
302
311
  [...this.labelledTerms.values()]
303
312
  );
304
313
 
305
- for (const termLabel of data.values) {
306
- this.labelCache.set(termLabel[0], termLabel[1]);
314
+ let last_entity = null;
315
+ for (const [key, jsonKnowledge] of data.values) {
316
+ if (key !== last_entity) {
317
+ const knowledge = JSON.parse(jsonKnowledge);
318
+ this.labelCache.set(key, knowledge['label'] || key);
319
+ last_entity = key;
320
+ }
307
321
  }
308
322
 
309
323
  const labelCacheObj = Object.fromEntries(this.labelCache);
@@ -339,6 +353,9 @@ export default {
339
353
  this.zoomLockLabel = this.zoomEnabled ? ZOOM_UNLOCK_LABEL : ZOOM_LOCK_LABEL;
340
354
  this.connectivityGraph.enableZoom(!this.zoomEnabled);
341
355
  },
356
+ updateErrorMessage: function (message) {
357
+ this.errorMessage = message;
358
+ },
342
359
  },
343
360
  };
344
361
  </script>
@@ -433,6 +450,19 @@ export default {
433
450
  z-index: 1;
434
451
  }
435
452
 
453
+ .connectivity-graph-error {
454
+ position: absolute;
455
+ top: 1rem;
456
+ left: 50%;
457
+ transform: translateX(-50%);
458
+ width: fit-content;
459
+ font-size: 12px;
460
+ padding: 0.25rem 0.5rem;
461
+ background-color: var(--el-color-error-light-9);
462
+ border-radius: var(--el-border-radius-small);
463
+ border: 1px solid var(--el-color-error);
464
+ }
465
+
436
466
  .visually-hidden {
437
467
  clip: rect(0 0 0 0);
438
468
  clip-path: inset(50%);
@@ -227,6 +227,7 @@ class CytoscapeGraph extends EventTarget
227
227
  .on('mouseout', 'node', this.exitNode.bind(this))
228
228
  .on('position', 'node', this.moveNode.bind(this))
229
229
  .on('tap', 'node', this.tapNode.bind(this))
230
+ .on('tap', this.tapNode.bind(this))
230
231
 
231
232
  this.tooltip = document.createElement('div')
232
233
  this.tooltip.className = 'cy-graph-tooltip'