diff --git a/gemma-web/src/main/webapp/scripts/api/entities/experiment/ExpressionExperimentPage.js b/gemma-web/src/main/webapp/scripts/api/entities/experiment/ExpressionExperimentPage.js index 18431b42bb..83dab82091 100755 --- a/gemma-web/src/main/webapp/scripts/api/entities/experiment/ExpressionExperimentPage.js +++ b/gemma-web/src/main/webapp/scripts/api/entities/experiment/ExpressionExperimentPage.js @@ -48,6 +48,25 @@ Gemma.ExpressionExperimentPage = Ext.extend( Ext.TabPanel, { } }, + checkData: function( eeId, geneList, callback ){ + // checks to see if a dataset has expression data to prevent the relevant tabs from + // being shown + var store = new Gemma.VisualizationStore() + store.on( 'exception', function( e,type, action, options, response, arg ){ + Ext.callback(callback,this,[false]) + }) + + store.load({ + params: [ [ eeId ], geneList || [] ], + callback: function (records, options, success) { + var hasData = !!(success && records && records.length > 0); + callback(hasData); + }, + scope: this + }); + + }, + /** * @memberOf Gemma.ExpressionExperimentPage */ @@ -148,12 +167,18 @@ Gemma.ExpressionExperimentPage = Ext.extend( Ext.TabPanel, { // EXPERIMENT DESIGN TAB this.add( this.makeDesignTab( experimentDetails ) ); + this.checkData(experimentDetails.id,[],function(hasData){ + if(hasData){ + // VISUALISATION TAB + this.add( this.makeVisualisationTab( experimentDetails, isAdmin ) ); + + // DIAGNOSTICS TAB + this.add( this.makeDiagnosticsTab( experimentDetails, isAdmin ) ); + } + }.createDelegate(this)) + - // VISUALISATION TAB - this.add( this.makeVisualisationTab( experimentDetails, isAdmin ) ); - // DIAGNOSTICS TAB - this.add( this.makeDiagnosticsTab( experimentDetails, isAdmin ) ); this.adjustForIsAdmin( isAdmin, this.editable ); @@ -208,6 +233,8 @@ Gemma.ExpressionExperimentPage = Ext.extend( Ext.TabPanel, { }; }, + + makeVisualisationTab : function( experimentDetails, isAdmin ) { var eeId = this.eeId; var title = "Data for a 'random' sampling of probes"; diff --git a/gemma-web/src/main/webapp/scripts/api/visualization/VisualizationWidget.js b/gemma-web/src/main/webapp/scripts/api/visualization/VisualizationWidget.js index e6b1edde14..6e6262d970 100755 --- a/gemma-web/src/main/webapp/scripts/api/visualization/VisualizationWidget.js +++ b/gemma-web/src/main/webapp/scripts/api/visualization/VisualizationWidget.js @@ -1199,7 +1199,7 @@ Gemma.VisualizationStore = function( config ) { }, this.record ); Gemma.VisualizationStore.superclass.constructor.call( this, config ); - + this.relayEvents( this.proxy, [ 'loadexception' ] ); }; @@ -1210,7 +1210,14 @@ Gemma.VisualizationStore = function( config ) { * @extends Ext.data.Store */ -Ext.extend( Gemma.VisualizationStore, Ext.data.Store, {} ); +Ext.extend( Gemma.VisualizationStore, Ext.data.Store, { + loadRecords: function(o, options,success){ + if (!o.records){ + o.records = [] + } + return Gemma.VisualizationStore.superclass.loadRecords.call(this,o, options, success) + } +} ); // //////////////////////////////////////////////////////////////////////////////////