mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #1647 from shiltemann/dev
Phinch interactive environment
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
[main]
|
||||
# Unused
|
||||
|
||||
[docker]
|
||||
# Command to execute docker. For example `sudo docker` or `docker-lxc`.
|
||||
command = docker {docker_args}
|
||||
|
||||
# The docker image name that should be started.
|
||||
image = shiltemann/docker-phinch-galaxy:16.04
|
||||
|
||||
# Additional arguments that are passed to the `docker run` command.
|
||||
#command_inject = --sig-proxy=true -e DEBUG=false
|
||||
|
||||
# URL to access the Galaxy API with from the spawn Docker container, if empty
|
||||
# this falls back to galaxy.ini's galaxy_infrastructure_url and finally to the
|
||||
# Docker host of the spawned container if that is also not set.
|
||||
#galaxy_url =
|
||||
|
||||
# The Docker hostname. It can be useful to run the Docker daemon on a different
|
||||
# host than Galaxy.
|
||||
#docker_hostname = localhost
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE interactive_environment SYSTEM "../../interactive_environments.dtd">
|
||||
<interactive_environment name="Phinch">
|
||||
<data_sources>
|
||||
<data_source>
|
||||
<model_class>HistoryDatasetAssociation</model_class>
|
||||
<test type="isinstance" test_attr="datatype" result_type="datatype">Biom1</test>
|
||||
<to_param param_attr="id">dataset_id</to_param>
|
||||
</data_source>
|
||||
</data_sources>
|
||||
<params>
|
||||
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
|
||||
</params>
|
||||
<entry_point entry_point_type="mako">phinch.mako</entry_point>
|
||||
</interactive_environment>
|
||||
@@ -0,0 +1,51 @@
|
||||
function load_notebook(url){
|
||||
$( document ).ready(function() {
|
||||
test_ie_availability(url, function(){
|
||||
append_notebook(url)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function append_notebook(url){
|
||||
clear_main_area();
|
||||
$('#main').append('<iframe frameBorder="0" seamless="seamless" style="width: 100%; height: 100%; overflow:auto;" scrolling="yes" src="'+ url +'"></iframe>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function keep_alive(notebook_access_url){
|
||||
/**
|
||||
* This is needed to keep the container alive. If the user leaves this site
|
||||
* this function is not constantly pinging the container, the container will
|
||||
* terminate itself.
|
||||
*/
|
||||
|
||||
var request_count = 0;
|
||||
interval = setInterval(function(){
|
||||
$.ajax({
|
||||
url: notebook_access_url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
timeout: 500,
|
||||
success: function(){
|
||||
console.log("Connected to IE, returning");
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
request_count++;
|
||||
console.log("Request " + request_count);
|
||||
if(request_count > 30){
|
||||
clearInterval(interval);
|
||||
clear_main_area();
|
||||
toastr.error(
|
||||
"Could not connect to IE, contact your administrator",
|
||||
"Error",
|
||||
{'closeButton': true, 'timeOut': 20000, 'tapToDismiss': false}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<%namespace name="ie" file="ie.mako" />
|
||||
<%
|
||||
|
||||
import os
|
||||
|
||||
# Sets ID and sets up a lot of other variables
|
||||
ie_request.load_deploy_config()
|
||||
|
||||
|
||||
# Launch the IE. This builds and runs the docker command in the background.
|
||||
ie_request.launch(env_override={
|
||||
'dataset_hid': hda.hid,
|
||||
'dataset_filename': hda.file_name
|
||||
})
|
||||
|
||||
# Only once the container is launched can we template our URLs. The ie_request
|
||||
# doesn't have all of the information needed until the container is running.
|
||||
url = ie_request.url_template('${PROXY_URL}/phinch/')
|
||||
|
||||
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
${ ie.load_default_js() }
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
${ ie.default_javascript_variables() }
|
||||
var url = '${ url }';
|
||||
${ ie.plugin_require_config() }
|
||||
|
||||
// Keep container running
|
||||
requirejs(['interactive_environments', 'plugin/phinch'], function(){
|
||||
keep_alive(url);
|
||||
});
|
||||
|
||||
// Load notebook
|
||||
requirejs(['interactive_environments', 'plugin/phinch'], function(){
|
||||
load_notebook(url);
|
||||
});
|
||||
|
||||
</script>
|
||||
<div id="main" style="width: 100%; height: 100%; overflow:hidden;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user