From 9f2556d4607a6b9f5a7f46bd73bc510adde6a741 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Sun, 6 Apr 2025 18:25:32 +1200 Subject: [PATCH 01/10] Add mapuuid in connectivity data --- src/components/FlatmapVuer.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index 796e35f3..2349f765 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -2204,6 +2204,10 @@ export default { if (this.mapImp.provenance?.connectivity) { this.tooltipEntry['knowledge-source'] = getKnowledgeSource(this.mapImp); } + // Map uuid to load connectivity information from the map + if (this.mapImp?.uuid) { + this.tooltipEntry['mapuuid'] = this.mapImp.uuid; + } this.$emit('connectivity-info-open', this.tooltipEntry); } if (this.annotationSidebar && this.viewingMode === 'Annotation') { From a8716cd9eb7696088c1036b008a326597c7d2233 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Sun, 6 Apr 2025 19:57:01 +1200 Subject: [PATCH 02/10] Add mapID and mapUUID to connectivity info --- src/components/FlatmapVuer.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index 2349f765..4c3c7590 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -2203,10 +2203,10 @@ export default { // Get connectivity knowledge source | SCKAN release if (this.mapImp.provenance?.connectivity) { this.tooltipEntry['knowledge-source'] = getKnowledgeSource(this.mapImp); - } - // Map uuid to load connectivity information from the map - if (this.mapImp?.uuid) { - this.tooltipEntry['mapuuid'] = this.mapImp.uuid; + + // Map id and uuid to load connectivity information from the map + this.tooltipEntry['mapId'] = this.mapImp.provenance.id; + this.tooltipEntry['mapuuid'] = this.mapImp.provenance.uuid; } this.$emit('connectivity-info-open', this.tooltipEntry); } From 35097b8ff02382b5929a8846ed759959ee515629 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Mon, 7 Apr 2025 12:30:07 +1200 Subject: [PATCH 03/10] Update components types --- src/components.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 2799c294..974a7996 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -8,7 +8,6 @@ export {} declare module 'vue' { export interface GlobalComponents { DynamicLegends: typeof import('./components/legends/DynamicLegends.vue')['default'] - ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete'] ElButton: typeof import('element-plus/es')['ElButton'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] @@ -24,7 +23,6 @@ declare module 'vue' { ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] - ElSwitch: typeof import('element-plus/es')['ElSwitch'] FlatmapVuer: typeof import('./components/FlatmapVuer.vue')['default'] MultiFlatmapVuer: typeof import('./components/MultiFlatmapVuer.vue')['default'] SelectionsGroup: typeof import('./components/SelectionsGroup.vue')['default'] From 52a9d3d5b556289c58bf3cc5ebe8a8ff7ab41bec Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 8 Apr 2025 14:30:45 +1200 Subject: [PATCH 04/10] Fix missing tooltip action click --- src/components/FlatmapVuer.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index 4c3c7590..8fbe697f 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -589,6 +589,7 @@ Please use `const` to assign meaningful names to them... :tooltipEntry="tooltipEntry" :annotationDisplay="viewingMode === 'Annotation'" @annotation="commitAnnotationEvent" + @onActionClick="onActionClick" /> @@ -638,6 +639,7 @@ import { mapState } from 'pinia' import { useMainStore } from '@/store/index' import { DrawToolbar, Tooltip, TreeControls } from '@abi-software/map-utilities' import '@abi-software/map-utilities/dist/style.css' +import EventBus from './EventBus.js' const ERROR_MESSAGE = 'cannot be found on the map.'; @@ -2721,6 +2723,9 @@ export default { if (this.mapImp) return this.mapImp.search(term) return [] }, + onActionClick: function (data) { + EventBus.emit('onActionClick', data) + }, }, props: { /** From 32569c507b04cdf3b6e8ac866e22c602f7f10cdf Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 8 Apr 2025 16:25:33 +1200 Subject: [PATCH 05/10] Add knowledge-source in storage --- src/services/flatmapKnowledge.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/flatmapKnowledge.js b/src/services/flatmapKnowledge.js index b1c03061..44c20ff8 100644 --- a/src/services/flatmapKnowledge.js +++ b/src/services/flatmapKnowledge.js @@ -46,12 +46,14 @@ function loadAndStoreKnowledge(mapImp, flatmapQueries) { where source="${knowledgeSource}" order by source desc`; const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge'); + const flatmapKnowledgeSource = sessionStorage.getItem('flatmap-knowledge-source'); - if (!flatmapKnowledge) { + if (!flatmapKnowledge || flatmapKnowledgeSource !== knowledgeSource) { flatmapQueries.flatmapQuery(sql).then((response) => { const mappedData = response.values.map(x => x[0]); const parsedData = mappedData.map(x => JSON.parse(x)); sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData)); + sessionStorage.setItem('flatmap-knowledge-source', knowledgeSource); updateFlatmapKnowledgeCache(); }); } @@ -69,6 +71,7 @@ function removeFlatmapKnowledgeCache() { const keys = [ 'flatmap-knowledge', 'flatmap-knowledge-expiry', + 'flatmap-knowledge-source', ]; keys.forEach((key) => { sessionStorage.removeItem(key); From 5827f281ec67d51ce774f22827dc6d8696f70b58 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 15 Apr 2025 14:00:07 +1200 Subject: [PATCH 06/10] Add option to load different connectivity source --- src/components/FlatmapVuer.vue | 9 +++++++++ src/services/flatmapQueries.js | 36 ++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index 77482d4d..f1ad1001 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -1884,6 +1884,15 @@ export default { } }); }, + changeConnectivitySource: function (payload) { + const { connectivityInfo, connectivitySource } = payload; + const { featureId } = connectivityInfo; + const newwPromise = this.flatmapQueries.queryForConnectivityNew(this.mapImp, featureId, null, connectivitySource); + Promise.resolve(newwPromise).then((result) => { + this.tooltipEntry = this.flatmapQueries.updateTooltipData(this.tooltipEntry); + this.$emit('connectivity-info-open', this.tooltipEntry); + }) + }, /** * @public * Function to create/display tooltips from the provided ``data``. diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index ea2928fc..2c9a9683 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -125,6 +125,18 @@ let FlatmapQueries = function () { return tooltipData } + this.updateTooltipData = function (tooltipEntry) { + return { + ...tooltipEntry, + origins: this.origins, + originsWithDatasets: this.originsWithDatasets, + components: this.components, + componentsWithDatasets: this.componentsWithDatasets, + destinations: this.destinations, + destinationsWithDatasets: this.destinationsWithDatasets, + }; + } + this.createComponentsLabelList = function (components, lookUp) { let labelList = [] components.forEach((n) => { @@ -253,9 +265,14 @@ let FlatmapQueries = function () { return results } - this.queryForConnectivityNew = function (mapImp, keastIds, signal, processConnectivity=true) { + this.queryForConnectivityNew = function (mapImp, keastIds, signal, connectivitySource, processConnectivity=true) { return new Promise((resolve) => { - mapImp.queryKnowledge(keastIds[0]) + const mapuuid = mapImp.provenance.uuid; + const queryAPI = connectivitySource === 'map' + ? this.queryMapConnectivity(mapuuid, keastIds[0]) + : mapImp.queryKnowledge(keastIds[0]); + + queryAPI .then((response) => { if (this.checkConnectivityExists(response)) { let connectivity = response; @@ -290,6 +307,21 @@ let FlatmapQueries = function () { }) } + this.queryMapConnectivity = async function (mapuuid, pathId) { + const url = this.flatmapApi + `flatmap/${mapuuid}/connectivity/${pathId}`; + + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Response status: ${response.status}`); + } + + return await response.json(); + } catch (error) { + throw new Error(error); + } + }, + this.queryForConnectivity = function (mapImp, keastIds, signal, processConnectivity=true) { const data = { sql: this.buildConnectivitySqlStatement(keastIds) } const headers = { From fc06cce3579968b156dccfd13c3b2e5aacbccc01 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 15 Apr 2025 14:15:01 +1200 Subject: [PATCH 07/10] Update connectivity source change data --- src/components/FlatmapVuer.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index f1ad1001..294903b5 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -1885,8 +1885,7 @@ export default { }); }, changeConnectivitySource: function (payload) { - const { connectivityInfo, connectivitySource } = payload; - const { featureId } = connectivityInfo; + const { featureId, connectivitySource } = payload; const newwPromise = this.flatmapQueries.queryForConnectivityNew(this.mapImp, featureId, null, connectivitySource); Promise.resolve(newwPromise).then((result) => { this.tooltipEntry = this.flatmapQueries.updateTooltipData(this.tooltipEntry); From 37782871e6c8b86f5b8dfd539f9b6e1a55b0d10c Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 15 Apr 2025 17:34:36 +1200 Subject: [PATCH 08/10] Add connectivity source when available --- src/services/flatmapQueries.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 2c9a9683..57a96d76 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -260,7 +260,10 @@ let FlatmapQueries = function () { this.rawURLs = [] if (!keastIds || keastIds.length == 0 || !keastIds[0]) return - let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal) // This on returns a promise so dont need 'await' + // set connectivity source if available + const connectivitySource = localStorage.getItem('connectivity-source'); + + let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal, connectivitySource) // This on returns a promise so dont need 'await' let results = await Promise.all([prom1]) return results } From a016c4cb8a487051861428dfc27dd1e6c4926346 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Thu, 17 Apr 2025 11:46:44 +1200 Subject: [PATCH 09/10] Sort connectivity list --- src/services/flatmapQueries.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 57a96d76..7664708e 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -75,6 +75,24 @@ const inArray = function (ar1, ar2) { return as1.indexOf(as2) !== -1 } +const compareNames = (a, b) => { + // to make it work for both string name and obj.name + const _nameA = a.name ?? a; + const _nameB = b.name ?? b; + const nameA = _nameA.toUpperCase(); + const nameB = _nameB.toUpperCase(); + + if (nameA < nameB) { + return -1; + } + + if (nameA > nameB) { + return 1; + } + + return 0; +} + let FlatmapQueries = function () { this.initialise = function (flatmapApi) { this.flatmapApi = flatmapApi @@ -427,13 +445,13 @@ let FlatmapQueries = function () { // Filter for the anatomy which is annotated on datasets this.originsWithDatasets = this.uberons.filter( (ub) => dendritesFlat.indexOf(ub.id) !== -1 - ) + ).sort(compareNames); this.componentsWithDatasets = this.uberons.filter( (ub) => componentsFlat.indexOf(ub.id) !== -1 - ) + ).sort(compareNames); this.destinationsWithDatasets = this.uberons.filter( (ub) => axonsFlat.indexOf(ub.id) !== -1 - ) + ).sort(compareNames); } this.processConnectivity = function (mapImp, connectivity) { @@ -472,13 +490,13 @@ let FlatmapQueries = function () { this.createLabelLookup(mapImp, conIds).then((lookUp) => { this.origins = dendrites.map((d) => this.createLabelFromNeuralNode(d, lookUp) - ) + ).sort(compareNames); this.components = components.map((c) => this.createLabelFromNeuralNode(c, lookUp) - ) + ).sort(compareNames); this.destinations = axons.map((a) => this.createLabelFromNeuralNode(a, lookUp) - ) + ).sort(compareNames); this.flattenAndFindDatasets(dendrites, components, axons) resolve({ ids: { From 09a22e37bb978dd34ec9e4bcd862216c12f5f879 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Fri, 2 May 2025 15:00:48 +1200 Subject: [PATCH 10/10] Update components declaration --- src/components.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 2799c294..974a7996 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -8,7 +8,6 @@ export {} declare module 'vue' { export interface GlobalComponents { DynamicLegends: typeof import('./components/legends/DynamicLegends.vue')['default'] - ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete'] ElButton: typeof import('element-plus/es')['ElButton'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] @@ -24,7 +23,6 @@ declare module 'vue' { ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] - ElSwitch: typeof import('element-plus/es')['ElSwitch'] FlatmapVuer: typeof import('./components/FlatmapVuer.vue')['default'] MultiFlatmapVuer: typeof import('./components/MultiFlatmapVuer.vue')['default'] SelectionsGroup: typeof import('./components/SelectionsGroup.vue')['default']