commit/galaxy-central: 2 new changesets

2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/381c547b681a/ Changeset: 381c547b681a Branch: next-stable User: carlfeberhard Date: 2014-09-24 17:54:04+00:00 Summary: Fix to 83aaac5: copy changes into client/ Affected #: 3 files diff -r 83aaac537783198aa18da52e0bccc31018ef968a -r 381c547b681aa09fccab1b03963377115d9d7cc4 client/galaxy/scripts/galaxy.frame.js --- a/client/galaxy/scripts/galaxy.frame.js +++ b/client/galaxy/scripts/galaxy.frame.js @@ -73,8 +73,59 @@ }); this._refresh(); }, + + /** + * Add a dataset to the frames. + */ + add_dataset: function(dataset_id) { + var self = this; + require(['mvc/data'], function(DATA) { + var dataset = new DATA.Dataset({ id: dataset_id }); + $.when( dataset.fetch() ).then( function() { + // Construct frame config based on dataset's type. + var frame_config = { + title: dataset.get('name') + }, + // HACK: For now, assume 'tabular' and 'interval' are the only + // modules that contain tabular files. This needs to be replaced + // will a is_datatype() function. + is_tabular = _.find(['tabular', 'interval'], function(data_type) { + return dataset.get('data_type').indexOf(data_type) !== -1; + }); + + // Use tabular chunked display if dataset is tabular; otherwise load via URL. + if (is_tabular) { + var tabular_dataset = new DATA.TabularDataset(dataset.toJSON()); + _.extend(frame_config, { + type: 'other', + content: function( parent_elt ) { + DATA.createTabularDatasetChunkedView({ + model: tabular_dataset, + parent_elt: parent_elt, + embedded: true, + height: '100%' + }); + } + }); + } + else { + _.extend(frame_config, { + type: 'url', + content: galaxy_config.root + 'datasets/' + + dataset.id + '/display/?preview=True' + }); + } + + self.add(frame_config); + + }); + }); + + }, - // adds and displays a new frame/window + /** + * Add and display a new frame/window based on options. + */ add: function(options) { // open new tab diff -r 83aaac537783198aa18da52e0bccc31018ef968a -r 381c547b681aa09fccab1b03963377115d9d7cc4 client/galaxy/scripts/mvc/data.js --- a/client/galaxy/scripts/mvc/data.js +++ b/client/galaxy/scripts/mvc/data.js @@ -20,7 +20,11 @@ }, initialize: function() { - this._set_metadata(); + // Metadata can be passed in as a model or a set of attributes; if it's + // already a model, there's no need to set metadata. + if (!this.get('metadata')) { + this._set_metadata(); + } // Update metadata on change. this.on('change', this._set_metadata, this); diff -r 83aaac537783198aa18da52e0bccc31018ef968a -r 381c547b681aa09fccab1b03963377115d9d7cc4 client/galaxy/scripts/mvc/dataset/dataset-li.js --- a/client/galaxy/scripts/mvc/dataset/dataset-li.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li.js @@ -161,24 +161,8 @@ var self = this; displayBtnData.onclick = function( ev ){ if( Galaxy.frame && Galaxy.frame.active ){ - // Create frame with TabularChunkedView. - Galaxy.frame.add({ - title : "Data Viewer: " + self.model.get( 'name' ), - type : "other", - content : function( parent_elt ){ - require(['mvc/data'], function(DATA) { - var new_dataset = new DATA.TabularDataset({ id: self.model.get( 'id' ) }); - $.when( new_dataset.fetch() ).then( function(){ - DATA.createTabularDatasetChunkedView({ - model: new_dataset, - parent_elt: parent_elt, - embedded: true, - height: '100%' - }); - }); - }); - } - }); + // Add dataset to frames. + Galaxy.frame.add_dataset(self.model.get('id')); ev.preventDefault(); } }; https://bitbucket.org/galaxy/galaxy-central/commits/7d53a4a090a4/ Changeset: 7d53a4a090a4 User: carlfeberhard Date: 2014-09-24 17:54:22+00:00 Summary: Merge default Affected #: 3 files diff -r 5808dd487257734f138833d5eed4d6a2d7e42f30 -r 7d53a4a090a4b17ea46a256b4dc16712297d48ec client/galaxy/scripts/galaxy.frame.js --- a/client/galaxy/scripts/galaxy.frame.js +++ b/client/galaxy/scripts/galaxy.frame.js @@ -73,8 +73,59 @@ }); this._refresh(); }, + + /** + * Add a dataset to the frames. + */ + add_dataset: function(dataset_id) { + var self = this; + require(['mvc/data'], function(DATA) { + var dataset = new DATA.Dataset({ id: dataset_id }); + $.when( dataset.fetch() ).then( function() { + // Construct frame config based on dataset's type. + var frame_config = { + title: dataset.get('name') + }, + // HACK: For now, assume 'tabular' and 'interval' are the only + // modules that contain tabular files. This needs to be replaced + // will a is_datatype() function. + is_tabular = _.find(['tabular', 'interval'], function(data_type) { + return dataset.get('data_type').indexOf(data_type) !== -1; + }); + + // Use tabular chunked display if dataset is tabular; otherwise load via URL. + if (is_tabular) { + var tabular_dataset = new DATA.TabularDataset(dataset.toJSON()); + _.extend(frame_config, { + type: 'other', + content: function( parent_elt ) { + DATA.createTabularDatasetChunkedView({ + model: tabular_dataset, + parent_elt: parent_elt, + embedded: true, + height: '100%' + }); + } + }); + } + else { + _.extend(frame_config, { + type: 'url', + content: galaxy_config.root + 'datasets/' + + dataset.id + '/display/?preview=True' + }); + } + + self.add(frame_config); + + }); + }); + + }, - // adds and displays a new frame/window + /** + * Add and display a new frame/window based on options. + */ add: function(options) { // open new tab diff -r 5808dd487257734f138833d5eed4d6a2d7e42f30 -r 7d53a4a090a4b17ea46a256b4dc16712297d48ec client/galaxy/scripts/mvc/data.js --- a/client/galaxy/scripts/mvc/data.js +++ b/client/galaxy/scripts/mvc/data.js @@ -20,7 +20,11 @@ }, initialize: function() { - this._set_metadata(); + // Metadata can be passed in as a model or a set of attributes; if it's + // already a model, there's no need to set metadata. + if (!this.get('metadata')) { + this._set_metadata(); + } // Update metadata on change. this.on('change', this._set_metadata, this); diff -r 5808dd487257734f138833d5eed4d6a2d7e42f30 -r 7d53a4a090a4b17ea46a256b4dc16712297d48ec client/galaxy/scripts/mvc/dataset/dataset-li.js --- a/client/galaxy/scripts/mvc/dataset/dataset-li.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li.js @@ -161,24 +161,8 @@ var self = this; displayBtnData.onclick = function( ev ){ if( Galaxy.frame && Galaxy.frame.active ){ - // Create frame with TabularChunkedView. - Galaxy.frame.add({ - title : "Data Viewer: " + self.model.get( 'name' ), - type : "other", - content : function( parent_elt ){ - require(['mvc/data'], function(DATA) { - var new_dataset = new DATA.TabularDataset({ id: self.model.get( 'id' ) }); - $.when( new_dataset.fetch() ).then( function(){ - DATA.createTabularDatasetChunkedView({ - model: new_dataset, - parent_elt: parent_elt, - embedded: true, - height: '100%' - }); - }); - }); - } - }); + // Add dataset to frames. + Galaxy.frame.add_dataset(self.model.get('id')); ev.preventDefault(); } }; 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