Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switching to specific servers #726

Merged
merged 9 commits into from
Oct 27, 2020
54 changes: 27 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,30 @@ jobs:
- export VFB_REPO=$(echo ${TRAVIS_REPO_SLUG##*/} | awk '{gsub(/\-/,"_",$0);gsub(/\./,"_",$0);print toupper($0)}')
- export REPO=$(echo ${TRAVIS_REPO_SLUG} | awk '{gsub(/\./,"_",$0);print tolower($0)}')
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo ${TRAVIS_BRANCH/\//-}; fi`
- if [ "$BUILD_TYPE" == "development" ]; then
export VFB_TREE_PDB_SERVER=https://pdb-dev.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb-dev.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl-dev.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr-dev.virtualflybrain.org/solr/ontology/select;
export TAG=$TAG-development;
elif [ "$BUILD_TYPE" == "staging" ]; then
- export VFB_PDB_SERVER=https://pdb.p2.virtualflybrain.org;
- export VFB_OWL_SERVER=http://owl.p2.virtualflybrain.org/kbs/vfb/;
- export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
- export VFB_TREE_PDB_SERVER=https://pdb.p2.virtualflybrain.org;
- export SOLR_SERVER=https://solr.p2.virtualflybrain.org/solr/ontology/select;
- if [ "$TRAVIS_BRANCH" == "master" ]; then
export VFB_TREE_PDB_SERVER=https://pdb.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr.virtualflybrain.org/solr/ontology/select;
else
export VFB_TREE_PDB_SERVER=https://pdb.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl.virtualflybrain.org/kbs/vfb/;
elif [ "$BUILD_TYPE" == "staging" ] || [ "$BUILD_TYPE" == "development" ]; then
export VFB_PDB_SERVER=https://pdb-dev.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl-dev.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr.virtualflybrain.org/solr/ontology/select;
export VFB_TREE_PDB_SERVER=https://pdb-dev.virtualflybrain.org;
export SOLR_SERVER=https://solr-dev.virtualflybrain.org/solr/ontology/select;
elif [ "$TRAVIS_BRANCH" == "alpha" ]; then
export VFB_PDB_SERVER=https://pdb-alpha.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl-alpha.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export VFB_TREE_PDB_SERVER=https://pdb-alpha.virtualflybrain.org;
export SOLR_SERVER=https://solr-alpha.virtualflybrain.org/solr/ontology/select;
fi;
export VFB_TREE_PDB_SERVER=https://pdb.p2.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb.p2.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl.p2.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr.p2.virtualflybrain.org/solr/ontology/select;
- export TAG="$TAG-TEST"
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS;
Expand Down Expand Up @@ -210,21 +209,22 @@ jobs:
export VFB_PDB_SERVER=http://pdb:7474;
export VFB_OWL_SERVER=http://owl:8080/kbs/vfb/;
export VFB_R_SERVER=http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast;
if [ "$BUILD_TYPE" == "development" ]; then
export VFB_TREE_PDB_SERVER=https://pdb-dev.virtualflybrain.org;
export SOLR_SERVER=https://solr-dev.virtualflybrain.org/solr/ontology/select;
elif [ "$BUILD_TYPE" == "staging" ]; then
if [ "$TRAVIS_BRANCH" == "master" ]; then
export VFB_TREE_PDB_SERVER=https://pdb.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr.virtualflybrain.org/solr/ontology/select;
elif [ "$BUILD_TYPE" == "staging" ] || [ "$BUILD_TYPE" == "development" ]; then
export VFB_TREE_PDB_SERVER=https://pdb-dev.virtualflybrain.org;
export SOLR_SERVER=https://solr-dev.virtualflybrain.org/solr/ontology/select;
elif [ "$TRAVIS_BRANCH" == "alpha" ]; then
export VFB_TREE_PDB_SERVER=https://pdb-alpha.virtualflybrain.org;
export SOLR_SERVER=https://solr-alpha.virtualflybrain.org/solr/ontology/select;
else
export VFB_TREE_PDB_SERVER=https://pdb.virtualflybrain.org;
export SOLR_SERVER=https://solr.virtualflybrain.org/solr/ontology/select;
fi;
export VFB_TREE_PDB_SERVER=https://pdb.p2.virtualflybrain.org;
export VFB_PDB_SERVER=http://pdb.p2.virtualflybrain.org;
export VFB_OWL_SERVER=http://owl.p2.virtualflybrain.org/kbs/vfb/;
export VFB_R_SERVER=http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast;
export SOLR_SERVER=https://solr.p2.virtualflybrain.org/solr/ontology/select;
docker build --cache-from metacell/java-virgo-maven:development -t=$REPO:$TAG.wss --build-arg VFB_TREE_PDB_SERVER_ARG=$VFB_TREE_PDB_SERVER --build-arg SOLR_SERVER_ARG=$SOLR_SERVER --build-arg VFB_R_SERVER_ARG=$VFB_R_SERVER --build-arg VFB_OWL_SERVER_ARG=$VFB_OWL_SERVER --build-arg VFB_PDB_SERVER_ARG=$VFB_PDB_SERVER --build-arg build_type=$BUILD_TYPE --build-arg targetBranch=$TRAVIS_BRANCH --build-arg originBranch=$BRANCH --build-arg defaultBranch=$DEFAULT_BRANCH --build-arg finalBuild=true $DOCKER_FOLDER && docker push $REPO:$TAG.wss;
fi;

Expand Down
3 changes: 2 additions & 1 deletion components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class VFBMain extends React.Component {
if ($.inArray(idsList[singleId], this.vfbLoadBuffer) == -1) {
this.vfbLoadBuffer.push(idsList[singleId]);
}
if (window[idsList[singleId]] != undefined) {
if (Instances.getInstance(idsList[singleId]) !== undefined) {
this.handleSceneAndTermInfoCallback(idsList[singleId]);
idsList.splice($.inArray(idsList[singleId], idsList), 1);
this.vfbLoadBuffer.splice($.inArray(idsList[singleId], this.vfbLoadBuffer), 1);
Expand Down Expand Up @@ -250,6 +250,7 @@ class VFBMain extends React.Component {
}.bind(this));
} else {
this.handlerInstanceUpdate(meta);
this.setActiveTab("termInfo");
}
// if the element is not invalid (try-catch) or it is part of the scene then remove it from the buffer
if (window[variableIds[singleId]] != undefined) {
Expand Down
57 changes: 38 additions & 19 deletions components/configuration/VFBListViewer/listViewerConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import ListViewerControlsMenu from '../../interface/VFBListViewer/ListViewerControlsMenu';
import { MultiStatusComponent, GroupComponent, ImageComponent, IconComponent, ColorComponent } from "@geppettoengine/geppetto-ui/list-viewer/ListViewer";
import Tooltip from '@material-ui/core/Tooltip';
import ListViewerControlsMenu from '../../interface/VFBListViewer/ListViewerControlsMenu';

/**
* Create component to display controls
Expand Down Expand Up @@ -36,10 +35,10 @@ const conf = [
{
id: "name",
title: "Name",
customComponent: component => {
customComponent: component => {
// Retrieve instance path
let path = component.value.get("path").split(".")[0];

let instance = Instances.getInstance(path);
var self = this;

Expand All @@ -48,8 +47,11 @@ const conf = [
window.setTermInfo(Instances.getInstance(path)[path + "_meta"], path);
};
// Create new HTML string with the Type name and tags only
let typeHTML = '<a id="' + instance.id + '" style="color:white;text-decoration: none;">' + instance.getName() + "</a>" ;

let typeHTML = '<a id="' + instance.id + '" style="color:white;text-decoration: none;cursor:pointer">' + instance.getName() + "</a>" ;
if (instance.isSelected()) {
typeHTML = '<a id="' + instance.id + '" style="color:yellow;text-decoration: none;cursor:pointer">' + instance.getName() + "</a>" ;
}

// Set HTML string inside div ready for React
return <div onClick={e => click(e)} dangerouslySetInnerHTML={{ __html: typeHTML }} />
},
Expand All @@ -58,36 +60,53 @@ const conf = [
{
id: "type",
title: "Type",
customComponent: component => {
customComponent: component => {
// Retrieve instance path
let path = component.value.get("path").split(".")[0];

let instance = Instances.getInstance(path)[path + "_meta"];

if ( instance === undefined ) {
return null;
}

// Retrieve the HTML type from the Instance, it's in the form of an HTML element saved as a string
let html = instance.getTypes().map(function (t) {
return t.type.getInitialValue().value
})[0].html;

// Extract HTML element anchor from html string
var matchAnchor = /<a[^>]*>([\s\S]*?)<\/a>/g
, type = html.match(matchAnchor);

// Extract HTML element anchor from html string
var matchSpan = /<span[^>]*>([\s\S]*?)<\/span>/g
, tags = html.match(matchSpan);

// Make anchor open in new tab, and fix path by adding 'geppetto?' to href
let textContent = type.join().replace('href="?', 'target="_blank" href="geppetto?');

var matchID = /data-instancepath\=\"([A-Za-z0-9 _]*)\"/
, classID = type[0].match(matchID)[1];

var matchText = /<a [^>]+>(.*?)<\/a>/
, newText = type[0].match(matchText)[1]

let textClass = '<a id="' + classID + '" style="color:#428bca;text-decoration: none;cursor:pointer">' + newText + "</a>"
// Create new HTML string with the Type name and tags only
let typeHTML = "<div>" + textContent + tags.join('') + "</div>" ;

let typeHTML = tags.join('') ;

let click = value => {
let id = value.target.id;
if (Instances.getInstance(id) === undefined) {
window.addVfbId(id);
} else {
window.setTermInfo(Instances.getInstance(id)[id + "_meta"], id);
}
};

// Set HTML string inside div ready for React
return <div dangerouslySetInnerHTML={{ __html: typeHTML }} />
return <div>
<div style={{ width: "40%", textAlign: "left", float: "left" }} onClick={e => click(e)} dangerouslySetInnerHTML={{ __html: textClass }} />
<div style={{ textAlign: "right", width: "60%", float: "right" }} dangerouslySetInnerHTML={{ __html: typeHTML }} />
</div>
},
source : entity => entity
},
Expand Down Expand Up @@ -118,4 +137,4 @@ const conf = [
}
];

export default conf;
export default conf;
16 changes: 10 additions & 6 deletions components/interface/VFBFocusTerm/VFBFocusTerm.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,20 @@ class VFBFocusTerm extends React.Component {
if (window[classId] === undefined) {
window.fetchVariableThenRun(classId, () => {
var variable = GEPPETTO.ModelFactory.getTopLevelVariablesById([classId])[0]
var allQueries = GEPPETTO.ModelFactory.getMatchingQueries(variable.getType(), undefined);
if (allQueries.length > 0) {
this.configuration.buttons[0].dynamicListInjector.parameters = [{ variable: variable, allQueries: allQueries }];
if (variable !== undefined) {
var allQueries = GEPPETTO.ModelFactory.getMatchingQueries(variable.getType(), undefined);
if (allQueries.length > 0) {
this.configuration.buttons[0].dynamicListInjector.parameters = [{ variable: variable, allQueries: allQueries }];
}
}
});
} else {
var variable = GEPPETTO.ModelFactory.getTopLevelVariablesById([classId])[0]
var allQueries = GEPPETTO.ModelFactory.getMatchingQueries(variable.getType(), undefined);
if (allQueries.length > 0) {
this.configuration.buttons[0].dynamicListInjector.parameters = [{ variable: variable, allQueries: allQueries }];
if (variable !== undefined) {
var allQueries = GEPPETTO.ModelFactory.getMatchingQueries(variable.getType(), undefined);
if (allQueries.length > 0) {
this.configuration.buttons[0].dynamicListInjector.parameters = [{ variable: variable, allQueries: allQueries }];
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/interface/VFBTree/VFBTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,4 @@ function mapDispatchToProps (dispatch) {
return { setTermInfo: (instance, visible) => dispatch(setTermInfo(instance, visible )) }
}

export default connect(mapStateToProps, mapDispatchToProps)(VFBTree);
export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef : true } )(VFBTree);
2 changes: 1 addition & 1 deletion model/vfb.xmi
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
name="anatomy_query"
description="fetch Individual instances from Class ID list"
runForCount="false"
query="&quot;statement&quot;: &quot;MATCH (primary:Class:Anatomy) WHERE primary.short_form in {ARRAY_ID_RESULTS} WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)&lt;- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)&lt;-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.symbol[0], '')} , channel_image: { channel: { short_form: channel.short_form, label: coalesce(channel.label,''), iri: channel.iri, types: labels(channel), symbol: coalesce(channel.symbol[0], '')} , imaging_technique: { short_form: technique.short_form, label: coalesce(technique.label,''), iri: technique.iri, types: labels(technique), symbol: coalesce(technique.symbol[0], '')} ,image: { template_channel : { short_form: template.short_form, label: coalesce(template.label,''), iri: template.iri, types: labels(template), symbol: coalesce(template.symbol[0], '')} , template_anatomy: { short_form: template_anat.short_form, label: coalesce(template_anat.label,''), iri: template_anat.iri, types: labels(template_anat), symbol: coalesce(template_anat.symbol[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,primary RETURN { core : { short_form: primary.short_form, label: coalesce(primary.label,''), iri: primary.iri, types: labels(primary), symbol: coalesce(primary.symbol[0], '')} , description : coalesce(primary.description, []), comment : coalesce(primary.comment, []) } AS term, '58214d4' AS version, 'anatomy_query' AS query, anatomy_channel_image&quot;, &quot;parameters&quot; : { &quot;ARRAY_ID_RESULTS&quot; : $ARRAY_ID_RESULTS }"
query="&quot;statement&quot;: &quot;MATCH (primary:Class) WHERE primary.short_form in {ARRAY_ID_RESULTS} WITH primary CALL apoc.cypher.run('WITH primary OPTIONAL MATCH (primary)&lt;- [:has_source|SUBCLASSOF|INSTANCEOF*]-(i:Individual)&lt;-[:depicts]- (channel:Individual)-[irw:in_register_with] ->(template:Individual)-[:depicts]-> (template_anat:Individual) RETURN template, channel, template_anat, i, irw limit 5', {primary:primary}) yield value with value.template as template, value.channel as channel,value.template_anat as template_anat, value.i as i, value.irw as irw, primary OPTIONAL MATCH (channel)-[:is_specified_output_of]->(technique:Class) WITH CASE WHEN channel IS NULL THEN [] ELSE COLLECT({ anatomy: { short_form: i.short_form, label: coalesce(i.label,''), iri: i.iri, types: labels(i), symbol: coalesce(i.symbol[0], '')} , channel_image: { channel: { short_form: channel.short_form, label: coalesce(channel.label,''), iri: channel.iri, types: labels(channel), symbol: coalesce(channel.symbol[0], '')} , imaging_technique: { short_form: technique.short_form, label: coalesce(technique.label,''), iri: technique.iri, types: labels(technique), symbol: coalesce(technique.symbol[0], '')} ,image: { template_channel : { short_form: template.short_form, label: coalesce(template.label,''), iri: template.iri, types: labels(template), symbol: coalesce(template.symbol[0], '')} , template_anatomy: { short_form: template_anat.short_form, label: coalesce(template_anat.label,''), iri: template_anat.iri, types: labels(template_anat), symbol: coalesce(template_anat.symbol[0], '')} ,image_folder: COALESCE(irw.folder[0], ''), index: coalesce(apoc.convert.toInteger(irw.index[0]), []) + [] }} }) END AS anatomy_channel_image ,primary RETURN { core : { short_form: primary.short_form, label: coalesce(primary.label,''), iri: primary.iri, types: labels(primary), symbol: coalesce(primary.symbol[0], '')} , description : coalesce(primary.description, []), comment : coalesce(primary.comment, []) } AS term, '58214d4' AS version, 'anatomy_query' AS query, anatomy_channel_image&quot;, &quot;parameters&quot; : { &quot;ARRAY_ID_RESULTS&quot; : $ARRAY_ID_RESULTS }"
countQuery="&quot;statement&quot;: &quot;MATCH (n:Class) WHERE n.short_form IN {ARRAY_ID_RESULTS} RETURN count(n) AS count&quot;, &quot;parameters&quot; : { &quot;ARRAY_ID_RESULTS&quot; : $ARRAY_ID_RESULTS }"/>
<queryChain
xsi:type="gep_2:ProcessQuery"
Expand Down