mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'filter_dataset_tags' into dev
This commit is contained in:
@@ -221,7 +221,8 @@ var View = Backbone.View.extend({
|
||||
hid : item.hid,
|
||||
keep : item.keep,
|
||||
label: item.hid + ': ' + item.name,
|
||||
value: item.id
|
||||
value: item.id,
|
||||
tags : item.tags
|
||||
});
|
||||
self.history[ item.id + '_' + src ] = item;
|
||||
});
|
||||
|
||||
@@ -109,6 +109,11 @@ var View = Backbone.View.extend({
|
||||
}
|
||||
},
|
||||
|
||||
/** Matches a search term with a given text */
|
||||
_match: function( term, text ) {
|
||||
return !term || term == '' || String( text ).toUpperCase().indexOf( term.toUpperCase() ) >= 0
|
||||
},
|
||||
|
||||
/** Updates the selection options */
|
||||
_changeData: function() {
|
||||
var self = this;
|
||||
@@ -125,7 +130,8 @@ var View = Backbone.View.extend({
|
||||
if ( this.model.get( 'searchable' ) ) {
|
||||
this.data2 = [];
|
||||
_.each( this.data, function( option, index ) {
|
||||
self.data2.push( { order: index, id: option.value, text: option.label } );
|
||||
var tags = _.reduce( option.tags, function( memo, tag ) { return memo + ' ' + tag }, '');
|
||||
self.data2.push( { order: index, id: option.value, text: option.label, tags: tags } );
|
||||
});
|
||||
this.$select.data( 'select2' ) && this.$select.select2( 'destroy' );
|
||||
this.$select.select2({
|
||||
@@ -135,7 +141,7 @@ var View = Backbone.View.extend({
|
||||
query : function( q ) {
|
||||
var pagesize = self.model.get( 'pagesize' );
|
||||
var results = _.filter( self.data2, function ( e ) {
|
||||
return !q.term || q.term == '' || e.text.toUpperCase().indexOf( q.term.toUpperCase() ) >= 0;
|
||||
return self._match( q.term, e.text ) || self._match( q.term, e.tags );
|
||||
});
|
||||
q.callback({
|
||||
results: results.slice( ( q.page - 1 ) * pagesize, q.page * pagesize ),
|
||||
|
||||
@@ -1416,6 +1416,7 @@ class History( object, Dictifiable, UsesAnnotations, HasName ):
|
||||
.options( joinedload("dataset"),
|
||||
joinedload("dataset.actions"),
|
||||
joinedload("dataset.actions.role"),
|
||||
joinedload("tags"),
|
||||
))
|
||||
self._active_datasets_and_roles = query.all()
|
||||
return self._active_datasets_and_roles
|
||||
|
||||
@@ -1767,8 +1767,13 @@ class DataToolParameter( BaseDataToolParameter ):
|
||||
multiple = self.multiple
|
||||
|
||||
# build and append a new select option
|
||||
def append( list, id, hid, name, src, keep=False ):
|
||||
return list.append( { 'id' : trans.security.encode_id( id ), 'hid' : hid, 'name' : name, 'src' : src, 'keep': keep } )
|
||||
def append( list, hda, name, src, keep=False ):
|
||||
return list.append( { 'id' : trans.security.encode_id( hda.id ),
|
||||
'hid' : hda.hid,
|
||||
'name' : name,
|
||||
'tags' : [ t.user_tname for t in hda.tags ],
|
||||
'src' : src,
|
||||
'keep' : keep } )
|
||||
|
||||
# add datasets
|
||||
visible_hda = other_values.get( self.name )
|
||||
@@ -1779,7 +1784,7 @@ class DataToolParameter( BaseDataToolParameter ):
|
||||
m = match.hda
|
||||
has_matched = has_matched or visible_hda == m or visible_hda == hda
|
||||
m_name = '%s (as %s)' % ( match.original_hda.name, match.target_ext ) if match.implicit_conversion else m.name
|
||||
append( d[ 'options' ][ 'hda' ], m.id, m.hid, m_name, 'hda' )
|
||||
append( d[ 'options' ][ 'hda' ], m, m_name, 'hda' )
|
||||
if not has_matched and hasattr( visible_hda, 'hid' ):
|
||||
if visible_hda.deleted:
|
||||
hda_state = 'deleted'
|
||||
@@ -1787,13 +1792,13 @@ class DataToolParameter( BaseDataToolParameter ):
|
||||
hda_state = 'hidden'
|
||||
else:
|
||||
hda_state = 'unavailable'
|
||||
append( d[ 'options' ][ 'hda' ], visible_hda.id, visible_hda.hid, '(%s) %s' % ( hda_state, visible_hda.name ), 'hda', True )
|
||||
append( d[ 'options' ][ 'hda' ], visible_hda, '(%s) %s' % ( hda_state, visible_hda.name ), 'hda', True )
|
||||
|
||||
# add dataset collections
|
||||
dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
|
||||
for hdca in history.active_dataset_collections:
|
||||
if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
|
||||
append( d[ 'options' ][ 'hdca' ], hdca.id, hdca.hid, hdca.name, 'hdca' )
|
||||
append( d[ 'options' ][ 'hdca' ], hdca, hdca.name, 'hdca' )
|
||||
|
||||
# sort both lists
|
||||
d['options']['hda'] = sorted(d['options']['hda'], key=lambda k: k['hid'], reverse=True)
|
||||
@@ -1920,20 +1925,22 @@ class DataCollectionToolParameter( BaseDataToolParameter ):
|
||||
# append directly matched collections
|
||||
for hdca in self.match_collections( trans, history, dataset_matcher ):
|
||||
d['options']['hdca'].append({
|
||||
'id': trans.security.encode_id( hdca.id ),
|
||||
'hid': hdca.hid,
|
||||
'name': hdca.name,
|
||||
'src': 'hdca'
|
||||
'id' : trans.security.encode_id( hdca.id ),
|
||||
'hid' : hdca.hid,
|
||||
'name' : hdca.name,
|
||||
'src' : 'hdca',
|
||||
'tags' : [ t.user_tname for t in hdca.tags ]
|
||||
})
|
||||
|
||||
# append matching subcollections
|
||||
for hdca in self.match_multirun_collections( trans, history, dataset_matcher ):
|
||||
subcollection_type = self._history_query( trans ).can_map_over( hdca ).collection_type
|
||||
d['options']['hdca'].append({
|
||||
'id': trans.security.encode_id( hdca.id ),
|
||||
'hid': hdca.hid,
|
||||
'name': hdca.name,
|
||||
'src': 'hdca',
|
||||
'id' : trans.security.encode_id( hdca.id ),
|
||||
'hid' : hdca.hid,
|
||||
'name' : hdca.name,
|
||||
'src' : 'hdca',
|
||||
'tags' : [ t.user_tname for t in hdca.tags ],
|
||||
'map_over_type': subcollection_type
|
||||
})
|
||||
|
||||
|
||||
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
@@ -204,11 +204,11 @@ class MockHistoryDatasetAssociation( object ):
|
||||
)
|
||||
self.dbkey = "hg19"
|
||||
self.implicitly_converted_parent_datasets = False
|
||||
|
||||
self.name = name
|
||||
self.hid = id
|
||||
self.id = id
|
||||
self.children = []
|
||||
self.tags = []
|
||||
|
||||
@property
|
||||
def state( self ):
|
||||
|
||||
Reference in New Issue
Block a user