Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement UI to display list of lists dataset collections #2613

Merged
merged 3 commits into from
Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/galaxy/scripts/mvc/collection/collection-li.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ DCListItemView.prototype.templates = (function(){
_l( 'a pair of datasets' ),
'<% } else if( collection.collection_type === "list:paired" ){ %>',
_l( 'a list of <%- countText %>dataset pairs' ),
'<% } else if( collection.collection_type === "list:list" ){ %>',
_l( 'a list of <%- countText %>dataset lists' ),
'<% } %>',
'</div>'
], 'collection' );
Expand Down
54 changes: 51 additions & 3 deletions client/galaxy/scripts/mvc/collection/collection-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,58 @@ var ListPairedDatasetCollection = DatasetCollection.extend(
});


//==============================================================================
/** @class Backbone model for a list dataset collection within a list:list dataset collection. */
var NestedListDCDCE = ListDatasetCollection.extend( BASE_MVC.mixin( DatasetCollectionElementMixin,
/** @lends NestedListDCDCE.prototype */{

/** This is both a collection and a collection element - call the constructor */
constructor : function( attributes, options ){
this.debug( '\t NestedListDCDCE.constructor:', attributes, options );
DatasetCollectionElementMixin.constructor.call( this, attributes, options );
},

/** String representation. */
toString : function(){
var objStr = ( this.object )?( '' + this.object ):( this.get( 'element_identifier' ) );
return ([ 'NestedListDCDCE(', objStr, ')' ].join( '' ));
}
}));


//==============================================================================
/** @class Backbone collection containing list dataset collections. */
var NestedListDCDCECollection = NestedDCDCECollection.extend({

/** We know this collection is composed of only nested pair collections */
model: NestedListDCDCE,

/** String representation. */
toString : function(){
return ([ 'NestedListDCDCECollection(', this.length, ')' ].join( '' ));
}
});


//==============================================================================
/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */
var ListOfListsDatasetCollection = DatasetCollection.extend({

/** list:paired is the only collection that itself contains collections */
collectionClass : NestedListDCDCECollection,

/** String representation. */
toString : function(){
return ([ 'ListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));
}
});


//==============================================================================
return {
ListDatasetCollection : ListDatasetCollection,
PairDatasetCollection : PairDatasetCollection,
ListPairedDatasetCollection : ListPairedDatasetCollection
ListDatasetCollection : ListDatasetCollection,
PairDatasetCollection : PairDatasetCollection,
ListPairedDatasetCollection : ListPairedDatasetCollection,
ListOfListsDatasetCollection: ListOfListsDatasetCollection
};
});
24 changes: 22 additions & 2 deletions client/galaxy/scripts/mvc/collection/collection-view-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ var NestedPairCollectionViewEdit = PairCollectionViewEdit.extend(


// =============================================================================
/** @class non-editable, read-only View/Controller for a dataset collection. */
/** @class editable, View/Controller for a list of pairs dataset collection. */
var ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(
/** @lends ListOfPairsCollectionView.prototype */{

Expand All @@ -146,11 +146,31 @@ var ListOfPairsCollectionViewEdit = CollectionViewEdit.extend(
});


// =============================================================================
/** @class View/Controller for a list of lists dataset collection. */
var ListOfListsCollectionViewEdit = CollectionViewEdit.extend(
/** @lends ListOfListsCollectionView.prototype */{

//TODO: not strictly needed - due to switch in CollectionView._getContentClass
/** sub view class used for nested collections */
NestedDCDCEViewClass : DC_EDIT.NestedDCDCEListItemEdit.extend({
foldoutPanelClass : NestedPairCollectionViewEdit
}),

// ........................................................................ misc
/** string rep */
toString : function(){
return 'ListOfListsCollectionViewEdit(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';
}
});


//==============================================================================
return {
CollectionViewEdit : CollectionViewEdit,
ListCollectionViewEdit : ListCollectionViewEdit,
PairCollectionViewEdit : PairCollectionViewEdit,
ListOfPairsCollectionViewEdit : ListOfPairsCollectionViewEdit
ListOfPairsCollectionViewEdit : ListOfPairsCollectionViewEdit,
ListOfListsCollectionViewEdit : ListOfListsCollectionViewEdit
};
});
21 changes: 20 additions & 1 deletion client/galaxy/scripts/mvc/collection/collection-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ CollectionView.prototype.templates = (function(){
_l( 'a pair of datasets' ),
'<% } else if( collection.collection_type === "list:paired" ){ %>',
_l( 'a list of paired datasets' ),
'<% } else if( collection.collection_type === "list:list" ){ %>',
_l( 'a list of dataset lists' ),
'<% } %>',
'</div>',
'</div>',
Expand Down Expand Up @@ -215,11 +217,28 @@ var ListOfPairsCollectionView = CollectionView.extend(
});


// =============================================================================
/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */
var ListOfListsCollectionView = CollectionView.extend({

/** sub view class used for nested collections */
NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView.extend({
foldoutPanelClass : PairCollectionView
}),

/** string rep */
toString : function(){
return 'ListOfListsCollectionView(' + (( this.model )?( this.model.get( 'name' )):( '' )) + ')';
}
});


//==============================================================================
return {
CollectionView : CollectionView,
ListCollectionView : ListCollectionView,
PairCollectionView : PairCollectionView,
ListOfPairsCollectionView : ListOfPairsCollectionView
ListOfPairsCollectionView : ListOfPairsCollectionView,
ListOfListsCollectionView : ListOfListsCollectionView
};
});
2 changes: 2 additions & 0 deletions client/galaxy/scripts/mvc/history/hdca-li-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var HDCAListItemEdit = _super.extend(
return DC_VIEW_EDIT.PairCollectionViewEdit;
case 'list:paired':
return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;
case 'list:list':
return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;
}
throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );
},
Expand Down
2 changes: 2 additions & 0 deletions client/galaxy/scripts/mvc/history/hdca-li.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ var HDCAListItemView = _super.extend(
return DC_VIEW.PairCollectionView;
case 'list:paired':
return DC_VIEW.ListOfPairsCollectionView;
case 'list:list':
return DC_VIEW.ListOfListsCollectionView;
}
throw new TypeError( 'Uknown collection_type: ' + this.model.get( 'collection_type' ) );
},
Expand Down
38 changes: 31 additions & 7 deletions client/galaxy/scripts/mvc/history/hdca-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ TODO:
var hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,
ListDC = DC_MODEL.ListDatasetCollection,
PairDC = DC_MODEL.PairDatasetCollection,
ListPairedDC = DC_MODEL.ListPairedDatasetCollection;
ListPairedDC = DC_MODEL.ListPairedDatasetCollection,
ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;

