(a) Fetch sample names before drawing variant track and (b) update dataset metadata when changed.

This commit is contained in:
Jeremy Goecks
2013-04-20 15:04:07 -04:00
parent f8235dae3b
commit ccd888511b
2 changed files with 19 additions and 2 deletions
+10 -2
View File
@@ -20,8 +20,15 @@ var Dataset = Backbone.RelationalModel.extend({
},
initialize: function() {
// -- Create and initialize metadata. --
// Set metadata.
// FIXME: pass back a metadata dict and then Backbone-relational
// can be used unpack metadata automatically.
this._set_metadata();
// Update metadata on change.
this.on('change', this._set_metadata, this);
},
_set_metadata: function() {
var metadata = new DatasetMetadata();
// Move metadata from dataset attributes to metadata object.
@@ -34,7 +41,8 @@ var Dataset = Backbone.RelationalModel.extend({
}
}, this);
this.set('metadata', metadata);
// Because this is an internal change, silence it.
this.set('metadata', metadata, { 'silent': true });
},
/**
+9
View File
@@ -4262,6 +4262,15 @@ extend(VariantTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
this.max_height_px = 0;
},
/**
* Additional initialization required before drawing track for the first time.
*/
predraw_init: function() {
if (!this.dataset.get_metadata('sample_names')) {
return this.dataset.fetch();
}
},
/**
* Actions to be taken after draw has been completed. Draw is completed when all tiles have been
* drawn/fetched and shown.