Skip to content

Commit

Permalink
Remove global config dictionary, use Galaxy instead
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 22, 2016
1 parent 3e00f7a commit fdad129
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
Expand Up @@ -21,7 +21,7 @@ define( [ 'utils/utils' ], function( Utils ) {

// Fetch data columns into dataset object
Utils.get({
url : config.root + 'api/datasets/' + options.id,
url : Galaxy.root + 'api/datasets/' + options.id,
data : {
data_type : 'raw_data',
provider : 'dataset-column',
Expand Down
Expand Up @@ -36,7 +36,7 @@ define( [ 'utils/utils' ], function( Utils ) {
chart.state( 'wait', 'Sending job request...' );
Utils.request({
type : 'POST',
url : config.root + 'api/tools',
url : Galaxy.root + 'api/tools',
data : {
'tool_id' : 'charts',
'inputs' : {
Expand Down Expand Up @@ -82,7 +82,7 @@ define( [ 'utils/utils' ], function( Utils ) {
if (previous != '') {
Utils.request({
type : 'PUT',
url : config.root + 'api/histories/none/contents/' + previous,
url : Galaxy.root + 'api/histories/none/contents/' + previous,
data : { deleted: true },
success : function() { refreshHdas() }
});
Expand All @@ -95,7 +95,7 @@ define( [ 'utils/utils' ], function( Utils ) {
var self = this;
Utils.request({
type : 'GET',
url : config.root + 'api/datasets/' + chart.get( 'dataset_id_job' ),
url : Galaxy.root + 'api/datasets/' + chart.get( 'dataset_id_job' ),
data : {},
success : function( dataset ) {
var ready = false;
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/charts/static/views/types.js
Expand Up @@ -98,7 +98,7 @@ define( [ 'utils/utils', 'mvc/ui/ui-misc', 'plugin/charts/overview' ], function(
$el.append( this._template_item({
id : id,
title : title,
url : config.app_root + 'charts/' + this.app.chartPath( id ) + '/logo.png'
url : app_root + 'charts/' + this.app.chartPath( id ) + '/logo.png'
}));
}
this.$el.append( $el );
Expand Down
27 changes: 5 additions & 22 deletions config/plugins/visualizations/charts/templates/charts.mako
Expand Up @@ -47,21 +47,13 @@

<body>
<script type="text/javascript">
// get configuration
var config = {
root : '${root}',
app_root : '${app_root}'
};
// link galaxy
var app_root = '${app_root}';
var Galaxy = Galaxy || parent.Galaxy || {
root : '${root}',
emit : {
debug: function() {}
}
};
// console protection
window.console = window.console || {
log : function(){},
debug : function(){},
Expand All @@ -70,10 +62,8 @@
error : function(){},
assert : function(){}
};
// configure require
require.config({
baseUrl: config.root + "static/scripts/",
baseUrl: Galaxy.root + "static/scripts/",
paths: {
"plugin" : "${app_root}",
"d3" : "libs/d3"
Expand All @@ -88,22 +78,15 @@
window.onbeforeunload = function() {
return 'You are leaving Charts.';
};
// application
var app = null;
$(function() {
// request application script
require(['plugin/app'], function(App) {
// load options
require( [ 'plugin/app' ], function( App ) {
var options = {
id : ${h.dumps( visualization_id )} || undefined,
config : ${h.dumps( config )}
}
// create application
app = new App(options);
// add to body
$('body').append(app.$el);
app = new App( options );
$( 'body' ).append( app.$el );
});
});
Expand Down

0 comments on commit fdad129

Please sign in to comment.