1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a76e32124ad8/
changeset: a76e32124ad8
user: jgoecks
date: 2011-09-19 22:07:53
summary: Trackster: (a) remove child tracks, which are replaced with track groups and
(b) preserve and restore track ordering, which was broken in 732ad7ebde0c.
affected #: 5 files (-1 bytes)
--- a/lib/galaxy/web/base/controller.py Mon Sep 19 11:59:09 2011 -0400
+++ b/lib/galaxy/web/base/controller.py Mon Sep 19 16:07:53 2011 -0400
@@ -195,8 +195,7 @@
"dataset_id": trans.security.encode_id( dataset.id ),
"prefs": prefs,
"filters": track_data_provider.get_filters(),
- "tool": get_tool_def( trans, dataset ),
- "is_child": t.get('is_child', False)
+ "tool": get_tool_def( trans, dataset )
} )
config = { "title": visualization.title, "vis_id":
trans.security.encode_id( visualization.id ),
--- a/lib/galaxy/web/controllers/tracks.py Mon Sep 19 11:59:09 2011 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Mon Sep 19 16:07:53 2011 -0400
@@ -573,8 +573,7 @@
"hda_ldda": track.get('hda_ldda',
"hda"),
"name": track['name'],
"track_type": track['track_type'],
- "prefs": track['prefs'],
- "is_child": track.get('is_child',
False)
+ "prefs": track['prefs']
} )
bookmarks = decoded_payload[ 'bookmarks' ]
vis_rev.config = { "tracks": tracks, "bookmarks": bookmarks
}
--- a/static/scripts/trackster.js Mon Sep 19 11:59:09 2011 -0400
+++ b/static/scripts/trackster.js Mon Sep 19 16:07:53 2011 -0400
@@ -723,6 +723,22 @@
$(window).trigger("resize");
this.update_intro_div();
},
+ /** JSONify view. */
+ to_json: function() {
+ var
+ view = this,
+ jsonified_drawables = [];
+ this.viewport_container.children(".track,.group").each(function() {
+ // Get object ID.
+ var id = $(this).attr("id");
+ id = parseInt( id.slice(id.lastIndexOf("_") + 1) );
+
+ // JSONify drawable.
+ jsonified_drawables.push(view.tracks[id].to_json());
+ });
+
+ return jsonified_drawables;
+ },
/** Show or hide intro div depending on view state. */
update_intro_div: function() {
if (this.num_tracks === 0) {
@@ -2030,35 +2046,8 @@
this.tool = (tool_dict !== undefined && obj_length(tool_dict) > 0 ? new
Tool(this, tool_dict) : undefined);
this.is_overview = false;
- //
- // TODO: Right now there is only the notion of a parent track and multiple child
tracks. However,
- // a more general notion of a 'track group' is probably needed and can be
easily created using
- // the code already in place for parent/child tracks. The view would then manage
track groups, and
- // each track group could be managed on its own.
- //
- this.parent_track = parent_track;
- this.child_tracks = [];
-
if (track.hidden) { return; }
-
- //
- // If track has parent:
- // -replace drag handle with child-track icon button; (TODO: eventually, we'll
want to be able
- // to make a set of child tracks dragable.)
- // -remove tool b/c child tracks cannot have tools.
- //
- if (this.parent_track) {
-
this.header_div.find(".draghandle").removeClass('draghandle').addClass('child-track-icon').addClass('icon-button');
- this.parent_element.addClass("child-track");
- this.tool = undefined;
- }
-
- //
- // Child tracks container setup.
- //
- track.child_tracks_container =
$("<div/>").addClass("child-tracks-container").hide();
- track.container_div.append(track.child_tracks_container);
-
+
//
// Create filters div.
//
@@ -2103,6 +2092,18 @@
};
extend(TiledTrack.prototype, Track.prototype, {
/**
+ * Convert track to JSON object.
+ */
+ to_json: function() {
+ return {
+ "track_type": this.get_type(),
+ "name": this.name,
+ "hda_ldda": this.hda_ldda,
+ "dataset_id": this.dataset_id,
+ "prefs": this.prefs
+ };
+ },
+ /**
* Change track's mode.
*/
change_mode: function(name) {
@@ -2208,19 +2209,10 @@
//
// Remove option.
//
-
- // Need to either remove track from view or from parent.
- var parent_obj = view;
- var no_tracks_fn = function() { $("#no-tracks").show(); };
- if (this.parent_track) {
- // Track is child track.
- parent_obj = this.parent_track;
- no_tracks_fn = function() {};
- }
track_dropdown.Remove = function() {
- parent_obj.remove_track(track);
+ view.remove_track(track);
if (parent_obj.num_tracks === 0) {
- no_tracks_fn();
+ $("#no-tracks").show();
}
};
@@ -2331,10 +2323,6 @@
if (all_tiles_drawn) {
track.postdraw_actions(drawn_tiles, width, w_scale, clear_after);
}
- // Draw child tracks.
- for (var i = 0; i < this.child_tracks.length; i++) {
- this.child_tracks[i].request_draw(force, clear_after);
- }
},
/**
* Actions to be taken after draw has been completed. Draw is completed when all
tiles have been
@@ -2511,26 +2499,6 @@
region = (chrom !== undefined && low !== undefined && high
!== undefined ?
chrom + ":" + low + "-" + high :
"all");
return " - region=[" + region + "], parameters=[" +
track.tool.get_param_values().join(", ") + "]";
- },
- /**
- * Add a child track to this track.
- */
- add_track: function(child_track) {
- child_track.track_id = this.track_id + "_" + this.child_tracks.length;
- child_track.container_div.attr('id', 'track_' +
child_track.track_id);
- this.child_tracks_container.append(child_track.container_div);
- moveable( child_track.container_div, '.child-track-icon' );
- if (!$(this.child_tracks_container).is(":visible")) {
- this.child_tracks_container.show();
- }
- this.child_tracks.push(child_track);
- this.view.has_changes = true;
- },
- /**
- * Remove a child track from this track.
- */
- remove_track: function(child_track) {
- child_track.container_div.fadeOut('slow', function() { $(this).remove();
});
}
});
--- a/static/scripts/trackster_ui.js Mon Sep 19 11:59:09 2011 -0400
+++ b/static/scripts/trackster_ui.js Mon Sep 19 16:07:53 2011 -0400
@@ -39,8 +39,7 @@
var track_from_dict = function(track_dict) {
return new addable_track_types[track_dict.track_type](
track_dict.name, view, track_dict.hda_ldda,
track_dict.dataset_id,
- track_dict.prefs, track_dict.filters, track_dict.tool
- /* TODO: ( track_dict.is_child ? parent_track : undefined */ );
+ track_dict.prefs, track_dict.filters, track_dict.tool);
};
/**
@@ -57,7 +56,6 @@
var track_config, track, parent_track, parent_obj;
for (var i = 0; i < tracks_config.length; i++) {
track_config = tracks_config[i];
- // TODO: set parent for child track:
track = track_from_dict(track_config);
parent_obj = view;
if (track_config.is_child) {
--- a/templates/tracks/browser.mako Mon Sep 19 11:59:09 2011 -0400
+++ b/templates/tracks/browser.mako Mon Sep 19 16:07:53 2011 -0400
@@ -205,24 +205,8 @@
// Show saving dialog box
show_modal("Saving...", "<img
src='${h.url_for('/static/images/yui/rel_interstitial_loading.gif')}'/>");
- // TODO: make save into its own function.
-
// Save tracks.
- var saved_tracks = [], tracks;
- for (var i = 0; i < view.tracks.length; i++) {
- track = view.tracks[i];
-
- // Add track.
- saved_tracks.push({
- "track_type": track.get_type(),
- "name": track.name,
- "hda_ldda": track.hda_ldda,
- "dataset_id": track.dataset_id,
- "prefs": track.prefs,
- // TODO: remove parent-child relationships in favor of a
group.
- "is_child": false
- });
- };
+ var saved_tracks = view.to_json();
// Save bookmarks.
var bookmarks = [];
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.