Skip to content

Commit

Permalink
Raven: fix import in galaxy.panels.mako
Browse files Browse the repository at this point in the history
Raven now uses a UMD and checks for requirejs removing it from globals
if found. This adds a require import to load Raven.
  • Loading branch information
carlfeberhard committed Jun 2, 2016
1 parent 25a26d8 commit d458906
Showing 1 changed file with 40 additions and 51 deletions.
91 changes: 40 additions & 51 deletions templates/webapps/galaxy/galaxy.panels.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%namespace name="masthead" file="/webapps/galaxy/galaxy.masthead.mako"/>
<%namespace name="galaxy_client" file="/galaxy_client_app.mako" />

<!DOCTYPE HTML>
<!DOCTYPE html>

## inject parameters parsed by controller config dictionary
<%
Expand All @@ -26,10 +26,10 @@
%>

<%def name="stylesheets()">
## load default style
${h.css("base")}
## load default style
${h.css("base")}
## modify default style
## modify default style
<style type="text/css">
#center {
%if not self.galaxy_config['left_panel']:
Expand Down Expand Up @@ -62,38 +62,14 @@
'libs/require',
)}
## send errors to Sntry server if configured
%if app.config.sentry_dsn:
${h.js( "libs/tracekit", "libs/raven" )}
<script>
Raven.config('${app.config.sentry_dsn_public}').install();
%if trans.user:
Raven.setUser( { email: "${trans.user.email|h}" } );
%endif
</script>
%endif
## make sure console exists
<script type="text/javascript">
// console protection
window.console = window.console ||
{
log : function(){},
debug : function(){},
info : function(){},
warn : function(){},
error : function(){},
assert : function(){}
};
</script>
## default script wrapper
<script type="text/javascript">
## configure require
// configure require
// due to our using both script tags and require, we need to access the same jq in both for plugin retention
define( 'jquery', [], function(){ return jQuery; })
require.config({
baseUrl: "${h.url_for('/static/scripts') }",
baseUrl: "${h.url_for('/static/scripts')}",
// cache buster based on templated server (re)start time
urlArgs: 'v=${app.server_starttime}',
shim: {
"libs/underscore": { exports: "_" },
"libs/backbone": {
Expand All @@ -102,11 +78,31 @@
},
"libs/d3": { exports: "d3" },
},
// cache buster based on templated server (re)start time
urlArgs: 'v=${app.server_starttime}'
});
var galaxy_config = ${ h.dumps( self.galaxy_config ) };
// send errors to Sentry server if configured
%if app.config.sentry_dsn:
require([ 'libs/raven' ], function( Raven ){
Raven.config( '${app.config.sentry_dsn_public}' ).install();
%if trans.user:
Raven.setUser({ email: "${trans.user.email|h}" });
%endif
});
%endif
// console protection
// TODO: Only needed for IE <9 which I believe we dropped
window.console = window.console || {
log : function(){},
debug : function(){},
info : function(){},
warn : function(){},
error : function(){},
assert : function(){}
};
// extra configuration global
var galaxy_config = ${ h.dumps( self.galaxy_config ) };
</script>
</%def>
Expand All @@ -124,19 +120,13 @@
});
});
} else {
console.log("'galaxy_config.app.jscript' missing.");
console.error("'galaxy_config.app.jscript' missing.");
}
});
</script>
## load the Galaxy global js var and run 'app' from above
${ galaxy_client.load( app='app' ) }
## alternate call where the module calls itself when included (no call to GalaxyApp()) - the above won't be needed
##precondition: module must call jq onready itself
##${ galaxy_client.load( app=( app_config[ 'jscript' ] if 'jscript' in app_config else None )) }
##TODO: at that point, we can think about optimizing the various apps
</%def>
## default late-load javascripts
Expand All @@ -162,18 +152,17 @@
## document
<html>
<head>
<title>
%if self.galaxy_config['title']:
${self.galaxy_config['title']}
%endif
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="UTF-8">
## for mobile browsers, don't scale up
<meta name = "viewport" content = "maximum-scale=1.0">
## force IE to standards mode, and prefer Google Chrome Frame if the user has already installed it
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">
<title>
%if self.galaxy_config['title']:
${self.galaxy_config['title']}
%endif
</title>
${self.stylesheets()}
${self.javascripts()}
Expand Down

0 comments on commit d458906

Please sign in to comment.