From a4c82467ba029a7bf005d325595bf337c1a24007 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Wed, 14 Apr 2021 07:17:34 +0100 Subject: [PATCH 01/20] swapping to paths for number of shortest paths --- components/interface/VFBCircuitBrowser/Controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/interface/VFBCircuitBrowser/Controls.js b/components/interface/VFBCircuitBrowser/Controls.js index 7e2d6391d..bc48f39a2 100644 --- a/components/interface/VFBCircuitBrowser/Controls.js +++ b/components/interface/VFBCircuitBrowser/Controls.js @@ -445,7 +445,7 @@ class Controls extends Component { - Hops + Paths Date: Wed, 14 Apr 2021 07:23:32 +0100 Subject: [PATCH 02/20] making labels clearer --- components/interface/VFBCircuitBrowser/Controls.js | 4 ++-- components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/interface/VFBCircuitBrowser/Controls.js b/components/interface/VFBCircuitBrowser/Controls.js index bc48f39a2..70c5634e6 100644 --- a/components/interface/VFBCircuitBrowser/Controls.js +++ b/components/interface/VFBCircuitBrowser/Controls.js @@ -445,7 +445,7 @@ class Controls extends Component { - Paths + # Paths - Weight + Min Weight diff --git a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js index d04e0cbce..c9aaefb90 100644 --- a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js +++ b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js @@ -58,7 +58,7 @@ class VFBCircuitBrowser extends Component { dropDownAnchorEl : null, neurons : [{ id : "", label : "" } , { id : "", label : "" }], hops : Math.ceil((configuration.maxHops - configuration.minHops) / 2), - weight : 70, + weight : 0, reload : false } this.updateGraph = this.updateGraph.bind(this); From 91d288f7cdefe2bcc2ea0260d677778231df6ae7 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Thu, 15 Apr 2021 14:29:11 +0100 Subject: [PATCH 03/20] trying with arrows --- css/VFBTermInfo.less | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/css/VFBTermInfo.less b/css/VFBTermInfo.less index 0d7e199ce..dddea41c9 100644 --- a/css/VFBTermInfo.less +++ b/css/VFBTermInfo.less @@ -934,3 +934,11 @@ transition: all 0.50s; } } + +details > summary::before { + content: '▶️'; +} + +details[open] > summary::before { + content: '🔽'; +} From 113e97f42b2873292a39b2b8356b965594b42327 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Thu, 15 Apr 2021 14:37:21 +0100 Subject: [PATCH 04/20] test with icon --- css/VFBTermInfo.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/VFBTermInfo.less b/css/VFBTermInfo.less index dddea41c9..97523385c 100644 --- a/css/VFBTermInfo.less +++ b/css/VFBTermInfo.less @@ -936,9 +936,9 @@ } details > summary::before { - content: '▶️'; + content: ''; } details[open] > summary::before { - content: '🔽'; + content: ''; } From 2c7efceefdb6df22a1901639f3f9789a3ffcba51 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Thu, 15 Apr 2021 14:53:40 +0100 Subject: [PATCH 05/20] swapping to unicode --- css/VFBTermInfo.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/VFBTermInfo.less b/css/VFBTermInfo.less index 97523385c..aa2f62fd5 100644 --- a/css/VFBTermInfo.less +++ b/css/VFBTermInfo.less @@ -936,9 +936,9 @@ } details > summary::before { - content: ''; + content: '\uf138'; } details[open] > summary::before { - content: ''; + content: '\uf13a'; } From f0c53544e9c56f913c28c46df6b26b4e15c6f321 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Thu, 15 Apr 2021 15:01:10 +0100 Subject: [PATCH 06/20] typo fix --- css/VFBTermInfo.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/VFBTermInfo.less b/css/VFBTermInfo.less index aa2f62fd5..a79de52e0 100644 --- a/css/VFBTermInfo.less +++ b/css/VFBTermInfo.less @@ -936,9 +936,9 @@ } details > summary::before { - content: '\uf138'; + content: ''; } details[open] > summary::before { - content: '\uf13a'; + content: ''; } From 0e35389543cd5dcb67cf1a0e6a6863f5558e8590 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Thu, 15 Apr 2021 15:17:54 +0100 Subject: [PATCH 07/20] adding both for css control --- css/VFBTermInfo.less | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/css/VFBTermInfo.less b/css/VFBTermInfo.less index a79de52e0..62d55a6da 100644 --- a/css/VFBTermInfo.less +++ b/css/VFBTermInfo.less @@ -935,10 +935,18 @@ } } -details > summary::before { - content: ''; +details > summary > i.fa-chevron-circle-right { + display: inline-block; +} + +details > summary > i.fa-chevron-circle-down { + display: none; } -details[open] > summary::before { - content: ''; +details[open] > summary > i.fa-chevron-circle-down { + display: inline-block; +} + +details[open] > summary > i.fa-chevron-circle-right { + display: none; } From 3c82077cf765e13ce9f8f4de94b0c529e35b3ed5 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Fri, 16 Apr 2021 11:32:43 +0100 Subject: [PATCH 08/20] bringing test into service --- tests/jest/vfb/{review => batch3}/term-context-tests.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/jest/vfb/{review => batch3}/term-context-tests.js (100%) diff --git a/tests/jest/vfb/review/term-context-tests.js b/tests/jest/vfb/batch3/term-context-tests.js similarity index 100% rename from tests/jest/vfb/review/term-context-tests.js rename to tests/jest/vfb/batch3/term-context-tests.js From b311f468283531d3bbe67b4d891261dbb76c6bdc Mon Sep 17 00:00:00 2001 From: jrmartin Date: Fri, 16 Apr 2021 11:28:58 -0700 Subject: [PATCH 09/20] #1106 Add more time to circuit browser tests --- tests/jest/vfb/review/circuit-browser-tests.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/jest/vfb/review/circuit-browser-tests.js b/tests/jest/vfb/review/circuit-browser-tests.js index e4fb4ad40..5bcc709ad 100644 --- a/tests/jest/vfb/review/circuit-browser-tests.js +++ b/tests/jest/vfb/review/circuit-browser-tests.js @@ -57,7 +57,7 @@ describe('VFB Circuit Browser Tests', () => { it('Refresh Graph with VFB_jrchjrch and VFB_jrchjsfu', async () => { await page.waitFor(ONE_SECOND); await page.click('#refreshCircuitBrowser'); - await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 90 * ONE_SECOND }); + await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 240 * ONE_SECOND }); const legendLabels = await page.evaluate( () => document.querySelectorAll("#circuitBrowserLegend li").length) expect(legendLabels).toBe(2); @@ -70,10 +70,10 @@ describe('VFB Circuit Browser Tests', () => { await page.click('#refreshCircuitBrowser'); await page.waitFor(10 * ONE_SECOND); - await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 90 * ONE_SECOND }); + await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 240 * ONE_SECOND }); const legendLabels = await page.evaluate( () => document.querySelectorAll("#circuitBrowserLegend li").length) - expect(legendLabels).toBe(3); + expect(legendLabels).toBe(2); }) it('Set weight field to 50', async () => { @@ -83,7 +83,7 @@ describe('VFB Circuit Browser Tests', () => { await page.click('#refreshCircuitBrowser'); await page.waitFor(10 * ONE_SECOND); - await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 90 * ONE_SECOND }); + await wait4selector(page, '#circuitBrowserLegend', { visible: true, timeout : 240 * ONE_SECOND }); const legendLabels = await page.evaluate( () => document.querySelectorAll("#circuitBrowserLegend li").length) expect(legendLabels).toBe(2); From 1249eb7d02789fad28b804cf808425dc81a9683c Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 19 Apr 2021 17:05:00 +0100 Subject: [PATCH 10/20] removing label restriction on the target --- .../VFBCircuitBrowser/circuitBrowserConfiguration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js index 1b2ba5e29..2aa149e85 100644 --- a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js +++ b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js @@ -6,7 +6,7 @@ var locationCypherQuery = ( instances, hops, weight ) => ({ + " MATCH (source:has_neuron_connectivity {short_form: a}), (target:Neuron {short_form: b})" + " CALL gds.beta.shortestPath.yens.stream({" + " nodeQuery: 'MATCH (n:has_neuron_connectivity) RETURN id(n) AS id'," - + " relationshipQuery: 'MATCH (a:has_neuron_connectivity)-[r:synapsed_to]->(b:has_neuron_connectivity) WHERE exists(r.weight) AND r.weight[0] >= " + + " relationshipQuery: 'MATCH (a:has_neuron_connectivity)-[r:synapsed_to]->(b:neuron WHERE exists(r.weight) AND r.weight[0] >= " + weight.toString() + " RETURN id(a) AS source, id(b) AS target, type(r) as type, 5000-r.weight[0] as weight_p'," + " sourceNode: id(source)," + " targetNode: id(target)," From 0b22d90cd4b75eff409fdf5f16fcc77fbcf6c693 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 19 Apr 2021 17:27:44 +0100 Subject: [PATCH 11/20] opening up nodes --- .../VFBCircuitBrowser/circuitBrowserConfiguration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js index 2aa149e85..a318f274f 100644 --- a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js +++ b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js @@ -5,8 +5,8 @@ var locationCypherQuery = ( instances, hops, weight ) => ({ + " WITH neurons[0] as a, neurons[1] AS b" + " MATCH (source:has_neuron_connectivity {short_form: a}), (target:Neuron {short_form: b})" + " CALL gds.beta.shortestPath.yens.stream({" - + " nodeQuery: 'MATCH (n:has_neuron_connectivity) RETURN id(n) AS id'," - + " relationshipQuery: 'MATCH (a:has_neuron_connectivity)-[r:synapsed_to]->(b:neuron WHERE exists(r.weight) AND r.weight[0] >= " + + " nodeQuery: 'MATCH (n:neuron) RETURN id(n) AS id'," + + " relationshipQuery: 'MATCH (a:neuron:has_neuron_connectivity)-[r:synapsed_to]->(b:neuron WHERE exists(r.weight) AND r.weight[0] >= " + weight.toString() + " RETURN id(a) AS source, id(b) AS target, type(r) as type, 5000-r.weight[0] as weight_p'," + " sourceNode: id(source)," + " targetNode: id(target)," From 6d095b7940c68dbda2ecabebb602e0aa8f8a2d6a Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 19 Apr 2021 17:51:28 +0100 Subject: [PATCH 12/20] typo fix --- .../VFBCircuitBrowser/circuitBrowserConfiguration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js index a318f274f..90767375d 100644 --- a/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js +++ b/components/configuration/VFBCircuitBrowser/circuitBrowserConfiguration.js @@ -5,8 +5,8 @@ var locationCypherQuery = ( instances, hops, weight ) => ({ + " WITH neurons[0] as a, neurons[1] AS b" + " MATCH (source:has_neuron_connectivity {short_form: a}), (target:Neuron {short_form: b})" + " CALL gds.beta.shortestPath.yens.stream({" - + " nodeQuery: 'MATCH (n:neuron) RETURN id(n) AS id'," - + " relationshipQuery: 'MATCH (a:neuron:has_neuron_connectivity)-[r:synapsed_to]->(b:neuron WHERE exists(r.weight) AND r.weight[0] >= " + + " nodeQuery: 'MATCH (n:Neuron) RETURN id(n) AS id'," + + " relationshipQuery: 'MATCH (a:Neuron:has_neuron_connectivity)-[r:synapsed_to]->(b:Neuron) WHERE exists(r.weight) AND r.weight[0] >= " + weight.toString() + " RETURN id(a) AS source, id(b) AS target, type(r) as type, 5000-r.weight[0] as weight_p'," + " sourceNode: id(source)," + " targetNode: id(target)," From 3513d22b566afb6e2083c6404f1c834e70816e55 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 20 Apr 2021 04:28:55 +0100 Subject: [PATCH 13/20] evaluating meta not simply path Was causing reload Manager.js:283 Uncaught The instance FBbt_00049921.FBbt_00049921_meta does not exist in the current model instances.getInstance @ Manager.js:283 customHandler @ VFBTermInfo.js:927 eval @ VFBTermInfo.js:573 dispatch @ jquery.js:5430 elemData.handle @ jquery.js:5234 --- components/interface/VFBTermInfo/VFBTermInfo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/interface/VFBTermInfo/VFBTermInfo.js b/components/interface/VFBTermInfo/VFBTermInfo.js index 98c35936c..510df9a3f 100644 --- a/components/interface/VFBTermInfo/VFBTermInfo.js +++ b/components/interface/VFBTermInfo/VFBTermInfo.js @@ -732,12 +732,13 @@ class VFBTermInfoWidget extends React.Component { return; } var Query = require('@geppettoengine/geppetto-core/model/Query'); - var n = window[path]; var otherId; var otherName; var target = widget; var that = this; var meta = path + "." + path + "_meta"; + var n = window[meta]; + if (n != undefined) { var metanode = Instances.getInstance(meta); if ((this.data.length > 0) && (this.data[0] == metanode)) { From 6688790b57448a5cbbdd2a025bf51faeb91aabb5 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 20 Apr 2021 04:46:03 +0100 Subject: [PATCH 14/20] ensuring the custom handler never throws an error and causes the link itself to be loaded. --- .../interface/VFBTermInfo/VFBTermInfo.js | 260 +++++++++--------- 1 file changed, 134 insertions(+), 126 deletions(-) diff --git a/components/interface/VFBTermInfo/VFBTermInfo.js b/components/interface/VFBTermInfo/VFBTermInfo.js index 510df9a3f..d01e0e602 100644 --- a/components/interface/VFBTermInfo/VFBTermInfo.js +++ b/components/interface/VFBTermInfo/VFBTermInfo.js @@ -677,151 +677,159 @@ class VFBTermInfoWidget extends React.Component { customHandler (node, path, widget) { - // handling path consisting of a list. Note: first ID is assumed to be the template followed by a single ID (comma separated) - if (path.indexOf("[") == 0) { - var templateID = path.split(',')[0].replace('[',''); - var instanceID = path.split(',')[1].replace(']',''); - if (templateID != window.templateID) { - // open new window with the new template and the instance ID - window.ga('vfb.send', 'event', 'request', 'newtemplate', templateID); - if (confirm("The image you requested is aligned to another template. \nClick OK to open in a new tab or Cancel to just view the image metadata.")) { - if (window.EMBEDDED) { - var curHost = parent.document.location.host; - var curProto = parent.document.location.protocol; + try { + // handling path consisting of a list. Note: first ID is assumed to be the template followed by a single ID (comma separated) + if (path.indexOf("[") == 0) { + var templateID = path.split(',')[0].replace('[',''); + var instanceID = path.split(',')[1].replace(']',''); + if (templateID != window.templateID) { + // open new window with the new template and the instance ID + window.ga('vfb.send', 'event', 'request', 'newtemplate', templateID); + if (confirm("The image you requested is aligned to another template. \nClick OK to open in a new tab or Cancel to just view the image metadata.")) { + if (window.EMBEDDED) { + var curHost = parent.document.location.host; + var curProto = parent.document.location.protocol; + } else { + var curHost = document.location.host; + var curProto = document.location.protocol; + } + var targetWindow = '_blank'; + var newUrl = window.redirectURL.replace(/\$VFB_ID\$/gi, instanceID).replace(/\$TEMPLATE\$/gi, templateID).replace(/\$HOST\$/gi, curHost).replace(/\$PROTOCOL\$/gi, curProto); + window.ga('vfb.send', 'event', 'opening', 'newtemplate', path); + window.open(newUrl, targetWindow); } else { - var curHost = document.location.host; - var curProto = document.location.protocol; + window.ga('vfb.send', 'event', 'cancelled', 'newtemplate', path); } - var targetWindow = '_blank'; - var newUrl = window.redirectURL.replace(/\$VFB_ID\$/gi, instanceID).replace(/\$TEMPLATE\$/gi, templateID).replace(/\$HOST\$/gi, curHost).replace(/\$PROTOCOL\$/gi, curProto); - window.ga('vfb.send', 'event', 'opening', 'newtemplate', path); - window.open(newUrl, targetWindow); + // passing only the instance ID for processing + path = instanceID; } else { - window.ga('vfb.send', 'event', 'cancelled', 'newtemplate', path); + // as same template pass only the instance ID for processing + path = instanceID; } - // passing only the instance ID for processing - path = instanceID; - } else { - // as same template pass only the instance ID for processing - path = instanceID; } - } - if (path.indexOf(GRAPHS) === 0 ) { - // Show Graph - const { vfbGraph } = this.props; - /* - * Path contains the instance and the index of the drop down query options - * Path is of type : "instance_path, query_index" - */ - vfbGraph(SHOW_GRAPH, Instances.getInstance(path.split(',')[1]), path.split(',')[2], true, true); - - // Notify VFBMain UI needs to be updated - this.props.uiUpdated(); - return; - } - if (path.indexOf(CIRCUIT_BROWSER) === 0 ) { - // Show Circuit Browser - const { vfbCircuitBrowser } = this.props; - /* - * Path contains the instancE ID passed to the circuit browser - */ - vfbCircuitBrowser(UPDATE_CIRCUIT_QUERY, path.split(',')[1], true); - - // Notify VFBMain UI needs to be updated - this.props.uiUpdated(); - return; - } - var Query = require('@geppettoengine/geppetto-core/model/Query'); - var otherId; - var otherName; - var target = widget; - var that = this; - var meta = path + "." + path + "_meta"; - var n = window[meta]; - - if (n != undefined) { - var metanode = Instances.getInstance(meta); - if ((this.data.length > 0) && (this.data[0] == metanode)) { - for ( var i = 0, nodePresent = false; i < this.data.length; i++) { - if (this.data[i].getId() === metanode.getId()) { - nodePresent = true; - this.data.unshift(this.data.splice(i, 1)[0]); + if (path.indexOf(GRAPHS) === 0 ) { + // Show Graph + const { vfbGraph } = this.props; + /* + * Path contains the instance and the index of the drop down query options + * Path is of type : "instance_path, query_index" + */ + vfbGraph(SHOW_GRAPH, Instances.getInstance(path.split(',')[1]), path.split(',')[2], true, true); + + // Notify VFBMain UI needs to be updated + this.props.uiUpdated(); + return; + } + if (path.indexOf(CIRCUIT_BROWSER) === 0 ) { + // Show Circuit Browser + const { vfbCircuitBrowser } = this.props; + /* + * Path contains the instancE ID passed to the circuit browser + */ + vfbCircuitBrowser(UPDATE_CIRCUIT_QUERY, path.split(',')[1], true); + + // Notify VFBMain UI needs to be updated + this.props.uiUpdated(); + return; + } + var Query = require('@geppettoengine/geppetto-core/model/Query'); + var otherId; + var otherName; + var target = widget; + var that = this; + var meta = path + "." + path + "_meta"; + var n = window[meta]; + + if (n != undefined) { + var metanode = Instances.getInstance(meta); + if ((this.data.length > 0) && (this.data[0] == metanode)) { + for ( var i = 0, nodePresent = false; i < this.data.length; i++) { + if (this.data[i].getId() === metanode.getId()) { + nodePresent = true; + this.data.unshift(this.data.splice(i, 1)[0]); + } + } + if (nodePresent === false) { + this.data.unshift(metanode); } } - if (nodePresent === false) { - this.data.unshift(metanode); - } - } - this.setTermInfo(metanode, metanode.name); - window.resolve3D(path); - } else { - // check for passed ID: - if (path.indexOf(',') > -1) { - otherId = path.split(',')[1]; - otherName = path.split(',')[2]; - path = path.split(',')[0]; + this.setTermInfo(metanode, metanode.name); + window.resolve3D(path); } else { - if (this.data.length) { - otherId = this.data[0].getParent(); + // check for passed ID: + if (path.indexOf(',') > -1) { + otherId = path.split(',')[1]; + otherName = path.split(',')[2]; + path = path.split(',')[0]; } else { - otherId = this.data.getParent(); - } - otherName = otherId.name; - otherId = otherId.id; - } - // try to evaluate as path in Model - var entity = Model[path]; - if (typeof (entity) != 'undefined' && entity instanceof Query) { - // clear query builder unless ctrl pressed them add to compound. - console.log('Query requested: ' + path + " " + otherName); - GEPPETTO.trigger('spin_logo'); - - this.props.queryBuilder.open(); - this.props.queryBuilder.switchView(false, false); - if (GEPPETTO.isKeyPressed("shift") && confirm("You selected a query with shift pressed indicating you wanted to combine with an existing query. \nClick OK to see combined results or Cancel to just view the results of this query alone.\nNote: If shift is not pressed please press and release to clear the flag.")) { - console.log('Query stacking requested.'); - } else { - this.props.queryBuilder.clearAllQueryItems(); - $('#add-new-query-container')[0].hidden = true; - $('#query-builder-items-container')[0].hidden = true; + if (this.data.length) { + otherId = this.data[0].getParent(); + } else { + otherId = this.data.getParent(); + } + otherName = otherId.name; + otherId = otherId.id; } - $("body").css("cursor", "progress"); + // try to evaluate as path in Model + var entity = Model[path]; + if (typeof (entity) != 'undefined' && entity instanceof Query) { + // clear query builder unless ctrl pressed them add to compound. + console.log('Query requested: ' + path + " " + otherName); + GEPPETTO.trigger('spin_logo'); + + this.props.queryBuilder.open(); + this.props.queryBuilder.switchView(false, false); + if (GEPPETTO.isKeyPressed("shift") && confirm("You selected a query with shift pressed indicating you wanted to combine with an existing query. \nClick OK to see combined results or Cancel to just view the results of this query alone.\nNote: If shift is not pressed please press and release to clear the flag.")) { + console.log('Query stacking requested.'); + } else { + this.props.queryBuilder.clearAllQueryItems(); + $('#add-new-query-container')[0].hidden = true; + $('#query-builder-items-container')[0].hidden = true; + } + $("body").css("cursor", "progress"); - $('#add-new-query-container')[0].hidden = true; - $('#query-builder-items-container')[0].hidden = true; + $('#add-new-query-container')[0].hidden = true; + $('#query-builder-items-container')[0].hidden = true; - var callback = function () { - // check if any results with count flag - if (that.props.queryBuilder.props.model.count > 0) { - // runQuery if any results - that.props.queryBuilder.runQuery(); + var callback = function () { + // check if any results with count flag + if (that.props.queryBuilder.props.model.count > 0) { + // runQuery if any results + that.props.queryBuilder.runQuery(); + } else { + that.props.queryBuilder.switchView(false); + } + // show query component + that.props.queryBuilder.open(); + $("body").css("cursor", "default"); + GEPPETTO.trigger('stop_spin_logo'); + }; + // add query item + selection + if (window[otherId] == undefined) { + window.fetchVariableThenRun(otherId, function () { + that.props.queryBuilder.addQueryItem({ term: otherName, id: otherId, queryObj: entity }, callback) + }); } else { - that.props.queryBuilder.switchView(false); + setTimeout(function () { + that.props.queryBuilder.addQueryItem({ term: otherName, id: otherId, queryObj: entity }, callback); + }, 100); } - // show query component - that.props.queryBuilder.open(); - $("body").css("cursor", "default"); - GEPPETTO.trigger('stop_spin_logo'); - }; - // add query item + selection - if (window[otherId] == undefined) { - window.fetchVariableThenRun(otherId, function () { - that.props.queryBuilder.addQueryItem({ term: otherName, id: otherId, queryObj: entity }, callback) - }); } else { - setTimeout(function () { - that.props.queryBuilder.addQueryItem({ term: otherName, id: otherId, queryObj: entity }, callback); - }, 100); + Model.getDatasources()[0].fetchVariable(path, function () { + var m = Instances.getInstance(meta); + this.setTermInfo(m, m.name); + window.addVfbId(path); + }.bind(this)); } - } else { - Model.getDatasources()[0].fetchVariable(path, function () { - var m = Instances.getInstance(meta); - this.setTermInfo(m, m.name); - window.addVfbId(path); - }.bind(this)); } + } catch (e) { + // error handling link + console.error("Issue loading: " + path); + console.error(e.message); + console.trace(); } + return; } componentDidUpdate () { From c7971b2666fb07ef48c5f63dbaa6411fd04e4057 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 20 Apr 2021 05:02:50 +0100 Subject: [PATCH 15/20] multiline-comment-style fix --- components/interface/VFBTermInfo/VFBTermInfo.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/interface/VFBTermInfo/VFBTermInfo.js b/components/interface/VFBTermInfo/VFBTermInfo.js index d01e0e602..72381feaa 100644 --- a/components/interface/VFBTermInfo/VFBTermInfo.js +++ b/components/interface/VFBTermInfo/VFBTermInfo.js @@ -711,9 +711,9 @@ class VFBTermInfoWidget extends React.Component { // Show Graph const { vfbGraph } = this.props; /* - * Path contains the instance and the index of the drop down query options - * Path is of type : "instance_path, query_index" - */ + * Path contains the instance and the index of the drop down query options + * Path is of type : "instance_path, query_index" + */ vfbGraph(SHOW_GRAPH, Instances.getInstance(path.split(',')[1]), path.split(',')[2], true, true); // Notify VFBMain UI needs to be updated @@ -724,8 +724,8 @@ class VFBTermInfoWidget extends React.Component { // Show Circuit Browser const { vfbCircuitBrowser } = this.props; /* - * Path contains the instancE ID passed to the circuit browser - */ + * Path contains the instancE ID passed to the circuit browser + */ vfbCircuitBrowser(UPDATE_CIRCUIT_QUERY, path.split(',')[1], true); // Notify VFBMain UI needs to be updated From e25393a8af5f51cd4f88fbe11dbe6193f356249c Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 20 Apr 2021 15:14:39 +0100 Subject: [PATCH 16/20] Fixing Transgene query rules --- model/vfb.xmi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/vfb.xmi b/model/vfb.xmi index 099c21797..a7b75e864 100644 --- a/model/vfb.xmi +++ b/model/vfb.xmi @@ -895,7 +895,9 @@ returnType="//@libraries.3/@types.1" queryChain="//@dataSources.2/@queries.8 //@dataSources.2/@queries.14 //@dataSources.0/@queries.8 //@dataSources.2/@queries.16 //@dataSources.2/@queries.12 //@dataSources.0/@queries.11 //@dataSources.2/@queries.0 //@dataSources.2/@queries.13 //@dataSources.0/@queries.14"> + type="//@libraries.3/@types.1 //@libraries.3/@types.28 //@libraries.3/@types.5"/> + Date: Fri, 23 Apr 2021 17:21:16 -0700 Subject: [PATCH 17/20] #1115 Styling circuit browser to match design --- .../interface/VFBCircuitBrowser/Controls.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/components/interface/VFBCircuitBrowser/Controls.js b/components/interface/VFBCircuitBrowser/Controls.js index 6a212b5b1..349b33a9e 100644 --- a/components/interface/VFBCircuitBrowser/Controls.js +++ b/components/interface/VFBCircuitBrowser/Controls.js @@ -70,9 +70,9 @@ const styles = theme => ({ }, expanded: { minHeight : "15px !important", margin : "0px !important" }, // Override default padding in Add Neuron button - addNeuron : { padding : "8px 5px 0px 2px" }, + addNeuron : { padding : "2vh 2vh 0px 2px" }, // Override default padding in Delete Neuron button - deleteNeuron : { padding : "4px 0px 0px 4px" }, + deleteNeuron : { padding : "2vh 0px 0px 4px" }, dottedIcon : { margin : "1rem 0 1rem 0 " }, legend : { padding: "2vh", @@ -91,7 +91,7 @@ const styles = theme => ({ height : "2vh", width : "2vh" }, - weightInput : { color : "white !important" } + weightInput : { color : "white !important", height : "20px", border : "none !important", backgroundColor: "#80808040 !important", paddingLeft : "10px !important" } }); /** @@ -152,6 +152,7 @@ class AutocompleteResults extends Component { render () { const label = "Neuron " + (this.props.index + 1) .toString(); + return ( )} @@ -419,15 +420,15 @@ class Controls extends Component { - - + +
- + { neuronFields.map((field, index) => ( @@ -454,19 +455,23 @@ class Controls extends Component { ))} - + { addNeuronDisabled ? null - : + + + } + + + { addNeuronDisabled + ? null + : Add Neuron } From a0104f49bd2d2e73a10684cbc146deccc5d72eed Mon Sep 17 00:00:00 2001 From: jrmartin Date: Mon, 10 May 2021 16:56:23 -0700 Subject: [PATCH 18/20] #1123 Layout styling issues in circuit browser configuration panel. #1120 Implement circuit browser clear button #1121 Adds flip button to flip 2 neurons. --- .../interface/VFBCircuitBrowser/Controls.js | 123 +++++++++++++----- .../VFBCircuitBrowser/VFBCircuitBrowser.js | 30 ++++- 2 files changed, 113 insertions(+), 40 deletions(-) diff --git a/components/interface/VFBCircuitBrowser/Controls.js b/components/interface/VFBCircuitBrowser/Controls.js index 0e497a07e..6eb154c34 100644 --- a/components/interface/VFBCircuitBrowser/Controls.js +++ b/components/interface/VFBCircuitBrowser/Controls.js @@ -22,6 +22,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'; import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; import DeleteIcon from '@material-ui/icons/Delete'; +import SwapVertIcon from '@material-ui/icons/SwapVert'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; import { connect } from "react-redux"; @@ -70,7 +71,8 @@ const styles = theme => ({ }, expanded: { minHeight : "15px !important", margin : "0px !important" }, // Override default padding in Add Neuron button - addNeuron : { padding : "2vh 2vh 0px 2px" }, + addNeuron : { padding : "0px" }, + reverseNeurons : { padding : "0 !important" }, // Override default padding in Delete Neuron button deleteNeuron : { padding : "2vh 0px 0px 4px" }, dottedIcon : { margin : "1rem 0 1rem 0 " }, @@ -91,7 +93,14 @@ const styles = theme => ({ height : "2vh", width : "2vh" }, - weightInput : { color : "white !important", height : "20px", border : "none !important", backgroundColor: "#80808040 !important", paddingLeft : "10px !important" } + weightInput : { + color : "white !important", + height : "20px", + border : "none !important", + backgroundColor: "#80808040 !important", + paddingLeft : "10px !important" + }, + weightInputDiv : { width : "100% !important" } }); /** @@ -190,11 +199,13 @@ class Controls extends Component { super(props); this.state = { typingTimeout: 0, - expanded : true + expanded : true, + key : 1 }; this.weight = this.props.weight; this.hops = this.props.hops; this.addNeuron = this.addNeuron.bind(this); + this.reverseNeurons = this.reverseNeurons.bind(this); this.neuronTextfieldModified = this.neuronTextfieldModified.bind(this); this.typingTimeout = this.typingTimeout.bind(this); this.sliderChange = this.sliderChange.bind(this); @@ -203,6 +214,7 @@ class Controls extends Component { this.deleteNeuronField = this.deleteNeuronField.bind(this); this.getUpdatedNeuronFields = this.getUpdatedNeuronFields.bind(this); this.resultSelectedChanged = this.resultSelectedChanged.bind(this); + this.setNeurons = this.setNeurons.bind(this); this.circuitQuerySelected = this.props.circuitQuerySelected; this.autoCompleteInput = React.createRef(); this.neuronFields = [{ id : "", label : "" } , { id : "", label : "" }]; @@ -257,6 +269,18 @@ class Controls extends Component { this.autocompleteRef[(neuronFields.length - 1).toString()] = React.createRef(); this.forceUpdate(); } + + /** + * Reverse neurons textfield + */ + reverseNeurons () { + let neuronFields = this.neuronFields; + [neuronFields[0], neuronFields[neuronFields.length - 1]] = [neuronFields[neuronFields.length - 1], neuronFields[0]] + // User has added the maximum number of neurons allowed in query search + this.neuronFields = neuronFields; + this.autocompleteRef[(neuronFields.length - 1).toString()] = React.createRef(); + this.forceUpdate(); + } /** * Validates neurons ID's are valid, checks there's at least 8 numbers in it @@ -341,6 +365,13 @@ class Controls extends Component { this.weight = event.target.value; } + setNeurons () { + this.neuronFields = [{ id : "", label : "" } , { id : "", label : "" }]; + while (this?.props?.circuitQuerySelected.length > 0) { + this?.props?.circuitQuerySelected.pop(); + } + this.setState({ key: Math.random() }); + } /** * Update neuron fields if there's a query preselected. */ @@ -394,10 +425,10 @@ class Controls extends Component { return (
-
+
- +
{ this.props.resultsAvailable() ?
    @@ -408,7 +439,7 @@ class Controls extends Component {
: null } - + } onClick={() => self.setState({ expanded : !expanded })} @@ -420,15 +451,15 @@ class Controls extends Component {
- - + +
- + { neuronFields.map((field, index) => ( @@ -455,35 +486,46 @@ class Controls extends Component { ))} - - { addNeuronDisabled - ? null - : - - - } - - - { addNeuronDisabled - ? null - : Add Neuron - } + + + + + { addNeuronDisabled + ? null + : + + + + + + + Add Neuron + + + }
- + - + # Paths - + - - + + Min Weight - - + + + >Refresh + + + diff --git a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js index a9f7c3ce1..55b3f4ca2 100644 --- a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js +++ b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js @@ -67,6 +67,7 @@ class VFBCircuitBrowser extends Component { this.resetCamera = this.resetCamera.bind(this); this.zoomIn = this.zoomIn.bind(this); this.zoomOut = this.zoomOut.bind(this); + this.clearGraph = this.clearGraph.bind(this); this.queriesUpdated = this.queriesUpdated.bind(this); this.updateHops = this.updateHops.bind(this); this.updateWeight = this.updateWeight.bind(this); @@ -77,6 +78,7 @@ class VFBCircuitBrowser extends Component { this.hoverNode = null; this.graphRef = React.createRef(); + this.controlsRef = React.createRef(); this.__isMounted = false; this.objectsLoaded = 0; this.focused = false; @@ -170,6 +172,11 @@ class VFBCircuitBrowser extends Component { } this.graphRef.current.ggv.current.zoom(zoom - out , 100); } + + clearGraph () { + this.setState({ neurons : [{ id : "", label : "" } , { id : "", label : "" }], graph : { nodes : [], links : [] } }); + this.controlsRef.current.setNeurons() + } /** * Handle Left click on Nodes @@ -238,8 +245,15 @@ class VFBCircuitBrowser extends Component { } }; + let params = { + results: response.data, + configuration : configuration, + styling : stylingConfiguration, + NODE_WIDTH : NODE_WIDTH, NODE_HEIGHT : NODE_HEIGHT + } + // Invoke web worker to perform conversion of graph data into format - worker.postMessage({ message: "refine", params: { results: response.data, configuration : configuration, styling : stylingConfiguration, NODE_WIDTH : NODE_WIDTH, NODE_HEIGHT : NODE_HEIGHT } }); + worker.postMessage({ message: "refine", params: params }); }) .catch( function (error) { self.setState( { loading : false } ); @@ -309,6 +323,8 @@ class VFBCircuitBrowser extends Component { circuitQuerySelected={this.circuitQuerySelected} datasource="SOLR" legend = {self.state.legend} + ref={self.controlsRef} + clearGraph={self.clearGraph} />
: link.label} // Width of links, log(weight) linkWidth={link => link.weight ? Math.log(link.weight) : 1 } - linkCurvature='curvature' - linkDirectionalArrowLength={link => link.weight ? Math.log(link.weight) * 3 : .5} + linkCurvature={.075} + linkDirectionalArrowLength={link => link.weight ? Math.log(link.weight) * 5 : 4} linkDirectionalArrowRelPos={.75} linkCanvasObject={(link, ctx) => { const MAX_FONT_SIZE = 5; @@ -501,7 +517,11 @@ class VFBCircuitBrowser extends Component { nodeCanvasObjectMode={node => 'replace'} // bu = Bottom Up, creates Graph with root at bottom dagMode="lr" - dagLevelDistance = {100} + nodeVal = { node => { + node.fx = node.level == 0 ? node.positionX : node.fx ? node.fx : 0 ; + node.fy = node.level > 0 ? -100 * node.level : node.fy ? node.fy : 0 ; + }} + dagLevelDistance = {25} onDagError={loopNodeIds => {}} // Handles clicking event on an individual node onNodeClick = { (node,event) => this.handleNodeLeftClick(node,event) } @@ -525,8 +545,10 @@ class VFBCircuitBrowser extends Component { resetCamera={self.resetCamera} zoomIn={self.zoomIn} zoomOut={self.zoomOut} + clearGraph={self.clearGraph} circuitQuerySelected={this.circuitQuerySelected} legend = {self.state.legend} + ref={self.controlsRef} /> } // Function triggered when hovering over a nodeoptions From 0bf4ed3697f97e41792d38f30ad2f16b878fb823 Mon Sep 17 00:00:00 2001 From: jrmartin Date: Tue, 11 May 2021 13:50:01 -0700 Subject: [PATCH 19/20] #1123 revert arrow length change --- components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js index 55b3f4ca2..9c3579a7d 100644 --- a/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js +++ b/components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js @@ -339,7 +339,7 @@ class VFBCircuitBrowser extends Component { // Width of links, log(weight) linkWidth={link => link.weight ? Math.log(link.weight) : 1 } linkCurvature={.075} - linkDirectionalArrowLength={link => link.weight ? Math.log(link.weight) * 5 : 4} + linkDirectionalArrowLength={link => link.weight ? Math.log(link.weight) * 5 : 2} linkDirectionalArrowRelPos={.75} linkCanvasObject={(link, ctx) => { const MAX_FONT_SIZE = 5; From 687ae56bfed2103236d36cf41adbe21a003241bd Mon Sep 17 00:00:00 2001 From: Dario Del Piano Date: Thu, 13 May 2021 10:14:35 +0100 Subject: [PATCH 20/20] adding simple script and alternative xmi for development --- model/start_dev_server.sh | 10 + model/vfb-dev.xmi | 1142 +++++++++++++++++++++++++++++++++++++ 2 files changed, 1152 insertions(+) create mode 100755 model/start_dev_server.sh create mode 100644 model/vfb-dev.xmi diff --git a/model/start_dev_server.sh b/model/start_dev_server.sh new file mode 100755 index 000000000..d955de2c2 --- /dev/null +++ b/model/start_dev_server.sh @@ -0,0 +1,10 @@ +cp vfb.xmi vfb.bak +mv vfb-dev.xmi vfb.xmi +if [[ "$(python --version)" =~ "3." ]]; then + python -m http.server 8989 +else + python -m SimpleHTTPServer 8989 +fi +echo "test test" +mv vfb.xmi vfb-dev.xmi +mv vfb.bak vfb.xmi diff --git a/model/vfb-dev.xmi b/model/vfb-dev.xmi new file mode 100644 index 000000000..e75f3bfce --- /dev/null +++ b/model/vfb-dev.xmi @@ -0,0 +1,1142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +