Skip to content

Commit

Permalink
PRAGMA37 demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mielliott committed Sep 15, 2019
1 parent 47bb3d3 commit edddcda
Show file tree
Hide file tree
Showing 27 changed files with 52,332 additions and 468 deletions.
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ELMFLAGS = --yes --warn

all: boom.tar.gz mcpa.tar.gz
cp -r mcpa/elm webapp/
cp mcpa/treeView.html.template webapp/treeView.html
cp mcpa/index.html.template webapp/index.html
#cp mcpa/treeView.html.template webapp/treeView.html
#cp mcpa/index.html.template webapp/index.html
#cp mcpa/packageView.html.template webapp/packageView.html # TODO: a template probably isn't necessary

debug: ELMFLAGS += --debug
Expand All @@ -14,7 +14,7 @@ boom.tar.gz: boom/elm/boomMain.js boom/elm/subsetpam.js boom/*
echo "BOOM-TEST" > boom/Version
tar -zcvf boom.tar.gz --exclude=boomFlagsOverride.js boom

mcpa.tar.gz: mcpa/elm/StatsHeatMap.js mcpa/elm/TreeView.js mcpa/elm/Package.js mcpa/*
mcpa.tar.gz: mcpa/elm/TreeView.js mcpa/elm/StatsTreeMap.js mcpa/elm/MapView.js mcpa/elm/ScatterMain.js mcpa/elm/Package.js mcpa/*
#git describe --tags > mcpa/VERSION
echo "MCPA-TEST" > mcpa/VERSION
tar -zcvf mcpa.tar.gz mcpa
Expand All @@ -25,11 +25,20 @@ boom/elm/boomMain.js: source/Decoder.elm source/*
boom/elm/subsetpam.js: source/Decoder.elm source/*
elm-make source/SubsetPam.elm $(ELMFLAGS) --output=boom/elm/subsetpam.js

mcpa/elm/MapView.js: source/Decoder.elm source/*
elm-make source/MapView.elm $(ELMFLAGS) --output=mcpa/elm/MapView.js

mcpa/elm/ScatterMain.js: source/Decoder.elm source/*
elm-make source/ScatterMain.elm $(ELMFLAGS) --output=mcpa/elm/ScatterMain.js

mcpa/elm/Package.js: source/Package.elm source/*
elm-make source/Package.elm $(ELMFLAGS) --output=mcpa/elm/Package.js

mcpa/elm/StatsHeatMap.js: source/Decoder.elm source/*
elm-make source/StatsHeatMap.elm $(ELMFLAGS) --output=mcpa/elm/StatsHeatMap.js
#mcpa/elm/StatsHeatMap.js: source/Decoder.elm source/*
# elm-make source/StatsHeatMap.elm $(ELMFLAGS) --output=mcpa/elm/StatsHeatMap.js

mcpa/elm/StatsTreeMap.js: source/Decoder.elm source/*
elm-make source/StatsTreeMap.elm $(ELMFLAGS) --output=mcpa/elm/StatsTreeMap.js

mcpa/elm/TreeView.js: source/Decoder.elm source/*
elm-make source/TreeView.elm $(ELMFLAGS) --output=mcpa/elm/TreeView.js
Expand Down
104 changes: 93 additions & 11 deletions lifemapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,43 @@ var lifemapper = sage2_webview_appCoreV01_extendWebview({
this.resizeEvents = "continuous"; // Recommended not to change. Options: never, continuous, onfinish

// Path / URL of the page you want to show
// TODO: so much ugliness to fix
if (data.customLaunchParams) {
console.log(data.customLaunchParams);
switch (data.customLaunchParams.view) {
case "occmap":
console.log("Launching Lifemapper app as \"occmap\"");
this.sendResize(752, 600);
this.changeURL(this.resrcPath + "/webapp/mapView.html", false);
//this.changeURL(this.resrcPath + "/webapp/statsTreeMap.html", false);
break;
case "tree":
console.log("Launching Lifemapper app as \"tree\"")
this.sendResize(688, 1400)
console.log("Launching Lifemapper app as \"tree\"");
this.sendResize(672, 1138);
this.changeURL(this.resrcPath + "/webapp/treeView.html", false);
break;
case "scatter":
console.log("Launching Lifemapper app as \"scatter\"");
this.sendResize(700, 700);
this.changeURL(this.resrcPath + "/webapp/scatterView.html", false);
break;
case "biotaphy":
console.log("Launching Lifemapper app as \"biotaphy\"");
this.sendResize(1200, 800);
this.changeURL(this.resrcPath + "/heuchera_demo/index.html", false);
break;
default:
console.log("Launching Lifemapper app with no parameters")
this.sendResize(560, 128)
console.log("Launching Lifemapper app with no parameters");
this.sendResize(560, 128);
this.changeURL(this.resrcPath + "/webapp/packageView.html", false);
break;
}
}
else {
console.log("Launching Lifemapper app with no parameters")
this.sendResize(560, 128)
console.log("Launching Lifemapper app with no parameters");
this.sendResize(560, 128);
this.changeURL(this.resrcPath + "/webapp/packageView.html", false);
//this.changeURL(this.resrcPath + "/webpageOLD/index.html", false);
}
},
load: function(date) {
Expand Down Expand Up @@ -91,7 +109,7 @@ var lifemapper = sage2_webview_appCoreV01_extendWebview({
// });

// TODO: remove these (keeping for now as reference)
/*entries.push({
entries.push({
description: "Set Counter value",
callback: "setCounterValueInPage", // function defined below
inputField: true, // Takes typed input from UI
Expand All @@ -102,13 +120,29 @@ var lifemapper = sage2_webview_appCoreV01_extendWebview({
description: "Force state update",
callback: "giveContainerStateToWebpage", // function defined below
parameters: {},
});*/
});

