mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Corrections to search and order change in history/view_multiple
- Load initial histories using ajax instead of bootstrapping. - Fix rendering after order change. - Fix 'none found' message when searching datasets. - Correct fetch filters when including deleted histories.
This commit is contained in:
@@ -115,6 +115,12 @@ var ControlledFetchCollection = Backbone.Collection.extend({
|
||||
return filterMap;
|
||||
},
|
||||
|
||||
/** override to reset allFetched flag to false */
|
||||
reset : function( models, options ){
|
||||
this.allFetched = false;
|
||||
return Backbone.Collection.prototype.reset.call( this, models, options );
|
||||
},
|
||||
|
||||
// ........................................................................ order
|
||||
order : null,
|
||||
|
||||
@@ -133,7 +139,8 @@ var ControlledFetchCollection = Backbone.Collection.extend({
|
||||
options = options || {};
|
||||
var collection = this;
|
||||
var comparator = collection.comparators[ order ];
|
||||
if( _.isUndefined( comparator ) ){ return; }
|
||||
if( _.isUndefined( comparator ) ){ throw new Error( 'unknown order: ' + order ); }
|
||||
// if( _.isUndefined( comparator ) ){ return; }
|
||||
if( comparator === collection.comparator ){ return; }
|
||||
|
||||
var oldOrder = collection.order;
|
||||
@@ -210,12 +217,26 @@ var PaginatedCollection = ControlledFetchCollection.extend({
|
||||
// anything less than a full page means we got all there is to get
|
||||
if( !limit || numFetched < limit ){
|
||||
collection.allFetched = true;
|
||||
collection.trigger( 'all-fetched', collection );
|
||||
collection.trigger( 'all-fetched', this );
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
fetchAll : function( options ){
|
||||
// whitelist options to prevent allowing limit/offset/filters
|
||||
// (use vanilla fetch instead)
|
||||
options = options || {};
|
||||
var self = this;
|
||||
options = _.pick( options, 'silent' );
|
||||
//TODO: this doesn't work
|
||||
options.filters = {};
|
||||
return self.fetch( options ).done( function( fetchData ){
|
||||
console.log( 'triggering:...' );
|
||||
self.allFetched = true;
|
||||
self.trigger( 'all-fetched', self );
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ var DatasetAssociation = Backbone.Model
|
||||
if( parsed.update_time ){
|
||||
parsed.update_time = new Date( parsed.update_time );
|
||||
}
|
||||
console.log( 'dataset-model.parsed:', parsed );
|
||||
return parsed;
|
||||
},
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ var HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({
|
||||
return _.first( this.filter( function( content ){ return content.get( 'hid' ) === hid; }) );
|
||||
},
|
||||
|
||||
/** return true if any contents don't have details */
|
||||
/** return true if all contents have details */
|
||||
haveDetails : function(){
|
||||
return this.all( function( content ){ return content.hasDetails(); });
|
||||
},
|
||||
@@ -330,6 +330,7 @@ var HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({
|
||||
|
||||
/** copy an existing, accessible hda into this collection */
|
||||
copy : function( json ){
|
||||
// TODO: somehow showhorn all this into 'save'
|
||||
var id, type, contentType;
|
||||
if( _.isString( json ) ){
|
||||
id = json;
|
||||
@@ -351,7 +352,7 @@ var HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({
|
||||
type : type
|
||||
})
|
||||
.done( function( response ){
|
||||
collection.add([ response ]);
|
||||
collection.add([ response ], { parse: true });
|
||||
})
|
||||
.fail( function( error, status, message ){
|
||||
collection.trigger( 'error', collection, xhr, {},
|
||||
@@ -386,6 +387,16 @@ var HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({
|
||||
},
|
||||
|
||||
// ........................................................................ searching
|
||||
/** return true if all contents have the searchable attributes */
|
||||
haveSearchDetails : function(){
|
||||
return this.allFetched && this.all( function( content ){
|
||||
// null (which is a valid returned annotation value)
|
||||
// will return false when using content.has( 'annotation' )
|
||||
//TODO: a bit hacky - formalize
|
||||
return _.has( content.attributes, 'annotation' );
|
||||
});
|
||||
},
|
||||
|
||||
/** return a new collection of contents whose attributes contain the substring matchesWhat */
|
||||
matches : function( matchesWhat ){
|
||||
return this.filter( function( content ){
|
||||
|
||||
@@ -300,9 +300,10 @@ var History = Backbone.Model
|
||||
if( !allDatasets ){
|
||||
postData.all_datasets = false;
|
||||
}
|
||||
postData.view = 'current';
|
||||
|
||||
var history = this,
|
||||
copy = jQuery.post( this.urlRoot, postData );
|
||||
var history = this;
|
||||
var copy = jQuery.post( this.urlRoot, postData );
|
||||
// if current - queue to setAsCurrent before firing 'copied'
|
||||
if( current ){
|
||||
return copy.then( function( response ){
|
||||
@@ -352,7 +353,6 @@ var HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend
|
||||
/** @type {Number} limit used for each subsequent fetch */
|
||||
limitPerFetch : 10,
|
||||
|
||||
|
||||
initialize : function( models, options ){
|
||||
options = options || {};
|
||||
this.log( 'HistoryCollection.initialize', models, options );
|
||||
@@ -412,6 +412,10 @@ var HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend
|
||||
if( !this.includeDeleted ){
|
||||
filters.deleted = false;
|
||||
filters.purged = false;
|
||||
} else {
|
||||
// force API to return both deleted and non
|
||||
//TODO: when the API is updated, remove this
|
||||
filters.deleted = null;
|
||||
}
|
||||
return _.defaults( superFilters, filters );
|
||||
},
|
||||
@@ -462,16 +466,11 @@ var HistoryCollection = _collectionSuper.extend( BASE_MVC.LoggableMixin ).extend
|
||||
return this;
|
||||
},
|
||||
|
||||
// /** override to reset allFetched flag to false */
|
||||
// reset : function( models, options ){
|
||||
// this.allFetched = false;
|
||||
// return _collectionSuper.prototype.reset.call( this, models, options );
|
||||
// },
|
||||
|
||||
toString: function toString(){
|
||||
return 'HistoryCollection(' + this.length + ',current:' + this.currentHistoryId + ')';
|
||||
}
|
||||
});
|
||||
window.HistoryCollection = HistoryCollection;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -106,28 +106,31 @@ var HistoryView = _super.extend(
|
||||
},
|
||||
|
||||
// ------------------------------------------------------------------------ inf. scrolling
|
||||
/** @type {Number} ms to debounce scroll handler for infinite scrolling */
|
||||
INFINITE_SCROLL_DEBOUNCE_MS : 40,
|
||||
/** @type {Number} number of px (or less) from the bottom the scrollbar should be before fetching */
|
||||
INFINITE_SCROLL_FETCH_THRESHOLD_PX : 128,
|
||||
|
||||
/** override to track the scroll container for this view */
|
||||
_setUpBehaviors : function( $where ){
|
||||
var DEBOUNCED_MS = 40,
|
||||
self = this,
|
||||
var self = this,
|
||||
$newRender = _super.prototype._setUpBehaviors.call( this, $where );
|
||||
// this needs to be handled outside the events hash since we're accessing the scollContainer
|
||||
// (rebind and debounce the method so we can cache for any later removal)
|
||||
self.scrollHandler = _.debounce( _.bind( this.scrollHandler, self ), DEBOUNCED_MS );
|
||||
self.scrollHandler = _.debounce( _.bind( this.scrollHandler, self ), self.INFINITE_SCROLL_DEBOUNCE_MS );
|
||||
self.$scrollContainer( $where ).on( 'scroll', self.scrollHandler );
|
||||
return self;
|
||||
},
|
||||
|
||||
/** */
|
||||
scrollHandler : function( ev ){
|
||||
var FETCH_MORE_PX_THRESHOLD = 128;
|
||||
var self = this;
|
||||
var pxToBottom = self._scrollDistanceToBottom();
|
||||
|
||||
// if the scrollbar is past the trigger point, we're not already fetching,
|
||||
// AND we're not displaying some panel OVER this one
|
||||
// AND we're not displaying some panel OVER this one: fetch more contents
|
||||
// note: is( :visible ) won't work here - it's still visible when this is covered with other panels
|
||||
if( pxToBottom < FETCH_MORE_PX_THRESHOLD && !self._fetching && _.isEmpty( self.panelStack ) ){
|
||||
if( pxToBottom < self.INFINITE_SCROLL_FETCH_THRESHOLD_PX && !self._fetching && _.isEmpty( self.panelStack ) ){
|
||||
self.listenToOnce( self.model.contents, 'sync', self.bulkAppendItemViews );
|
||||
// TODO: gotta be a better way than a _fetching flag
|
||||
self._fetching = true;
|
||||
|
||||
@@ -53,7 +53,7 @@ var HistoryInnerView = HISTORY_VIEW_EDIT.HistoryViewEdit.extend({
|
||||
if( empty ){
|
||||
return $emptyMsg.empty().append( self.emptyMsg ).show();
|
||||
|
||||
} else if( self.searchFor && self.model.contents.haveDetails() ){
|
||||
} else if( self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length ){
|
||||
return $emptyMsg.empty().append( self.noneFoundMsg ).show();
|
||||
}
|
||||
return $();
|
||||
@@ -364,16 +364,15 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
* @fires 'new-collection' when set with this view as the arg
|
||||
*/
|
||||
setCollection : function setCollection( collection ){
|
||||
// console.log( 'setCollection:', collection );
|
||||
this.stopListening( this.collection );
|
||||
|
||||
this.collection = collection || new HISTORY_MODEL.HistoryCollection();
|
||||
this.setUpCollectionListeners();
|
||||
|
||||
// this.collection.sort({ silent : true });
|
||||
this.createColumns();
|
||||
this.hdaQueue.clear();
|
||||
|
||||
// multipanel.addModels( collection, { silent: true });
|
||||
this.trigger( 'new-collection', this );
|
||||
return this;
|
||||
},
|
||||
@@ -382,12 +381,13 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
* @fires 'new-collection' when set with this view as the arg
|
||||
*/
|
||||
addModels : function addModels( models, collection, options ){
|
||||
console.log( 'addModels:', models, collection, options );
|
||||
// console.log( 'addModels:', models, collection, options );
|
||||
options = options || {};
|
||||
var multipanel = this;
|
||||
models = _.isArray( models )? models : [ models ];
|
||||
models.forEach( function( model ){
|
||||
multipanel.addColumn( model, false );
|
||||
// if this is from a fetch, sort will be called and it will call render
|
||||
});
|
||||
return this;
|
||||
},
|
||||
@@ -416,6 +416,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
},
|
||||
|
||||
_postFetchAll : function( fetchData ){
|
||||
console.log( '_postFetchAll' );
|
||||
this.$( '.histories-loading-indicator' ).remove();
|
||||
// when new histories is fetched and the indicator is not required,
|
||||
// the panel will jump slightly left - totally aesthetic but jarring
|
||||
@@ -428,16 +429,14 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
|
||||
/** Re-render and set currentHistoryId to reflect a new current history */
|
||||
setCurrentHistory : function setCurrentHistory( history ){
|
||||
// console.log( 'setCurrentHistory:', history );
|
||||
this.log( 'setCurrentHistory:', history );
|
||||
var oldCurrentColumn = _.findWhere( this.columnMap, { currentHistory: true });
|
||||
if( oldCurrentColumn ){
|
||||
oldCurrentColumn.currentHistory = false;
|
||||
oldCurrentColumn.$el.height( '' );
|
||||
}
|
||||
// console.log( ' :', oldCurrentColumn );
|
||||
|
||||
var newCurrentColumn = this.columnMap[ this.collection.currentHistoryId ];
|
||||
// console.log( ' :', newCurrentColumn );
|
||||
newCurrentColumn.currentHistory = true;
|
||||
this.collection.sort();
|
||||
this._recalcFirstColumnHeight();
|
||||
@@ -516,7 +515,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
|
||||
/** add a new column for history and render all columns if render is true */
|
||||
addColumn : function add( history, render ){
|
||||
//this.debug( 'adding column for:', history );
|
||||
// console.debug( 'adding column for:', history, render );
|
||||
render = render !== undefined? render : true;
|
||||
var newColumn = this.createColumn( history );
|
||||
this.columnMap[ history.id ] = newColumn;
|
||||
@@ -553,7 +552,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
multipanel._recalcFirstColumnHeight();
|
||||
}
|
||||
|
||||
//TODO: to freeColumn (where Columns have freePanel)
|
||||
//TODO: to freeColumn (where Columns have freePanel)
|
||||
multipanel.stopListening( column.panel );
|
||||
multipanel.stopListening( column );
|
||||
delete multipanel.columnMap[ column.model.id ];
|
||||
@@ -580,7 +579,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
multipanel._dropData = null;
|
||||
multipanel.currentColumnDropTargetOff();
|
||||
},
|
||||
'droptarget:drop': function( ev, data, panel ){
|
||||
'droptarget:drop': function( ev, data, panel ){
|
||||
//note: bad copy sources fail silently
|
||||
var toCopy = multipanel._dropData.filter( function( json ){
|
||||
return panel.model.contents.isCopyable( json );
|
||||
@@ -657,12 +656,12 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
|
||||
/** Render the columns and panels */
|
||||
renderColumns : function renderColumns( speed ){
|
||||
speed = speed !== undefined? speed: this.fxSpeed;
|
||||
//this.log( 'renderColumns:', speed );
|
||||
speed = _.isNumber( speed )? speed: this.fxSpeed;
|
||||
// console.log( 'renderColumns:', speed );
|
||||
// render columns and track the total number rendered, firing an event when all are rendered
|
||||
var multipanel = this,
|
||||
sortedAndFiltered = multipanel.sortedFilteredColumns();
|
||||
//this.log( '\t sortedAndFiltered:', sortedAndFiltered );
|
||||
// console.log( '\t sortedAndFiltered:', sortedAndFiltered );
|
||||
|
||||
// set up width based on collection size
|
||||
var $middle = multipanel.$( '.middle' ).empty()
|
||||
@@ -671,7 +670,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
sortedAndFiltered.forEach( function( column, i ){
|
||||
column.$el.appendTo( $middle );
|
||||
column.delegateEvents();
|
||||
multipanel.renderColumn( column, speed );
|
||||
column.render( speed );
|
||||
});
|
||||
if( !multipanel.collection.allFetched ){
|
||||
$middle.append( multipanel.loadingIndicatorTemplate( multipanel ) );
|
||||
@@ -700,12 +699,6 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
);
|
||||
},
|
||||
|
||||
/** Render a single column using the non-blocking setTimeout( 0 ) pattern */
|
||||
renderColumn : function( column, speed ){
|
||||
speed = speed !== undefined? speed: this.fxSpeed;
|
||||
return column.render( speed );
|
||||
},
|
||||
|
||||
//TODO: combine the following two more sensibly
|
||||
//TODO: could have HistoryContents.haveDetails return false
|
||||
// if column.model.contents.length === 0 && !column.model.get( 'empty' ) then just check that
|
||||
@@ -716,7 +709,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
// console.log( 'queueHdaFetch:', column, column.model.get( 'contents_shown' ) );
|
||||
// if the history model says it has hdas but none are present, queue an ajax req for them
|
||||
if( column.model.contents.length === 0 && column.model.get( 'contents_shown' ).shown ){
|
||||
//this.log( '\t fetch needed:', column );
|
||||
// console.log( 'fetch needed: ' + column );
|
||||
var ids = _.values( column.panel.storage.get( 'expandedIds' ) ).join();
|
||||
var fetchOptions = ids? { details : ids } : {};
|
||||
// this uses a 'named' queue so that duplicate requests are ignored
|
||||
@@ -739,7 +732,9 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
this.hdaQueue.add({
|
||||
name : column.model.id,
|
||||
fn : function(){
|
||||
return column.model.contents.fetch({ details: 'all' });
|
||||
return column.model.contents.progressivelyFetchDetails()
|
||||
.done( function(){ column.panel._renderEmptyMessage(); });
|
||||
// return column.model.contents.fetch({ details: 'all' });
|
||||
}
|
||||
});
|
||||
// the queue is re-used, so if it's not processing requests - start it again
|
||||
@@ -821,19 +816,24 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
// set the sort order text also
|
||||
multipanel.$( '.current-order' ).text( multipanel.orderDescriptions[ orderKey ] );
|
||||
multipanel.toggleOptionsPopover();
|
||||
|
||||
// set the order and re-fetch using the new order
|
||||
// set the order and re-fetch using the new order, saving the current history as the first
|
||||
collection.setOrder( orderKey );
|
||||
collection.reset( collection.slice( 0, 1 ), { silent : true });
|
||||
multipanel.setCollection( collection );
|
||||
collection.fetchFirst();
|
||||
multipanel.once( 'columns-rendered', multipanel._scrollLeft, this );
|
||||
var currentHistoryModel = collection.slice( 0, 1 );
|
||||
collection.fetchFirst().done( function(){
|
||||
collection.unshift( currentHistoryModel, { silent: true });
|
||||
multipanel.createColumns();
|
||||
// need to clear this or previously fetched contents won't refetch now (bc of named queue)
|
||||
multipanel.hdaQueue.clear();
|
||||
multipanel.render();
|
||||
});
|
||||
multipanel.once( 'columns-rendered', multipanel._scrollLeft );
|
||||
//TODO: check allFetched and do not reset if so - just sort instead
|
||||
},
|
||||
|
||||
/** scroll the column container right or left */
|
||||
_scrollLeft : function( val ){
|
||||
this.$( '.outer-middle' ).scrollLeft( val || 0 );
|
||||
val = _.isNumber( val )? val : 0;
|
||||
this.$( '.outer-middle' ).scrollLeft( val );
|
||||
},
|
||||
|
||||
/** Set up any view plugins */
|
||||
@@ -849,20 +849,20 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
onfirstsearch : function( searchFor ){
|
||||
multipanel.$( '#search-histories' ).searchInput( 'toggle-loading' );
|
||||
multipanel.renderInfo( _l( 'loading all histories for search' ) );
|
||||
multipanel.collection.fetch()
|
||||
multipanel.collection.fetchAll()
|
||||
.done( function(){
|
||||
multipanel.$( '#search-histories' ).searchInput( 'toggle-loading' );
|
||||
multipanel.renderInfo( '' );
|
||||
});
|
||||
},
|
||||
onsearch : function( searchFor ){
|
||||
onsearch : function( searchFor ){
|
||||
multipanel.historySearch = searchFor;
|
||||
multipanel.filters = [ function(){
|
||||
return this.model.matchesAll( multipanel.historySearch );
|
||||
}];
|
||||
multipanel.renderColumns( 0 );
|
||||
},
|
||||
onclear : function( searchFor ){
|
||||
onclear : function( searchFor ){
|
||||
multipanel.historySearch = null;
|
||||
//TODO: remove specifically not just reset
|
||||
multipanel.filters = [];
|
||||
@@ -894,13 +894,13 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
|
||||
multipanel.$( '#search-datasets' ).searchInput( 'toggle-loading' );
|
||||
});
|
||||
},
|
||||
onsearch : function( searchFor ){
|
||||
onsearch : function( searchFor ){
|
||||
multipanel.datasetSearch = searchFor;
|
||||
multipanel.sortedFilteredColumns().forEach( function( column ){
|
||||
column.panel.searchItems( searchFor );
|
||||
});
|
||||
},
|
||||
onclear : function( searchFor ){
|
||||
onclear : function( searchFor ){
|
||||
multipanel.datasetSearch = null;
|
||||
multipanel.sortedFilteredColumns().forEach( function( column ){
|
||||
column.panel.clearSearch();
|
||||
|
||||
@@ -261,9 +261,6 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
|
||||
self.history_manager.error_unless_accessible( original.history, trans.user, current_history=trans.history )
|
||||
hda = self.hda_manager.copy( original, history=history )
|
||||
|
||||
# data_copy = original.copy( copy_children=True )
|
||||
# hda = history.add_dataset( data_copy )
|
||||
|
||||
trans.sa_session.flush()
|
||||
if not hda:
|
||||
return None
|
||||
@@ -305,7 +302,7 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
|
||||
for ld in traverse( folder ):
|
||||
hda = ld.library_dataset_dataset_association.to_history_dataset_association( history, add_to_history=True )
|
||||
hda_dict = self.hda_serializer.serialize_to_view( hda,
|
||||
user=trans.user, trans=trans, **self._parse_serialization_params( kwd, 'detailed' ) )
|
||||
user=trans.user, trans=trans, **self._parse_serialization_params( kwd, 'detailed' ) )
|
||||
rval.append( hda_dict )
|
||||
else:
|
||||
message = "Invalid 'source' parameter in request %s" % source
|
||||
|
||||
@@ -638,39 +638,17 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
|
||||
user_is_owner=user_is_owner, history_is_current=history_is_current,
|
||||
show_deleted=show_deleted, show_hidden=show_hidden, use_panels=use_panels )
|
||||
|
||||
# @web.require_login( "use more than one Galaxy history" )
|
||||
@web.require_login( "use more than one Galaxy history" )
|
||||
@web.expose
|
||||
def view_multiple( self, trans, include_deleted_histories=False, order='update_time', limit=10 ):
|
||||
"""
|
||||
"""
|
||||
if not trans.user:
|
||||
log_in_url = url_for( controller="user", action="login", use_panels=True )
|
||||
log_in_link = "<a href='%s'>log in</a>" % ( log_in_url )
|
||||
register_url = url_for( controller="user", action="create", use_panels=True )
|
||||
register_link = "<a href='%s'>register</a>" % ( register_url )
|
||||
return trans.show_error_message( "You need to %s or %s to use multiple histories"
|
||||
% ( log_in_link, register_link ), use_panels=True )
|
||||
|
||||
current_history_id = trans.security.encode_id( trans.history.id )
|
||||
# TODO: allow specifying user_id for admin?
|
||||
include_deleted_histories = galaxy.util.string_as_bool( include_deleted_histories )
|
||||
order_by = self.history_manager.parse_order_by( order, default='update_time' )
|
||||
limit = parse_int( limit, min_val=1, default=10, allow_none=True)
|
||||
|
||||
deleted_filter = None
|
||||
if not include_deleted_histories:
|
||||
deleted_filter = [ model.History.deleted == false(), model.History.purged == false() ]
|
||||
|
||||
current_history = trans.get_history()
|
||||
histories = [ current_history ]
|
||||
histories += self.history_manager.by_user( trans.user, filters=deleted_filter, limit=limit, order_by=order_by )
|
||||
|
||||
history_dictionaries = []
|
||||
for history in histories:
|
||||
history_dictionary = self.history_serializer.serialize_to_view( history,
|
||||
view='current', user=trans.user, trans=trans )
|
||||
history_dictionaries.append( history_dictionary )
|
||||
|
||||
return trans.fill_template_mako( "history/view_multiple.mako", histories=history_dictionaries,
|
||||
return trans.fill_template_mako( "history/view_multiple.mako", current_history_id=current_history_id,
|
||||
include_deleted_histories=include_deleted_histories, order=order, limit=limit )
|
||||
|
||||
@web.expose
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"controlled-fetch-collection.js","sources":["../../../src/mvc/base/controlled-fetch-collection.js"],"names":["define","_","Backbone","BASE_MVC","ControlledFetchCollection","Collection","extend","initialize","models","options","prototype","call","this","setOrder","order","silent","_setUpListeners","on","changed-order","sort","fetch","_buildFetchOptions","clone","self","remove","traditional","data","_buildFetchData","filters","_buildFetchFilters","isEmpty","_fetchFiltersToAjaxData","defaults","pick","_fetchParams","filterMap","q","qv","each","v","k","undefined","push","comparators","update_time","buildComparator","ascending","update_time-asc","create_time","create_time-asc","collection","comparator","isUndefined","trigger","PaginatedCollection","limitOnFirstFetch","limitPerFetch","allFetched","lastFetched","fetchFirst","fetchMore","reset","limit","console","warn","jQuery","when","offset","always","done","fetchedData","numFetched","isArray","length"],"mappings":"AAAAA,QACI,kBACA,gBACA,gBACD,SAAUC,EAAGC,EAAUC,GAC1B,YAOA,IAAIC,GAA4BF,EAASG,WAAWC,QAGhDC,WAAa,SAAUC,EAAQC,GAC3BP,EAASG,WAAWK,UAAUH,WAAWI,KAAMC,KAAMJ,EA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,QAAS,wBAGvBgB,KAAM,SAAyBC,GAC5B,GAAIC,GAAatE,EAAEuE,QAASF,GAAeA,EAAYG,OAAS,CAChEvB,GAAWQ,aAAea,IAGrBT,GAAsBA,EAAbS,KACVrB,EAAWO,YAAa,EACxBP,EAAWG,QAAS,cAAeH,QAUnD,QACI9C,0BAA8BA,EAC9BkD,oBAA8BA"}
|
||||
{"version":3,"file":"controlled-fetch-collection.js","sources":["../../../src/mvc/base/controlled-fetch-collection.js"],"names":["define","_","Backbone","BASE_MVC","ControlledFetchCollection","Collection","extend","initialize","models","options","prototype","call","this","setOrder","order","silent","_setUpListeners","on","changed-order","sort","fetch","_buildFetchOptions","clone","self","remove","traditional","data","_buildFetchData","filters","_buildFetchFilters","isEmpty","_fetchFiltersToAjaxData","defaults","pick","_fetchParams","filterMap","q","qv","each","v","k","undefined","push","reset","allFetched","comparators","update_time","buildComparator","ascending","update_time-asc","create_time","create_time-asc","collection","comparator","isUndefined","Error","trigger","PaginatedCollection","limitOnFirstFetch","limitPerFetch","lastFetched","fetchFirst","fetchMore","limit","console","warn","jQuery","when","offset","always","done","fetchedData","numFetched","isArray","length","fetchAll","log"],"mappings":"AAAAA,QACI,kBACA,gBACA,gBACD,SAAUC,EAAGC,EAAUC,GAC1B,YAOA,IAAIC,GAA4BF,EAASG,WAAWC,QAGhDC,WAAa,SAAUC,EAAQC,GAC3BP,EAASG,WAAWK,UAAUH,WAAWI,KAAMC,KAAMJ,EAAQC,GAC7DG,KAAKC,SAAUJ,EAAQK,OAASF,KAAKE,OAASC,QAAQ,KAK1DC,gBAAkB,WACd,MAAOJ,MAAKK,IACRC,gBAAkBN,KAAKO,QAO/BC,MAAQ,SAAUX,GAEd,MADAA,GAAUG,KAAKS,mBAAoBZ,GAC5BP,EAASG,WAAWK,UAAUU,MAAMT,KAAMC,KAAMH,IAI3DY,mBAAqB,SAAUZ,GAG3BA,EAAUR,EAAEqB,MAAOb,MACnB,IAAIc,GAAOX,IAIXH,GAAQe,OAASf,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EAAWI,QAAS,cAAe5C,UAMnD+D,SAAW,SAAUlE,GAGjBA,EAAUA,KACV,IAAIc,GAAOX,IAIX,OAHAH,GAAUR,EAAEgC,KAAMxB,EAAS,UAE3BA,EAAQmB,WACDL,EAAKH,MAAOX,GAAU6D,KAAM,WAC/BN,QAAQY,IAAK,kBACbrD,EAAKqB,YAAa,EAClBrB,EAAKiC,QAAS,cAAejC,OAOrC,QACInB,0BAA8BA,EAC9BqD,oBAA8BA"}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define(["libs/underscore","libs/backbone","mvc/base-mvc"],function(a,b,c){"use strict";var d=b.Collection.extend({initialize:function(a,c){b.Collection.prototype.initialize.call(this,a,c),this.setOrder(c.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(a){return a=this._buildFetchOptions(a),b.Collection.prototype.fetch.call(this,a)},_buildFetchOptions:function(b){b=a.clone(b)||{};var c=this;b.remove=b.remove||!1,b.traditional=!0,b.data=b.data||c._buildFetchData(b);var d=this._buildFetchFilters(b);return a.isEmpty(d)||a.extend(b.data,this._fetchFiltersToAjaxData(d)),b},_buildFetchData:function(b){var c={};return this.order&&(c.order=this.order),a.defaults(a.pick(b,this._fetchParams),c)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(b){return a.clone(b.filters||{})},_fetchFiltersToAjaxData:function(b){var c={q:[],qv:[]};return a.each(b,function(a,b){void 0!==a&&""!==a&&(a===!0&&(a="True"),a===!1&&(a="False"),null===a&&(a="None"),c.q.push(b),c.qv.push(a))}),c},order:null,comparators:{update_time:c.buildComparator("update_time",{ascending:!1}),"update_time-asc":c.buildComparator("update_time",{ascending:!0}),create_time:c.buildComparator("create_time",{ascending:!1}),"create_time-asc":c.buildComparator("create_time",{ascending:!0})},setOrder:function(b,c){c=c||{};var d=this,e=d.comparators[b];if(!a.isUndefined(e)&&e!==d.comparator){{d.order}return d.order=b,d.comparator=e,c.silent||d.trigger("changed-order",c),d}}}),e=d.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.limitOnFirstFetch=b.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=b.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=b.lastFetched||0},fetchFirst:function(b){return b=b?a.clone(b):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.extend(b,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(b){b=a.clone(b||{});var c=this;if(!b.reset&&c.allFetched)return console.warn("allFetched"),jQuery.when();b.offset=b.reset?0:c.lastFetched;var d=b.limit=b.limit||c.limitPerFetch||null;return c.trigger("fetching-more"),c.fetch(b).always(function(){c.trigger("fetching-more-done")}).done(function(b){var e=a.isArray(b)?b.length:0;c.lastFetched+=e,(!d||d>e)&&(c.allFetched=!0,c.trigger("all-fetched",c))})}});return{ControlledFetchCollection:d,PaginatedCollection:e}});
|
||||
define(["libs/underscore","libs/backbone","mvc/base-mvc"],function(a,b,c){"use strict";var d=b.Collection.extend({initialize:function(a,c){b.Collection.prototype.initialize.call(this,a,c),this.setOrder(c.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(a){return a=this._buildFetchOptions(a),b.Collection.prototype.fetch.call(this,a)},_buildFetchOptions:function(b){b=a.clone(b)||{};var c=this;b.remove=b.remove||!1,b.traditional=!0,b.data=b.data||c._buildFetchData(b);var d=this._buildFetchFilters(b);return a.isEmpty(d)||a.extend(b.data,this._fetchFiltersToAjaxData(d)),b},_buildFetchData:function(b){var c={};return this.order&&(c.order=this.order),a.defaults(a.pick(b,this._fetchParams),c)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(b){return a.clone(b.filters||{})},_fetchFiltersToAjaxData:function(b){var c={q:[],qv:[]};return a.each(b,function(a,b){void 0!==a&&""!==a&&(a===!0&&(a="True"),a===!1&&(a="False"),null===a&&(a="None"),c.q.push(b),c.qv.push(a))}),c},reset:function(a,c){return this.allFetched=!1,b.Collection.prototype.reset.call(this,a,c)},order:null,comparators:{update_time:c.buildComparator("update_time",{ascending:!1}),"update_time-asc":c.buildComparator("update_time",{ascending:!0}),create_time:c.buildComparator("create_time",{ascending:!1}),"create_time-asc":c.buildComparator("create_time",{ascending:!0})},setOrder:function(b,c){c=c||{};var d=this,e=d.comparators[b];if(a.isUndefined(e))throw new Error("unknown order: "+b);if(e!==d.comparator){{d.order}return d.order=b,d.comparator=e,c.silent||d.trigger("changed-order",c),d}}}),e=d.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(a,b){d.prototype.initialize.call(this,a,b),this.limitOnFirstFetch=b.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=b.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=b.lastFetched||0},fetchFirst:function(b){return b=b?a.clone(b):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.extend(b,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(b){b=a.clone(b||{});var c=this;if(!b.reset&&c.allFetched)return console.warn("allFetched"),jQuery.when();b.offset=b.reset?0:c.lastFetched;var d=b.limit=b.limit||c.limitPerFetch||null;return c.trigger("fetching-more"),c.fetch(b).always(function(){c.trigger("fetching-more-done")}).done(function(b){var e=a.isArray(b)?b.length:0;c.lastFetched+=e,(!d||d>e)&&(c.allFetched=!0,c.trigger("all-fetched",this))})},fetchAll:function(b){b=b||{};var c=this;return b=a.pick(b,"silent"),b.filters={},c.fetch(b).done(function(){console.log("triggering:..."),c.allFetched=!0,c.trigger("all-fetched",c)})}});return{ControlledFetchCollection:d,PaginatedCollection:e}});
|
||||
//# sourceMappingURL=../../../maps/mvc/base/controlled-fetch-collection.js.map
|
||||
@@ -1,2 +1,2 @@
|
||||
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){"use strict";var d="dataset",e=b.SearchableModelMixin,f=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(e,{_logNamespace:d,defaults:{state:a.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(b,c){this.debug(this+"(Dataset).initialize",b,c),this.get("accessible")||this.set("state",a.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var a=this.get("id");if(!a)return{};var b={purge:"datasets/"+a+"/purge_async",display:"datasets/"+a+"/display/?preview=True",edit:"datasets/"+a+"/edit",download:"datasets/"+a+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+a,rerun:"tool_runner/rerun?id="+a,show_params:"datasets/"+a+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+a+"&metadata_name="};return _.each(b,function(a,c){b[c]=Galaxy.root+a}),this.urls=b,b},_setUpListeners:function(){this.on("change:state",function(a,b){this.log(this+" has changed state:",a,b),this.inReadyState()&&this.trigger("state:ready",a,b,this.previous("state"))}),this.on("change:id change:file_ext",function(){this._generateUrls()})},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);return _.extend(a,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var b=_.contains(a.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||b},hasDetails:function(){return this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(a){var b=this;return Backbone.Model.prototype.fetch.call(this,a).always(function(){b._generateUrls()})},parse:function(a,b){var c=Backbone.Model.prototype.parse.call(this,a,b);return c.create_time&&(c.create_time=new Date(c.create_time)),c.update_time&&(c.update_time=new Date(c.update_time)),c},"delete":function(a){return this.get("deleted")?jQuery.when():this.save({deleted:!0},a)},undelete:function(a){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},a)},purge:function(a){if(this.get("purged"))return jQuery.when();a=a||{},a.url=this.urls.purge;var b=this,d=jQuery.ajax(a);return d.done(function(){b.set({deleted:!0,purged:!0})}),d.fail(function(d){var e=c("Unable to purge dataset"),f="Removal of datasets by users is not allowed in this Galaxy instance";d.responseJSON&&d.responseJSON.error?e=d.responseJSON.error:-1!==d.responseText.indexOf(f)&&(e=f),d.responseText=e,b.trigger("error",b,d,a,c(e),{error:e})}),d},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},toString:function(){var a=this.get("id")||"";return this.get("name")&&(a='"'+this.get("name")+'",'+a),"Dataset("+a+")"}})),g=Backbone.Collection.extend(b.LoggableMixin).extend({_logNamespace:d,model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(a){return a.get("id")})},notReady:function(){return this.filter(function(a){return!a.inReadyState()})},haveDetails:function(){return this.all(function(a){return a.hasDetails()})},ajaxQueue:function(a,b){var c=jQuery.Deferred(),d=this.length,e=[];if(!d)return c.resolve([]),c;var f=this.chain().reverse().map(function(g,h){return function(){var i=a.call(g,b);i.done(function(a){c.notify({curr:h,total:d,response:a,model:g})}),i.always(function(a){e.push(a),f.length?f.shift()():c.resolve(e)})}}).value();return f.shift()(),c},matches:function(a){return this.filter(function(b){return b.matches(a)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:f,DatasetAssociationCollection:g}});
|
||||
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){"use strict";var d="dataset",e=b.SearchableModelMixin,f=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(e,{_logNamespace:d,defaults:{state:a.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(b,c){this.debug(this+"(Dataset).initialize",b,c),this.get("accessible")||this.set("state",a.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var a=this.get("id");if(!a)return{};var b={purge:"datasets/"+a+"/purge_async",display:"datasets/"+a+"/display/?preview=True",edit:"datasets/"+a+"/edit",download:"datasets/"+a+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+a,rerun:"tool_runner/rerun?id="+a,show_params:"datasets/"+a+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+a+"&metadata_name="};return _.each(b,function(a,c){b[c]=Galaxy.root+a}),this.urls=b,b},_setUpListeners:function(){this.on("change:state",function(a,b){this.log(this+" has changed state:",a,b),this.inReadyState()&&this.trigger("state:ready",a,b,this.previous("state"))}),this.on("change:id change:file_ext",function(){this._generateUrls()})},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);return _.extend(a,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var b=_.contains(a.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||b},hasDetails:function(){return this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(a){var b=this;return Backbone.Model.prototype.fetch.call(this,a).always(function(){b._generateUrls()})},parse:function(a,b){var c=Backbone.Model.prototype.parse.call(this,a,b);return c.create_time&&(c.create_time=new Date(c.create_time)),c.update_time&&(c.update_time=new Date(c.update_time)),console.log("dataset-model.parsed:",c),c},"delete":function(a){return this.get("deleted")?jQuery.when():this.save({deleted:!0},a)},undelete:function(a){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},a)},purge:function(a){if(this.get("purged"))return jQuery.when();a=a||{},a.url=this.urls.purge;var b=this,d=jQuery.ajax(a);return d.done(function(){b.set({deleted:!0,purged:!0})}),d.fail(function(d){var e=c("Unable to purge dataset"),f="Removal of datasets by users is not allowed in this Galaxy instance";d.responseJSON&&d.responseJSON.error?e=d.responseJSON.error:-1!==d.responseText.indexOf(f)&&(e=f),d.responseText=e,b.trigger("error",b,d,a,c(e),{error:e})}),d},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},toString:function(){var a=this.get("id")||"";return this.get("name")&&(a='"'+this.get("name")+'",'+a),"Dataset("+a+")"}})),g=Backbone.Collection.extend(b.LoggableMixin).extend({_logNamespace:d,model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(a){return a.get("id")})},notReady:function(){return this.filter(function(a){return!a.inReadyState()})},haveDetails:function(){return this.all(function(a){return a.hasDetails()})},ajaxQueue:function(a,b){var c=jQuery.Deferred(),d=this.length,e=[];if(!d)return c.resolve([]),c;var f=this.chain().reverse().map(function(g,h){return function(){var i=a.call(g,b);i.done(function(a){c.notify({curr:h,total:d,response:a,model:g})}),i.always(function(a){e.push(a),f.length?f.shift()():c.resolve(e)})}}).value();return f.shift()(),c},matches:function(a){return this.filter(function(b){return b.matches(a)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:f,DatasetAssociationCollection:g}});
|
||||
//# sourceMappingURL=../../../maps/mvc/dataset/dataset-model.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -36,23 +36,29 @@ define( 'app', function(){
|
||||
], function( HISTORY_MODEL, MULTI_HISTORY ){
|
||||
$(function(){
|
||||
console.log( bootstrapped.order );
|
||||
histories = new HISTORY_MODEL.HistoryCollection( bootstrapped.histories, {
|
||||
histories = new HISTORY_MODEL.HistoryCollection( [], {
|
||||
includeDeleted : bootstrapped.includingDeleted,
|
||||
order : bootstrapped.order,
|
||||
limitOnFirstFetch : bootstrapped.limit,
|
||||
limitPerFetch : bootstrapped.limit,
|
||||
lastFetched : bootstrapped.limit,
|
||||
currentHistoryId : '${histories[0][ "id" ]}',
|
||||
// lastFetched : bootstrapped.limit,
|
||||
currentHistoryId : bootstrapped.current_history_id,
|
||||
});
|
||||
|
||||
multipanel = new MULTI_HISTORY.MultiPanelColumns({
|
||||
el : $( '#center' ).get(0),
|
||||
histories : histories,
|
||||
}).render( 0 );
|
||||
})
|
||||
histories.fetchFirst().done( function(){
|
||||
multipanel.createColumns();
|
||||
multipanel.render( 0 );
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
${ galaxy_client.load( app='app', histories=histories,
|
||||
${ galaxy_client.load( app='app', current_history_id=current_history_id,
|
||||
includingDeleted=include_deleted_histories, order=order, limit=limit ) }
|
||||
##${ galaxy_client.load( app='app', histories=histories,
|
||||
## includingDeleted=include_deleted_histories, order=order, limit=limit ) }
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user