commit/galaxy-central: 4 new changesets
4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/fc65aae7f9a3/ Changeset: fc65aae7f9a3 User: martenson Date: 2014-01-16 19:37:04 Summary: new packed js Affected #: 2 files diff -r dd0bf9c3d0e42246964c8d65785ece1feec6b98e -r fc65aae7f9a3b4ea5f040558e7408837a1d41c07 static/scripts/packed/mvc/visualization/scatterplotControlForm.js --- /dev/null +++ b/static/scripts/packed/mvc/visualization/scatterplotControlForm.js @@ -0,0 +1,1 @@ +var ScatterplotControlForm=Backbone.View.extend(LoggableMixin).extend({className:"scatterplot-control-form",dataLoadDelay:4000,dataLoadSize:5000,loadingIndicatorImage:"loading_small_white_bg.gif",fetchMsg:"Fetching data...",renderMsg:"Rendering...",initialize:function(a){this.log(this+".initialize, attributes:",a);this.dataset=null;this.chartConfig=null;this.chart=null;this.loader=null;this.$dataControl=null;this.$chartControl=null;this.$statsDisplay=null;this.$chartDisplay=null;this.dataFetch=null;this.initializeFromAttributes(a);this.initializeChart(a);this.initializeDataLoader(a)},initializeFromAttributes:function(a){if(!a||!a.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=a.dataset}if(jQuery.type(this.dataset.metadata_column_types)==="string"){this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ")}this.log("\t dataset:",this.dataset);if(this.dataset.comment_lines&&this.dataset.comment_lines.length){var b=this.dataset.comment_lines[0],c=b.split("\t");if(c.length===this.dataset.metadata_column_types.length){this.possibleHeaders=c}}if(!a.apiDatasetsURL){throw ("ScatterplotView requires a apiDatasetsURL")}else{this.dataURL=a.apiDatasetsURL+"/"+this.dataset.id+"?"}this.log("\t dataURL:",this.dataURL)},initializeChart:function(a){this.chartConfig=a.chartConfig||{};this.log("\t initial chartConfig:",this.chartConfig);this.chart=new TwoVarScatterplot(this.chartConfig);this.chartConfig=this.chart.config},initializeDataLoader:function(b){var a=this;this.loader=new LazyDataLoader({url:null,start:b.start||0,total:b.total||this.dataset.metadata_data_lines,delay:this.dataLoadDelay,size:this.dataLoadSize,buildUrl:function(d,c){return this.url+"&"+jQuery.param({start_val:d,max_vals:c})}});$(this.loader).bind("error",function(e,c,d){a.log("ERROR:",c,d);alert("ERROR fetching data:\n"+c+"\n"+d);a.hideLoadingIndicator()})},render:function(){this.log(this+".render");this.$el.append(ScatterplotControlForm.templates.mainLayout({loadingIndicatorImagePath:galaxy_config.root+"static/images/"+this.loadingIndicatorImage,message:""}));this.$dataControl=this._render_dataControl();this.$chartControl=this._render_chartControl();this.$statsDisplay=this.$el.find(".tab-pane#stats-display");this.$chartDisplay=this._render_chartDisplay();if(this.chartConfig.xColumn&&this.chartConfig.yColumn){this.renderChart()}this.$el.find("[title]").tooltip();return this},_render_dataControl:function(){var b=this,a=[],e=[],c=(this.possibleHeaders&&this.$dataControl)?(this.$dataControl.find("#first-line-header-checkbox").is(":checked")):(false);_.each(this.dataset.metadata_column_types,function(i,g){var h=g+1,f="column "+h;if(b.dataset.metadata_column_names){f=b.dataset.metadata_column_names[g]}else{if(c){f=b.possibleHeaders[g]}}a.push({index:h,name:f});if(i==="int"||i==="float"){e.push({index:h,name:f})}});var d=this.$el.find(".tab-pane#data-control");d.html(ScatterplotControlForm.templates.dataControl({allColumns:a,numericColumns:e,possibleHeaders:(this.possibleHeaders)?(this.possibleHeaders.join(", ")):(""),usePossibleHeaders:c}));if(!this.dataset.metadata_column_names&&this.possibleHeaders){d.find("#first-line-header").show()}d.find("#X-select").val(this.chartConfig.xColumn);d.find("#Y-select").val(this.chartConfig.yColumn);if(this.chartConfig.idColumn!==undefined){d.find("#include-id-checkbox").attr("checked",true).trigger("change");d.find("#ID-select").val(this.chartConfig.idColumn)}return d},_render_chartControl:function(){var a=this,b=this.$el.find(".tab-pane#chart-control"),c={datapointSize:{min:2,max:10,step:1},width:{min:200,max:800,step:20},height:{min:200,max:800,step:20}};b.append(ScatterplotControlForm.templates.chartControl(this.chartConfig));b.find(".numeric-slider-input").each(function(){var f=$(this),e=f.find(".slider-output"),g=f.find(".slider"),h=f.attr("id");function d(){var j=$(this),i=j.slider("value");e.text(i)}g.slider(_.extend(c[h],{value:a.chartConfig[h],change:d,slide:d}))});return b},_render_chartDisplay:function(){var a=this.$el.find(".tab-pane#chart-display");a.append(ScatterplotControlForm.templates.chartDisplay(this.chartConfig));return a},events:{"change #include-id-checkbox":"toggleThirdColumnSelector","change #first-line-header-checkbox":"rerenderDataControl","click #data-control #render-button":"renderChart","click #chart-control #render-button":"changeChartSettings"},toggleThirdColumnSelector:function(){this.$el.find('select[name="ID"]').parent().toggle()},rerenderDataControl:function(){this.$dataControl=this._render_dataControl()},showLoadingIndicator:function(b,c){b=b||"";var a=this.$el.find("div#loading-indicator");messageBox=a.find(".loading-message");if(a.is(":visible")){if(b){messageBox.fadeOut("fast",function(){messageBox.text(b);messageBox.fadeIn("fast",c)})}else{c()}}else{if(b){messageBox.text(b)}a.fadeIn("fast",c)}},hideLoadingIndicator:function(a){this.$el.find("div#loading-indicator").fadeOut("fast",a)},renderChart:function(){this.log(this+".renderChart");this.data=null;this.meta=null;_.extend(this.chartConfig,this.getChartSettings());this.log("\t chartConfig:",this.chartConfig);this.chart.updateConfig(this.chartConfig,false);this.loader.url=this.dataURL+"&"+jQuery.param(this.getDataSettings());this.log("\t loader: total lines:",this.loader.total," url:",this.loader.url);var a=this;$(this.loader).bind("loaded.new",function(c,b){a.log(a+" loaded.new",b);a.postProcessDataFetchResponse(b);a.log("\t postprocessed data:",a.data);a.log("\t postprocessed meta:",a.meta);a.showLoadingIndicator(a.renderMsg,function(){a.chart.render(a.data,a.meta);a.renderStats(a.data,a.meta);a.hideLoadingIndicator()})});$(this.loader).bind("complete",function(b,c){a.log(a+" complete",c);$(a.loader).unbind()});a.showLoadingIndicator(a.fetchMsg,function(){a.$el.find("ul.nav").find('a[href="#chart-display"]').tab("show");a.loader.load()})},renderStats:function(){this.log(this+".renderStats");this.$statsDisplay.html(ScatterplotControlForm.templates.statsDisplay({stats:[{name:"Count",xval:this.meta[0].count,yval:this.meta[1].count},{name:"Min",xval:this.meta[0].min,yval:this.meta[1].min},{name:"Max",xval:this.meta[0].max,yval:this.meta[1].max},{name:"Sum",xval:this.meta[0].sum,yval:this.meta[1].sum},{name:"Mean",xval:this.meta[0].mean,yval:this.meta[1].mean},{name:"Median",xval:this.meta[0].median,yval:this.meta[1].median}]}))},changeChartSettings:function(){var a=this;newChartSettings=this.getChartSettings();_.extend(this.chartConfig,newChartSettings);this.log("this.chartConfig:",this.chartConfig);this.chart.updateConfig(this.chartConfig,false);if(a.data&&a.meta){a.showLoadingIndicator(a.renderMsg,function(){a.$el.find("ul.nav").find('a[href="#chart-display"]').tab("show");a.chart.render(a.data,a.meta);a.hideLoadingIndicator()})}else{this.renderChart()}},postProcessDataFetchResponse:function(a){this.postProcessData(a.data);this.postProcessMeta(a.meta)},postProcessData:function(b){var a=this;if(a.data){_.each(b,function(d,c){a.data[c]=a.data[c].concat(d)})}else{a.data=b}},postProcessMeta:function(c){var a=this,b=this.dataset.metadata_column_types;if(a.meta){_.each(c,function(e,d){var i=a.meta[d],g=b[d];i.count+=(e.count)?(e.count):(0);if((g==="int")||(g==="float")){i.min=Math.min(e.min,i.min);i.max=Math.max(e.max,i.max);i.sum=e.sum+i.sum;i.mean=(i.count)?(i.sum/i.count):(null);var f=a.data[d].slice().sort(),h=Math.floor(f.length/2);if(f.length%2===0){i.median=((f[h]+f[(h+1)])/2)}else{i.median=f[h]}}})}else{a.meta=c}},getDataSettings:function(){var b=this.getColumnSelections(),a=[];this.log("\t columnSelections:",b);a=[b.X.colIndex-1,b.Y.colIndex-1];if(this.$dataControl.find("#include-id-checkbox").attr("checked")){a.push(b.ID.colIndex-1)}var c={data_type:"raw_data",provider:"column_with_stats",columns:"["+a+"]"};this.log("\t data settings (url params):",c);return c},getColumnSelections:function(){var a={};this.$dataControl.find("div.column-select select").each(function(){var b=$(this),c=b.val();a[b.attr("name")]={colIndex:c,colName:b.children('[value="'+c+'"]').text()}});return a},getChartSettings:function(){var c={},d=this.getColumnSelections();c.datapointSize=this.$chartControl.find("#datapointSize.numeric-slider-input").find(".slider").slider("value");c.width=this.$chartControl.find("#width.numeric-slider-input").find(".slider").slider("value");c.height=this.$chartControl.find("#height.numeric-slider-input").find(".slider").slider("value");var b=this.$chartControl.find("input#X-axis-label").val(),a=this.$chartControl.find("input#Y-axis-label").val();c.xLabel=(b==="X")?(d.X.colName):(b);c.yLabel=(a==="Y")?(d.Y.colName):(a);c.animDuration=(this.$chartControl.find("#animate-chart").is(":checked"))?(this.chart.defaults.animDuration):(0);this.log("\t chartSettings:",c);return c},toString:function(){return"ScatterplotControlForm("+((this.dataset)?(this.dataset.id):(""))+")"}});ScatterplotControlForm.templates={mainLayout:Handlebars.templates["template-visualization-scatterplotControlForm"],dataControl:Handlebars.templates["template-visualization-dataControl"],chartControl:Handlebars.templates["template-visualization-chartControl"],statsDisplay:Handlebars.templates["template-visualization-statsDisplay"],chartDisplay:Handlebars.templates["template-visualization-chartDisplay"]}; \ No newline at end of file diff -r dd0bf9c3d0e42246964c8d65785ece1feec6b98e -r fc65aae7f9a3b4ea5f040558e7408837a1d41c07 static/scripts/packed/mvc/visualization/visualization-model.js --- /dev/null +++ b/static/scripts/packed/mvc/visualization/visualization-model.js @@ -0,0 +1,1 @@ +var Visualization=Backbone.Model.extend(LoggableMixin).extend({defaults:{},url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(a){this.log(this+".initialize",a,this.attributes);this._setUpListeners()},_setUpListeners:function(){},setConfig:function(b){var a=this.get("config");if(_.isObject(a)){b=_.extend(_.clone(a),b)}this.set("config",b);return this},toString:function(){var a=this.get("id")||"";if(this.get("title")){a+=":"+this.get("title")}return"Visualization("+a+")"}});var VisualizationCollection=Backbone.Collection.extend(LoggableMixin).extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(b,a){a=a||{}},set:function(c,a){var b=this;c=_.map(c,function(e){var f=b.get(e.id);if(!f){return e}var d=f.toJSON();_.extend(d,e);return d});Backbone.Collection.prototype.set.call(this,c,a)},toString:function(){return(["VisualizationCollection(",[this.historyId,this.length].join(),")"].join(""))}}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/9855cc27c607/ Changeset: 9855cc27c607 User: martenson Date: 2014-01-16 20:08:58 Summary: PEP8 tweaks Affected #: 1 file diff -r fc65aae7f9a3b4ea5f040558e7408837a1d41c07 -r 9855cc27c607c9b3889610660259b17d16f3c0c8 lib/galaxy/webapps/galaxy/api/authenticate.py --- a/lib/galaxy/webapps/galaxy/api/authenticate.py +++ b/lib/galaxy/webapps/galaxy/api/authenticate.py @@ -21,19 +21,24 @@ def get_api_key( self, trans, **kwd ) * GET /api/authenticate/baseauth returns an API key for authenticated user based on BaseAuth headers + + :rtype: dict + :returns: api_key in json format + + :raises: ObjectNotFound, HTTPBadRequest """ email, password = self._decode_baseauth( trans.environ.get( 'HTTP_AUTHORIZATION' ) ) user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email == email ).all() - if (len(user) is not 1): + if ( len( user ) is not 1 ): # DB is inconsistent and we have more users with same email raise ObjectNotFound else: user = user[0] is_valid_user = user.check_password( password ) - if (is_valid_user): + if ( is_valid_user ): user_id = user.id api_key_row = trans.sa_session.query( trans.app.model.APIKeys ).filter( trans.app.model.APIKeys.table.c.user_id == user_id ).first() else: @@ -47,23 +52,23 @@ the form (email, password), and raises a HTTPBadRequest exception if nothing could be decoded. """ - split = encoded_str.strip().split(' ') + split = encoded_str.strip().split( ' ' ) # If split is only one element, try to decode the email and password # directly. - if len(split) == 1: + if len( split ) == 1: try: - email, password = b64decode(split[0]).split(':') + email, password = b64decode( split[ 0 ] ).split( ':' ) except: raise HTTPBadRequest # If there are only two elements, check the first and ensure it says # 'basic' so that we know we're about to decode the right thing. If not, # bail out. - elif len(split) == 2: - if split[0].strip().lower() == 'basic': + elif len( split ) == 2: + if split[ 0 ].strip().lower() == 'basic': try: - email, password = b64decode(split[1]).split(':') + email, password = b64decode( split[ 1 ] ).split( ':' ) except: raise HTTPBadRequest else: @@ -74,4 +79,4 @@ else: raise HTTPBadRequest - return unquote(email), unquote(password) + return unquote( email ), unquote( password ) https://bitbucket.org/galaxy/galaxy-central/commits/1773a15233bb/ Changeset: 1773a15233bb User: martenson Date: 2014-01-16 20:13:15 Summary: Merge Affected #: 4 files diff -r 9855cc27c607c9b3889610660259b17d16f3c0c8 -r 1773a15233bb1424f86481068a386d6e0aeaba9e lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -602,7 +602,11 @@ if check_migrate_tools: # Alert the Galaxy admin to tools that have been moved from the distribution to the tool shed. from tool_shed.galaxy_install.migrate.check import verify_tools - verify_tools( self, install_db_url, config_file, self.config.database_engine_options ) + if combined_install_database: + install_database_options = self.config.database_engine_options + else: + install_database_options = self.config.install_database_engine_options + verify_tools( self, install_db_url, config_file, install_database_options ) from galaxy.model import mapping self.model = mapping.init( self.config.file_path, diff -r 9855cc27c607c9b3889610660259b17d16f3c0c8 -r 1773a15233bb1424f86481068a386d6e0aeaba9e lib/galaxy/webapps/tool_shed/api/repositories.py --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -129,7 +129,7 @@ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, changeset_revision ) - if not repository_metadata: + if repository_metadata is None: # The changeset_revision column in the repository_metadata table has been updated with a new # value value, so find the changeset_revision to which we need to update. repo_dir = repository.repo_path( trans.app ) @@ -139,7 +139,7 @@ encoded_repository_id, new_changeset_revision ) changeset_revision = new_changeset_revision - if repository_metadata: + if repository_metadata is not None: encoded_repository_metadata_id = trans.security.encode_id( repository_metadata.id ) repository_metadata_dict = repository_metadata.to_dict( view='collection', value_mapper=self.__get_value_mapper( trans ) ) @@ -168,7 +168,8 @@ def __get_value_mapper( self, trans ): value_mapper = { 'id' : trans.security.encode_id, - 'repository_id' : trans.security.encode_id } + 'repository_id' : trans.security.encode_id, + 'user_id' : trans.security.encode_id } return value_mapper @web.expose_api diff -r 9855cc27c607c9b3889610660259b17d16f3c0c8 -r 1773a15233bb1424f86481068a386d6e0aeaba9e lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -68,7 +68,8 @@ def __get_value_mapper( self, trans ): value_mapper = { 'id' : trans.security.encode_id, - 'repository_id' : trans.security.encode_id } + 'repository_id' : trans.security.encode_id, + 'user_id' : trans.security.encode_id } return value_mapper @web.expose_api_anonymous @@ -159,15 +160,33 @@ repository_dependency_repository_metadata = \ suc.get_repository_metadata_by_changeset_revision( trans, repository_dependency_id, changeset_revision ) if repository_dependency_repository_metadata is None: - log.debug( 'Cannot locate repository_metadata with id %s for repository dependency %s owned by %s.' % \ - ( str( repository_dependency_id ), str( name ), str( owner ) ) ) - continue + # The changeset_revision column in the repository_metadata table has been updated with a new + # value value, so find the changeset_revision to which we need to update. + repo_dir = repository_dependency.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + new_changeset_revision = suc.get_next_downloadable_changeset_revision( repository_dependency, + repo, + changeset_revision ) + repository_dependency_repository_metadata = \ + suc.get_repository_metadata_by_changeset_revision( trans, + repository_dependency_id, + new_changeset_revision ) + if repository_dependency_repository_metadata is None: + decoded_repository_dependency_id = trans.security.decode_id( repository_dependency_id ) + debug_msg = 'Cannot locate repository_metadata with id %d for repository dependency %s owned by %s ' % \ + ( decoded_repository_dependency_id, str( name ), str( owner ) ) + debug_msg += 'using either of these changeset_revisions: %s, %s.' % \ + ( str( changeset_revision ), str( new_changeset_revision ) ) + log.debug( debug_msg ) + continue + else: + changeset_revision = new_changeset_revision repository_dependency_repository_metadata_id = trans.security.encode_id( repository_dependency_repository_metadata.id ) repository_dependency_dict = repository_dependency.to_dict( view='element', value_mapper=self.__get_value_mapper( trans ) ) # We have to add the changeset_revision of of the repository dependency. repository_dependency_dict[ 'changeset_revision' ] = changeset_revision - repository_dependency_dict[ 'url' ] = web.url_for( controller='repositories', + repository_dependency_dict[ 'url' ] = web.url_for( controller='repository_revisions', action='show', id=repository_dependency_repository_metadata_id ) repository_dependencies_dicts.append( repository_dependency_dict ) diff -r 9855cc27c607c9b3889610660259b17d16f3c0c8 -r 1773a15233bb1424f86481068a386d6e0aeaba9e lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -724,8 +724,8 @@ def get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision ): """ - Return the installable changeset_revision in the repository changelog after the changeset to which after_changeset_revision refers. If there - isn't one, return None. + Return the installable changeset_revision in the repository changelog after the changeset to which + after_changeset_revision refers. If there isn't one, return None. """ changeset_revisions = get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True ) if len( changeset_revisions ) == 1: https://bitbucket.org/galaxy/galaxy-central/commits/2b0aba01ad8d/ Changeset: 2b0aba01ad8d User: martenson Date: 2014-01-17 15:55:27 Summary: Merge Affected #: 19 files diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/app.js --- a/config/plugins/visualizations/charts/static/app.js +++ b/config/plugins/visualizations/charts/static/app.js @@ -1,10 +1,10 @@ // dependencies define(['library/portlet', 'library/ui', 'library/utils', 'views/charts', 'views/viewport', 'views/chart', 'views/group', - 'models/datasets', 'models/chart', 'models/charts', 'models/types'], + 'models/config', 'models/datasets', 'models/chart', 'models/charts', 'models/group', 'models/types'], function( Portlet, Ui, Utils, ChartsView, ViewportView, ChartView, GroupView, - Datasets, Chart, Charts, Types + Config, Datasets, Chart, Charts, Group, Types ) { // widget @@ -19,10 +19,14 @@ // link galaxy this.modal = parent.Galaxy.modal; + // create configuration model + this.config = new Config(); + // create chart models this.types = new Types(); this.chart = new Chart(); this.charts = new Charts(); + this.group = new Group(); // create dataset handler this.datasets = new Datasets(this); diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/models/chart.js --- a/config/plugins/visualizations/charts/static/models/chart.js +++ b/config/plugins/visualizations/charts/static/models/chart.js @@ -22,8 +22,9 @@ // reset reset: function() { - this.clear().set(this.defaults); + this.clear({silent: true}).set(this.defaults); this.groups.reset(); + this.trigger('reset', this); }, // copy diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/models/config.js --- /dev/null +++ b/config/plugins/visualizations/charts/static/models/config.js @@ -0,0 +1,16 @@ +// dependencies +define([], function() { + + +// model +return Backbone.Model.extend( +{ + // options + defaults : { + query_limit : 20, + query_pace : 1000, + query_max : 5 + } +}); + +}); \ No newline at end of file diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/models/group.js --- a/config/plugins/visualizations/charts/static/models/group.js +++ b/config/plugins/visualizations/charts/static/models/group.js @@ -1,23 +1,14 @@ // dependencies -define(['library/utils'], function(Utils) { - +define([], function() { // model return Backbone.Model.extend( { - // defaults - defaults : { - }, - - // initialize - initialize: function(options) - { - }, - // reset reset: function() { - this.clear().set(this.defaults); + this.clear({silent: true}).set(this.defaults); + this.trigger('reset', this); } }); diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/views/chart.js --- a/config/plugins/visualizations/charts/static/views/chart.js +++ b/config/plugins/visualizations/charts/static/views/chart.js @@ -125,6 +125,9 @@ this.chart.on('change:type', function(chart) { self.table.value(chart.get('type')); }); + this.chart.on('reset', function(chart) { + self._resetChart(); + }); // collection events this.app.charts.on('add', function(chart) { @@ -140,23 +143,17 @@ }); // reset - this.reset(); + this._resetChart(); }, // reset - reset: function() { - this.chart.reset(); + _resetChart: function() { this.chart.set('id', Utils.uuid()); this.chart.set('dataset_id', this.app.options.dataset.id); this.chart.set('type', 'bardiagram'); this.chart.set('title', 'Chart title'); }, - // set chart - setChart: function(new_chart) { - this.chart.copy(new_chart); - }, - // create chart _saveChart: function() { // update chart data diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/views/charts.js --- a/config/plugins/visualizations/charts/static/views/charts.js +++ b/config/plugins/visualizations/charts/static/views/charts.js @@ -16,12 +16,12 @@ ondblclick : function(chart_id) { // get chart var chart = self.app.charts.get(chart_id); - + self.app.chart.copy(chart); + // show edit self.$el.hide(); // update model and show create - self.app.chart_view.setChart(chart); self.app.chart_view.$el.show(); }, onchange : function(chart_id) { @@ -41,7 +41,7 @@ tooltip: 'Create', onclick: function() { self.$el.hide(); - self.app.chart_view.reset(); + self.app.chart.reset(); self.app.chart_view.$el.show(); } }), @@ -57,11 +57,11 @@ // get chart var chart = self.app.charts.get(chart_id); + self.app.chart.copy(chart); // show edit self.$el.hide(); self.app.chart_view.$el.show(); - self.app.chart_view.setChart(chart); } }), 'delete' : new Ui.ButtonIcon({ diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/views/group.js --- a/config/plugins/visualizations/charts/static/views/group.js +++ b/config/plugins/visualizations/charts/static/views/group.js @@ -1,13 +1,10 @@ // dependencies -define(['library/portlet', 'library/table', 'library/ui', 'library/utils', 'models/group'], - function(Portlet, Table, Ui, Utils, Group) { +define(['library/portlet', 'library/table', 'library/ui', 'library/utils'], + function(Portlet, Table, Ui, Utils) { // chart config return Backbone.View.extend( { - // model - group: new Group(), - // columns columns: [], @@ -18,6 +15,7 @@ // get current chart object this.chart = this.app.chart; + this.group = this.app.group; // ui elements this.message = new Ui.Message(); @@ -69,6 +67,9 @@ this.group.on('change', function() { self._refreshGroup(); }); + this.group.on('reset', function() { + self._resetGroup(); + }); }, // show @@ -77,8 +78,7 @@ }, // reset - reset: function() { - this.group.reset(); + _resetGroup: function() { this.group.set('id', Utils.uuid()); this.group.set('label', 'Group label'); }, diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae config/plugins/visualizations/charts/static/views/groups.js --- a/config/plugins/visualizations/charts/static/views/groups.js +++ b/config/plugins/visualizations/charts/static/views/groups.js @@ -37,9 +37,9 @@ icon : 'fa-plus', tooltip: 'Create', onclick: function() { + self.app.group.reset(); self.app.chart_view.$el.hide(); self.app.group_view.show(); - self.app.group_view.reset(); } }), 'edit' : new Ui.ButtonIcon({ diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -512,13 +512,14 @@ def before_setting_metadata( self, dataset ): """This function is called on the dataset before metadata is set.""" dataset.clear_associated_files( metadata_safe = True ) - def __new_composite_file( self, name, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, is_binary = False, space_to_tab = False, **kwds ): + def __new_composite_file( self, name, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, is_binary = False, to_posix_lines = True, space_to_tab = False, **kwds ): kwds[ 'name' ] = name kwds[ 'optional' ] = optional kwds[ 'mimetype' ] = mimetype kwds[ 'description' ] = description kwds[ 'substitute_name_with_metadata' ] = substitute_name_with_metadata kwds[ 'is_binary' ] = is_binary + kwds[ 'to_posix_lines' ] = to_posix_lines kwds[ 'space_to_tab' ] = space_to_tab return Bunch( **kwds ) def add_composite_file( self, name, **kwds ): diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/tools/actions/upload_common.py --- a/lib/galaxy/tools/actions/upload_common.py +++ b/lib/galaxy/tools/actions/upload_common.py @@ -332,6 +332,7 @@ is_binary=is_binary, link_data_only=link_data_only, uuid=uuid_str, + to_posix_lines=uploaded_dataset.to_posix_lines, space_to_tab=uploaded_dataset.space_to_tab, in_place=trans.app.config.external_chown_script is None, path=uploaded_dataset.path ) diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -266,6 +266,9 @@ name = context.get( 'NAME', None ) info = context.get( 'INFO', None ) warnings = [] + to_posix_lines = False + if context.get( 'to_posix_lines', None ) not in [ "None", None, False ]: + to_posix_lines = True space_to_tab = False if context.get( 'space_to_tab', None ) not in [ "None", None, False ]: space_to_tab = True @@ -298,6 +301,7 @@ break if file_bunch.path: break + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab return file_bunch, warnings def get_filenames( context ): @@ -307,16 +311,21 @@ ftp_files = context['ftp_files'] name = context.get( 'NAME', None ) info = context.get( 'INFO', None ) + to_posix_lines = False + if context.get( 'to_posix_lines', None ) not in [ "None", None, False ]: + to_posix_lines = True space_to_tab = False if context.get( 'space_to_tab', None ) not in [ "None", None, False ]: space_to_tab = True warnings = [] file_bunch = get_data_file_filename( data_file, override_name = name, override_info = info ) if file_bunch.path: + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab rval.append( file_bunch ) for file_bunch in get_url_paste_urls_or_filename( context, override_name = name, override_info = info ): if file_bunch.path: + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab rval.append( file_bunch ) # look for files uploaded via FTP @@ -390,11 +399,13 @@ #replace sniff here with just creating an empty file temp_name, is_multi_byte = sniff.stream_to_file( StringIO.StringIO( d_type.generate_primary_file( dataset ) ), prefix='upload_auto_primary_file' ) dataset.primary_file = temp_name + dataset.to_posix_lines = True dataset.space_to_tab = False else: file_bunch, warnings = get_one_filename( groups_incoming[ 0 ] ) writable_files_offset = 1 dataset.primary_file = file_bunch.path + dataset.to_posix_lines = file_bunch.to_posix_lines dataset.space_to_tab = file_bunch.space_to_tab dataset.warnings.extend( warnings ) if dataset.primary_file is None:#remove this before finish, this should create an empty dataset diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -524,7 +524,7 @@ results[ 'repository_status' ].append( message ) stop_time = strftime( "%Y-%m-%d %H:%M:%S" ) results[ 'stop_time' ] = stop_time - return json.to_json_string( results, sort_keys=True, indent=4 * ' ' ) + return json.to_json_string( results, sort_keys=True, indent=4 ) @web.expose_api def show( self, trans, id, **kwd ): diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -53,7 +53,7 @@ link_details = util.string_as_bool( kwd.get( 'link_details', False ) ) try: id = urllib.unquote_plus( id ) - tool = self.app.toolbox.tools_by_id.get( id, None ) + tool = self.app.toolbox.get_tool( id ) if not tool: trans.response.status = 404 return { 'error': 'tool not found', 'id': id } diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -129,7 +129,7 @@ webapp.mapper.resource( 'role', 'roles', path_prefix='/api' ) webapp.mapper.resource( 'group', 'groups', path_prefix='/api' ) webapp.mapper.resource_with_deleted( 'quota', 'quotas', path_prefix='/api' ) - webapp.mapper.connect( '/api/tools/{id:.*?}', action='show', controller="tools" ) + webapp.mapper.connect( '/api/tools/{id:.+?}', action='show', controller="tools" ) webapp.mapper.resource( 'tool', 'tools', path_prefix='/api' ) webapp.mapper.resource_with_deleted( 'user', 'users', path_prefix='/api' ) webapp.mapper.resource( 'genome', 'genomes', path_prefix='/api' ) diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/galaxy/webapps/tool_shed/api/repositories.py --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -384,7 +384,7 @@ results = handle_repository( trans, repository, results ) stop_time = strftime( "%Y-%m-%d %H:%M:%S" ) results[ 'stop_time' ] = stop_time - return json.to_json_string( results, sort_keys=True, indent=4 * ' ' ) + return json.to_json_string( results, sort_keys=True, indent=4 ) @web.expose_api def reset_metadata_on_repository( self, trans, payload, **kwd ): @@ -423,7 +423,7 @@ results = handle_repository( trans, start_time, repository ) stop_time = strftime( "%Y-%m-%d %H:%M:%S" ) results[ 'stop_time' ] = stop_time - return json.to_json_string( results, sort_keys=True, indent=4 * ' ' ) + return json.to_json_string( results, sort_keys=True, indent=4 ) @web.expose_api_anonymous def show( self, trans, id, **kwd ): diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -877,8 +877,7 @@ username = trans.user.username clause_list = [] for repository in trans.sa_session.query( trans.model.Repository ) \ - .filter( and_( trans.model.Repository.table.c.deleted == False, - trans.model.Repository.table.c.deprecated == False ) ): + .filter( trans.model.Repository.table.c.deleted == False ): # Always reset metadata on all repositories of type tool_dependency_definition. if repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION: clause_list.append( trans.model.Repository.table.c.id == repository.id ) @@ -905,14 +904,12 @@ else: if order: return trans.sa_session.query( trans.model.Repository ) \ - .filter( and_( trans.model.Repository.table.c.deleted == False, - trans.model.Repository.table.c.deprecated == False ) ) \ + .filter( trans.model.Repository.table.c.deleted == False ) \ .order_by( trans.model.Repository.table.c.name, trans.model.Repository.table.c.user_id ) else: return trans.sa_session.query( trans.model.Repository ) \ - .filter( and_( trans.model.Repository.table.c.deleted == False, - trans.model.Repository.table.c.deprecated == False ) ) + .filter( trans.model.Repository.table.c.deleted == False ) else: # We're in Galaxy. if order: @@ -1599,8 +1596,8 @@ return folder_contents def pretty_print( dict=None ): - if dict: - return json.to_json_string( dict, sort_keys=True, indent=4 * ' ' ) + if dict is not None: + return json.to_json_string( dict, sort_keys=True, indent=4 ) def remove_dir( dir ): """Attempt to remove a directory from disk.""" diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae test/functional/api/test_tools.py --- a/test/functional/api/test_tools.py +++ b/test/functional/api/test_tools.py @@ -33,6 +33,27 @@ create_response = self._post( "tools", data=payload ) self._assert_has_keys( create_response.json(), 'outputs' ) + def test_upload_posix_newline_fixes( self ): + windows_content = "1\t2\t3\r4\t5\t6\r" + posix_content = windows_content.replace("\r", "\n") + result_content = self._upload_and_get_content( windows_content ) + self.assertEquals( result_content, posix_content ) + + def test_upload_disable_posix_fix( self ): + windows_content = "1\t2\t3\r4\t5\t6\r" + result_content = self._upload_and_get_content( windows_content, to_posix_lines=None ) + self.assertEquals( result_content, windows_content ) + + def test_upload_tab_to_space( self ): + table = "1 2 3\n4 5 6\n" + result_content = self._upload_and_get_content( table, space_to_tab="Yes" ) + self.assertEquals( result_content, "1\t2\t3\n4\t5\t6\n" ) + + def test_upload_tab_to_space_off_by_default( self ): + table = "1 2 3\n4 5 6\n" + result_content = self._upload_and_get_content( table ) + self.assertEquals( result_content, table ) + def test_run_cat1( self ): history_id = self._new_history() new_dataset = self._new_dataset( history_id ) @@ -52,6 +73,14 @@ self._assert_has_keys( create_response.json(), 'outputs' ) self._wait_for_history( history_id, assert_ok=True ) + def _upload_and_get_content( self, content, **upload_kwds ): + history_id = self._new_history() + new_dataset = self._new_dataset( history_id, content=content, **upload_kwds ) + self._wait_for_history( history_id, assert_ok=True ) + display_response = self._get( "histories/%s/contents/%s/display" % ( history_id, new_dataset[ "id" ] ) ) + self._assert_status_code_is( display_response, 200 ) + return display_response.content + def _new_dataset( self, history_id, content='TestData123', **kwds ): payload = self._upload_payload( history_id, content, **kwds ) run_response = self._post( "tools", data=payload ) @@ -86,6 +115,10 @@ 'dbkey': dbkey, 'file_type': file_type, } + if "to_posix_lines" in kwds: + upload_params[ "files_0|to_posix_lines"] = kwds[ "to_posix_lines" ] + if "space_to_tab" in kwds: + upload_params[ "files_0|space_to_tab" ] = kwds[ "space_to_tab" ] return self._run_tool_payload( tool_id='upload1', inputs=upload_params, diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae tools/data_source/upload.py --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -264,10 +264,14 @@ if link_data_only == 'copy_files': if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]: in_place = False - if dataset.space_to_tab: - line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place ) - else: - line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place ) + # Convert universal line endings to Posix line endings, but allow the user to turn it off, + # so that is becomes possible to upload gzip, bz2 or zip files with binary data without + # corrupting the content of those files. + if dataset.to_posix_lines: + if dataset.space_to_tab: + line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place ) + else: + line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place ) if dataset.file_type == 'auto': ext = sniff.guess_ext( dataset.path, registry.sniff_order ) else: diff -r 1773a15233bb1424f86481068a386d6e0aeaba9e -r 2b0aba01ad8d5025684c19b33be4a3f1fb5916ae tools/data_source/upload.xml --- a/tools/data_source/upload.xml +++ b/tools/data_source/upload.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<tool name="Upload File" id="upload1" version="1.1.3" workflow_compatible="false"> +<tool name="Upload File" id="upload1" version="1.1.4" workflow_compatible="false"><description> from your computer </description> @@ -38,6 +38,12 @@ </param><param name="url_paste" type="text" area="true" size="5x35" label="URL/Text" help="Here you may specify a list of URLs (one per line) or paste the contents of a file."/><param name="ftp_files" type="ftpfile" label="Files uploaded via FTP"/> + <!-- Change the following parameter from hidden to select to enable + modifying this option via the Web GUI. See Bitbucket pull request + 171 for more information. --> + <param name="to_posix_lines" type="hidden" display="checkboxes" multiple="True" label="Convert universal line endings to Posix line endings" help="Turn this option off if you upload a gzip, bz2 or zip archive which contains a binary file." value="Yes"> + <option value="Yes" selected="true">Yes</option> + </param><param name="space_to_tab" type="select" display="checkboxes" multiple="True" label="Convert spaces to tabs" help="Use this option if you are entering intervals by hand."><option value="Yes">Yes</option></param> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org