entries.push({
description: "Open a phylogenetic tree",
callback: "openTreeCallback", // function defined below
parameters: {},
});
entries.push({
description: "Open an occurrence map",
callback: "openMapCallback", // function defined below
parameters: {},
});
entries.push({
description: "Open a scatter plot",
callback: "openScatterCallback", // function defined below
parameters: {},
});
entries.push({
description: "Open BiotaPhy",
callback: "openBiotaPhyCallback", // function defined below
parameters: {},
});

return entries;
},

Expand All @@ -129,11 +163,59 @@ var lifemapper = sage2_webview_appCoreV01_extendWebview({
// Add optional functions

openTreeCallback: function() {
console.log("Opening phylogenetic tree app")
this.launchAppWithValues("Lifemapper-SAGE2-App", { view : "tree" })
console.log("Opening phylogenetic tree app");
this.launchAppWithValues("Lifemapper-SAGE2-App", { view : "tree" });
},

openMapCallback: function() {
console.log("Opening occurrence map app");
this.launchAppWithValues("Lifemapper-SAGE2-App", { view : "occmap" });
},

openScatterCallback: function() {
console.log("Opening scatter plot app");
this.launchAppWithValues("Lifemapper-SAGE2-App", { view : "scatter" });
},

openBiotaPhyCallback: function() {
console.log("Opening a BiotaPhy app")
this.launchAppWithValues("Lifemapper-SAGE2-App", { view : "biotaphy" })
},

suggestNodesForSites: function(data) {
console.log("Suggesting nodes for sites");
this.sendDataToParentApp("propagateNodesForSites", JSON.stringify(data));
},

suggestSitesForNode: function(data) {
console.log("Suggesting sites for node");
console.log("Received this piece a junkah:");
console.log(JSON.stringify(data))
console.log("End of junk")
this.sendDataToParentApp("propagateSitesForNode", JSON.stringify(data));
},

propagateNodesForSites: function(data) {
console.log("Propagating nodes for sites");
this.sendDataToChildrenApps("receiveNodesForSites", data);
},

propagateSitesForNode: function(data) {
console.log("Propagating sites for node");
this.sendDataToChildrenApps("receiveSitesForNode", data);
},

receiveNodesForSites: function(data) {
console.log("Receiving nodes for sites");
this.callFunctionInWebpage("receiveNodesForSites", data);
},

receiveSitesForNode: function(data) {
console.log("Receiving sites for node");
this.callFunctionInWebpage("receiveSitesForNode", data);
},

askParent: function(func, data) {
askParent: function(func, data) { // TODO: not in use? Remove?
data._sender = this.id; // Provide an address for the parent to reply to
this.sendDataToParentApp(func, data);
},
Expand Down
Loading

0 comments on commit edddcda

Please sign in to comment.