//==============================================================================
/** Override to post to contents route w/o id. */
Expand Down Expand Up @@ -91,11 +92,8 @@ var HistoryPairDatasetCollection = PairDC.extend( hcontentMixin ).extend(


//==============================================================================
/** @class Backbone model for List of Pairs Dataset Collection within a History.
* @constructs
*/
var HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).extend(
/** @lends HistoryListPairedDatasetCollection.prototype */{
/** @class Backbone model for List of Pairs Dataset Collection within a History. */
var HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).extend({

defaults : _.extend( _.clone( ListPairedDC.prototype.defaults ), {
history_content_type: 'dataset_collection',
Expand All @@ -118,10 +116,36 @@ var HistoryListPairedDatasetCollection = ListPairedDC.extend( hcontentMixin ).ex
});


//==============================================================================
/** @class Backbone model for List of Lists Dataset Collection within a History. */
var HistoryListOfListsDatasetCollection = ListOfListsDC.extend( hcontentMixin ).extend({

defaults : _.extend( _.clone( ListOfListsDC.prototype.defaults ), {
history_content_type: 'dataset_collection',
collection_type : 'list:list',
model_class : 'HistoryDatasetCollectionAssociation'
}),

initialize : function( model, options ){
ListOfListsDC.prototype.initialize.call( this, model, options );
hcontentMixin.initialize.call( this, model, options );
},

/** Override to post to contents route w/o id. */
save : buildHDCASave( ListOfListsDC.prototype.save ),

/** String representation. */
toString : function(){
return ([ 'HistoryListOfListsDatasetCollection(', this.get( 'name' ), ')' ].join( '' ));
}
});


//==============================================================================
return {
HistoryListDatasetCollection : HistoryListDatasetCollection,
HistoryPairDatasetCollection : HistoryPairDatasetCollection,
HistoryListPairedDatasetCollection : HistoryListPairedDatasetCollection
HistoryListPairedDatasetCollection : HistoryListPairedDatasetCollection,
HistoryListOfListsDatasetCollection : HistoryListOfListsDatasetCollection
};
});
6 changes: 5 additions & 1 deletion client/galaxy/scripts/mvc/history/history-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ var HistoryContents = Backbone.Collection
return new HDCA_MODEL.HistoryPairDatasetCollection( attrs, options );
case 'list:paired':
return new HDCA_MODEL.HistoryListPairedDatasetCollection( attrs, options );
case 'list:list':
return new HDCA_MODEL.HistoryListOfListsDatasetCollection( attrs, options );
}
// This is a hack inside a hack:
// Raise a plain object with validationError to fake a model.validationError
// (since we don't have a model to use validate with)
// (the outer hack being the mixed content/model function in this collection)
return { validationError : 'Unknown collection_type: ' + attrs.history_content_type };
var msg = 'Unknown collection_type: ' + attrs.collection_type;
console.warn( msg, attrs );
return { validationError : msg };
}
return { validationError : 'Unknown history_content_type: ' + attrs.history_content_type };
},
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/collection/collection-li.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading