mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #4680 from natefoo/gie-client
[17.09] Client side fixes for GIEs
This commit is contained in:
@@ -17,81 +17,164 @@ function display_spinner(){
|
||||
$('#main').append('<img id="spinner" src="' + galaxy_root + 'static/style/largespinner.gif" style="position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;">');
|
||||
}
|
||||
|
||||
function not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step) {
|
||||
if(timeout_values.count == 0){
|
||||
display_spinner();
|
||||
toastr.info(
|
||||
"Galaxy is launching a container in which to run this interactive environment. Please wait...",
|
||||
{'closeButton': true, 'tapToDismiss': false}
|
||||
);
|
||||
|
||||
/* Create a spin_state object used by spin() and spin_again() */
|
||||
function make_spin_state(type, ajax_timeout_init, ajax_timeout_max, ajax_timeout_step, sleep_init, sleep_max, sleep_step, log_attempts){
|
||||
var s = {
|
||||
type: (typeof type !== 'undefined') ? type : "GIE spin",
|
||||
ajax_timeout: (typeof ajax_timeout_init !== 'undefined') ? ajax_timeout_init : 2000,
|
||||
ajax_timeout_max: (typeof ajax_timeout_max !== 'undefined') ? ajax_timeout_max : 16000,
|
||||
ajax_timeout_step: (typeof ajax_timeout_step !== 'undefined') ? ajax_timeout_step : 500,
|
||||
sleep: (typeof sleep_init !== 'undefined') ? sleep_init : 500,
|
||||
sleep_max: (typeof sleep_max !== 'undefined') ? sleep_max : 8000,
|
||||
sleep_step: (typeof sleep_step !== 'undefined') ? sleep_step : 100,
|
||||
log_attempts: (typeof log_attempts !== 'undefined') ? log_attempts : true,
|
||||
count: 0,
|
||||
}
|
||||
timeout_values.count++;
|
||||
if(timeout_values.time < timeout_time_max){
|
||||
timeout_values.time += timeout_time_step;
|
||||
}
|
||||
console.log("Readiness request " + timeout_values.count + " sleeping " + timeout_values.time / 1000 + "s");
|
||||
window.setTimeout(timeout, timeout_values.time)
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a URL for a boolean true/false and call a callback when done.
|
||||
|
||||
/* Log/display an error when spinning fails. */
|
||||
function spin_error(console_msg, user_msg, clear){
|
||||
console.log(console_msg);
|
||||
if(clear) clear_main_area();
|
||||
if(typeof user_msg == "string"){
|
||||
toastr.clear();
|
||||
toastr.error(
|
||||
user_msg,
|
||||
"Error",
|
||||
{'closeButton': true, 'timeOut': 0, 'extendedTimeOut': 0, 'tapToDismiss': false}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Increase sleep time and spin again. */
|
||||
function spin_again(spin_state){
|
||||
if(spin_state.sleep < spin_state.sleep_max){
|
||||
spin_state.sleep += spin_state.sleep_step;
|
||||
}
|
||||
if(spin_state.log_attempts){
|
||||
console.log(spin_state.type + " request " + spin_state.count + " request timeout " + spin_state.ajax_timeout + "ms sleeping " + spin_state.sleep / 1000 + "s");
|
||||
}
|
||||
window.setTimeout(spin_state.spinner, spin_state.sleep);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Spin on a URL as long as it times out, otherwise, call the provided success or error callback. If the callback
|
||||
* returns `true`, the condition is considered "resolved" and spinning stops. Otherwise, continue spinning, increasing
|
||||
* AJAX timeouts and/or sleep values as configured in the spin_state.
|
||||
*/
|
||||
function load_when_ready(url, success_callback){
|
||||
var ajax_timeout = 500;
|
||||
var ajax_timeout_max = 10000;
|
||||
var ajax_timeout_step = 250;
|
||||
var timeout_values = { time: 1000, count: 0 };
|
||||
var timeout_time_max = 15000;
|
||||
var timeout_time_step = 1000;
|
||||
var timeout = function(){
|
||||
$.ajax({
|
||||
function spin(url, bool_response, success_callback, timeout_callback, error_callback, spin_state){
|
||||
var spinner = function(){
|
||||
var ajax_params = {
|
||||
url: url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
timeout: ajax_timeout,
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data == true){
|
||||
console.log("Galaxy reports IE container ready, returning");
|
||||
clear_main_area();
|
||||
toastr.clear();
|
||||
success_callback();
|
||||
}else if(data == false){
|
||||
not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step);
|
||||
timeout: spin_state.ajax_timeout,
|
||||
success: function(data, status, jqxhr){
|
||||
if(!success_callback(data, status, jqxhr)) spin_again(spin_state);
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
if(status == "timeout"){
|
||||
if(spin_state.ajax_timeout < spin_state.ajax_timeout_max){
|
||||
spin_state.ajax_timeout += spin_state.ajax_timeout_step;
|
||||
}
|
||||
spin_state.count++;
|
||||
if(!timeout_callback(jqxhr, status, error)) spin_again(spin_state);
|
||||
}else{
|
||||
clear_main_area();
|
||||
toastr.clear();
|
||||
toastr.error(
|
||||
"Galaxy failed to launch a container in which to run this interactive environment, contact your administrator.",
|
||||
"Error",
|
||||
{'closeButton': true, 'tapToDismiss': false}
|
||||
);
|
||||
spin_state.count++;
|
||||
if(!error_callback(jqxhr, status, error)) spin_again(spin_state);
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown){
|
||||
if(textStatus == "timeout"){
|
||||
if(ajax_timeout < ajax_timeout_max){
|
||||
ajax_timeout += ajax_timeout_step;
|
||||
}
|
||||
not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step);
|
||||
}else{
|
||||
clear_main_area();
|
||||
toastr.clear();
|
||||
toastr.error(
|
||||
"Galaxy encountered an error while attempting to determine the readiness of this interactive environment, contact your administrator.",
|
||||
"Error",
|
||||
{'closeButton': true, 'tapToDismiss': false}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if(bool_response) ajax_params["dataType"] = "json";
|
||||
$.ajax(ajax_params);
|
||||
}
|
||||
window.setTimeout(timeout, timeout_values.time);
|
||||
console.log("Setting up new spinner for " + spin_state.type + " on " + url);
|
||||
spin_state.spinner = spinner;
|
||||
window.setTimeout(spinner, spin_state.sleep);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Spin on a URL forever until there is an acceptable response.
|
||||
* @param {String} url: URL to test response of. Must return a 200 (302->200 is OK).
|
||||
* @param {Boolean} bool_response: If set to `true`, do not stop spinning until the response is `true`. Otherwise, stop
|
||||
* as soon as a successful response is received.
|
||||
*/
|
||||
function spin_until(url, bool_response, messages, success_callback, spin_state){
|
||||
var warn_at = 40; // ~2 mins
|
||||
var message_once = function(message, spin_state){
|
||||
if(spin_state.count == 1){
|
||||
display_spinner();
|
||||
toastr.info(
|
||||
message,
|
||||
null,
|
||||
{'closeButton': true, 'timeOut': 0, 'extendedTimeOut': 0, 'tapToDismiss': false}
|
||||
);
|
||||
}
|
||||
}
|
||||
var wrapped_success = function(data){
|
||||
if(!bool_response || (bool_response && data == true)){
|
||||
console.log(messages["success"]);
|
||||
clear_main_area();
|
||||
toastr.clear();
|
||||
success_callback();
|
||||
}else if(bool_response && data == false){
|
||||
message_once(messages["not_ready"], spin_state);
|
||||
return false; // keep spinning
|
||||
}else{
|
||||
spin_error("Invalid response to " + spin_state.type + " request", messages["invalid_response"], true);
|
||||
}
|
||||
return true; // stop spinning
|
||||
}
|
||||
var timeout_error = function(jqxhr, status, error){
|
||||
message_once(messages["waiting"], spin_state)
|
||||
if(spin_state.count == warn_at){
|
||||
toastr.warning(
|
||||
messages["wait_warn"],
|
||||
"Warning",
|
||||
{'closeButton': true, 'timeOut': 0, 'extendedTimeOut': 0, 'tapToDismiss': false}
|
||||
);
|
||||
}
|
||||
return false; // keep spinning
|
||||
}
|
||||
spin(
|
||||
url,
|
||||
bool_response,
|
||||
wrapped_success,
|
||||
timeout_error,
|
||||
timeout_error,
|
||||
spin_state
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test a boolean (json) response from a URL, and call a callback when done.
|
||||
* http://stackoverflow.com/q/25390206/347368
|
||||
* @param {String} url: URL to test response of. Must return a 200 (302->200 is OK) and either `true` or `false`.
|
||||
* @param {String} callback: function to call once successfully connected.
|
||||
*
|
||||
*/
|
||||
function load_when_ready(url, success_callback){
|
||||
var messages = {
|
||||
success: "Galaxy reports IE container ready, returning",
|
||||
not_ready: "Galaxy is launching a container in which to run this interactive environment. Please wait...",
|
||||
unknown_response: "Galaxy failed to launch a container in which to run this interactive environment, contact a Galaxy administrator.",
|
||||
waiting: "Galaxy is launching a container in which to run this interactive environment. Please wait...",
|
||||
wait_warn: "It is taking an usually long time to start a container. Attempts will continue but you may want to report this condition to a Galaxy administrator if it does not succeed soon.",
|
||||
error: "Galaxy encountered an error while attempting to determine the readiness of this interactive environment's container, contact a Galaxy administrator."
|
||||
}
|
||||
var spin_state = make_spin_state("IE container readiness");
|
||||
spin_until(url, true, messages, success_callback, spin_state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test availability of a URL, and call a callback when done.
|
||||
@@ -101,34 +184,12 @@ function load_when_ready(url, success_callback){
|
||||
*
|
||||
*/
|
||||
function test_ie_availability(url, success_callback){
|
||||
var request_count = 0;
|
||||
display_spinner();
|
||||
interval = setInterval(function(){
|
||||
$.ajax({
|
||||
url: url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
timeout: 500,
|
||||
success: function(){
|
||||
console.log("Connected to IE, returning");
|
||||
clearInterval(interval);
|
||||
success_callback();
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
request_count++;
|
||||
console.log("Availability 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}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
var messages = {
|
||||
success: "IE connection succeeded, returning",
|
||||
waiting: "Interactive environment container is running, attempting to connect to the IE. Please wait...",
|
||||
wait_warn: "It is taking an usually long time to connect to the interactive environment. Attempts will continue but you may want to report this condition to a Galaxy administrator if it does not succeed soon.",
|
||||
error: "An error was encountered while attempting to connect to the interactive environment, contact your administrator."
|
||||
}
|
||||
var spin_state = make_spin_state("IE availability");
|
||||
spin_until(url, false, messages, success_callback, spin_state);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ function load_notebook(password, notebook_login_url, notebook_access_url){
|
||||
// we've successfully connected to the IE.
|
||||
test_ie_availability(notebook_login_url, function(){
|
||||
_handle_notebook_loading(password, notebook_login_url, notebook_access_url);
|
||||
keep_alive();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,34 +49,44 @@ function keep_alive(){
|
||||
* 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}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 30000);
|
||||
var warn_at = 4;
|
||||
var count_max = 60;
|
||||
// we sleep 15 seconds between requests and the default timeout for the Jupyter container is 120 seconds, so start
|
||||
// with a pretty high ajax timeout. sleep starts low because we want to get the warning up pretty quickly
|
||||
var spin_state = make_spin_state("IE keep alive", 8000, 16000, 2000, 5000, 15000, 5000, false);
|
||||
var success = function(){
|
||||
console.log("IE keepalive request succeeded");
|
||||
toastr.clear()
|
||||
if(spin_state.count >= warn_at){
|
||||
toastr.clear();
|
||||
toastr.success(
|
||||
"Interactive environment connection restored",
|
||||
{'closeButton': true, 'timeOut': 5000, 'extendedTimeOut': 2000, 'tapToDismiss': true}
|
||||
);
|
||||
}
|
||||
spin_state.count = 0;
|
||||
spin_state.timeout_count = 0;
|
||||
spin_state.error_count = 0;
|
||||
return false; // keep spinning
|
||||
}
|
||||
var timeout_error = function(jqxhr, status, error){
|
||||
console.log("IE keepalive request failed " + spin_state.count + " time(s) of " + count_max + " max: " + status + ": " + error);
|
||||
if(spin_state.count == warn_at){
|
||||
toastr.warning(
|
||||
"Your browser has been unable to contact the interactive environment for "
|
||||
+ spin_state.count + " consecutive attempts, if you do not reestablish "
|
||||
+ "a connection, your IE container may be terminated.",
|
||||
"Warning",
|
||||
{'closeButton': true, 'timeOut': 0, 'extendedTimeOut': 0, 'tapToDismiss': false}
|
||||
);
|
||||
return false; // keep spinning
|
||||
}else if(spin_state.count >= count_max){
|
||||
spin_error("IE keepalive failure limit reached", "Lost connection to interactive environment, contact your administrator", false);
|
||||
return true; // stop spinning
|
||||
}
|
||||
}
|
||||
console.log("IE keep alive worker starting");
|
||||
spin(notebook_access_url, false, success, timeout_error, timeout_error, spin_state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,12 +58,6 @@ var notebook_login_url = '${ notebook_login_url }';
|
||||
var notebook_access_url = '${ notebook_access_url }';
|
||||
${ ie.plugin_require_config() }
|
||||
|
||||
// Keep container running
|
||||
requirejs(['interactive_environments', 'plugin/jupyter'], function(){
|
||||
keep_alive();
|
||||
});
|
||||
|
||||
|
||||
// Load notebook
|
||||
|
||||
requirejs(['interactive_environments', 'plugin/jupyter'], function(){
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"galaxy.interactive_environments.js","sources":["../src/galaxy.interactive_environments.js"],"names":["append_notebook","url","clear_main_area","$","append","remove","children","display_spinner","galaxy_root","not_ready","timeout","timeout_values","timeout_time_max","timeout_time_step","count","toastr","info","closeButton","tapToDismiss","time","console","log","window","setTimeout","load_when_ready","success_callback","ajax_timeout","ajax_timeout_max","ajax_timeout_step","ajax","xhrFields","withCredentials","type","dataType","success","data","clear","error","jqXHR","textStatus","test_ie_availability","request_count","interval","setInterval","clearInterval","timeOut"],"mappings":"AAIA,QAASA,iBAAgBC,GACrBC,kBACAC,EAAE,SAASC,OAAO,uHAAwHH,EAAK,eAInJ,QAASC,mBACLC,EAAE,YAAYE,SACdF,EAAE,SAASG,WAAWD,SAG1B,QAASE,mBACDJ,EAAE,SAASC,OAAO,0BAA4BI,YAAc,wGAGpE,QAASC,WAAUC,EAASC,EAAgBC,EAAkBC,GAC/B,GAAxBF,EAAeG,QACdP,kBACAQ,OAAOC,KACH,gGACCC,aAAe,EAAMC,cAAgB,KAG9CP,EAAeG,QACZH,EAAeQ,KAAOP,IACrBD,EAAeQ,MAAQN,GAE3BO,QAAQC,IAAI,qBAAuBV,EAAeG,MAAQ,aAAeH,EAAeQ,KAAO,IAAO,KACtGG,OAAOC,WAAWb,EAASC,EAAeQ,MAM9C,QAASK,iBAAgBvB,EAAKwB,GAC1B,GAAIC,GAAe,IACfC,EAAmB,IACnBC,EAAoB,IACpBjB,GAAmBQ,KAAM,IAAML,MAAO,GACtCF,EAAmB,KACnBC,EAAoB,IACpBH,EAAU,WACVP,EAAE0B,MACE5B,IAAKA,EACL6B,WACIC,iBAAiB,GAErBC,KAAM,MACNtB,QAASgB,EACTO,SAAU,OACVC,QAAS,SAASC,GACH,GAARA,GACCf,QAAQC,IAAI,gDACZnB,kBACAa,OAAOqB,QACPX,KACa,GAARU,EACL1B,UAAUC,EAASC,EAAgBC,EAAkBC,IAErDX,kBACAa,OAAOqB,QACPrB,OAAOsB,MACH,gHACA,SACCpB,aAAe,EAAMC,cAAgB,MAIlDmB,MAAO,SAASC,EAAOC,GACF,WAAdA,GACmBZ,EAAfD,IACCA,GAAgBE,GAEpBnB,UAAUC,EAASC,EAAgBC,EAAkBC,KAErDX,kBACAa,OAAOqB,QACPrB,OAAOsB,MACH,uIACA,SACCpB,aAAe,EAAMC,cAAgB,QAM1DI,QAAOC,WAAWb,EAASC,EAAeQ,MAY9C,QAASqB,sBAAqBvC,EAAKwB,GAC/B,GAAIgB,GAAgB,CACpBlC,mBACAmC,SAAWC,YAAY,WACnBxC,EAAE0B,MACE5B,IAAKA,EACL6B,WACIC,iBAAiB,GAErBC,KAAM,MACNtB,QAAS,IACTwB,QAAS,WACLd,QAAQC,IAAI,8BACZuB,cAAcF,UACdjB,KAEJY,MAAO,WACHI,IACArB,QAAQC,IAAI,wBAA0BoB,GACnCA,EAAgB,KACfG,cAAcF,UACdxC,kBACAa,OAAOsB,MACH,sDACA,SACCpB,aAAe,EAAM4B,QAAW,IAAO3B,cAAgB,SAKzE"}
|
||||
{"version":3,"file":"galaxy.interactive_environments.js","sources":["../src/galaxy.interactive_environments.js"],"names":["append_notebook","url","clear_main_area","$","append","remove","children","display_spinner","galaxy_root","make_spin_state","type","ajax_timeout_init","ajax_timeout_max","ajax_timeout_step","sleep_init","sleep_max","sleep_step","log_attempts","s","ajax_timeout","sleep","count","spin_error","console_msg","user_msg","clear","console","log","toastr","error","closeButton","timeOut","extendedTimeOut","tapToDismiss","spin_again","spin_state","window","setTimeout","spinner","spin","bool_response","success_callback","timeout_callback","error_callback","ajax_params","xhrFields","withCredentials","timeout","success","data","status","jqxhr","ajax","spin_until","messages","warn_at","message_once","message","info","wrapped_success","timeout_error","warning","load_when_ready","not_ready","unknown_response","waiting","wait_warn","test_ie_availability"],"mappings":"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"}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":3,"sources":["webpack:///login.bundled.js","webpack:///./galaxy/scripts/apps/login.js"],"names":["webpackJsonp","module","exports","__webpack_require__","Backbone","_","jQuery","$","GalaxyApp","_l","Page","window","app","options","bootstrapped","Galaxy","debug","redirect","encodeURI","show_welcome_with_login","params","param","use_panels","location","href","root","LoginPage","View","extend","initialize","page","this","model","Model","title","setElement","_template","render","prop","welcome_url","login_url","Right","call"],"mappings":"AAAAA,cAAc,IAER,SAASC,EAAQC,EAASC,ICFhC,SAAAC,EAAAC,GAAA,GAAIC,GAASH,EAAS,GAClBI,EAAID,EACJE,EAAYL,EAAS,IAAWK,UAChCC,EAAKN,EAAS,GACdO,EAAOP,EAAS,GAEpBQ,QAAOC,IAAM,SAAcC,EAASC,GAChCH,OAAOI,OAAS,GAAIP,GAAWK,EAASC,GACxCC,OAAOC,MAAO,YACd,IAAIC,GAAWC,UAAWL,EAAQI,SAIlC,KAAKJ,EAAQM,wBAAyB,CAClC,GAAIC,GAASd,EAAOe,OAAQC,WAAa,OAAQL,SAAWA,GAE5D,aADAN,OAAOY,SAASC,KAAOT,OAAOU,KAAO,cAAgBL,GAIzD,GAAIM,GAAYtB,EAASuB,KAAKC,QAC1BC,WAAY,SAAUC,GAClBC,KAAKD,KAAOA,EACZC,KAAKC,MAAQ,GAAI5B,GAAS6B,OAAQC,MAAQzB,EAAI,oBAC9CsB,KAAKI,WAAYJ,KAAKK,cAE1BC,OAAQ,WACJN,KAAKD,KAAKvB,EAAG,gBAAiB+B,KAAM,MAAOzB,EAAQ0B,cAEvDH,UAAY,WACR,GAAII,GAAY3B,EAAQY,KAAO,cAAgBlB,EAAEc,OAASJ,SAAWA,GACrE,OAAO,gBAAkBuB,EAAY,2DAI7CjC,GAAE,WACEQ,OAAOe,KAAO,GAAIpB,GAAKiB,KAAMtB,EAAEuB,OAAQf,GACnC4B,MAAQf,UDQUgB,KAAKxC,EAASC,EAAoB,GAAIA,EAAoB","file":"login.bundled.js","sourcesContent":["webpackJsonp([5],[\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var jQuery = __webpack_require__(1),\n\t $ = jQuery,\n\t GalaxyApp = __webpack_require__(52).GalaxyApp,\n\t _l = __webpack_require__(6),\n\t Page = __webpack_require__(53);\n\t\n\twindow.app = function app(options, bootstrapped) {\n\t window.Galaxy = new GalaxyApp(options, bootstrapped);\n\t Galaxy.debug('login app');\n\t var redirect = encodeURI(options.redirect);\n\t\n\t // TODO: remove iframe for user login (at least) and render login page from here\n\t // then remove this redirect\n\t if (!options.show_welcome_with_login) {\n\t var params = jQuery.param({ use_panels: 'True', redirect: redirect });\n\t window.location.href = Galaxy.root + 'user/login?' + params;\n\t return;\n\t }\n\t\n\t var LoginPage = Backbone.View.extend({\n\t initialize: function (page) {\n\t this.page = page;\n\t this.model = new Backbone.Model({ title: _l('Login required') });\n\t this.setElement(this._template());\n\t },\n\t render: function () {\n\t this.page.$('#galaxy_main').prop('src', options.welcome_url);\n\t },\n\t _template: function () {\n\t var login_url = options.root + 'user/login?' + $.param({ redirect: redirect });\n\t return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n\t }\n\t });\n\t\n\t $(function () {\n\t Galaxy.page = new Page.View(_.extend(options, {\n\t Right: LoginPage\n\t }));\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ }\n]);\n\n\n/** WEBPACK FOOTER **\n ** login.bundled.js\n **/","var jQuery = require( 'jquery' ),\n $ = jQuery,\n GalaxyApp = require( 'galaxy' ).GalaxyApp,\n _l = require( 'utils/localization' ),\n Page = require( 'layout/page' );\n\nwindow.app = function app( options, bootstrapped ){\n window.Galaxy = new GalaxyApp( options, bootstrapped );\n Galaxy.debug( 'login app' );\n var redirect = encodeURI( options.redirect );\n\n // TODO: remove iframe for user login (at least) and render login page from here\n // then remove this redirect\n if( !options.show_welcome_with_login ){\n var params = jQuery.param({ use_panels : 'True', redirect : redirect });\n window.location.href = Galaxy.root + 'user/login?' + params;\n return;\n }\n\n var LoginPage = Backbone.View.extend({\n initialize: function( page ) {\n this.page = page;\n this.model = new Backbone.Model({ title : _l( 'Login required' ) } );\n this.setElement( this._template() );\n },\n render: function() {\n this.page.$( '#galaxy_main' ).prop( 'src', options.welcome_url );\n },\n _template : function() {\n var login_url = options.root + 'user/login?' + $.param( { redirect : redirect } );\n return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n }\n });\n\n $(function(){\n Galaxy.page = new Page.View( _.extend( options, {\n Right : LoginPage\n } ) );\n });\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./galaxy/scripts/apps/login.js\n **/"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack:///login.bundled.js","webpack:///./galaxy/scripts/apps/login.js"],"names":["webpackJsonp","module","exports","__webpack_require__","Backbone","_","jQuery","$","GalaxyApp","_l","Page","window","app","options","bootstrapped","Galaxy","debug","redirect","encodeURI","show_welcome_with_login","params","param","use_panels","location","href","root","LoginPage","View","extend","initialize","page","this","model","Model","title","setElement","_template","render","prop","welcome_url","login_url","Right","call"],"mappings":"AAAAA,cAAc,IAER,SAAUC,EAAQC,EAASC,ICFjC,SAAAC,EAAAC,GAAA,GAAIC,GAASH,EAAS,GAClBI,EAAID,EACJE,EAAYL,EAAS,IAAWK,UAChCC,EAAKN,EAAS,GACdO,EAAOP,EAAS,GAEpBQ,QAAOC,IAAM,SAAcC,EAASC,GAChCH,OAAOI,OAAS,GAAIP,GAAWK,EAASC,GACxCC,OAAOC,MAAO,YACd,IAAIC,GAAWC,UAAWL,EAAQI,SAIlC,KAAKJ,EAAQM,wBAAyB,CAClC,GAAIC,GAASd,EAAOe,OAAQC,WAAa,OAAQL,SAAWA,GAE5D,aADAN,OAAOY,SAASC,KAAOT,OAAOU,KAAO,cAAgBL,GAIzD,GAAIM,GAAYtB,EAASuB,KAAKC,QAC1BC,WAAY,SAAUC,GAClBC,KAAKD,KAAOA,EACZC,KAAKC,MAAQ,GAAI5B,GAAS6B,OAAQC,MAAQzB,EAAI,oBAC9CsB,KAAKI,WAAYJ,KAAKK,cAE1BC,OAAQ,WACJN,KAAKD,KAAKvB,EAAG,gBAAiB+B,KAAM,MAAOzB,EAAQ0B,cAEvDH,UAAY,WACR,GAAII,GAAY3B,EAAQY,KAAO,cAAgBlB,EAAEc,OAASJ,SAAWA,GACrE,OAAO,gBAAkBuB,EAAY,2DAI7CjC,GAAE,WACEQ,OAAOe,KAAO,GAAIpB,GAAKiB,KAAMtB,EAAEuB,OAAQf,GACnC4B,MAAQf,UDQUgB,KAAKxC,EAASC,EAAoB,GAAIA,EAAoB","file":"login.bundled.js","sourcesContent":["webpackJsonp([5],[\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var jQuery = __webpack_require__(1),\n\t $ = jQuery,\n\t GalaxyApp = __webpack_require__(52).GalaxyApp,\n\t _l = __webpack_require__(6),\n\t Page = __webpack_require__(53);\n\t\n\twindow.app = function app(options, bootstrapped) {\n\t window.Galaxy = new GalaxyApp(options, bootstrapped);\n\t Galaxy.debug('login app');\n\t var redirect = encodeURI(options.redirect);\n\t\n\t // TODO: remove iframe for user login (at least) and render login page from here\n\t // then remove this redirect\n\t if (!options.show_welcome_with_login) {\n\t var params = jQuery.param({ use_panels: 'True', redirect: redirect });\n\t window.location.href = Galaxy.root + 'user/login?' + params;\n\t return;\n\t }\n\t\n\t var LoginPage = Backbone.View.extend({\n\t initialize: function (page) {\n\t this.page = page;\n\t this.model = new Backbone.Model({ title: _l('Login required') });\n\t this.setElement(this._template());\n\t },\n\t render: function () {\n\t this.page.$('#galaxy_main').prop('src', options.welcome_url);\n\t },\n\t _template: function () {\n\t var login_url = options.root + 'user/login?' + $.param({ redirect: redirect });\n\t return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n\t }\n\t });\n\t\n\t $(function () {\n\t Galaxy.page = new Page.View(_.extend(options, {\n\t Right: LoginPage\n\t }));\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ })\n]);\n\n\n// WEBPACK FOOTER //\n// login.bundled.js","var jQuery = require( 'jquery' ),\n $ = jQuery,\n GalaxyApp = require( 'galaxy' ).GalaxyApp,\n _l = require( 'utils/localization' ),\n Page = require( 'layout/page' );\n\nwindow.app = function app( options, bootstrapped ){\n window.Galaxy = new GalaxyApp( options, bootstrapped );\n Galaxy.debug( 'login app' );\n var redirect = encodeURI( options.redirect );\n\n // TODO: remove iframe for user login (at least) and render login page from here\n // then remove this redirect\n if( !options.show_welcome_with_login ){\n var params = jQuery.param({ use_panels : 'True', redirect : redirect });\n window.location.href = Galaxy.root + 'user/login?' + params;\n return;\n }\n\n var LoginPage = Backbone.View.extend({\n initialize: function( page ) {\n this.page = page;\n this.model = new Backbone.Model({ title : _l( 'Login required' ) } );\n this.setElement( this._template() );\n },\n render: function() {\n this.page.$( '#galaxy_main' ).prop( 'src', options.welcome_url );\n },\n _template : function() {\n var login_url = options.root + 'user/login?' + $.param( { redirect : redirect } );\n return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n }\n });\n\n $(function(){\n Galaxy.page = new Page.View( _.extend( options, {\n Right : LoginPage\n } ) );\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/login.js"],"sourceRoot":""}
|
||||
@@ -1,2 +1,2 @@
|
||||
function append_notebook(a){clear_main_area(),$("#main").append('<iframe frameBorder="0" seamless="seamless" style="width: 100%; height: 100%; overflow:hidden;" scrolling="no" src="'+a+'"></iframe>')}function clear_main_area(){$("#spinner").remove(),$("#main").children().remove()}function display_spinner(){$("#main").append('<img id="spinner" src="'+galaxy_root+'static/style/largespinner.gif" style="position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;">')}function not_ready(a,b,c,d){0==b.count&&(display_spinner(),toastr.info("Galaxy is launching a container in which to run this interactive environment. Please wait...",{closeButton:!0,tapToDismiss:!1})),b.count++,b.time<c&&(b.time+=d),console.log("Readiness request "+b.count+" sleeping "+b.time/1e3+"s"),window.setTimeout(a,b.time)}function load_when_ready(a,b){var c=500,d=1e4,e=250,f={time:1e3,count:0},g=15e3,h=1e3,i=function(){$.ajax({url:a,xhrFields:{withCredentials:!0},type:"GET",timeout:c,dataType:"json",success:function(a){1==a?(console.log("Galaxy reports IE container ready, returning"),clear_main_area(),toastr.clear(),b()):0==a?not_ready(i,f,g,h):(clear_main_area(),toastr.clear(),toastr.error("Galaxy failed to launch a container in which to run this interactive environment, contact your administrator.","Error",{closeButton:!0,tapToDismiss:!1}))},error:function(a,b){"timeout"==b?(d>c&&(c+=e),not_ready(i,f,g,h)):(clear_main_area(),toastr.clear(),toastr.error("Galaxy encountered an error while attempting to determine the readiness of this interactive environment, contact your administrator.","Error",{closeButton:!0,tapToDismiss:!1}))}})};window.setTimeout(i,f.time)}function test_ie_availability(a,b){var c=0;display_spinner(),interval=setInterval(function(){$.ajax({url:a,xhrFields:{withCredentials:!0},type:"GET",timeout:500,success:function(){console.log("Connected to IE, returning"),clearInterval(interval),b()},error:function(){c++,console.log("Availability request "+c),c>30&&(clearInterval(interval),clear_main_area(),toastr.error("Could not connect to IE, contact your administrator","Error",{closeButton:!0,timeOut:2e4,tapToDismiss:!1}))}})},1e3)}
|
||||
function append_notebook(a){clear_main_area(),$("#main").append('<iframe frameBorder="0" seamless="seamless" style="width: 100%; height: 100%; overflow:hidden;" scrolling="no" src="'+a+'"></iframe>')}function clear_main_area(){$("#spinner").remove(),$("#main").children().remove()}function display_spinner(){$("#main").append('<img id="spinner" src="'+galaxy_root+'static/style/largespinner.gif" style="position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;">')}function make_spin_state(a,b,c,d,e,f,g,h){var i={type:"undefined"!=typeof a?a:"GIE spin",ajax_timeout:"undefined"!=typeof b?b:2e3,ajax_timeout_max:"undefined"!=typeof c?c:16e3,ajax_timeout_step:"undefined"!=typeof d?d:500,sleep:"undefined"!=typeof e?e:500,sleep_max:"undefined"!=typeof f?f:8e3,sleep_step:"undefined"!=typeof g?g:100,log_attempts:"undefined"!=typeof h?h:!0,count:0};return i}function spin_error(a,b,c){console.log(a),c&&clear_main_area(),"string"==typeof b&&(toastr.clear(),toastr.error(b,"Error",{closeButton:!0,timeOut:0,extendedTimeOut:0,tapToDismiss:!1}))}function spin_again(a){a.sleep<a.sleep_max&&(a.sleep+=a.sleep_step),a.log_attempts&&console.log(a.type+" request "+a.count+" request timeout "+a.ajax_timeout+"ms sleeping "+a.sleep/1e3+"s"),window.setTimeout(a.spinner,a.sleep)}function spin(a,b,c,d,e,f){var g=function(){var g={url:a,xhrFields:{withCredentials:!0},type:"GET",timeout:f.ajax_timeout,success:function(a,b,d){c(a,b,d)||spin_again(f)},error:function(a,b,c){"timeout"==b?(f.ajax_timeout<f.ajax_timeout_max&&(f.ajax_timeout+=f.ajax_timeout_step),f.count++,d(a,b,c)||spin_again(f)):(f.count++,e(a,b,c)||spin_again(f))}};b&&(g.dataType="json"),$.ajax(g)};console.log("Setting up new spinner for "+f.type+" on "+a),f.spinner=g,window.setTimeout(g,f.sleep)}function spin_until(a,b,c,d,e){var f=40,g=function(a,b){1==b.count&&(display_spinner(),toastr.info(a,null,{closeButton:!0,timeOut:0,extendedTimeOut:0,tapToDismiss:!1}))},h=function(a){if(!b||b&&1==a)console.log(c.success),clear_main_area(),toastr.clear(),d();else{if(b&&0==a)return g(c.not_ready,e),!1;spin_error("Invalid response to "+e.type+" request",c.invalid_response,!0)}return!0},i=function(){return g(c.waiting,e),e.count==f&&toastr.warning(c.wait_warn,"Warning",{closeButton:!0,timeOut:0,extendedTimeOut:0,tapToDismiss:!1}),!1};spin(a,b,h,i,i,e)}function load_when_ready(a,b){var c={success:"Galaxy reports IE container ready, returning",not_ready:"Galaxy is launching a container in which to run this interactive environment. Please wait...",unknown_response:"Galaxy failed to launch a container in which to run this interactive environment, contact a Galaxy administrator.",waiting:"Galaxy is launching a container in which to run this interactive environment. Please wait...",wait_warn:"It is taking an usually long time to start a container. Attempts will continue but you may want to report this condition to a Galaxy administrator if it does not succeed soon.",error:"Galaxy encountered an error while attempting to determine the readiness of this interactive environment's container, contact a Galaxy administrator."},d=make_spin_state("IE container readiness");spin_until(a,!0,c,b,d)}function test_ie_availability(a,b){var c={success:"IE connection succeeded, returning",waiting:"Interactive environment container is running, attempting to connect to the IE. Please wait...",wait_warn:"It is taking an usually long time to connect to the interactive environment. Attempts will continue but you may want to report this condition to a Galaxy administrator if it does not succeed soon.",error:"An error was encountered while attempting to connect to the interactive environment, contact your administrator."},d=make_spin_state("IE availability");spin_until(a,!1,c,b,d)}
|
||||
//# sourceMappingURL=../maps/galaxy.interactive_environments.js.map
|
||||
Reference in New Issue
Block a user