Skip to content

Commit

Permalink
Merge pull request #1300 from VirtualFlyBrain/feature/1298
Browse files Browse the repository at this point in the history
Feature/1298 testing
  • Loading branch information
Robbie1977 authored Mar 10, 2022
2 parents 8cc6a3f + 1e1c91d commit fc1614a
Show file tree
Hide file tree
Showing 39 changed files with 1,615 additions and 421 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARG geppettoSimulationRelease=vfb_20200604_a
ARG geppettoDatasourceRelease=vfb_20200604_a
ARG geppettoModelSwcRelease=v1.0.1
ARG geppettoFrontendRelease=development
ARG geppettoClientRelease=VFBv2.2.0.7
ARG geppettoClientRelease=VFBv2.2.2
ARG ukAcVfbGeppettoRelease=download

ARG mvnOpt="-Dhttps.protocols=TLSv1.2 -DskipTests --quiet -Pmaster"
Expand All @@ -38,6 +38,7 @@ ENV VFB_OWL_SERVER=${VFB_OWL_SERVER_ARG}
ENV VFB_R_SERVER=${VFB_R_SERVER_ARG}
ENV SOLR_SERVER=${SOLR_SERVER_ARG}
ENV googleAnalyticsSiteCode=${googleAnalyticsSiteCode_ARG}
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true

RUN /bin/echo -e "\e[1;35mORIGIN BRANCH ------------ $originBranch\e[0m" &&\
/bin/echo -e "\e[1;35mTARGET BRANCH ------------ $targetBranch\e[0m" &&\
Expand Down
79 changes: 20 additions & 59 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import VFBTermInfoWidget from './interface/VFBTermInfo/VFBTermInfo';
import Logo from '@geppettoengine/geppetto-client/components/interface/logo/Logo';
import Canvas from '@geppettoengine/geppetto-client/components/interface/3dCanvas/Canvas';
import QueryBuilder from '@geppettoengine/geppetto-client/components/interface/query/queryBuilder';
import VFBDownloadContents from './interface/VFBDownloadContents/VFBDownloadContents';
import VFBUploader from './interface/VFBUploader/VFBUploader';
import HTMLViewer from '@geppettoengine/geppetto-ui/html-viewer/HTMLViewer';
import VFBListViewer from './interface/VFBListViewer/VFBListViewer';
Expand Down Expand Up @@ -52,6 +53,7 @@ class VFBMain extends React.Component {
quickHelpVisible: undefined,
UIUpdated: true,
wireframeVisible: false,
downloadContentsVisible : true,
uploaderContentsVisible : true
};

