Skip to content

Commit

Permalink
Merge pull request #57 from VirtualFlyBrain/vfb_geppetto_application
Browse files Browse the repository at this point in the history
Vfb geppetto application updates
  • Loading branch information
Robbie1977 authored Jul 4, 2019
2 parents 2d70bec + 49c8916 commit f354661
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ install:
- cd uk.ac.vfb.geppetto
- mvn -Dhttps.protocols=TLSv1.2 -DskipTests --quiet install


before_script:
- npm install travis-ci

after_success:
- node travis/trigger-build.js



Expand Down
59 changes: 49 additions & 10 deletions src/main/java/uk/ac/vfb/geppetto/VFBProcessTermInfoJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@ private String highlightLinks(String text) {
return text;
}
}

public String logo() {
String result = "";
if (this.icon != null && !this.icon.equals("")) {
if (this.link != null && !this.link.equals("")) {
result = "<span class=\"terminfo-logo\"><a href=\"" + this.link + "\" target=\"_blank\" ><img class=\"terminfo-logo\" src=\"" + this.icon + "\" /></a></span>";
}else{
result = "<span class=\"terminfo-logo\"><img class=\"terminfo-logo\" src=\"" + this.icon + "\" /></span>";
}
}
return result;
}

public String link() {
String result = "";
if (this.link != null && !this.link.equals("")) {
result = "<span class=\"terminfo-link\"><a href=\"" + this.link + "\" target=\"_blank\" ><i class=\"popup-icon-link fa fa-external-link\"></i> " + this.link + "</a></span>";
}
return result;
}
}

class rel {
Expand Down Expand Up @@ -829,12 +849,17 @@ public ArrayValue thumbnail() {
}

public String imageFile(List<channel_image> images, String filename) {
for (channel_image ci : images) {
if (checkURL(ci.getUrl("", filename))) {
return ci.getUrl("", filename);
try{
for (channel_image ci : images) {
if (checkURL(ci.getUrl("", filename))) {
return ci.getUrl("", filename);
}
}
} catch (Exception e) {
System.out.println("Error in vfbTerm.imageFile: " + e.toString());
e.printStackTrace();
}
if (debug) System.out.println("Failed to find: " + filename);
System.out.println("Failed to find: " + filename);
return null;
}

Expand Down Expand Up @@ -977,6 +1002,20 @@ public QueryResults process(ProcessQuery query, DataSource dataSource, Variable
tempData = "<b>" + vfbTerm.term.core.label + "</b> (" + vfbTerm.term.core.short_form + ") " + vfbTerm.term.core.types(showTypes);
addModelHtml(tempData, "Name", header, metadataType, geppettoModelAccess);

// Logo
header = "logo";
tempData = vfbTerm.term.logo();
if (!tempData.equals("")) {
addModelHtml(tempData, "Logo", header, metadataType, geppettoModelAccess);
}

// Link
header = "link";
tempData = vfbTerm.term.link();
if (!tempData.equals("")) {
addModelHtml(tempData, "Link", header, metadataType, geppettoModelAccess);
}

// Types
header = "types";
superTypes = vfbTerm.term.core.typeList();
Expand Down Expand Up @@ -1060,32 +1099,32 @@ public QueryResults process(ProcessQuery query, DataSource dataSource, Variable
// OBJ - 3D mesh
tempData = vfbTerm.imageFile(vfbTerm.channel_image, "volume_man.obj");
if (tempData == null){
if (debug) System.out.println("OBJ " + tempData);
tempData = vfbTerm.imageFile(vfbTerm.channel_image, "volume.obj");
}
if (debug) System.out.println("OBJ " + tempData);
if (tempData != null){
addModelObj(tempData.replace("https://","http://"), "3D volume", variable.getId(), parentType, geppettoModelAccess, dataSource);
}

// SWC - 3D mesh
tempData = vfbTerm.imageFile(vfbTerm.channel_image, "volume.swc");
if (debug) System.out.println("SWC " + tempData);
if (tempData != null){
if (debug) System.out.println("SWC " + tempData);
addModelSwc(tempData.replace("https://","http://"), "3D Skeleton", variable.getId(), parentType, geppettoModelAccess, dataSource);
}

// Slices - 3D slice viewer
tempData = vfbTerm.imageFile(vfbTerm.channel_image, "volume.wlz");
if (debug) System.out.println("WLZ " + tempData);
if (tempData != null){
if (debug) System.out.println("WLZ " + tempData);
addModelSlices(tempData.replace("http://","https://"), "Stack Viewer Slices", variable.getId(), parentType, geppettoModelAccess, dataSource, vfbTerm.getDomains());
}

// Download - NRRD stack
tempData = vfbTerm.imageFile(vfbTerm.channel_image, "volume.nrrd");
if (debug) System.out.println("NRRD " + tempData);
if (tempData != null){
addModelHtml("Aligned Image: <a download=\"" + variable.getId() + ".nrrd\" href=\"" + tempData.replace("http://","https://") + "\">" + variable.getId() + ".nrrd</a><br>Note: see source & license above for terms of reuse and correct attribution.", "Downloads", "downloads", metadataType, geppettoModelAccess);
if (debug) System.out.println("NRRD " + tempData);
addModelHtml("Aligned Image: <a download=\"" + variable.getId() + ".nrrd\" href=\"" + tempData.replace("http://","https://").replace("https://www.virtualflybrain.org/data/","/data/") + "\">" + variable.getId() + ".nrrd</a><br>Note: see source & license above for terms of reuse and correct attribution.", "Downloads", "downloads", metadataType, geppettoModelAccess);
}
}

Expand Down Expand Up @@ -1119,7 +1158,7 @@ public QueryResults process(ProcessQuery query, DataSource dataSource, Variable
tempData = vfbTerm.imageFile(vfbTerm.template_channel, "volume.nrrd");
if (debug) System.out.println("NRRD " + tempData);
if (tempData != null){
addModelHtml("Aligned Image: <a download=\"" + variable.getId() + ".nrrd\" href=\"" + tempData.replace("http://","https://") + "\">" + variable.getId() + ".nrrd</a><br>Note: see source & license above for terms of reuse and correct attribution.", "Downloads", "downloads", metadataType, geppettoModelAccess);
addModelHtml("Aligned Image: <a download=\"" + variable.getId() + ".nrrd\" href=\"" + tempData.replace("http://","https://").replace("https://www.virtualflybrain.org/data/","/data/") + "\">" + variable.getId() + ".nrrd</a><br>Note: see source & license above for terms of reuse and correct attribution.", "Downloads", "downloads", metadataType, geppettoModelAccess);
}
}

Expand Down
33 changes: 33 additions & 0 deletions travis/trigger-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var Travis = require('travis-ci');

// change this
var repo = "VirtualFlyBrain/geppetto-vfb";

var travis = new Travis({
version: '2.0.0'
});

travis.authenticate({

github_token: process.env.TRATOKEN

}, function (err, res) {
if (err) {
return console.error(err);
}

travis.repos(repo.split('/')[0], repo.split('/')[1]).builds.get(function (err, res) {
if (err) {
return console.error(err);
}

travis.requests.post({
build_id: res.builds[0].id
}, function (err, res) {
if (err) {
return console.error(err);
}
console.log(res.flash[0].notice);
});
});
});

0 comments on commit f354661

Please sign in to comment.