mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
History panel: clean up and documentation
This commit is contained in:
@@ -13,7 +13,8 @@ NOTE: not much going on here. Until we find out what operations a user will need
|
||||
var _super = DC_LI.DCListItemView;
|
||||
/** @class Editing view for DatasetCollectionElement.
|
||||
*/
|
||||
var DCEListItemEdit = _super.extend({
|
||||
var DCEListItemEdit = _super.extend(
|
||||
/** @lends DCEListItemEdit.prototype */{
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
@@ -8,7 +8,8 @@ define([
|
||||
var ListItemView = BASE_MVC.ListItemView;
|
||||
/** @class Read only view for DatasetCollection.
|
||||
*/
|
||||
var DCListItemView = ListItemView.extend({
|
||||
var DCListItemView = ListItemView.extend(
|
||||
/** @lends DCListItemView.prototype */{
|
||||
//TODO: may not be needed
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
@@ -26,7 +27,7 @@ var DCListItemView = ListItemView.extend({
|
||||
ListItemView.prototype.initialize.call( this, attributes );
|
||||
},
|
||||
|
||||
/** In this override, don't show`or render any details (no need to do anything here)
|
||||
/** In this override, don't show or render any details (no need to do anything here)
|
||||
* - currently the parent control will load a panel for this collection over itself
|
||||
* @fires expanded when a body has been expanded
|
||||
*/
|
||||
@@ -87,7 +88,8 @@ DCListItemView.prototype.templates = (function(){
|
||||
//==============================================================================
|
||||
/** @class Read only view for DatasetCollectionElement.
|
||||
*/
|
||||
var DCEListItemView = ListItemView.extend({
|
||||
var DCEListItemView = ListItemView.extend(
|
||||
/** @lends DCEListItemView.prototype */{
|
||||
//TODO: this might be expendable - compacted with HDAListItemView
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
@@ -99,7 +101,7 @@ var DCEListItemView = ListItemView.extend({
|
||||
/** jq fx speed for this view */
|
||||
fxSpeed : 'fast',
|
||||
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attributes ){
|
||||
if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }
|
||||
this.log( 'DCEListItemView.initialize:', attributes );
|
||||
@@ -138,14 +140,15 @@ DCEListItemView.prototype.templates = (function(){
|
||||
/** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation
|
||||
* (a dataset contained in a dataset collection).
|
||||
*/
|
||||
var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend({
|
||||
var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend(
|
||||
/** @lends DatasetDCEListItemView.prototype */{
|
||||
|
||||
className : DATASET_LI.DatasetListItemView.prototype.className + " dataset-collection-element",
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attributes ){
|
||||
if( attributes.logger ){ this.logger = this.model.logger = attributes.logger; }
|
||||
this.log( 'DatasetDCEListItemView.initialize:', attributes );
|
||||
@@ -185,7 +188,8 @@ DatasetDCEListItemView.prototype.templates = (function(){
|
||||
/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection
|
||||
* (a nested DC).
|
||||
*/
|
||||
var NestedDCDCEListItemView = DCListItemView.extend({
|
||||
var NestedDCDCEListItemView = DCListItemView.extend(
|
||||
/** @lends NestedDCDCEListItemView.prototype */{
|
||||
|
||||
className : DCListItemView.prototype.className + " dataset-collection-element",
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ any YAGNI).
|
||||
* When collection elements are passed from the API, the underlying element is
|
||||
* in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).
|
||||
* This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues
|
||||
* effectively changing a DCE from a container to a subclass.
|
||||
* effectively changing a DCE from a container to a subclass (has a --> is a).
|
||||
*/
|
||||
var DatasetCollectionElementMixin = {
|
||||
|
||||
@@ -82,7 +82,7 @@ var DatasetCollectionElementMixin = {
|
||||
};
|
||||
|
||||
//TODO: unused?
|
||||
/** Concrete class of Generic DatasetCollectionElement */
|
||||
/** @class Concrete class of Generic DatasetCollectionElement */
|
||||
var DatasetCollectionElement = Backbone.Model
|
||||
.extend( BASE_MVC.LoggableMixin )
|
||||
.extend( DatasetCollectionElementMixin );
|
||||
@@ -94,7 +94,6 @@ var DCECollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
/** @lends DCECollection.prototype */{
|
||||
model: DatasetCollectionElement,
|
||||
|
||||
// comment this out to suppress log output
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
@@ -124,7 +123,10 @@ var DatasetDCE = DATASET_MODEL.DatasetAssociation.extend( BASE_MVC.mixin( Datase
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
defaults : _.extend( {}, DATASET_MODEL.DatasetAssociation.prototype.defaults, DatasetCollectionElementMixin.defaults ),
|
||||
defaults : _.extend( {},
|
||||
DATASET_MODEL.DatasetAssociation.prototype.defaults,
|
||||
DatasetCollectionElementMixin.defaults
|
||||
),
|
||||
|
||||
// because all objects have constructors (as this hashmap would even if this next line wasn't present)
|
||||
// the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model
|
||||
@@ -162,7 +164,7 @@ var DatasetDCECollection = DCECollection.extend(
|
||||
//logger : console,
|
||||
|
||||
//TODO: unused?
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attributes, options ){
|
||||
this.debug( this + '(DatasetDCECollection).initialize:', attributes, options );
|
||||
DCECollection.prototype.initialize.call( this, attributes, options );
|
||||
@@ -203,7 +205,7 @@ var DatasetCollection = Backbone.Model
|
||||
/** Which class to use for elements */
|
||||
collectionClass : DCECollection,
|
||||
|
||||
/** */
|
||||
/** set up: create elements instance var and (on changes to elements) update them */
|
||||
initialize : function( model, options ){
|
||||
this.debug( this + '(DatasetCollection).initialize:', model, options, this );
|
||||
//historyContent.HistoryContent.prototype.initialize.call( this, attrs, options );
|
||||
@@ -269,6 +271,7 @@ var DatasetCollection = Backbone.Model
|
||||
},
|
||||
|
||||
// ........................................................................ searchable
|
||||
/** searchable attributes for collections */
|
||||
searchAttributes : [
|
||||
'name'
|
||||
],
|
||||
@@ -291,6 +294,7 @@ var ListDatasetCollection = DatasetCollection.extend(
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
/** override since we know the collection will only contain datasets */
|
||||
collectionClass : DatasetDCECollection,
|
||||
|
||||
//TODO: unused?
|
||||
@@ -368,10 +372,11 @@ var NestedDCDCECollection = DCECollection.extend(
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
/** This is a collection of nested collections */
|
||||
model: NestedDCDCE,
|
||||
|
||||
//TODO: unused?
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attrs, options ){
|
||||
this.debug( this + '(NestedDCDCECollection).initialize:', attrs, options );
|
||||
DCECollection.prototype.initialize.call( this, attrs, options );
|
||||
@@ -394,7 +399,10 @@ var NestedPairDCDCE = PairDatasetCollection.extend( BASE_MVC.mixin( DatasetColle
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
/** */
|
||||
// because all objects have constructors (as this hashmap would even if this next line wasn't present)
|
||||
// the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model
|
||||
// - re-apply manually it now
|
||||
/** This is both a collection and a collection element - call the constructor */
|
||||
constructor : function( attributes, options ){
|
||||
this.debug( '\t NestedPairDCDCE.constructor:', attributes, options );
|
||||
//DatasetCollection.constructor.call( this, attributes, options );
|
||||
@@ -418,10 +426,11 @@ var NestedPairDCDCECollection = NestedDCDCECollection.extend(
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
/** We know this collection is composed of only nested pair collections */
|
||||
model: NestedPairDCDCE,
|
||||
|
||||
//TODO: unused?
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attrs, options ){
|
||||
this.debug( this + '(NestedPairDCDCECollection).initialize:', attrs, options );
|
||||
NestedDCDCECollection.prototype.initialize.call( this, attrs, options );
|
||||
@@ -443,11 +452,11 @@ var ListPairedDatasetCollection = DatasetCollection.extend(
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
// list:paired is the only collection that itself contains collections
|
||||
/** list:paired is the only collection that itself contains collections */
|
||||
collectionClass : NestedPairDCDCECollection,
|
||||
|
||||
//TODO: unused?
|
||||
/** */
|
||||
/** set up */
|
||||
initialize : function( attributes, options ){
|
||||
this.debug( this + '(ListPairedDatasetCollection).initialize:', attributes, options );
|
||||
DatasetCollection.prototype.initialize.call( this, attributes, options );
|
||||
|
||||
@@ -24,7 +24,9 @@ var CollectionPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
/** (in ms) that jquery effects will use */
|
||||
fxSpeed : 'fast',
|
||||
|
||||
/** sub view class used for datasets */
|
||||
DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,
|
||||
/** sub view class used for nested collections */
|
||||
NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView,
|
||||
|
||||
// ......................................................................... SET UP
|
||||
@@ -229,7 +231,7 @@ var CollectionPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
}
|
||||
},
|
||||
|
||||
/** */
|
||||
/** When a sub-collection is clicked, hide the current panel and render the sub-collection in its own panel */
|
||||
_addCollectionPanel : function( collectionView ){
|
||||
//TODO: a bit hackish
|
||||
var currPanel = this,
|
||||
@@ -333,9 +335,11 @@ CollectionPanel.templates = CollectionPanel.prototype.templates = (function(){
|
||||
|
||||
// =============================================================================
|
||||
/** @class non-editable, read-only View/Controller for a dataset collection. */
|
||||
var ListCollectionPanel = CollectionPanel.extend({
|
||||
var ListCollectionPanel = CollectionPanel.extend(
|
||||
/** @lends ListCollectionPanel.prototype */{
|
||||
|
||||
//TODO: not strictly needed - due to switch in CollectionPanel._getContentClass
|
||||
/** sub view class used for datasets */
|
||||
DatasetDCEViewClass : DC_LI.DatasetDCEListItemView,
|
||||
|
||||
// ........................................................................ misc
|
||||
@@ -348,7 +352,8 @@ var ListCollectionPanel = CollectionPanel.extend({
|
||||
|
||||
// =============================================================================
|
||||
/** @class non-editable, read-only View/Controller for a dataset collection. */
|
||||
var PairCollectionPanel = ListCollectionPanel.extend({
|
||||
var PairCollectionPanel = ListCollectionPanel.extend(
|
||||
/** @lends PairCollectionPanel.prototype */{
|
||||
|
||||
// ........................................................................ misc
|
||||
/** string rep */
|
||||
@@ -360,9 +365,11 @@ var PairCollectionPanel = ListCollectionPanel.extend({
|
||||
|
||||
// =============================================================================
|
||||
/** @class non-editable, read-only View/Controller for a dataset collection. */
|
||||
var ListOfPairsCollectionPanel = CollectionPanel.extend({
|
||||
var ListOfPairsCollectionPanel = CollectionPanel.extend(
|
||||
/** @lends ListOfPairsCollectionPanel.prototype */{
|
||||
|
||||
//TODO: not strictly needed - due to switch in CollectionPanel._getContentClass
|
||||
/** sub view class used for nested collections */
|
||||
NestedDCDCEViewClass : DC_LI.NestedDCDCEListItemView,
|
||||
|
||||
// ........................................................................ misc
|
||||
|
||||
@@ -10,7 +10,7 @@ var searchableMixin = BASE_MVC.SearchableModelMixin;
|
||||
* The DA's are made searchable (by attribute) by mixing in SearchableModelMixin.
|
||||
*/
|
||||
var DatasetAssociation = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
BASE_MVC.mixin( searchableMixin, {
|
||||
BASE_MVC.mixin( searchableMixin, /** @lends DatasetAssociation.prototype */{
|
||||
|
||||
/** default attributes for a model */
|
||||
defaults : {
|
||||
@@ -43,8 +43,10 @@ var DatasetAssociation = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
//annotation : ''
|
||||
},
|
||||
|
||||
initialize : function( attrs, options ){
|
||||
this.debug( 'Dataset.initialize', attrs, options );
|
||||
/** instance vars and listeners */
|
||||
initialize : function( attributes, options ){
|
||||
this.debug( this + '(Dataset).initialize', attributes, options );
|
||||
|
||||
//!! this state is not in trans.app.model.Dataset.states - set it here -
|
||||
if( !this.get( 'accessible' ) ){
|
||||
this.set( 'state', STATES.NOT_VIEWABLE );
|
||||
@@ -62,7 +64,6 @@ var DatasetAssociation = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
var id = this.get( 'id' );
|
||||
if( !id ){ return {}; }
|
||||
var urls = {
|
||||
//TODO: how many of these are still used?
|
||||
'purge' : 'datasets/' + id + '/purge_async',
|
||||
'display' : 'datasets/' + id + '/display/?preview=True',
|
||||
'edit' : 'datasets/' + id + '/edit',
|
||||
@@ -146,6 +147,7 @@ var DatasetAssociation = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
return this.save( { deleted: false }, options );
|
||||
},
|
||||
|
||||
/** remove the file behind this dataset from the filesystem (if permitted) */
|
||||
purge : function _purge( options ){
|
||||
//TODO: use, override model.destroy, HDA.delete({ purge: true })
|
||||
if( this.get( 'purged' ) ){ return jQuery.when(); }
|
||||
@@ -160,7 +162,7 @@ var DatasetAssociation = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend(
|
||||
// }, options ));
|
||||
//
|
||||
//xhr.done( function( response ){
|
||||
// console.debug( 'response', response );
|
||||
// hda.debug( 'response', response );
|
||||
// //hda.set({ deleted: true, purged: true });
|
||||
// hda.set( response );
|
||||
//});
|
||||
|
||||
@@ -27,8 +27,9 @@ var STATES = {
|
||||
PAUSED : 'paused',
|
||||
/** metadata discovery/setting failed or errored (but otherwise ok) */
|
||||
FAILED_METADATA : 'failed_metadata',
|
||||
//TODO: not in trans.app.model.Dataset.states - is in database
|
||||
/** not accessible to the current user (i.e. due to permissions) */
|
||||
NOT_VIEWABLE : 'noPermission', // not in trans.app.model.Dataset.states
|
||||
NOT_VIEWABLE : 'noPermission',
|
||||
/** deleted while uploading */
|
||||
DISCARDED : 'discarded',
|
||||
/** the tool producing this dataset failed */
|
||||
|
||||
@@ -7,7 +7,8 @@ define([
|
||||
var _super = HDCA_LI.HDCAListItemView;
|
||||
/** @class Editing view for HistoryDatasetCollectionAssociation.
|
||||
*/
|
||||
var HDCAListItemEdit = _super.extend({
|
||||
var HDCAListItemEdit = _super.extend(
|
||||
/** @lends HDCAListItemEdit.prototype */{
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
@@ -9,13 +9,12 @@ define([
|
||||
var _super = DC_LI.DCListItemView;
|
||||
/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).
|
||||
*/
|
||||
var HDCAListItemView = _super.extend({
|
||||
var HDCAListItemView = _super.extend(
|
||||
/** @lends HDCAListItemView.prototype */{
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
//logger : console,
|
||||
|
||||
//TODO: not a dataset
|
||||
/** */
|
||||
className : _super.prototype.className + " history-content",
|
||||
|
||||
/** In this override, add the state as a class for use with state-based CSS */
|
||||
|
||||
@@ -19,7 +19,6 @@ var hcontentMixin = HISTORY_CONTENT.HistoryContentMixin,
|
||||
|
||||
//==============================================================================
|
||||
/** @class Backbone model for List Dataset Collection within a History.
|
||||
* @constructs
|
||||
*/
|
||||
var HistoryListDatasetCollection = ListDC.extend( hcontentMixin ).extend(
|
||||
/** @lends HistoryListDatasetCollection.prototype */{
|
||||
|
||||
@@ -34,20 +34,24 @@ var HistoryContentMixin = {
|
||||
// Build a new id (type_id) that prefixes the history_content_type so the bbone collection can differentiate
|
||||
idAttribute : 'type_id',
|
||||
|
||||
/** override constructor to build type_id and insert into original attributes */
|
||||
constructor : function( attrs, options ){
|
||||
attrs.type_id = typeIdStr( attrs.history_content_type, attrs.id );
|
||||
this.debug( 'HistoryContentMixin.constructor:', attrs.type_id );
|
||||
Backbone.Model.apply( this, arguments );
|
||||
},
|
||||
|
||||
/** object level fn for building the type_id string */
|
||||
_typeIdStr : function(){
|
||||
return typeIdStr( this.get( 'history_content_type' ), this.get( 'id' ) );
|
||||
},
|
||||
|
||||
/** add listener to re-create type_id when the id changes */
|
||||
initialize : function( attrs, options ){
|
||||
this.on( 'change:id', this._createTypeId );
|
||||
},
|
||||
|
||||
/** set the type_id in the model attributes */
|
||||
_createTypeId : function(){
|
||||
this.set( 'type_id', this._typeIdStr() );
|
||||
},
|
||||
@@ -90,12 +94,12 @@ var HistoryContentMixin = {
|
||||
return url;
|
||||
},
|
||||
|
||||
/** save this HDA as not visible */
|
||||
/** save this content as not visible */
|
||||
hide : function( options ){
|
||||
if( !this.get( 'visible' ) ){ return jQuery.when(); }
|
||||
return this.save( { visible: false }, options );
|
||||
},
|
||||
/** save this HDA as visible */
|
||||
/** save this content as visible */
|
||||
unhide : function( options ){
|
||||
if( this.get( 'visible' ) ){ return jQuery.when(); }
|
||||
return this.save( { visible: true }, options );
|
||||
@@ -114,6 +118,7 @@ var HistoryContentMixin = {
|
||||
|
||||
|
||||
//==============================================================================
|
||||
//TODO: needed?
|
||||
/** @class (Concrete/non-mixin) base model for content items.
|
||||
*/
|
||||
var HistoryContent = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend( HistoryContentMixin );
|
||||
|
||||
@@ -26,7 +26,6 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
|
||||
/** since history content is a mix, override model fn into a factory, creating based on history_content_type */
|
||||
model : function( attrs, options ) {
|
||||
//console.debug( 'HistoryContents.model:', attrs, options );
|
||||
|
||||
//TODO: can we move the type_id stuff here?
|
||||
//attrs.type_id = typeIdStr( attrs );
|
||||
@@ -70,24 +69,25 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
},
|
||||
|
||||
// ........................................................................ common queries
|
||||
/** Get the ids of every hda in this collection
|
||||
/** Get the ids of every item in this collection
|
||||
* @returns array of encoded ids
|
||||
*/
|
||||
ids : function(){
|
||||
return this.map( function( hda ){ return hda.get('id'); });
|
||||
//TODO: is this still useful since type_id
|
||||
return this.map( function( item ){ return item.get('id'); });
|
||||
},
|
||||
|
||||
/** Get hdas that are not ready
|
||||
* @returns array of HDAs
|
||||
/** Get contents that are not ready
|
||||
* @returns array of content models
|
||||
*/
|
||||
notReady : function(){
|
||||
return this.filter( function( hda ){
|
||||
return !hda.inReadyState();
|
||||
return this.filter( function( content ){
|
||||
return !content.inReadyState();
|
||||
});
|
||||
},
|
||||
|
||||
/** Get the id of every hda in this collection not in a 'ready' state (running).
|
||||
* @returns an array of hda ids
|
||||
/** Get the id of every model in this collection not in a 'ready' state (running).
|
||||
* @returns an array of model ids
|
||||
* @see HistoryDatasetAssociation#inReadyState
|
||||
*/
|
||||
running : function(){
|
||||
@@ -95,24 +95,26 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
this.each( function( item ){
|
||||
var isRunning = !item.inReadyState();
|
||||
if( isRunning ){
|
||||
//TODO: is this still correct since type_id
|
||||
idList.push( item.get( 'id' ) );
|
||||
}
|
||||
});
|
||||
return idList;
|
||||
},
|
||||
|
||||
/** Get the hda with the given hid
|
||||
/** Get the model with the given hid
|
||||
* @param {Int} hid the hid to search for
|
||||
* @returns {HistoryDatasetAssociation} the hda with the given hid or undefined if not found
|
||||
* @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found
|
||||
*/
|
||||
getByHid : function( hid ){
|
||||
return _.first( this.filter( function( hda ){ return hda.get( 'hid' ) === hid; }) );
|
||||
return _.first( this.filter( function( content ){ return content.get( 'hid' ) === hid; }) );
|
||||
},
|
||||
|
||||
/** Get every 'shown' hda in this collection based on show_deleted/hidden
|
||||
* @param {Boolean} show_deleted are we showing deleted hdas?
|
||||
* @param {Boolean} show_hidden are we showing hidden hdas?
|
||||
* @returns array of hda models
|
||||
//TODO:?? this may belong in the containing view
|
||||
/** Get every 'shown' model in this collection based on show_deleted/hidden
|
||||
* @param {Boolean} show_deleted are we showing deleted content?
|
||||
* @param {Boolean} show_hidden are we showing hidden content?
|
||||
* @returns array of content models
|
||||
* @see HistoryDatasetAssociation#isVisible
|
||||
*/
|
||||
getVisible : function( show_deleted, show_hidden, filters ){
|
||||
@@ -131,13 +133,13 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
return filteredHdas;
|
||||
},
|
||||
|
||||
/** return true if any hdas don't have details */
|
||||
/** return true if any contents don't have details */
|
||||
haveDetails : function(){
|
||||
return this.all( function( hda ){ return hda.hasDetails(); });
|
||||
return this.all( function( content ){ return content.hasDetails(); });
|
||||
},
|
||||
|
||||
// ........................................................................ ajax
|
||||
/** fetch detailed model data for all HDAs in this collection */
|
||||
/** fetch detailed model data for all contents in this collection */
|
||||
fetchAllDetails : function( options ){
|
||||
options = options || {};
|
||||
var detailsFlag = { details: 'all' };
|
||||
@@ -145,8 +147,8 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
return this.fetch( options );
|
||||
},
|
||||
|
||||
/** using a queue, perform hdaAjaxFn on each of the hdas in this collection */
|
||||
ajaxQueue : function( hdaAjaxFn, options ){
|
||||
/** using a queue, perform ajaxFn on each of the models in this collection */
|
||||
ajaxQueue : function( ajaxFn, options ){
|
||||
var deferred = jQuery.Deferred(),
|
||||
startingLength = this.length,
|
||||
responses = [];
|
||||
@@ -157,12 +159,12 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
}
|
||||
|
||||
// use reverse order (stylistic choice)
|
||||
var ajaxFns = this.chain().reverse().map( function( hda, i ){
|
||||
var ajaxFns = this.chain().reverse().map( function( content, i ){
|
||||
return function(){
|
||||
var xhr = hdaAjaxFn.call( hda, options );
|
||||
var xhr = ajaxFn.call( content, options );
|
||||
// if successful, notify using the deferred to allow tracking progress
|
||||
xhr.done( function( response ){
|
||||
deferred.notify({ curr: i, total: startingLength, response: response, model: hda });
|
||||
deferred.notify({ curr: i, total: startingLength, response: response, model: content });
|
||||
});
|
||||
// (regardless of previous error or success) if not last ajax call, shift and call the next
|
||||
// if last fn, resolve deferred
|
||||
@@ -183,17 +185,18 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
},
|
||||
|
||||
// ........................................................................ sorting/filtering
|
||||
/** return a new collection of HDAs whose attributes contain the substring matchesWhat */
|
||||
/** return a new collection of contents whose attributes contain the substring matchesWhat */
|
||||
matches : function( matchesWhat ){
|
||||
return this.filter( function( hda ){
|
||||
return hda.matches( matchesWhat );
|
||||
return this.filter( function( content ){
|
||||
return content.matches( matchesWhat );
|
||||
});
|
||||
},
|
||||
|
||||
// ........................................................................ misc
|
||||
/** override to get a correct/smarter merge when incoming data is partial */
|
||||
set : function( models, options ){
|
||||
// arrrrrrrrrrrrrrrrrg...
|
||||
// override to get a correct/smarter merge when incoming data is partial (e.g. stupid backbone)
|
||||
// (e.g. stupid backbone)
|
||||
// w/o this partial models from the server will fill in missing data with model defaults
|
||||
// and overwrite existing data on the client
|
||||
// see Backbone.Collection.set and _prepareModel
|
||||
@@ -213,7 +216,7 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
|
||||
Backbone.Collection.prototype.set.call( this, models, options );
|
||||
},
|
||||
|
||||
/** Convert this ad-hoc collection of HDAs to a formal collection tracked
|
||||
/** Convert this ad-hoc collection of hdas to a formal collection tracked
|
||||
by the server.
|
||||
**/
|
||||
promoteToHistoryDatasetCollection : function _promote( history, collection_type, options ){
|
||||
|
||||
@@ -23,7 +23,7 @@ var _super = HPANEL.ReadOnlyHistoryPanel;
|
||||
* @constructs
|
||||
*/
|
||||
var AnnotatedHistoryPanel = _super.extend(
|
||||
/** @lends HistoryPanel.prototype */{
|
||||
/** @lends AnnotatedHistoryPanel.prototype */{
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
// comment this out to suppress log output
|
||||
|
||||
@@ -7,7 +7,8 @@ define([
|
||||
// ============================================================================
|
||||
/** session storage for history panel preferences (and to maintain state)
|
||||
*/
|
||||
var HistoryPanelPrefs = BASE_MVC.SessionStorageModel.extend({
|
||||
var HistoryPanelPrefs = BASE_MVC.SessionStorageModel.extend(
|
||||
/** @lends HistoryPanelPrefs.prototype */{
|
||||
defaults : {
|
||||
/** is the panel currently showing the search/filter controls? */
|
||||
searching : false,
|
||||
|
||||
@@ -333,9 +333,9 @@ var HistoryPanel = _super.extend(
|
||||
// maintain a list of hdas that are selected
|
||||
hdaView.on( 'selected', function( hdaView, event ){
|
||||
if( !event ){ return; }
|
||||
//console.debug( 'selected', event );
|
||||
//this.debug( 'selected', event );
|
||||
var selectedIds = [];
|
||||
//console.debug( historyView.lastSelectedViewId, historyView.hdaViews[ historyView.lastSelectedViewId ] );
|
||||
//this.debug( historyView.lastSelectedViewId, historyView.hdaViews[ historyView.lastSelectedViewId ] );
|
||||
|
||||
// shift will select a range, but not set lastSelectedViewId
|
||||
if( ( event.shiftKey )
|
||||
@@ -348,19 +348,19 @@ var HistoryPanel = _super.extend(
|
||||
} else {
|
||||
var id = hdaView.model.id;
|
||||
historyView.lastSelectedViewId = id;
|
||||
//console.debug( 'lastSelectedViewId:', historyView.lastSelectedViewId );
|
||||
//this.debug( 'lastSelectedViewId:', historyView.lastSelectedViewId );
|
||||
selectedIds = [ id ];
|
||||
}
|
||||
//console.debug( 'selectedIds:', selectedIds );
|
||||
//this.debug( 'selectedIds:', selectedIds );
|
||||
historyView.selectedHdaIds = _.union( historyView.selectedHdaIds, selectedIds );
|
||||
//TODO: might want to use getSelectedHdaViews instead managing these lists with ops
|
||||
//console.debug( 'selected', historyView.selectedHdaIds );
|
||||
//this.debug( 'selected', historyView.selectedHdaIds );
|
||||
});
|
||||
hdaView.on( 'de-selected', function( hdaView, event ){
|
||||
//console.debug( 'de-selected', event );
|
||||
//this.debug( 'de-selected', event );
|
||||
var id = hdaView.model.id;
|
||||
historyView.selectedHdaIds = _.without( historyView.selectedHdaIds, id );
|
||||
//console.debug( 'de-selected', historyView.selectedHdaIds );
|
||||
//this.debug( 'de-selected', historyView.selectedHdaIds );
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ define([
|
||||
], function( HISTORY_MODEL, HDA_LI, HDCA_LI, USER, BASE_MVC, _l ){
|
||||
// ============================================================================
|
||||
/** session storage for individual history preferences */
|
||||
var HistoryPrefs = BASE_MVC.SessionStorageModel.extend({
|
||||
var HistoryPrefs = BASE_MVC.SessionStorageModel.extend(
|
||||
/** @lends HistoryPrefs.prototype */{
|
||||
|
||||
defaults : {
|
||||
//TODO:?? expandedHdas to array?
|
||||
expandedHdas : {},
|
||||
@@ -85,6 +87,7 @@ var ReadOnlyHistoryPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend
|
||||
|
||||
/** class to use for constructing the HDA views */
|
||||
HDAViewClass : HDA_LI.HDAListItemView,
|
||||
/** class to use for constructing the HDCA views */
|
||||
HDCAViewClass : HDCA_LI.HDCAListItemView,
|
||||
|
||||
tagName : 'div',
|
||||
@@ -753,17 +756,17 @@ var ReadOnlyHistoryPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend
|
||||
this.storage.get( 'show_hidden' ),
|
||||
this.filters
|
||||
).each( function( hda ){
|
||||
//console.debug( 'checking: ', hda.get( 'name' ) );
|
||||
//panel.debug( 'checking: ', hda.get( 'name' ) );
|
||||
if( withinSet ){
|
||||
//console.debug( '\t\t adding: ', hda.get( 'name' ) );
|
||||
//panel.debug( '\t\t adding: ', hda.get( 'name' ) );
|
||||
set.push( panel.hdaViews[ hda.id ] );
|
||||
if( hda === viewA.model || hda === viewB.model ){
|
||||
//console.debug( '\t found last: ', hda.get( 'name' ) );
|
||||
//panel.debug( '\t found last: ', hda.get( 'name' ) );
|
||||
withinSet = false;
|
||||
}
|
||||
} else {
|
||||
if( hda === viewA.model || hda === viewB.model ){
|
||||
//console.debug( 'found first: ', hda.get( 'name' ) );
|
||||
//panel.debug( 'found first: ', hda.get( 'name' ) );
|
||||
withinSet = true;
|
||||
set.push( panel.hdaViews[ hda.id ] );
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
define(["mvc/collection/collection-model","mvc/collection/collection-li","mvc/base-mvc","utils/localization"],function(h,f,a,e){var d=Backbone.View.extend(a.LoggableMixin).extend({tagName:"div",className:"dataset-collection-panel",fxSpeed:"fast",DatasetDCEViewClass:f.DatasetDCEListItemView,NestedDCDCEViewClass:f.NestedDCDCEListItemView,initialize:function(i){i=i||{};if(i.logger){this.logger=i.logger}this.log(this+".initialize:",i);this.linkTarget=i.linkTarget||"_blank";this.hasUser=i.hasUser;this.panelStack=[];this.parentName=i.parentName;window.collectionPanel=this},_setUpListeners:function(){this.on("all",function(i){this.log(this+"",arguments)},this);return this},_setUpModelEventHandlers:function(){return this},render:function(k,l){this.log("render:",k,l);k=(k===undefined)?(this.fxSpeed):(k);var i=this,j;if(!this.model){return this}j=this.renderModel();$(i).queue("fx",[function(m){if(k&&i.$el.is(":visible")){i.$el.fadeOut(k,m)}else{m()}},function(m){i.$el.empty();if(j){i.$el.append(j.children())}m()},function(m){if(k&&!i.$el.is(":visible")){i.$el.fadeIn(k,m)}else{m()}},function(m){if(l){l.call(this)}i.trigger("rendered",this);m()}]);return this},renderModel:function(){var k=this.model.get("collection_type")||this.model.object.get("collection_type"),j=_.extend(this.model.toJSON(),{parentName:this.parentName,type:k}),i=$("<div/>").append(this.templates.panel(j));this._setUpBehaviours(i);this.renderContents(i);return i},_setUpBehaviours:function(i){i=i||this.$el;i.find("[title]").tooltip({placement:"bottom"});return this},$container:function(){return(this.findContainerFn)?(this.findContainerFn.call(this)):(this.$el.parent())},$datasetsList:function(i){return(i||this.$el).find(".datasets-list")},renderContents:function(j){j=j||this.$el;this.warn(this+".renderContents:, model:",this.model);var i=this,l={},k=this.model.getVisibleContents();this.$datasetsList(j).empty();if(k&&k.length){k.each(function(n){var o=n.id,m=i._createContentView(n);l[o]=m;i._attachContentView(m.render(),j)})}this.contentViews=l;return this.contentViews},_createContentView:function(k){var j=null,i=this._getContentClass(k);j=new i({model:k,linkTarget:this.linkTarget,hasUser:this.hasUser,logger:this.logger});this._setUpContentListeners(j);return j},_getContentClass:function(i){switch(i.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.NestedDCDCEViewClass}throw new TypeError("Unknown element type:",i.get("element_type"))},_setUpContentListeners:function(j){var i=this;if(j.model.get("element_type")==="dataset_collection"){j.on("expanded",function(k){i.info("expanded",k);i._addCollectionPanel(k)})}},_addCollectionPanel:function(k){var l=this,i=k.model;var j=new c({model:i,parentName:this.model.get("name"),linkTarget:this.linkTarget});l.panelStack.push(j);l.$(".controls").add(".datasets-list").hide();l.$el.append(j.$el);j.on("close",function(){l.render();k.collapse();l.panelStack.pop()});if(!j.model.hasDetails()){var m=j.model.fetch();m.done(function(){j.render()})}else{j.render()}},_attachContentView:function(k,j){j=j||this.$el;var i=this.$datasetsList(j);i.append(k.$el);return this},events:{"click .navigation .back":"close"},close:function(i){this.$el.remove();this.trigger("close")},toString:function(){return"CollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});d.templates=d.prototype.templates=(function(){var i=_.template(['<div class="controls">','<div class="navigation">','<a class="back" href="javascript:void(0)">','<span class="fa fa-icon fa-angle-left"></span>',e("Back to "),"<%- collection.parentName %>","</a>","</div>",'<div class="title">','<div class="name"><%- collection.name || collection.element_identifier %></div>','<div class="subtitle">','<% if( collection.type === "list" ){ %>',e("a list of datasets"),'<% } else if( collection.type === "paired" ){ %>',e("a pair of datasets"),'<% } else if( collection.type === "list:paired" ){ %>',e("a list of paired datasets"),"<% } %>","</div>","</div>","</div>",'<div class="datasets-list"></div>'].join(""));return{panel:function(j){return i({_l:e,collection:j})}}}());var b=d.extend({DatasetDCEViewClass:f.DatasetDCEListItemView,toString:function(){return"ListCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var c=b.extend({toString:function(){return"PairCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var g=d.extend({NestedDCDCEViewClass:f.NestedDCDCEListItemView,toString:function(){return"ListOfPairsCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CollectionPanel:d,ListCollectionPanel:b,PairCollectionPanel:c,ListOfPairsCollectionPanel:g}});
|
||||
define(["mvc/collection/collection-model","mvc/collection/collection-li","mvc/base-mvc","utils/localization"],function(h,f,a,e){var d=Backbone.View.extend(a.LoggableMixin).extend({tagName:"div",className:"dataset-collection-panel",fxSpeed:"fast",DatasetDCEViewClass:f.DatasetDCEListItemView,NestedDCDCEViewClass:f.NestedDCDCEListItemView,initialize:function(i){i=i||{};if(i.logger){this.logger=i.logger}this.log(this+".initialize:",i);this.linkTarget=i.linkTarget||"_blank";this.hasUser=i.hasUser;this.panelStack=[];this.parentName=i.parentName},_setUpListeners:function(){this.on("all",function(i){this.log(this+"",arguments)},this);return this},_setUpModelEventHandlers:function(){return this},render:function(k,l){this.log("render:",k,l);k=(k===undefined)?(this.fxSpeed):(k);var i=this,j;if(!this.model){return this}j=this.renderModel();$(i).queue("fx",[function(m){if(k&&i.$el.is(":visible")){i.$el.fadeOut(k,m)}else{m()}},function(m){i.$el.empty();if(j){i.$el.append(j.children())}m()},function(m){if(k&&!i.$el.is(":visible")){i.$el.fadeIn(k,m)}else{m()}},function(m){if(l){l.call(this)}i.trigger("rendered",this);m()}]);return this},renderModel:function(){var k=this.model.get("collection_type")||this.model.object.get("collection_type"),j=_.extend(this.model.toJSON(),{parentName:this.parentName,type:k}),i=$("<div/>").append(this.templates.panel(j));this._setUpBehaviours(i);this.renderContents(i);return i},_setUpBehaviours:function(i){i=i||this.$el;i.find("[title]").tooltip({placement:"bottom"});return this},$container:function(){return(this.findContainerFn)?(this.findContainerFn.call(this)):(this.$el.parent())},$datasetsList:function(i){return(i||this.$el).find(".datasets-list")},renderContents:function(j){j=j||this.$el;this.warn(this+".renderContents:, model:",this.model);var i=this,l={},k=this.model.getVisibleContents();this.$datasetsList(j).empty();if(k&&k.length){k.each(function(n){var o=n.id,m=i._createContentView(n);l[o]=m;i._attachContentView(m.render(),j)})}this.contentViews=l;return this.contentViews},_createContentView:function(k){var j=null,i=this._getContentClass(k);j=new i({model:k,linkTarget:this.linkTarget,hasUser:this.hasUser,logger:this.logger});this._setUpContentListeners(j);return j},_getContentClass:function(i){switch(i.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.NestedDCDCEViewClass}throw new TypeError("Unknown element type:",i.get("element_type"))},_setUpContentListeners:function(j){var i=this;if(j.model.get("element_type")==="dataset_collection"){j.on("expanded",function(k){i.info("expanded",k);i._addCollectionPanel(k)})}},_addCollectionPanel:function(k){var l=this,i=k.model;var j=new c({model:i,parentName:this.model.get("name"),linkTarget:this.linkTarget});l.panelStack.push(j);l.$(".controls").add(".datasets-list").hide();l.$el.append(j.$el);j.on("close",function(){l.render();k.collapse();l.panelStack.pop()});if(!j.model.hasDetails()){var m=j.model.fetch();m.done(function(){j.render()})}else{j.render()}},_attachContentView:function(k,j){j=j||this.$el;var i=this.$datasetsList(j);i.append(k.$el);return this},events:{"click .navigation .back":"close"},close:function(i){this.$el.remove();this.trigger("close")},toString:function(){return"CollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});d.templates=d.prototype.templates=(function(){var i=_.template(['<div class="controls">','<div class="navigation">','<a class="back" href="javascript:void(0)">','<span class="fa fa-icon fa-angle-left"></span>',e("Back to "),"<%- collection.parentName %>","</a>","</div>",'<div class="title">','<div class="name"><%- collection.name || collection.element_identifier %></div>','<div class="subtitle">','<% if( collection.type === "list" ){ %>',e("a list of datasets"),'<% } else if( collection.type === "paired" ){ %>',e("a pair of datasets"),'<% } else if( collection.type === "list:paired" ){ %>',e("a list of paired datasets"),"<% } %>","</div>","</div>","</div>",'<div class="datasets-list"></div>'].join(""));return{panel:function(j){return i({_l:e,collection:j})}}}());var b=d.extend({DatasetDCEViewClass:f.DatasetDCEListItemView,toString:function(){return"ListCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var c=b.extend({toString:function(){return"PairCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});var g=d.extend({NestedDCDCEViewClass:f.NestedDCDCEListItemView,toString:function(){return"ListOfPairsCollectionPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CollectionPanel:d,ListCollectionPanel:b,PairCollectionPanel:c,ListOfPairsCollectionPanel:g}});
|
||||
@@ -1 +1 @@
|
||||
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){var f=b.SearchableModelMixin;var e=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(f,{defaults:{state:a.NEW,deleted:false,purged:false,name:"(unnamed dataset)",accessible:true,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(h,g){this.debug("Dataset.initialize",h,g);if(!this.get("accessible")){this.set("state",a.NOT_VIEWABLE)}this.urls=this._generateUrls();this._setUpListeners()},_generateUrls:function(){var i=this.get("id");if(!i){return{}}var h={purge:"datasets/"+i+"/purge_async",display:"datasets/"+i+"/display/?preview=True",edit:"datasets/"+i+"/edit",download:"datasets/"+i+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+i,rerun:"tool_runner/rerun?id="+i,show_params:"datasets/"+i+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+i+"&metadata_name="};var g=(galaxy_config&&galaxy_config.root)?(galaxy_config.root):("/");_.each(h,function(k,j){h[j]=g+k});this.urls=h;return h},_setUpListeners:function(){this.on("change:state",function(h,g){this.log(this+" has changed state:",h,g);if(this.inReadyState()){this.trigger("state:ready",h,g,this.previous("state"))}});this.on("change:id change:file_ext",function(g){this._generateUrls()})},toJSON:function(){var g=Backbone.Model.prototype.toJSON.call(this);return _.extend(g,{urls:this.urls})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},inReadyState:function(){var g=_.contains(a.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||g)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function(g){if(this.get("deleted")){return jQuery.when()}return this.save({deleted:true},g)},undelete:function(g){if(!this.get("deleted")||this.get("purged")){return jQuery.when()}return this.save({deleted:false},g)},purge:function d(g){if(this.get("purged")){return jQuery.when()}g=g||{};g.url=this.urls.purge;var h=this,i=jQuery.ajax(g);i.done(function(l,j,k){h.set({deleted:true,purged:true})});i.fail(function(n,j,m){var k=c("Unable to purge dataset");var l=("Removal of datasets by users is not allowed in this Galaxy instance");if(n.responseJSON&&n.responseJSON.error){k=n.responseJSON.error}else{if(n.responseText.indexOf(l)!==-1){k=l}}n.responseText=k;h.trigger("error",h,n,g,c(k),{error:k})});return i},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 g=this.get("id")||"";if(this.get("name")){g='"'+this.get("name")+'",'+g}return"Dataset("+g+")"}}));return{DatasetAssociation:e}});
|
||||
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){var f=b.SearchableModelMixin;var e=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(f,{defaults:{state:a.NEW,deleted:false,purged:false,name:"(unnamed dataset)",accessible:true,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(g,h){this.debug(this+"(Dataset).initialize",g,h);if(!this.get("accessible")){this.set("state",a.NOT_VIEWABLE)}this.urls=this._generateUrls();this._setUpListeners()},_generateUrls:function(){var i=this.get("id");if(!i){return{}}var h={purge:"datasets/"+i+"/purge_async",display:"datasets/"+i+"/display/?preview=True",edit:"datasets/"+i+"/edit",download:"datasets/"+i+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+i,rerun:"tool_runner/rerun?id="+i,show_params:"datasets/"+i+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+i+"&metadata_name="};var g=(galaxy_config&&galaxy_config.root)?(galaxy_config.root):("/");_.each(h,function(k,j){h[j]=g+k});this.urls=h;return h},_setUpListeners:function(){this.on("change:state",function(h,g){this.log(this+" has changed state:",h,g);if(this.inReadyState()){this.trigger("state:ready",h,g,this.previous("state"))}});this.on("change:id change:file_ext",function(g){this._generateUrls()})},toJSON:function(){var g=Backbone.Model.prototype.toJSON.call(this);return _.extend(g,{urls:this.urls})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},inReadyState:function(){var g=_.contains(a.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||g)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function(g){if(this.get("deleted")){return jQuery.when()}return this.save({deleted:true},g)},undelete:function(g){if(!this.get("deleted")||this.get("purged")){return jQuery.when()}return this.save({deleted:false},g)},purge:function d(g){if(this.get("purged")){return jQuery.when()}g=g||{};g.url=this.urls.purge;var h=this,i=jQuery.ajax(g);i.done(function(l,j,k){h.set({deleted:true,purged:true})});i.fail(function(n,j,m){var k=c("Unable to purge dataset");var l=("Removal of datasets by users is not allowed in this Galaxy instance");if(n.responseJSON&&n.responseJSON.error){k=n.responseJSON.error}else{if(n.responseText.indexOf(l)!==-1){k=l}}n.responseText=k;h.trigger("error",h,n,g,c(k),{error:k})});return i},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 g=this.get("id")||"";if(this.get("name")){g='"'+this.get("name")+'",'+g}return"Dataset("+g+")"}}));return{DatasetAssociation:e}});
|
||||
@@ -1 +1 @@
|
||||
define(["mvc/history/history-content-model","mvc/history/hda-model","mvc/history/hdca-model","mvc/base-mvc","utils/localization"],function(g,e,b,a,c){var f=Backbone.Collection.extend(a.LoggableMixin).extend({model:function(i,h){if(i.history_content_type==="dataset"){return new e.HistoryDatasetAssociation(i,h)}else{if(i.history_content_type==="dataset_collection"){switch(i.collection_type){case"list":return new b.HistoryListDatasetCollection(i,h);case"paired":return new b.HistoryPairDatasetCollection(i,h);case"list:paired":return new b.HistoryListPairedDatasetCollection(i,h)}throw new TypeError("Unknown collection_type: "+i.collection_type)}}throw new TypeError("Unknown history_content_type: "+i.history_content_type)},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(h){return h.get("id")})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(j){var i=!j.inReadyState();if(i){h.push(j.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,k,j){j=j||[];this.debug("checking isVisible");var i=new f(this.filter(function(l){return l.isVisible(h,k)}));_.each(j,function(l){if(!_.isFunction(l)){return}i=new f(i.filter(l))});return i},haveDetails:function(){return this.all(function(h){return h.hasDetails()})},fetchAllDetails:function(i){i=i||{};var h={details:"all"};i.data=(i.data)?(_.extend(i.data,h)):(h);return this.fetch(i)},ajaxQueue:function(k,j){var i=jQuery.Deferred(),h=this.length,m=[];if(!h){i.resolve([]);return i}var l=this.chain().reverse().map(function(o,n){return function(){var p=k.call(o,j);p.done(function(q){i.notify({curr:n,total:h,response:q,model:o})});p.always(function(q){m.push(q);if(l.length){l.shift()()}else{i.resolve(m)}})}}).value();l.shift()();return i},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){var i=this;j=_.map(j,function(m){var l=m.attributes||m,n=g.typeIdStr(l.history_content_type,l.id),o=i.get(n);if(!o){return m}var k=o.toJSON();_.extend(k,m);return k});Backbone.Collection.prototype.set.call(this,j,h)},promoteToHistoryDatasetCollection:function d(m,k,i){i=i||{};i.url=this.url();i.type="POST";var o=k;var l=[],h=null;if(k==="list"){this.chain().each(function(r){var p=r.attributes.name;var s=r.get("id");var q=r.attributes.history_content_type;if(q==="dataset"){if(o!=="list"){this.log("Invalid collection type")}l.push({name:p,src:"hda",id:s})}else{if(o==="list"){o="list:"+r.attributes.collection_type}else{if(o!=="list:"+r.attributes.collection_type){this.log("Invalid collection type")}}l.push({name:p,src:"hdca",id:s})}});h="New Dataset List"}else{if(k==="paired"){var j=this.ids();if(j.length!==2){}l.push({name:"forward",src:"hda",id:j[0]});l.push({name:"reverse",src:"hda",id:j[1]});h="New Dataset Pair"}}i.data={type:"dataset_collection",name:h,collection_type:o,element_identifiers:JSON.stringify(l)};var n=jQuery.ajax(i);n.done(function(r,p,q){m.refresh()});n.fail(function(r,p,q){if(r.responseJSON&&r.responseJSON.error){error=r.responseJSON.error}else{error=r.responseJSON}r.responseText=error});return n},print:function(){var h=this;h.each(function(i){h.debug(i);if(i.elements){h.debug("\t elements:",i.elements)}})},toString:function(){return(["HistoryContents(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryContents:f}});
|
||||
define(["mvc/history/history-content-model","mvc/history/hda-model","mvc/history/hdca-model","mvc/base-mvc","utils/localization"],function(g,e,b,a,c){var f=Backbone.Collection.extend(a.LoggableMixin).extend({model:function(i,h){if(i.history_content_type==="dataset"){return new e.HistoryDatasetAssociation(i,h)}else{if(i.history_content_type==="dataset_collection"){switch(i.collection_type){case"list":return new b.HistoryListDatasetCollection(i,h);case"paired":return new b.HistoryPairDatasetCollection(i,h);case"list:paired":return new b.HistoryListPairedDatasetCollection(i,h)}throw new TypeError("Unknown collection_type: "+i.collection_type)}}throw new TypeError("Unknown history_content_type: "+i.history_content_type)},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(h){return h.get("id")})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(j){var i=!j.inReadyState();if(i){h.push(j.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,k,j){j=j||[];this.debug("checking isVisible");var i=new f(this.filter(function(l){return l.isVisible(h,k)}));_.each(j,function(l){if(!_.isFunction(l)){return}i=new f(i.filter(l))});return i},haveDetails:function(){return this.all(function(h){return h.hasDetails()})},fetchAllDetails:function(i){i=i||{};var h={details:"all"};i.data=(i.data)?(_.extend(i.data,h)):(h);return this.fetch(i)},ajaxQueue:function(m,j){var i=jQuery.Deferred(),h=this.length,l=[];if(!h){i.resolve([]);return i}var k=this.chain().reverse().map(function(o,n){return function(){var p=m.call(o,j);p.done(function(q){i.notify({curr:n,total:h,response:q,model:o})});p.always(function(q){l.push(q);if(k.length){k.shift()()}else{i.resolve(l)}})}}).value();k.shift()();return i},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){var i=this;j=_.map(j,function(m){var l=m.attributes||m,n=g.typeIdStr(l.history_content_type,l.id),o=i.get(n);if(!o){return m}var k=o.toJSON();_.extend(k,m);return k});Backbone.Collection.prototype.set.call(this,j,h)},promoteToHistoryDatasetCollection:function d(m,k,i){i=i||{};i.url=this.url();i.type="POST";var o=k;var l=[],h=null;if(k==="list"){this.chain().each(function(r){var p=r.attributes.name;var s=r.get("id");var q=r.attributes.history_content_type;if(q==="dataset"){if(o!=="list"){this.log("Invalid collection type")}l.push({name:p,src:"hda",id:s})}else{if(o==="list"){o="list:"+r.attributes.collection_type}else{if(o!=="list:"+r.attributes.collection_type){this.log("Invalid collection type")}}l.push({name:p,src:"hdca",id:s})}});h="New Dataset List"}else{if(k==="paired"){var j=this.ids();if(j.length!==2){}l.push({name:"forward",src:"hda",id:j[0]});l.push({name:"reverse",src:"hda",id:j[1]});h="New Dataset Pair"}}i.data={type:"dataset_collection",name:h,collection_type:o,element_identifiers:JSON.stringify(l)};var n=jQuery.ajax(i);n.done(function(r,p,q){m.refresh()});n.fail(function(r,p,q){if(r.responseJSON&&r.responseJSON.error){error=r.responseJSON.error}else{error=r.responseJSON}r.responseText=error});return n},print:function(){var h=this;h.each(function(i){h.debug(i);if(i.elements){h.debug("\t elements:",i.elements)}})},toString:function(){return(["HistoryContents(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryContents:f}});
|
||||
@@ -1 +1 @@
|
||||
define(["mvc/history/history-panel","mvc/history/hda-li","utils/localization"],function(e,b,a){var d=e.ReadOnlyHistoryPanel;var c=d.extend({className:"annotated-history-panel",HDAViewClass:b.HDAReadonlyListItemView,renderModel:function(){this.$el.addClass(this.className);var h=d.prototype.renderModel.call(this),f=this.$datasetsList(h),g=$("<table/>").addClass("datasets-list datasets-table");g.append(f.children());f.replaceWith(g);h.find(".history-subtitle").after(this.renderHistoryAnnotation());h.find(".history-search-btn").hide();h.find(".history-controls").after(h.find(".history-search-controls").show());return h},renderHistoryAnnotation:function(){var f=this.model.get("annotation");if(!f){return null}return $(['<div class="history-annotation">',f,"</div>"].join(""))},renderHdas:function(g){g=g||this.$el;var f=d.prototype.renderHdas.call(this,g);this.$datasetsList(g).prepend($("<tr/>").addClass("headers").append([$("<th/>").text(a("Dataset")),$("<th/>").text(a("Annotation"))]));return f},attachContentView:function(i,g){g=g||this.$el;var j=_.find(i.el.classList,function(k){return(/^state\-/).test(k)}),f=i.model.get("annotation")||"",h=$("<tr/>").addClass("dataset-row").append([$("<td/>").addClass("dataset-container").append(i.$el).addClass(j?j.replace("-","-color-"):""),$("<td/>").addClass("additional-info").text(f)]);this.$datasetsList(g).append(h)},events:_.extend(_.clone(d.prototype.events),{"click tr":function(f){$(f.currentTarget).find(".dataset-title-bar").click()},"click .icon-btn":function(f){f.stopPropagation()}}),toString:function(){return"AnnotatedHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{AnnotatedHistoryPanel:c}});
|
||||
define(["mvc/history/history-panel","mvc/history/hda-li","utils/localization"],function(e,b,a){var d=e.ReadOnlyHistoryPanel;var c=d.extend({className:"annotated-history-panel",renderModel:function(){this.$el.addClass(this.className);var h=d.prototype.renderModel.call(this),f=this.$datasetsList(h),g=$("<table/>").addClass("datasets-list datasets-table");g.append(f.children());f.replaceWith(g);h.find(".history-subtitle").after(this.renderHistoryAnnotation());h.find(".history-search-btn").hide();h.find(".history-controls").after(h.find(".history-search-controls").show());return h},renderHistoryAnnotation:function(){var f=this.model.get("annotation");if(!f){return null}return $(['<div class="history-annotation">',f,"</div>"].join(""))},renderHdas:function(g){g=g||this.$el;var f=d.prototype.renderHdas.call(this,g);this.$datasetsList(g).prepend($("<tr/>").addClass("headers").append([$("<th/>").text(a("Dataset")),$("<th/>").text(a("Annotation"))]));return f},attachContentView:function(i,g){g=g||this.$el;var j=_.find(i.el.classList,function(k){return(/^state\-/).test(k)}),f=i.model.get("annotation")||"",h=$("<tr/>").addClass("dataset-row").append([$("<td/>").addClass("dataset-container").append(i.$el).addClass(j?j.replace("-","-color-"):""),$("<td/>").addClass("additional-info").text(f)]);this.$datasetsList(g).append(h)},events:_.extend(_.clone(d.prototype.events),{"click tr":function(f){$(f.currentTarget).find(".dataset-title-bar").click()},"click .icon-btn":function(f){f.stopPropagation()}}),toString:function(){return"AnnotatedHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{AnnotatedHistoryPanel:c}});
|
||||
Reference in New Issue
Block a user