Expand Down Expand Up @@ -488,6 +490,12 @@ class VFBMain extends React.Component {
[buttonState]: !this.state[buttonState]
});
break;
case 'downloadContentsVisible':
this.refs.downloadContentsRef?.openDialog();
break;
case 'uploaderContentsVisible':
this.refs.uploaderContentsRef?.openDialog();
break;
case 'quickHelpVisible':
if (this.state[buttonState] === undefined) {
this.setState({
Expand Down Expand Up @@ -527,6 +535,9 @@ class VFBMain extends React.Component {
case 'triggerSetTermInfo':
this.handlerInstanceUpdate(click.value[0]);
break;
case 'downloadContentsVisible':
this.refs.downloadContentsRef?.openDialog();
break;
case 'uploaderContentsVisible':
this.refs.uploaderContentsRef?.openDialog();
break;
Expand Down Expand Up @@ -1286,63 +1297,6 @@ class VFBMain extends React.Component {
idsList += ",";
}
idsList += this.idFromURL;
// populate page meta for this term for indexing
try {
window.ga('vfb.send', 'pageview', window.location.href );
if ( window.XMLHttpRequest ) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
try {
if (this.responseXML.title.indexOf("404 Not Found") < 0) {
document.title = 'Virtual Fly Brain (' + this.responseXML.title + ')';
document.body.style.font = "x-large";
document.querySelector('meta[property="og:title"]').setAttribute("content",this.responseXML.title);
document.querySelector('meta[name="description"]').setAttribute("content",this.responseXML.getElementById('json').innerText.substring(0, 4900));
document.querySelector('meta[property="og:description"]').setAttribute("content",this.responseXML.getElementById('json').innerText.substring(0, 4900));
if (document.getElementById('metaDesc') != null) {
if (this.responseXML.head != undefined && this.responseXML.head.getElementsByTagName('script') != undefined && this.responseXML.head.getElementsByTagName('script') != null && this.responseXML.head.getElementsByTagName('script')[1] != undefined) {
document.getElementById('metaDesc').innerHTML = this.responseXML.head.getElementsByTagName('script')[1].innerHTML;
}
} else {
if (this.responseXML.head != undefined && this.responseXML.head.getElementsByTagName('script') != undefined && this.responseXML.head.getElementsByTagName('script') != null && this.responseXML.head.getElementsByTagName('script')[1] != undefined) {
var script = document.createElement('script');
script.type = 'application/ld+json';
script.id = 'metaDesc';
script.innerHTML = this.responseXML.head.getElementsByTagName('script')[1].innerHTML;
document.getElementsByTagName('head')[0].appendChild(script);
}
}
var viewport = !!document.querySelector("meta[name='viewport']");
viewport = viewport ? document.querySelector("meta[name='viewport']") : document.createElement('meta');
viewport.setAttribute('name', 'viewport');
viewport.setAttribute('content', 'width=device-width, initial-scale=1');
document.head.appendChild(viewport);
}
} catch (err) {
console.log(err);
}
}
xhr.open( 'GET', 'https://virtualflybrain.org/data/VFB/json/' + this.idFromURL + '.html')
xhr.responseType = 'document';
xhr.send();
}
} catch (err) {
console.error(err);
}
try {
var link = !!document.querySelector("link[rel='amphtml']");
link = link ? document.querySelector("link[rel='amphtml']") : document.createElement('link');
link.setAttribute('rel', 'amphtml');
link.setAttribute('href', 'https://virtualflybrain.org/data/VFB/json/' + this.idFromURL + '.html');
document.head.appendChild(link);
var conlink = !!document.querySelector("link[rel='canonical']");
conlink = conlink ? document.querySelector("link[rel='canonical']") : document.createElement('link');
conlink.setAttribute('rel', 'canonical');
conlink.setAttribute('href', 'https://virtualflybrain.org/reports/' + this.idFromURL);
document.head.appendChild(conlink);
} catch (err) {
console.error(err);
}
} else if (idList[list].indexOf("i=") > -1) {
if (idsList.length > 0) {
idsList = "," + idsList;
Expand All @@ -1351,7 +1305,7 @@ class VFBMain extends React.Component {
} else if (idList[list].indexOf("q=") > -1) {
const multipleQueries = idList[list].replace("q=","").replace("%20", " ").split(";");
let that = this;
multipleQueries?.forEach( query => {
multipleQueries?.forEach( query => {
const querySplit = query.split(",");
that.urlQueryLoader.push({ id : querySplit[0].trim(), selection : querySplit[1].trim() });
});
Expand Down Expand Up @@ -1392,7 +1346,7 @@ class VFBMain extends React.Component {
GEPPETTO.on(GEPPETTO.Events.Instance_added, function (instance) {
that.props.instanceAdded(instance);
});

GEPPETTO.on(GEPPETTO.Events.Instances_created, function (instances) {
// Set template Instance to be not clickable in 3D viewer
if ( instances[0]?.id?.includes(window.templateID) ) {
Expand Down Expand Up @@ -1529,6 +1483,10 @@ class VFBMain extends React.Component {

GEPPETTO.on(GEPPETTO.Events.Websocket_disconnected, function () {
window.ga('vfb.send', 'event', 'disconnected', 'websocket-disconnect', (window.location.pathname + window.location.search));
if (GEPPETTO.MessageSocket.protocol == 'wss://' && location.protocol !== 'https:') {
console.log("%c Unsecure connection used reloading with HTTPS connection... ", 'background: #444; color: #bada55');
location.replace(`https:${location.href.substring(location.protocol.length)}`);
}
if (GEPPETTO.MessageSocket.socketStatus == GEPPETTO.Resources.SocketStatus.CLOSE) {
if (GEPPETTO.MessageSocket.attempts < 10) {
window.ga('vfb.send', 'event', 'reconnect-attempt:' + GEPPETTO.MessageSocket.attempts, 'websocket-disconnect', (window.location.pathname + window.location.search));
Expand Down Expand Up @@ -1752,7 +1710,10 @@ class VFBMain extends React.Component {
searchConfiguration={this.searchConfiguration}
datasourceConfiguration={this.datasourceConfiguration} />

<VFBDownloadContents ref="downloadContentsRef" open={false} />

<VFBUploader ref="uploaderContentsRef" open={false} />

{this.htmlToolbarRender}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ var locationCypherQuery = ( instances, paths, weight ) => ({
+ " WITH * ORDER BY index DESC"
+ " UNWIND relationships(path) as sr"
+ " OPTIONAL MATCH cp=(x:Neuron:has_neuron_connectivity)-[:synapsed_to]-(y:Neuron:has_neuron_connectivity) WHERE x=apoc.rel.startNode(sr) AND y=apoc.rel.endNode(sr) OPTIONAL MATCH fp=(x)-[r:synapsed_to]->(y) WHERE r.weight[0] >= " + weight?.toString()
+ " RETURN distinct a as root, collect(distinct fp) as pp, collect(distinct cp) as p, collect(distinct id(r)) as fr, sourceNode as source, targetNode as target, max(length(path)) as maxHops, collect(distinct toString(id(r))+':'+toString(index)) as relationshipY ",
+ " OPTIONAL MATCH (x)-[xio:INSTANCEOF]->(xpc:Class) OPTIONAL MATCH (y)-[yio:INSTANCEOF]->(ypc:Class) WITH *,'\"'+ x.short_form+'\":{\"'+xpc.short_form+'\":\"' + xpc.label + '\"},\"'+ y.short_form+'\":{\"'+ypc.short_form+'\":\"' + ypc.label + '\"}' as Class"
+ " RETURN distinct a as root, collect(distinct fp) as pp, collect(distinct cp) as p, collect(distinct id(r)) as fr, sourceNode as source, targetNode as target, max(length(path)) as maxHops, collect(distinct toString(id(r))+':'+toString(index)) as relationshipY, "
+ " apoc.convert.fromJsonMap('{' + apoc.text.join(collect(Class),',') + '}') as class ",
"resultDataContents": ["row", "graph"]
}
]
});

var Neo4jLabels = {
FAFB : "FAFB",
L1EM : "L1EM",
FlyEM_HB : "FlyEM_HB"
}

// See query explanation on https://github.com/VirtualFlyBrain/graph_queries/blob/main/weighted_path.md

var configuration = {
Expand Down Expand Up @@ -63,46 +72,43 @@ var styling = {
// Color apply to target and source nodes when hovering over a link or a node.
defaultNeighborNodesHoverColor : "orange",
// Font used for text in nodes
defaultNodeFont : "5px sans-serif",
defaultNodeFont : "8px sans-serif",
// Color of font in node's text
defaultNodeFontColor : "black",
// Node border color
defaultBorderColor : "black",
// When hovering over a node, the node's border color changes to create a halo effect
defaultNodeHoverBoderColor : "red",
// Title bar (in node) background color
defaultNodeTitleBackgroundColor : "#11bffe",
defaultNodeTitleBackgroundColor : "grey",
// Description area (in node) background color
defaultNodeDescriptionBackgroundColor : "white",
nodeColorsByLabel : {
"Template" : "#ff6cc8",
"GABAergic" : "#9551ff",
"Dopaminergic" : "#3551ff",
"Cholinergic" : "#95515f",
"Glutamatergic" : "#95f1ff",
"Octopaminergic" : "#f3511f",
"Serotonergic" : "#9501f0",
"Motor_neuron" : "#fffa30",
"Sensory_neuron" : "#ff3a3a",
"Peptidergic_neuron" : "#5f6a3a",
"Glial_cell" : "#ff3a6a",
"Clone" : "#d6007d",
"Synaptic_neuropil" : "#00a2aa",
"License" : "#0164d8",
"Person" : "#023f00",
"Neuron" : "#7f2100",
"Neuron_projection_bundle" : "#d6327d",
"Resource" : "#005f1d",
"Site" : "#005f1d",
"Expression_pattern" : "#534700",
"Split" : "#e012e3",
"DataSet" : "#b700b5",
"Ganglion" : "#d6007d",
"Neuromere" : "#d6507d",
"Cell" : "#ff6a3a",
"Property" : "#005f1d",
"Anatomy" : "#00a2aa",
"_Class" : "#0164d8"
"GABAergic" : "#377eb8",
"Neuron_projection_bundle" : "#ff7f00",
"Nervous_system" : "#4daf4a",
"Dopaminergic" : "#f781bf",
"Motor_neuron" : "#a65628",
"Cholinergic" : "#984ea3",
"Neuromere" : "#999999",
"Expression_pattern_fragment" : "#e41a1c",
"Peptidergic_neuron" : "#dede00",
"Ganglion" : "#377eb8",
"Muscle" : "#ff7f00",
"Glutamatergic" : "#4daf4a",
"Cluster" : "#f781bf",
"Clone" : "#a65628",
"Octopaminergic" : "#984ea3",
"Anatomy" : "#999999",
"Adult" : "#e41a1c",
"Synaptic_neuropil_subdomain" : "#dede00",
"Expression_pattern" : "#377eb8",
"Synaptic_neuropil_block" : "#ff7f00",
"Synaptic_neuropil_domain" : "#4daf4a",
"Serotonergic" : "#f781bf",
"Larva" : "#a65628",
"Neuron" : "#984ea3",
"Sensory_neuron" : "#999999"
},
controlIcons : {
home : "fa fa-home",
Expand All @@ -120,5 +126,6 @@ module.exports = {
configuration,
styling,
restPostConfig,
locationCypherQuery
locationCypherQuery,
Neo4jLabels
};
34 changes: 34 additions & 0 deletions components/configuration/VFBDownloadContents/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"postURL":"https://zip.virtualflybrain.org/download",
"contentType": "application/json",
"zipName" : "VFB Files.zip",
"options" :{
"obj": {
"label" : "OBJ",
"tooltip" : "Download OBJ"
},
"swc": {
"label" : "SWC",
"tooltip" : "Download SWC"
},
"nrrd": {
"label" : "NRRD",
"tooltip" : "Download NRRD"
},
"reference": {
"label" : "References",
"tooltip" : "Download References"
}
},
"text" : {
"title" : "Download Data",
"typesSubtitle" : "Please select the desired types",
"variablesSubtitle" : "Please select Variables:",
"noVariablesSubtitle" : "No loaded variables",
"errorMessage" : "Something went wrong... We were not able to download the data. Please try again.",
"noEntriesFound" : "No entries found for the types and variables selected.",
"cancelButton" : "Cancel",
"downloadButton" : "Download",
"tryAgainButton" : "Try Again"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/configuration/VFBDownloadContents/obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 21 additions & 5 deletions components/configuration/VFBMain/searchConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var searchStyle = {
singleResult: {
"color": "white",
"fontSize": "18px",

"whiteSpace" : "normal",
":hover": {
"color": "#11bffe",
"background-color": "#252323",
Expand Down Expand Up @@ -91,25 +91,29 @@ var datasourceConfiguration = {
"defType": "edismax",
"qf": "label^100 synonym^100 label_autosuggest_ws label_autosuggest_e label_autosuggest synonym_autosuggest_ws synonym_autosuggest shortform_autosuggest",
"indent": "true",
"fl": "short_form,label,synonym,id,facets_annotation",
"fl": "short_form,label,synonym,id,facets_annotation,unique_facets",
"start": "0",
"pf":"true",
"fq": [
"shortform_autosuggest:VFB* OR shortform_autosuggest:FB* OR facets_annotation:DataSet OR facets_annotation:pub"
],
"rows": "100",
"wt": "json",
"bq": "shortform_autosuggest:VFB*^110.0 shortform_autosuggest:FBbt*^100.0 label_s:\"\"^2 synonym_s:\"\" short_form:FBbt_00003982^2 facets_annotation:Deprecated^0.001"
"bq": "shortform_autosuggest:VFBexp*^10.0 shortform_autosuggest:VFB*^100.0 shortform_autosuggest:FBbt*^100.0 label_s:\"\"^2 synonym_s:\"\" short_form:FBbt_00003982^2 facets_annotation:Deprecated^0.001"
}
};

var searchConfiguration = {
"resultsMapping":
{
"name": "label",
"id": "short_form"
"id": "short_form",
"labels" : "unique_facets"
},
"label_manipulation" : label => label,
"filters_expanded": true,
"filter_positive" : "^100",
"filter_negative" : "^0.001",
"filters": [
{
"key": "facets_annotation",
Expand Down Expand Up @@ -305,6 +309,13 @@ var searchConfiguration = {
if (b.label.toLowerCase().indexOf(InputString.toLowerCase()) > -1 && b.label.toLowerCase().indexOf(InputString.toLowerCase()) < a.label.toLowerCase().indexOf(InputString.toLowerCase())) {
return 1;
}
// move up expression (VFBexp) terms
if (a.id.indexOf("VFBexp") > -1 && b.id.indexOf("VFBexp") < 0) {
return -1;
}
if (b.id.indexOf("VFBexp") > -1 && a.id.indexOf("VFBexp") < 0) {
return 1;
}
// if the match in the id is closer to start then move up
if (a.id.toLowerCase().indexOf(InputString.toLowerCase()) > -1 && a.id.toLowerCase().indexOf(InputString.toLowerCase()) < b.id.toLowerCase().indexOf(InputString.toLowerCase())) {
return -1;
Expand All @@ -323,11 +334,16 @@ var searchConfiguration = {
},
"clickHandler": function (id) {
window.addVfbId(id);
},
"Neo4jLabels" : {
"FAFB" : "FAFB",
"L1EM" : "L1EM",
"FlyEM_HB" : "FlyEM_HB"
}
};

module.exports = {
searchStyle,
searchConfiguration,
datasourceConfiguration,
datasourceConfiguration
};
Loading

0 comments on commit fc1614a

Please sign in to comment.