diff --git a/static/maps/mvc/collection/collection-model.js.map b/static/maps/mvc/collection/collection-model.js.map index 40901deefc80..bfa0545b03b4 100644 --- a/static/maps/mvc/collection/collection-model.js.map +++ b/static/maps/mvc/collection/collection-model.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/collection/collection-model.js"],"names":["DatasetCollectionElementMixin","defaults","model_class","element_identifier","element_index","element_type","_mergeObject","attributes","_","extend","object","element_id","id","options","this","idAttribute","apply","arguments","response","DatasetCollectionElement","Backbone","Model","_baseMvc2","default","LoggableMixin","_logNamespace","DCECollection","Collection","model","toString","length","join","DatasetDCE","_datasetModel2","DatasetAssociation","url","has","Galaxy","root","mixin","console","warn","prototype","_downloadQueryParameters","get","constructor","debug","call","elements","DatasetDCECollection","DatasetCollection","collection_type","deleted","collectionClass","initialize","_createElementsModel","log","unset","silent","self","each","element","index","parent_hdca_id","toJSON","json","inReadyState","populated","isDeletedOrPurged","hasDetails","getVisibleContents","filters","parse","parsed","create_time","Date","update_time","delete","jQuery","when","save","undelete","searchAttributes","idAndName","ListDatasetCollection","NestedDCDCE","objStr","NestedDCDCECollection","NestedPairDCDCE","PairDatasetCollection","NestedPairDCDCECollection","ListPairedDatasetCollection","NestedListDCDCE","NestedListDCDCECollection","ListOfListsDatasetCollection"],"mappings":"0QAkDIA,SAEAC,UACIC,YAAa,2BACbC,mBAAoB,KACpBC,cAAe,KACfC,aAAc,MAIlBC,aAAc,SAASC,GARvBN,OAWIO,EAAEC,OAAOF,EAAYA,EAAWG,QAC5BC,WAAYJ,EAAWK,YAb/BL,EAAAG,OACAT,GAIII,YAAAA,SAAcE,EAAAM,GAiBdN,EAAaO,KAAKR,aAAaC,GAdnCO,KAAAC,YAAA,aACAT,SAAAA,MAAcU,MAAAF,KAAAG,YAINN,MAAAA,SAAAA,EAAYJ,GADwB,IAAAA,EAAxCW,EAIA,OADAX,EAAOA,KAAAA,aAAPA,MAMAY,EAAAC,SAAAC,MAAAZ,OAAAa,EAAAC,QAAAC,eACAj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AGA3D,SAAA,WACAA,OAAU,6BAAWf,KAAAgB,OAAA,KAAAC,KAAA,OAWrB4D,EAAAzC,EAAwCzC,QAGhC4C,gBAAWqC,EAdnB7D,SAAU,WAkBN,OAAA,+BAAAf,KAAA8B,IAAA,QAAA,KAAAb,KAAA,OASZ6D,EAAAR,EAAA3E,OACAa,EAAAC,QAAAgB,MACIsD,GAhBQhD,YAAa,SAAStC,EAAYM,GAoB1CC,KAAAgC,MAAA,kCAAAvC,EAAAM,GACAgB,EAAqBgB,YAAAE,KAAAjC,KAAAP,EAAAM,IAfbgB,SAAU,WAqBtB,OAAA,mBADAf,KAAAJ,OAAA,GAAAI,KAAAJ,OAAAI,KAAA8B,IAAA,sBACA,KAAAb,KAAA,QAQK8D,EAAAN,EAAA9E,QAjBDmB,MAAOgE,EAsBPR,SAAAA,WACAK,OAAAA,6BAAuBA,KAAAA,OAFZ,KAAA1D,KAAA,OAXX+D,EAA+B5C,EAAkBzC,QAEjD4C,gBAAiBwC,EAGjBhE,SAAU,WACN,OAAQ,gCAAiCf,KAAK8B,IAAI,QAAS,KAAKb,KAAK,kBAMzEqD,sBAAuBA,EACvBK,sBAAuBA,EACvBE,4BAA6BA,EAC7BG,6BAA8BA","file":"../../../scripts/mvc/collection/collection-model.js","sourcesContent":["import DATASET_MODEL from \"mvc/dataset/dataset-model\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/*\nNotes:\n\nTerminology:\n DatasetCollection/DC : a container of datasets or nested DatasetCollections\n Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\n\nThis all seems too complex unfortunately:\n\n- Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n either a dataset or a nested DC. This would make the hierarchy much taller. I've\n decided to merge the contained JSON with the DC element json - making the 'has a'\n relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n DRY in both models and views, but may make tracking or tracing within these models\n more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n or DatasetCollections (nested)). This also violates the rule of thumb about\n favoring aggregation over inheritance.\n- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n These each should a) be usable on their own, b) be usable in the context of\n nesting within a collection model (at least in the case of ListPaired), and\n c) be usable within the context of other container models (like History or\n LibraryFolder, etc.). I've tried to separate/extract classes in order to\n handle those three situations, but it's proven difficult to do in a simple,\n readable manner.\n- Ideally, histories and libraries would inherit from the same server models as\n dataset collections do since they are (in essence) dataset collections themselves -\n making the whole nested structure simpler. This would be a large, error-prone\n refactoring and migration.\n\nMany of the classes and heirarchy are meant as extension points so, while the\nrelations and flow may be difficult to understand initially, they'll allow us to\nhandle the growth or flux dataset collection in the future (w/o actually implementing\nany YAGNI).\n\n*/\n//_________________________________________________________________________________________________ ELEMENTS\n/** @class mixin for Dataset collection elements.\n * When collection elements are passed from the API, the underlying element is\n * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n * effectively changing a DCE from a container to a subclass (has a --> is a).\n */\nvar DatasetCollectionElementMixin = {\n /** default attributes used by elements in a dataset collection */\n defaults: {\n model_class: \"DatasetCollectionElement\",\n element_identifier: null,\n element_index: null,\n element_type: null\n },\n\n /** merge the attributes of the sub-object 'object' into this model */\n _mergeObject: function(attributes) {\n // if we don't preserve and correct ids here, the element id becomes the object id\n // and collision in backbone's _byId will occur and only\n _.extend(attributes, attributes.object, {\n element_id: attributes.id\n });\n delete attributes.object;\n return attributes;\n },\n\n /** override to merge this.object into this */\n constructor: function(attributes, options) {\n // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n attributes = this._mergeObject(attributes);\n this.idAttribute = \"element_id\";\n Backbone.Model.apply(this, arguments);\n },\n\n /** when the model is fetched, merge this.object into this */\n parse: function(response, options) {\n var attributes = response;\n attributes = this._mergeObject(attributes);\n return attributes;\n }\n};\n\n/** @class Concrete class of Generic DatasetCollectionElement */\nvar DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin)\n .extend(DatasetCollectionElementMixin)\n .extend({ _logNamespace: \"collections\" });\n\n//==============================================================================\n/** @class Base/Abstract Backbone collection for Generic DCEs. */\nvar DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n /** @lends DCECollection.prototype */ {\n _logNamespace: \"collections\",\n\n model: DatasetCollectionElement,\n\n /** String representation. */\n toString: function() {\n return [\"DatasetCollectionElementCollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n */\nvar DatasetDCE = DATASET_MODEL.DatasetAssociation.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends DatasetDCE.prototype */ {\n /** url fn */\n url: function() {\n // won't always be an hda\n if (!this.has(\"history_id\")) {\n console.warn(\"no endpoint for non-hdas within a collection yet\");\n // (a little silly since this api endpoint *also* points at hdas)\n return `${Galaxy.root}api/datasets`;\n }\n return `${Galaxy.root}api/histories/${this.get(\"history_id\")}/contents/${this.get(\"id\")}`;\n },\n\n defaults: _.extend(\n {},\n DATASET_MODEL.DatasetAssociation.prototype.defaults,\n DatasetCollectionElementMixin.defaults\n ),\n\n _downloadQueryParameters: function() {\n return `?to_ext=${this.get(\"file_ext\")}&hdca_id=${this.get(\n \"parent_hdca_id\"\n )}&element_identifier=${this.get(\"element_identifier\")}`;\n },\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually for now\n /** call the mixin constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t DatasetDCE.constructor:\", attributes, options);\n //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails: function() {\n return this.elements && this.elements.length;\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.get(\"element_identifier\");\n return [\"DatasetDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n */\nvar DatasetDCECollection = DCECollection.extend(\n /** @lends DatasetDCECollection.prototype */ {\n model: DatasetDCE,\n\n /** String representation. */\n toString: function() {\n return [\"DatasetDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//_________________________________________________________________________________________________ COLLECTIONS\n/** @class Backbone model for Dataset Collections.\n * The DC API returns an array of JSON objects under the attribute elements.\n * This model:\n * - removes that array/attribute ('elements') from the model,\n * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n * - passes that json onto the bbone collection\n * - caches the bbone collection in this.elements\n */\nvar DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin)\n .extend(BASE_MVC.SearchableModelMixin)\n .extend(\n /** @lends DatasetCollection.prototype */ {\n _logNamespace: \"collections\",\n\n /** default attributes for a model */\n defaults: {\n /* 'list', 'paired', or 'list:paired' */\n collection_type: null,\n //??\n deleted: false\n },\n\n /** Which class to use for elements */\n collectionClass: DCECollection,\n\n /** set up: create elements instance var and (on changes to elements) update them */\n initialize: function(model, options) {\n this.debug(`${this}(DatasetCollection).initialize:`, model, options, this);\n this.elements = this._createElementsModel();\n this.on(\"change:elements\", function() {\n this.log(\"change:elements\");\n //TODO: prob. better to update the collection instead of re-creating it\n this.elements = this._createElementsModel();\n });\n },\n\n /** move elements model attribute to full collection */\n _createElementsModel: function() {\n this.debug(`${this}._createElementsModel`, this.collectionClass, this.get(\"elements\"), this.elements);\n //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n var elements = this.get(\"elements\") || [];\n this.unset(\"elements\", { silent: true });\n var self = this;\n _.each(elements, (element, index) => {\n _.extend(element, {\n parent_hdca_id: self.get(\"id\")\n });\n });\n this.elements = new this.collectionClass(elements);\n //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n return this.elements;\n },\n\n // ........................................................................ common queries\n /** pass the elements back within the model json when this is serialized */\n toJSON: function() {\n var json = Backbone.Model.prototype.toJSON.call(this);\n if (this.elements) {\n json.elements = this.elements.toJSON();\n }\n return json;\n },\n\n /** Is this collection in a 'ready' state no processing (for the collection) is left\n * to do on the server.\n */\n inReadyState: function() {\n var populated = this.get(\"populated\");\n return this.isDeletedOrPurged() || populated;\n },\n\n //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n /** Does the DC contain any elements yet? Is a fetch() required? */\n hasDetails: function() {\n return this.elements.length !== 0;\n },\n\n /** Given the filters, what models in this.elements would be returned? */\n getVisibleContents: function(filters) {\n // filters unused for now\n return this.elements;\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse: function(response, options) {\n var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n if (parsed.create_time) {\n parsed.create_time = new Date(parsed.create_time);\n }\n if (parsed.update_time) {\n parsed.update_time = new Date(parsed.update_time);\n }\n return parsed;\n },\n\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n delete: function(options) {\n if (this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true }, options);\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete: function(options) {\n if (!this.get(\"deleted\") || this.get(\"purged\")) {\n return jQuery.when();\n }\n return this.save({ deleted: false }, options);\n },\n\n /** Is this collection deleted or purged? */\n isDeletedOrPurged: function() {\n return this.get(\"deleted\") || this.get(\"purged\");\n },\n\n // ........................................................................ searchable\n /** searchable attributes for collections */\n searchAttributes: [\"name\", \"tags\"],\n\n // ........................................................................ misc\n /** String representation */\n toString: function() {\n var idAndName = [this.get(\"id\"), this.get(\"name\") || this.get(\"element_identifier\")];\n return `DatasetCollection(${idAndName.join(\",\")})`;\n }\n }\n );\n\n//==============================================================================\n/** Model for a DatasetCollection containing datasets (non-nested).\n */\nvar ListDatasetCollection = DatasetCollection.extend(\n /** @lends ListDatasetCollection.prototype */ {\n /** override since we know the collection will only contain datasets */\n collectionClass: DatasetDCECollection,\n\n /** String representation. */\n toString: function() {\n return `List${DatasetCollection.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n */\nvar PairDatasetCollection = ListDatasetCollection.extend(\n /** @lends PairDatasetCollection.prototype */ {\n /** String representation. */\n toString: function() {\n return `Pair${DatasetCollection.prototype.toString.call(this)}`;\n }\n }\n);\n\n//_________________________________________________________________________________________________ NESTED COLLECTIONS\n// this is where things get weird, man. Weird.\n//TODO: it might be possible to compact all the following...I think.\n//==============================================================================\n/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n * (a nested collection). Currently only list:paired.\n */\nvar NestedDCDCE = DatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedDCDCE.prototype */ {\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** call the mixin constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedDCDCE.constructor:\", attributes, options);\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n */\nvar NestedDCDCECollection = DCECollection.extend(\n /** @lends NestedDCDCECollection.prototype */ {\n /** This is a collection of nested collections */\n model: NestedDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n */\nvar NestedPairDCDCE = PairDatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedPairDCDCE.prototype */ {\n //TODO:?? possibly rename to NestedDatasetCollection?\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** This is both a collection and a collection element - call the constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedPairDCDCE.constructor:\", attributes, options);\n //DatasetCollection.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedPairDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection for a backbone collection containing paired dataset collections.\n */\nvar NestedPairDCDCECollection = NestedDCDCECollection.extend(\n /** @lends PairDCDCECollection.prototype */ {\n /** We know this collection is composed of only nested pair collections */\n model: NestedPairDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedPairDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n */\nvar ListPairedDatasetCollection = DatasetCollection.extend(\n /** @lends ListPairedDatasetCollection.prototype */ {\n /** list:paired is the only collection that itself contains collections */\n collectionClass: NestedPairDCDCECollection,\n\n /** String representation. */\n toString: function() {\n return [\"ListPairedDatasetCollection(\", this.get(\"name\"), \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\nvar NestedListDCDCE = ListDatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedListDCDCE.prototype */ {\n /** This is both a collection and a collection element - call the constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedListDCDCE.constructor:\", attributes, options);\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedListDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection containing list dataset collections. */\nvar NestedListDCDCECollection = NestedDCDCECollection.extend({\n /** We know this collection is composed of only nested pair collections */\n model: NestedListDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedListDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n});\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\nvar ListOfListsDatasetCollection = DatasetCollection.extend({\n /** list:paired is the only collection that itself contains collections */\n collectionClass: NestedListDCDCECollection,\n\n /** String representation. */\n toString: function() {\n return [\"ListOfListsDatasetCollection(\", this.get(\"name\"), \")\"].join(\"\");\n }\n});\n\n//==============================================================================\nexport default {\n ListDatasetCollection: ListDatasetCollection,\n PairDatasetCollection: PairDatasetCollection,\n ListPairedDatasetCollection: ListPairedDatasetCollection,\n ListOfListsDatasetCollection: ListOfListsDatasetCollection\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/collection/collection-model.js"],"names":["DatasetCollectionElementMixin","defaults","model_class","element_identifier","element_index","element_type","_mergeObject","attributes","_","extend","object","element_id","id","options","this","idAttribute","apply","arguments","response","DatasetCollectionElement","Backbone","Model","_baseMvc2","default","LoggableMixin","_logNamespace","DCECollection","Collection","model","toString","length","join","DatasetDCE","_datasetModel2","DatasetAssociation","url","has","Galaxy","root","mixin","console","warn","prototype","_downloadQueryParameters","get","elementIdentifier","fileExt","constructor","debug","call","hasDetails","elements","DatasetDCECollection","DatasetCollection","SearchableModelMixin","collection_type","deleted","collectionClass","initialize","_createElementsModel","log","silent","unset","self","element","index","parent_hdca_id","toJSON","json","inReadyState","populated","isDeletedOrPurged","getVisibleContents","filters","parse","parsed","create_time","Date","update_time","delete","jQuery","when","save","undelete","searchAttributes","idAndName","ListDatasetCollection","PairDatasetCollection","NestedDCDCE","NestedPairDCDCE","NestedPairDCDCECollection","NestedDCDCECollection","ListPairedDatasetCollection","NestedListDCDCE","ListOfListsDatasetCollection","NestedListDCDCECollection"],"mappings":"0QAkDIA,SAEAC,UACIC,YAAa,2BACbC,mBAAoB,KACpBC,cAAe,KACfC,aAAc,MAIlBC,aAAc,SAASC,GARvBN,OAWIO,EAAEC,OAAOF,EAAYA,EAAWG,QAC5BC,WAAYJ,EAAWK,YAb/BL,EAAAG,OACAT,GAIII,YAAAA,SAAcE,EAAAM,GAiBdN,EAAaO,KAAKR,aAAaC,GAdnCO,KAAAC,YAAA,aACAT,SAAAA,MAAcU,MAAAF,KAAAG,YAINN,MAAAA,SAAAA,EAAYJ,GADwB,IAAAA,EAAxCW,EAIA,OADAX,EAAOA,KAAAA,aAAPA,MAMAY,EAAAC,SAAAC,MAAAZ,OAAAa,EAAAC,QAAAC,eACAjB,OAAAA,GACAE,QAAAgB,cAAA,gBAIJC,EAAAN,SAAAO,WAAAlB,OAAAa,EAAAC,QAAAC,eAAAf,QAEIgB,cAAIlB,cAEJqB,MAAAT,EAkBAU,SAAU,WAdlB,OAAA,sCAAAf,KAAAgB,OAAA,KAAAC,KAAA,OAuBIC,EAAaC,EAAAV,QAAcW,mBAAmBzB,OAZ1CmB,EAAAA,QAAAA,MAcA5B,GAVImC,IAAA,WARZ,OAAArB,KAAAsB,IAAA,cAgBiBC,OAAAC,KAAbN,iBAA2BE,KAAAA,IAAmBzB,cAA9CuB,aACSO,KACLvC,IAAAA,OAMYwC,QAAQC,KAAK,oDAVjCJ,OAAAC,KAAA,iBAOYH,SAAK3B,EAAAC,UAEGwB,EAAAV,QAAUW,mBAAeQ,UAAAzC,SACzBuC,EAAavC,UAGhB0C,yBAAA,WACD,IAAUN,EAAVvB,KAAA8B,IAAA,YAT2BC,EAAA/B,KAAA8B,IAAA,sBAY/B3C,MAAAA,WAEI6C,EAFJ7C,Y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AAI,QAAS,KAAKb,KAAK,kBAMzEuD,sBAAuBA,EACvBC,sBAAuBA,EACvBK,4BAA6BA,EAC7BE,6BAA8BA","file":"../../../scripts/mvc/collection/collection-model.js","sourcesContent":["import DATASET_MODEL from \"mvc/dataset/dataset-model\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/*\nNotes:\n\nTerminology:\n DatasetCollection/DC : a container of datasets or nested DatasetCollections\n Element/DatasetCollectionElement/DCE : an item contained in a DatasetCollection\n HistoryDatasetCollectionAssociation/HDCA: a DatasetCollection contained in a history\n\n\nThis all seems too complex unfortunately:\n\n- Terminology collision between DatasetCollections (DCs) and Backbone Collections.\n- In the DatasetCollections API JSON, DC Elements use a 'Has A' stucture to *contain*\n either a dataset or a nested DC. This would make the hierarchy much taller. I've\n decided to merge the contained JSON with the DC element json - making the 'has a'\n relation into an 'is a' relation. This seems simpler to me and allowed a lot of\n DRY in both models and views, but may make tracking or tracing within these models\n more difficult (since DatasetCollectionElements are now *also* DatasetAssociations\n or DatasetCollections (nested)). This also violates the rule of thumb about\n favoring aggregation over inheritance.\n- Currently, there are three DatasetCollection subclasses: List, Pair, and ListPaired.\n These each should a) be usable on their own, b) be usable in the context of\n nesting within a collection model (at least in the case of ListPaired), and\n c) be usable within the context of other container models (like History or\n LibraryFolder, etc.). I've tried to separate/extract classes in order to\n handle those three situations, but it's proven difficult to do in a simple,\n readable manner.\n- Ideally, histories and libraries would inherit from the same server models as\n dataset collections do since they are (in essence) dataset collections themselves -\n making the whole nested structure simpler. This would be a large, error-prone\n refactoring and migration.\n\nMany of the classes and heirarchy are meant as extension points so, while the\nrelations and flow may be difficult to understand initially, they'll allow us to\nhandle the growth or flux dataset collection in the future (w/o actually implementing\nany YAGNI).\n\n*/\n//_________________________________________________________________________________________________ ELEMENTS\n/** @class mixin for Dataset collection elements.\n * When collection elements are passed from the API, the underlying element is\n * in a sub-object 'object' (IOW, a DCE representing an HDA will have HDA json in element.object).\n * This mixin uses the constructor and parse methods to merge that JSON with the DCE attribtues\n * effectively changing a DCE from a container to a subclass (has a --> is a).\n */\nvar DatasetCollectionElementMixin = {\n /** default attributes used by elements in a dataset collection */\n defaults: {\n model_class: \"DatasetCollectionElement\",\n element_identifier: null,\n element_index: null,\n element_type: null\n },\n\n /** merge the attributes of the sub-object 'object' into this model */\n _mergeObject: function(attributes) {\n // if we don't preserve and correct ids here, the element id becomes the object id\n // and collision in backbone's _byId will occur and only\n _.extend(attributes, attributes.object, {\n element_id: attributes.id\n });\n delete attributes.object;\n return attributes;\n },\n\n /** override to merge this.object into this */\n constructor: function(attributes, options) {\n // console.debug( '\\t DatasetCollectionElement.constructor:', attributes, options );\n attributes = this._mergeObject(attributes);\n this.idAttribute = \"element_id\";\n Backbone.Model.apply(this, arguments);\n },\n\n /** when the model is fetched, merge this.object into this */\n parse: function(response, options) {\n var attributes = response;\n attributes = this._mergeObject(attributes);\n return attributes;\n }\n};\n\n/** @class Concrete class of Generic DatasetCollectionElement */\nvar DatasetCollectionElement = Backbone.Model.extend(BASE_MVC.LoggableMixin)\n .extend(DatasetCollectionElementMixin)\n .extend({ _logNamespace: \"collections\" });\n\n//==============================================================================\n/** @class Base/Abstract Backbone collection for Generic DCEs. */\nvar DCECollection = Backbone.Collection.extend(BASE_MVC.LoggableMixin).extend(\n /** @lends DCECollection.prototype */ {\n _logNamespace: \"collections\",\n\n model: DatasetCollectionElement,\n\n /** String representation. */\n toString: function() {\n return [\"DatasetCollectionElementCollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a dataset collection element that is a dataset (HDA).\n */\nvar DatasetDCE = DATASET_MODEL.DatasetAssociation.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends DatasetDCE.prototype */ {\n /** url fn */\n url: function() {\n // won't always be an hda\n if (!this.has(\"history_id\")) {\n console.warn(\"no endpoint for non-hdas within a collection yet\");\n // (a little silly since this api endpoint *also* points at hdas)\n return `${Galaxy.root}api/datasets`;\n }\n return `${Galaxy.root}api/histories/${this.get(\"history_id\")}/contents/${this.get(\"id\")}`;\n },\n\n defaults: _.extend(\n {},\n DATASET_MODEL.DatasetAssociation.prototype.defaults,\n DatasetCollectionElementMixin.defaults\n ),\n\n _downloadQueryParameters: function() {\n var fileExt = this.get(\"file_ext\");\n var elementIdentifier = this.get(\"element_identifier\");\n var parentHdcaId = this.get(\"parent_hdca_id\");\n return `?to_ext=${fileExt}&hdca_id=${parentHdcaId}&element_identifier=${elementIdentifier}`;\n },\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually for now\n /** call the mixin constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t DatasetDCE.constructor:\", attributes, options);\n //DATASET_MODEL.DatasetAssociation.prototype.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** Does this model already contain detailed data (as opposed to just summary level data)? */\n hasDetails: function() {\n return this.elements && this.elements.length;\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.get(\"element_identifier\");\n return `DatasetDCE({objStr})`;\n }\n }\n )\n);\n\n//==============================================================================\n/** @class DCECollection of DatasetDCE's (a list of datasets, a pair of datasets).\n */\nvar DatasetDCECollection = DCECollection.extend(\n /** @lends DatasetDCECollection.prototype */ {\n model: DatasetDCE,\n\n /** String representation. */\n toString: function() {\n return [\"DatasetDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//_________________________________________________________________________________________________ COLLECTIONS\n/** @class Backbone model for Dataset Collections.\n * The DC API returns an array of JSON objects under the attribute elements.\n * This model:\n * - removes that array/attribute ('elements') from the model,\n * - creates a bbone collection (of the class defined in the 'collectionClass' attribute),\n * - passes that json onto the bbone collection\n * - caches the bbone collection in this.elements\n */\nvar DatasetCollection = Backbone.Model.extend(BASE_MVC.LoggableMixin)\n .extend(BASE_MVC.SearchableModelMixin)\n .extend(\n /** @lends DatasetCollection.prototype */ {\n _logNamespace: \"collections\",\n\n /** default attributes for a model */\n defaults: {\n /* 'list', 'paired', or 'list:paired' */\n collection_type: null,\n //??\n deleted: false\n },\n\n /** Which class to use for elements */\n collectionClass: DCECollection,\n\n /** set up: create elements instance var and (on changes to elements) update them */\n initialize: function(model, options) {\n this.debug(`${this}(DatasetCollection).initialize:`, model, options, this);\n this.elements = this._createElementsModel();\n this.on(\"change:elements\", function() {\n this.log(\"change:elements\");\n //TODO: prob. better to update the collection instead of re-creating it\n this.elements = this._createElementsModel();\n });\n },\n\n /** move elements model attribute to full collection */\n _createElementsModel: function() {\n this.debug(`${this}._createElementsModel`, this.collectionClass, this.get(\"elements\"), this.elements);\n //TODO: same patterns as DatasetCollectionElement _createObjectModel - refactor to BASE_MVC.hasSubModel?\n var elements = this.get(\"elements\") || [];\n this.unset(\"elements\", { silent: true });\n var self = this;\n _.each(elements, (element, index) => {\n _.extend(element, {\n parent_hdca_id: self.get(\"id\")\n });\n });\n this.elements = new this.collectionClass(elements);\n //this.debug( 'collectionClass:', this.collectionClass + '', this.elements );\n return this.elements;\n },\n\n // ........................................................................ common queries\n /** pass the elements back within the model json when this is serialized */\n toJSON: function() {\n var json = Backbone.Model.prototype.toJSON.call(this);\n if (this.elements) {\n json.elements = this.elements.toJSON();\n }\n return json;\n },\n\n /** Is this collection in a 'ready' state no processing (for the collection) is left\n * to do on the server.\n */\n inReadyState: function() {\n var populated = this.get(\"populated\");\n return this.isDeletedOrPurged() || populated;\n },\n\n //TODO:?? the following are the same interface as DatasetAssociation - can we combine?\n /** Does the DC contain any elements yet? Is a fetch() required? */\n hasDetails: function() {\n return this.elements.length !== 0;\n },\n\n /** Given the filters, what models in this.elements would be returned? */\n getVisibleContents: function(filters) {\n // filters unused for now\n return this.elements;\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse: function(response, options) {\n var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n if (parsed.create_time) {\n parsed.create_time = new Date(parsed.create_time);\n }\n if (parsed.update_time) {\n parsed.update_time = new Date(parsed.update_time);\n }\n return parsed;\n },\n\n /** save this dataset, _Mark_ing it as deleted (just a flag) */\n delete: function(options) {\n if (this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true }, options);\n },\n /** save this dataset, _Mark_ing it as undeleted */\n undelete: function(options) {\n if (!this.get(\"deleted\") || this.get(\"purged\")) {\n return jQuery.when();\n }\n return this.save({ deleted: false }, options);\n },\n\n /** Is this collection deleted or purged? */\n isDeletedOrPurged: function() {\n return this.get(\"deleted\") || this.get(\"purged\");\n },\n\n // ........................................................................ searchable\n /** searchable attributes for collections */\n searchAttributes: [\"name\", \"tags\"],\n\n // ........................................................................ misc\n /** String representation */\n toString: function() {\n var idAndName = [this.get(\"id\"), this.get(\"name\") || this.get(\"element_identifier\")];\n return `DatasetCollection(${idAndName.join(\",\")})`;\n }\n }\n );\n\n//==============================================================================\n/** Model for a DatasetCollection containing datasets (non-nested).\n */\nvar ListDatasetCollection = DatasetCollection.extend(\n /** @lends ListDatasetCollection.prototype */ {\n /** override since we know the collection will only contain datasets */\n collectionClass: DatasetDCECollection,\n\n /** String representation. */\n toString: function() {\n return `List${DatasetCollection.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** Model for a DatasetCollection containing fwd/rev datasets (a list of 2).\n */\nvar PairDatasetCollection = ListDatasetCollection.extend(\n /** @lends PairDatasetCollection.prototype */ {\n /** String representation. */\n toString: function() {\n return `Pair${DatasetCollection.prototype.toString.call(this)}`;\n }\n }\n);\n\n//_________________________________________________________________________________________________ NESTED COLLECTIONS\n// this is where things get weird, man. Weird.\n//TODO: it might be possible to compact all the following...I think.\n//==============================================================================\n/** @class Backbone model for a Generic DatasetCollectionElement that is also a DatasetCollection\n * (a nested collection). Currently only list:paired.\n */\nvar NestedDCDCE = DatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedDCDCE.prototype */ {\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** call the mixin constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedDCDCE.constructor:\", attributes, options);\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection containing Generic NestedDCDCE's (nested dataset collections).\n */\nvar NestedDCDCECollection = DCECollection.extend(\n /** @lends NestedDCDCECollection.prototype */ {\n /** This is a collection of nested collections */\n model: NestedDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a paired dataset collection within a list:paired dataset collection.\n */\nvar NestedPairDCDCE = PairDatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedPairDCDCE.prototype */ {\n //TODO:?? possibly rename to NestedDatasetCollection?\n\n // because all objects have constructors (as this hashmap would even if this next line wasn't present)\n // the constructor in hcontentMixin won't be attached by BASE_MVC.mixin to this model\n // - re-apply manually it now\n /** This is both a collection and a collection element - call the constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedPairDCDCE.constructor:\", attributes, options);\n //DatasetCollection.constructor.call( this, attributes, options );\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedPairDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection for a backbone collection containing paired dataset collections.\n */\nvar NestedPairDCDCECollection = NestedDCDCECollection.extend(\n /** @lends PairDCDCECollection.prototype */ {\n /** We know this collection is composed of only nested pair collections */\n model: NestedPairDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedPairDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains DatasetCollections (pairs).\n */\nvar ListPairedDatasetCollection = DatasetCollection.extend(\n /** @lends ListPairedDatasetCollection.prototype */ {\n /** list:paired is the only collection that itself contains collections */\n collectionClass: NestedPairDCDCECollection,\n\n /** String representation. */\n toString: function() {\n return [\"ListPairedDatasetCollection(\", this.get(\"name\"), \")\"].join(\"\");\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for a list dataset collection within a list:list dataset collection. */\nvar NestedListDCDCE = ListDatasetCollection.extend(\n BASE_MVC.mixin(\n DatasetCollectionElementMixin,\n /** @lends NestedListDCDCE.prototype */ {\n /** This is both a collection and a collection element - call the constructor */\n constructor: function(attributes, options) {\n this.debug(\"\\t NestedListDCDCE.constructor:\", attributes, options);\n DatasetCollectionElementMixin.constructor.call(this, attributes, options);\n },\n\n /** String representation. */\n toString: function() {\n var objStr = this.object ? `${this.object}` : this.get(\"element_identifier\");\n return [\"NestedListDCDCE(\", objStr, \")\"].join(\"\");\n }\n }\n )\n);\n\n//==============================================================================\n/** @class Backbone collection containing list dataset collections. */\nvar NestedListDCDCECollection = NestedDCDCECollection.extend({\n /** We know this collection is composed of only nested pair collections */\n model: NestedListDCDCE,\n\n /** String representation. */\n toString: function() {\n return [\"NestedListDCDCECollection(\", this.length, \")\"].join(\"\");\n }\n});\n\n//==============================================================================\n/** @class Backbone Model for a DatasetCollection (list) that contains other lists. */\nvar ListOfListsDatasetCollection = DatasetCollection.extend({\n /** list:paired is the only collection that itself contains collections */\n collectionClass: NestedListDCDCECollection,\n\n /** String representation. */\n toString: function() {\n return [\"ListOfListsDatasetCollection(\", this.get(\"name\"), \")\"].join(\"\");\n }\n});\n\n//==============================================================================\nexport default {\n ListDatasetCollection: ListDatasetCollection,\n PairDatasetCollection: PairDatasetCollection,\n ListPairedDatasetCollection: ListPairedDatasetCollection,\n ListOfListsDatasetCollection: ListOfListsDatasetCollection\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/collection/collection-view.js.map b/static/maps/mvc/collection/collection-view.js.map index 0a97683d0c17..f1e05083a6d0 100644 --- a/static/maps/mvc/collection/collection-view.js.map +++ b/static/maps/mvc/collection/collection-view.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/collection/collection-view.js"],"names":["_super","_listView2","default","ModelListPanel","CollectionView","extend","_logNamespace","className","prototype","DatasetDCEViewClass","_collectionLi2","DatasetDCEListItemView","NestedDCDCEViewClass","NestedDCDCEListItemView","modelCollectionKey","initialize","attributes","call","this","logNamespace","linkTarget","panelStack","parentName","foldoutStyle","Galaxy","root","model","id","console","log","_queueNewRender","$newRender","speed","undefined","fxSpeed","panel","trigger","getVisibleContents","get","_swapNewRender","TypeError","_getItemViewOptions","options","_","_getItemViewClass","hasUser","_setUpItemViewListeners","view","drilldown","v","_collapseDrilldownPanel","push","$","add","$list","$el","append","_expandDrilldownPanel","pop","render","events","click .navigation .back","close","event","remove","toString","templates","_baseMvc2","wrapTemplate","_localization2","controlsTemplate","controls","ListCollectionView","clone","PairCollectionView","ListOfPairsCollectionView","ListOfListsCollectionView","foldoutPanelClass"],"mappings":"4VAaIA,EAASC,EAAAC,QAAUC,eACnBC,EAAiBJ,EAAOK,QAGpBC,cAXW,cAaXC,UAAcP,EAAOQ,UAAUD,UAA/B,4BAGAE,oBAAqBC,EAAAR,QAAMS,uBAfnCC,qBAAAF,EAAAR,QAAAW,wBAmBQC,mBAAoB,WAXxBC,WAAA,SAAAC,GACIhB,EAAAQ,UAAAO,WAAAE,KAAAC,KAAAF,GACAV,KAAAA,WAAea,EAFoBC,YAAA,SAInCb,KAAAA,QAAqBC,EAAUD,QAE/BW,KAAAG,cAEAH,KAAAI,WAAAN,EAAAM,WAEAJ,KAAAK,aAAAP,EAAAO,cAAA,UACAT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KQ,MAAQR,KAAKQ,MAAMY,IAAI,QAAU,IAA1E,kBAMJlC,eAAgBA,EAChBoE,mBAAoBA,EACpBE,mBAAoBA,EACpBC,0BAA2BA,EAC3BC,0BAA2BA","file":"../../../scripts/mvc/collection/collection-view.js","sourcesContent":["import LIST_VIEW from \"mvc/list/list-view\";\nimport DC_MODEL from \"mvc/collection/collection-model\";\nimport DC_LI from \"mvc/collection/collection-li\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\nvar logNamespace = \"collections\";\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a dataset collection.\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar CollectionView = _super.extend(\n /** @lends CollectionView.prototype */ {\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n _logNamespace: logNamespace,\n\n className: `${_super.prototype.className} dataset-collection-panel`,\n\n /** sub view class used for datasets */\n DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey: \"elements\",\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize: function(attributes) {\n _super.prototype.initialize.call(this, attributes);\n this.linkTarget = attributes.linkTarget || \"_blank\";\n\n this.hasUser = attributes.hasUser;\n /** A stack of panels that currently cover or hide this panel */\n this.panelStack = [];\n /** The text of the link to go back to the panel containing this one */\n this.parentName = attributes.parentName;\n /** foldout or drilldown */\n this.foldoutStyle = attributes.foldoutStyle || \"foldout\";\n this.downloadUrl = `${Galaxy.root}api/dataset_collections/${this.model.attributes.id}/download`;\n console.log(this);\n },\n\n _queueNewRender: function($newRender, speed) {\n speed = speed === undefined ? this.fxSpeed : speed;\n var panel = this;\n panel.log(\"_queueNewRender:\", $newRender, speed);\n\n // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n // this causes display: block for those elems after the use of show/hide animations\n // animations are removed from this view for now until fixed\n panel._swapNewRender($newRender);\n panel.trigger(\"rendered\", panel);\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, use model.getVisibleContents */\n _filterCollection: function() {\n //TODO: should *not* be model.getVisibleContents - visibility is not model related\n return this.model.getVisibleContents();\n },\n\n /** override to return proper view class based on element_type */\n _getItemViewClass: function(model) {\n //this.debug( this + '._getItemViewClass:', model );\n //TODO: subclasses use DCEViewClass - but are currently unused - decide\n switch (model.get(\"element_type\")) {\n case \"hda\":\n return this.DatasetDCEViewClass;\n case \"dataset_collection\":\n return this.NestedDCDCEViewClass;\n }\n throw new TypeError(\"Unknown element type:\", model.get(\"element_type\"));\n },\n\n /** override to add link target and anon */\n _getItemViewOptions: function(model) {\n var options = _super.prototype._getItemViewOptions.call(this, model);\n return _.extend(options, {\n linkTarget: this.linkTarget,\n hasUser: this.hasUser,\n //TODO: could move to only nested: list:paired\n foldoutStyle: this.foldoutStyle\n });\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners: function(view) {\n var panel = this;\n _super.prototype._setUpItemViewListeners.call(panel, view);\n\n // use pub-sub to: handle drilldown expansion and collapse\n panel.listenTo(view, {\n \"expanded:drilldown\": function(v, drilldown) {\n this._expandDrilldownPanel(drilldown);\n },\n \"collapsed:drilldown\": function(v, drilldown) {\n this._collapseDrilldownPanel(drilldown);\n }\n });\n return this;\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel: function(drilldown) {\n this.panelStack.push(drilldown);\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$(\"> .controls\")\n .add(this.$list())\n .hide();\n drilldown.parentName = this.model.get(\"name\");\n this.$el.append(drilldown.render().$el);\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel: function(drilldown) {\n this.panelStack.pop();\n this.render();\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events: {\n \"click .navigation .back\": \"close\"\n },\n\n /** close/remove this collection panel */\n close: function(event) {\n this.remove();\n this.trigger(\"close\");\n },\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `CollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n//------------------------------------------------------------------------------ TEMPLATES\nCollectionView.prototype.templates = (() => {\n var controlsTemplate = BASE_MVC.wrapTemplate(\n [\n '
',\n '
',\n '',\n '',\n _l(\"Back to \"),\n \"<%- view.parentName %>\",\n \"\",\n \"
\",\n\n '
',\n '
<%- collection.name || collection.element_identifier %>
',\n '
',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l(\"a list of datasets\"),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l(\"a pair of datasets\"),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l(\"a list of paired datasets\"),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l(\"a list of dataset lists\"),\n \"<% } %>\",\n \"
\",\n \"
\",\n\n '
',\n\n '
',\n '',\n '\" title=\"\" download=\"\" data-original-title=\"Download Collection\">',\n '',\n \"\",\n \"
\",\n \"
\"\n ],\n \"collection\"\n );\n\n return _.extend(_.clone(_super.prototype.templates), {\n controls: controlsTemplate\n });\n})();\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionView = CollectionView.extend(\n /** @lends ListCollectionView.prototype */ {\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `ListCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionView = ListCollectionView.extend(\n /** @lends PairCollectionView.prototype */ {\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `PairCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListOfPairsCollectionView = CollectionView.extend(\n /** @lends ListOfPairsCollectionView.prototype */ {\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass: PairCollectionView\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `ListOfPairsCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionView = CollectionView.extend({\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass: PairCollectionView\n }),\n\n /** string rep */\n toString: function() {\n return `ListOfListsCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n});\n\n//==============================================================================\nexport default {\n CollectionView: CollectionView,\n ListCollectionView: ListCollectionView,\n PairCollectionView: PairCollectionView,\n ListOfPairsCollectionView: ListOfPairsCollectionView,\n ListOfListsCollectionView: ListOfListsCollectionView\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/collection/collection-view.js"],"names":["_super","_listView2","default","ModelListPanel","CollectionView","extend","_logNamespace","className","prototype","DatasetDCEViewClass","_collectionLi2","DatasetDCEListItemView","NestedDCDCEViewClass","NestedDCDCEListItemView","modelCollectionKey","initialize","attributes","call","this","logNamespace","linkTarget","panelStack","parentName","foldoutStyle","Galaxy","root","model","id","_queueNewRender","$newRender","speed","undefined","fxSpeed","panel","_swapNewRender","_filterCollection","downloadUrl","getVisibleContents","get","trigger","TypeError","_getItemViewOptions","options","_","_getItemViewClass","hasUser","_setUpItemViewListeners","view","drilldown","v","_collapseDrilldownPanel","push","$","add","$list","$el","append","_expandDrilldownPanel","pop","render","events","click .navigation .back","close","event","remove","toString","templates","_baseMvc2","wrapTemplate","_localization2","controlsTemplate","controls","ListCollectionView","clone","PairCollectionView","ListOfPairsCollectionView","ListOfListsCollectionView","foldoutPanelClass"],"mappings":"4VAaIA,EAASC,EAAAC,QAAUC,eACnBC,EAAiBJ,EAAOK,QAGpBC,cAXW,cAaXC,UAAcP,EAAOQ,UAAUD,UAA/B,4BAGAE,oBAAqBC,EAAAR,QAAMS,uBAfnCC,qBAAAF,EAAAR,QAAAW,wBAmBQC,mBAAoB,WAXxBC,WAAA,SAAAC,GACIhB,EAAAQ,UAAAO,WAAAE,KAAAC,KAAAF,GACAV,KAAAA,WAAea,EAFoBC,YAAA,SAInCb,KAAAA,QAAqBC,EAAUD,QAE/BW,KAAAG,cAEAH,KAAAI,WAAAN,EAAAM,WAEAJ,KAAAK,aAAAP,EAAAO,cAAA,UACAT,KAAAA,YAAoBU,OAXeC,KAWnCX,2BAXmCI,KAAAQ,MAAAV,WAAAW,GAWnCb,aAGAc,gBAAA,SAAAC,EAAAC,GAkBIA,OAAkBC,IAAVD,EAAsBZ,KAAKc,QAAUF,EAC7C,IAAIG,EAAQf,KAhBhBH,EAAAA,IAAY,mBAASC,EAAYc,GAK7BG,EAAAC,eAAAL,GACAI,EAAKZ,QAAAA,WAALY,IAKAE,kBAAKC,WAmBL,OAAOlB,KAAKQ,MAAMW,sBAblBJ,kBAAU,SAAAP,GAGV,OAAAA,EAAAY,IAAA,iBACA,IAAA,MACMJ,OAAAA,KAANzB,oBACAwB,IAAMM,qBAxCyB,OAAArB,KAAAN,qBA2CnC,MAAA,IAAA4B,UAAA,wBAAAd,EAAAY,IAAA,kBAIIG,oBAAO,SAAWJ,GA/Ca,IAAAK,EAAA1C,EAAAQ,UAAAiC,oBAAAxB,KAAAC,KAAAQ,GAkE/B,OAAOiB,EAAEtC,OAAOqC,GAhBpBtB,WAAAF,KAAAE,WACAwB,QAAAA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,IAAAE,EAAApE,EAAAC,QAIQI,oBAAAC,EAAAR,QAAAS,uBAE2DsD,SAHb,WApB1C,MAAA,uBAA6B/C,KAAKQ,MAAQR,KAAKQ,MAAMY,IAAI,QAAU,IAAnE,OAORoC,EAAqBF,EAAmBnE,QA+BxC4D,SAAA,WACArD,MAAAA,uBAAsBM,KAAAQ,MAAMb,KAAAA,MAAAA,IAAAA,QAAwBR,IAApDO,OAOC+D,EAAAvE,EAAAC,QAvBGO,qBA2BOF,EAAAR,QAAAW,wBAAAR,QACXD,kBAAgBA,IAtBZ6D,SAAU,WACN,MAAA,8BAAoC/C,KAAKQ,MAAQR,KAAKQ,MAAMY,IAAI,QAAU,IAA1E,OAORsC,EAA4BxE,EAAeC,QAE3CO,qBAAsBF,EAAAR,QAAMW,wBAAwBR,QAChDwE,kBAAmBH,IAIvBT,SAAU,WACN,MAAA,8BAAoC/C,KAAKQ,MAAQR,KAAKQ,MAAMY,IAAI,QAAU,IAA1E,kBAMJlC,eAAgBA,EAChBoE,mBAAoBA,EACpBE,mBAAoBA,EACpBC,0BAA2BA,EAC3BC,0BAA2BA","file":"../../../scripts/mvc/collection/collection-view.js","sourcesContent":["import LIST_VIEW from \"mvc/list/list-view\";\nimport DC_MODEL from \"mvc/collection/collection-model\";\nimport DC_LI from \"mvc/collection/collection-li\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\nvar logNamespace = \"collections\";\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a dataset collection.\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar CollectionView = _super.extend(\n /** @lends CollectionView.prototype */ {\n //MODEL is either a DatasetCollection (or subclass) or a DatasetCollectionElement (list of pairs)\n _logNamespace: logNamespace,\n\n className: `${_super.prototype.className} dataset-collection-panel`,\n\n /** sub view class used for datasets */\n DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey: \"elements\",\n\n // ......................................................................... SET UP\n /** Set up the view, set up storage, bind listeners to HistoryContents events\n * @param {Object} attributes optional settings for the panel\n */\n initialize: function(attributes) {\n _super.prototype.initialize.call(this, attributes);\n this.linkTarget = attributes.linkTarget || \"_blank\";\n\n this.hasUser = attributes.hasUser;\n /** A stack of panels that currently cover or hide this panel */\n this.panelStack = [];\n /** The text of the link to go back to the panel containing this one */\n this.parentName = attributes.parentName;\n /** foldout or drilldown */\n this.foldoutStyle = attributes.foldoutStyle || \"foldout\";\n this.downloadUrl = `${Galaxy.root}api/dataset_collections/${this.model.attributes.id}/download`;\n },\n\n _queueNewRender: function($newRender, speed) {\n speed = speed === undefined ? this.fxSpeed : speed;\n var panel = this;\n panel.log(\"_queueNewRender:\", $newRender, speed);\n\n // TODO: jquery@1.12 doesn't change display when the elem has display: flex\n // this causes display: block for those elems after the use of show/hide animations\n // animations are removed from this view for now until fixed\n panel._swapNewRender($newRender);\n panel.trigger(\"rendered\", panel);\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** In this override, use model.getVisibleContents */\n _filterCollection: function() {\n //TODO: should *not* be model.getVisibleContents - visibility is not model related\n return this.model.getVisibleContents();\n },\n\n /** override to return proper view class based on element_type */\n _getItemViewClass: function(model) {\n //this.debug( this + '._getItemViewClass:', model );\n //TODO: subclasses use DCEViewClass - but are currently unused - decide\n switch (model.get(\"element_type\")) {\n case \"hda\":\n return this.DatasetDCEViewClass;\n case \"dataset_collection\":\n return this.NestedDCDCEViewClass;\n }\n throw new TypeError(\"Unknown element type:\", model.get(\"element_type\"));\n },\n\n /** override to add link target and anon */\n _getItemViewOptions: function(model) {\n var options = _super.prototype._getItemViewOptions.call(this, model);\n return _.extend(options, {\n linkTarget: this.linkTarget,\n hasUser: this.hasUser,\n //TODO: could move to only nested: list:paired\n foldoutStyle: this.foldoutStyle\n });\n },\n\n // ------------------------------------------------------------------------ collection sub-views\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners: function(view) {\n var panel = this;\n _super.prototype._setUpItemViewListeners.call(panel, view);\n\n // use pub-sub to: handle drilldown expansion and collapse\n panel.listenTo(view, {\n \"expanded:drilldown\": function(v, drilldown) {\n this._expandDrilldownPanel(drilldown);\n },\n \"collapsed:drilldown\": function(v, drilldown) {\n this._collapseDrilldownPanel(drilldown);\n }\n });\n return this;\n },\n\n /** Handle drill down by hiding this panels list and controls and showing the sub-panel */\n _expandDrilldownPanel: function(drilldown) {\n this.panelStack.push(drilldown);\n // hide this panel's controls and list, set the name for back navigation, and attach to the $el\n this.$(\"> .controls\")\n .add(this.$list())\n .hide();\n drilldown.parentName = this.model.get(\"name\");\n this.$el.append(drilldown.render().$el);\n },\n\n /** Handle drilldown close by freeing the panel and re-rendering this panel */\n _collapseDrilldownPanel: function(drilldown) {\n this.panelStack.pop();\n this.render();\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events: {\n \"click .navigation .back\": \"close\"\n },\n\n /** close/remove this collection panel */\n close: function(event) {\n this.remove();\n this.trigger(\"close\");\n },\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `CollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n//------------------------------------------------------------------------------ TEMPLATES\nCollectionView.prototype.templates = (() => {\n var controlsTemplate = BASE_MVC.wrapTemplate(\n [\n '
',\n '
',\n '',\n '',\n _l(\"Back to \"),\n \"<%- view.parentName %>\",\n \"\",\n \"
\",\n\n '
',\n '
<%- collection.name || collection.element_identifier %>
',\n '
',\n '<% if( collection.collection_type === \"list\" ){ %>',\n _l(\"a list of datasets\"),\n '<% } else if( collection.collection_type === \"paired\" ){ %>',\n _l(\"a pair of datasets\"),\n '<% } else if( collection.collection_type === \"list:paired\" ){ %>',\n _l(\"a list of paired datasets\"),\n '<% } else if( collection.collection_type === \"list:list\" ){ %>',\n _l(\"a list of dataset lists\"),\n \"<% } %>\",\n \"
\",\n \"
\",\n\n '
',\n\n '
',\n '',\n '\" title=\"\" download=\"\" data-original-title=\"Download Collection\">',\n '',\n \"\",\n \"
\",\n \"
\"\n ],\n \"collection\"\n );\n\n return _.extend(_.clone(_super.prototype.templates), {\n controls: controlsTemplate\n });\n})();\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListCollectionView = CollectionView.extend(\n /** @lends ListCollectionView.prototype */ {\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for datasets */\n DatasetDCEViewClass: DC_LI.DatasetDCEListItemView,\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `ListCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar PairCollectionView = ListCollectionView.extend(\n /** @lends PairCollectionView.prototype */ {\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `PairCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a dataset collection. */\nvar ListOfPairsCollectionView = CollectionView.extend(\n /** @lends ListOfPairsCollectionView.prototype */ {\n //TODO: not strictly needed - due to switch in CollectionView._getContentClass\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass: PairCollectionView\n }),\n\n // ........................................................................ misc\n /** string rep */\n toString: function() {\n return `ListOfPairsCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n// =============================================================================\n/** @class non-editable, read-only View/Controller for a list of lists dataset collection. */\nvar ListOfListsCollectionView = CollectionView.extend({\n /** sub view class used for nested collections */\n NestedDCDCEViewClass: DC_LI.NestedDCDCEListItemView.extend({\n foldoutPanelClass: PairCollectionView\n }),\n\n /** string rep */\n toString: function() {\n return `ListOfListsCollectionView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n});\n\n//==============================================================================\nexport default {\n CollectionView: CollectionView,\n ListCollectionView: ListCollectionView,\n PairCollectionView: PairCollectionView,\n ListOfPairsCollectionView: ListOfPairsCollectionView,\n ListOfListsCollectionView: ListOfListsCollectionView\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/hda-li.js.map b/static/maps/mvc/history/hda-li.js.map index 04d09fa64be5..b40b7bfb12b9 100644 --- a/static/maps/mvc/history/hda-li.js.map +++ b/static/maps/mvc/history/hda-li.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/hda-li.js"],"names":["_super","_datasetLi2","default","DatasetListItemView","HDAListItemView","extend","className","prototype","initialize","attributes","options","call","this","toString","model","templates","titleBarTemplate","warnings","_","hidden","_baseMvc2","wrapTemplate","titleBar","_localization2"],"mappings":"iQAKIA,EAASC,EAAAC,QAAWC,oBAMpBC,EAAkBJ,EAAOK,QAErBC,UAAcN,EAAOO,UAAUD,UAA/B,mBAEAE,WAAY,SAASC,EAAYC,GAC7BV,EAAOO,UAAUC,WAAWG,KAAKC,KAAMH,EAAYC,IAV/DG,SAAA,WAiBY,MAAA,oBADkBD,KAAKE,MAAL,GAAgBF,KAAKE,MAAU,cACjD,OARJN,EAAAA,UAAYO,UAAA,WACRf,IAAAA,EAAOO,EAAAA,QAAUC,cAGrB,6CACA,mCACAK,sBAEI,+CACH,gDAbT,SA8BY,QAbZ,0BACA,wFACAT,wCACQY,4DAEI,UACA,YAGA,UACA,UAgBR,WAIYC,EAAAC,EAAAb,UAAAL,EAAAO,UACAQ,UAAAE,UALqDE,OAAjEC,EAAAlB,QAAAmB,cAeIC,gCACAL,gDAFJ,EAAAM,EAAArB,SAAA,gCAtCJ,SAgCgB,WAEJ,aAIR,OAAOgB,EAAEb,UAAWL,EAAOO,UAAUQ,WACjCO,SAAUN,EACVC,SAAUA,IAvDE,cA6DhBb,gBAAiBA","file":"../../../scripts/mvc/history/hda-li.js","sourcesContent":["import DATASET_LI from \"mvc/dataset/dataset-li\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Read only view for HistoryDatasetAssociation.\n * Since there are no controls on the HDAView to hide the dataset,\n * the primary thing this class does (currently) is override templates\n * to render the HID.\n */\nvar HDAListItemView = _super.extend(\n /** @lends HDAListItemView.prototype */ {\n className: `${_super.prototype.className} history-content`,\n\n initialize: function(attributes, options) {\n _super.prototype.initialize.call(this, attributes, options);\n },\n\n // ......................................................................... misc\n /** String representation */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDAListItemView(${modelString})`;\n }\n }\n);\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemView.prototype.templates = (() => {\n var titleBarTemplate = BASE_MVC.wrapTemplate(\n [\n // adding the hid display to the title\n '
',\n '',\n '
',\n //TODO: remove whitespace and use margin-right\n '<%- dataset.hid %> ',\n '<%- dataset.name %>',\n \"
\",\n \"
\",\n '',\n \"<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>\",\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n \"<% } %>\",\n \"<% }); %>\",\n \"\",\n \"
\"\n ],\n \"dataset\"\n );\n\n var warnings = _.extend({}, _super.prototype.templates.warnings, {\n hidden: BASE_MVC.wrapTemplate(\n [\n // add a warning when hidden\n \"<% if( !dataset.visible ){ %>\",\n '
',\n _l(\"This dataset has been hidden\"),\n \"
\",\n \"<% } %>\"\n ],\n \"dataset\"\n )\n });\n\n return _.extend({}, _super.prototype.templates, {\n titleBar: titleBarTemplate,\n warnings: warnings\n });\n})();\n\n//==============================================================================\nexport default {\n HDAListItemView: HDAListItemView\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/hda-li.js"],"names":["_super","_datasetLi2","default","DatasetListItemView","HDAListItemView","extend","className","prototype","initialize","attributes","options","call","this","model","templates","warnings","_","hidden","_baseMvc2","wrapTemplate","_localization2","titleBar","titleBarTemplate","dataset","hid","escape","name","_historyItemLi2","nametagTemplate","modelString"],"mappings":"wSAMIA,EAASC,EAAAC,QAAWC,oBAMpBC,EAAkBJ,EAAOK,QAErBC,UAAcN,EAAOO,UAAUD,UAA/B,mBAEAE,WAAY,SAASC,EAAYC,GAC7BV,EAAOO,UAAUC,WAAWG,KAAKC,KAAMH,EAAYC,IAX3DV,SAAS,WAkBD,MAAA,oBAjBZY,KAAAC,MAAA,GAAAD,KAAAC,MAAA,cAiBY,OAOZT,EAAgBG,UAAUO,UAAa,WAf/BN,IAaRO,EAAAC,EAAAX,UAAAL,EAAAO,UAAAO,UAAAC,UACAE,OAAAC,EAAAhB,QAAAiB,cAE2B,gCAAvB,gDAkBY,EAAAC,EAAAlB,SAAG,gCANXa,SACAE,WAGQ,aAWRI,OAAAA,EAAAA,UAAUC,EAAAA,UADkCR,WAE5CC,SA5CY,SAAAQ,GAAA,MAAA,0KAIZA,EAAAC,IAJY,+CAKZR,EAAAS,OAAAF,EAAAG,MALY,+DAQRC,EAAAzB,QAAA0B,gBAA0BC,GARlB,0BA0CgCd,SAAhDA,IA3BmC,cAkCxBX,gBACMA","file":"../../../scripts/mvc/history/hda-li.js","sourcesContent":["import DATASET_LI from \"mvc/dataset/dataset-li\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport HISTORY_ITEM_LI from \"mvc/history/history-item-li\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = DATASET_LI.DatasetListItemView;\n/** @class Read only view for HistoryDatasetAssociation.\n * Since there are no controls on the HDAView to hide the dataset,\n * the primary thing this class does (currently) is override templates\n * to render the HID.\n */\nvar HDAListItemView = _super.extend(\n /** @lends HDAListItemView.prototype */ {\n className: `${_super.prototype.className} history-content`,\n\n initialize: function(attributes, options) {\n _super.prototype.initialize.call(this, attributes, options);\n },\n\n // ......................................................................... misc\n /** String representation */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDAListItemView(${modelString})`;\n }\n }\n);\n\n// ............................................................................ TEMPLATES\n/** underscore templates */\nHDAListItemView.prototype.templates = (() => {\n var titleBarTemplate = dataset => `\n
\n \n
\n ${dataset.hid}\n ${_.escape(dataset.name)}\n
\n
\n ${HISTORY_ITEM_LI.nametagTemplate(dataset)}\n
\n `;\n\n var warnings = _.extend({}, _super.prototype.templates.warnings, {\n hidden: BASE_MVC.wrapTemplate(\n [\n // add a warning when hidden\n \"<% if( !dataset.visible ){ %>\",\n '
',\n _l(\"This dataset has been hidden\"),\n \"
\",\n \"<% } %>\"\n ],\n \"dataset\"\n )\n });\n\n return _.extend({}, _super.prototype.templates, {\n titleBar: titleBarTemplate,\n warnings: warnings\n });\n})();\n\n//==============================================================================\nexport default {\n HDAListItemView: HDAListItemView\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/hdca-li-edit.js.map b/static/maps/mvc/history/hdca-li-edit.js.map index 198c4435af59..66c61e4631fe 100644 --- a/static/maps/mvc/history/hdca-li-edit.js.map +++ b/static/maps/mvc/history/hdca-li-edit.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/hdca-li-edit.js"],"names":["_super","_hdcaLi2","default","HDCAListItemView","HDCAListItemEdit","extend","_getFoldoutPanelClass","this","model","get","_collectionViewEdit2","ListCollectionViewEdit","PairCollectionViewEdit","ListOfListsCollectionViewEdit","TypeError","log","prototype","_renderPrimaryActions","_renderDeleteButton","self","deleted","_faIconButton2","title","_localization2","classes","faIcon","disabled","onclick","$el","find","trigger","toString"],"mappings":"wTAMIA,EAASC,EAAAC,QAAQC,iBAGjBC,EAAmBJ,EAAOK,QAMtBC,sBAAuB,WACnB,OAAQC,KAAKC,MAAMC,IAAI,oBACnB,IAAK,OACD,OAAOC,EAAAR,QAAaS,uBACxB,IAAK,SACD,OAAOD,EAAAR,QAAaU,uBAfxC,IAAA,cACa,OAAAF,EAAAR,QAAQC,8BACrB,IAAA,YAiBoB,OAAOO,EAAAR,QAAaW,8BAdpC,MAAA,IAAAC,UAAA,2BAAyCP,KAAAC,MAAAC,IAAA,qBAKrCH,sBAAuB,WAGX,OAFRC,KAAAQ,IAAQR,KAAR,0BAEQP,EAAAgB,UAAOC,sBAAaN,KAAAA,MAAAA,QAAAA,KAApBO,yBAIAA,oBAAO,WACX,IAAAC,EAAKZ,KACDa,EAAAb,KAAOC,MAAAC,IAAA,WARf,OAAA,EAAAY,EAAAnB,UAUAoB,MAAUR,GAAJ,EAAAS,EAAArB,SAAA,0CAAwD,EAAAqB,EAAArB,SAAA,UAhB7BsB,QAAA,aAkC7BC,OAAQ,WAfhBC,SAAAN,EACAO,QAAA,WAEIR,EAAAS,IAAAC,KAAA,wBAAAC,QAAA,YACAX,EAAAX,MAAA,aAOAuB,SAAIX,WAEAE,MAAAA,qBADGf,KAAAC,MAAA,GAAAD,KAAaC,MAAA,cAChBc,kBAOIH,iBAAAA","file":"../../../scripts/mvc/history/hdca-li-edit.js","sourcesContent":["import HDCA_LI from \"mvc/history/hdca-li\";\nimport DC_VIEW_EDIT from \"mvc/collection/collection-view-edit\";\nimport faIconButton from \"ui/fa-icon-button\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = HDCA_LI.HDCAListItemView;\n/** @class Editing view for HistoryDatasetCollectionAssociation.\n */\nvar HDCAListItemEdit = _super.extend(\n /** @lends HDCAListItemEdit.prototype */ {\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** Override to return editable versions of the collection panels */\n _getFoldoutPanelClass: function() {\n switch (this.model.get(\"collection_type\")) {\n case \"list\":\n return DC_VIEW_EDIT.ListCollectionViewEdit;\n case \"paired\":\n return DC_VIEW_EDIT.PairCollectionViewEdit;\n case \"list:paired\":\n return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n case \"list:list\":\n return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n }\n throw new TypeError(`Uknown collection_type: ${this.model.get(\"collection_type\")}`);\n },\n\n // ......................................................................... delete\n /** In this override, add the delete button. */\n _renderPrimaryActions: function() {\n this.log(`${this}._renderPrimaryActions`);\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call(this).concat([this._renderDeleteButton()]);\n },\n\n /** Render icon-button to delete this collection. */\n _renderDeleteButton: function() {\n var self = this;\n var deleted = this.model.get(\"deleted\");\n return faIconButton({\n title: deleted ? _l(\"Dataset collection is already deleted\") : _l(\"Delete\"),\n classes: \"delete-btn\",\n faIcon: \"fa-times\",\n disabled: deleted,\n onclick: function() {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n self.$el.find(\".icon-btn.delete-btn\").trigger(\"mouseout\");\n self.model[\"delete\"]();\n }\n });\n },\n\n // ......................................................................... misc\n /** string rep */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDCAListItemEdit(${modelString})`;\n }\n }\n);\n\n//==============================================================================\nexport default {\n HDCAListItemEdit: HDCAListItemEdit\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/hdca-li-edit.js"],"names":["_super","_hdcaLi2","default","HDCAListItemView","HDCAListItemEdit","extend","_getFoldoutPanelClass","collectionType","this","model","get","_collectionViewEdit2","ListCollectionViewEdit","PairCollectionViewEdit","ListOfPairsCollectionViewEdit","ListOfListsCollectionViewEdit","TypeError","_renderPrimaryActions","log","prototype","_renderDeleteButton","_this","deleted","_faIconButton2","title","_localization2","classes","faIcon","disabled","onclick","trigger","toString"],"mappings":"wTAMIA,EAASC,EAAAC,QAAQC,iBAGjBC,EAAmBJ,EAAOK,QAMtBC,sBAAuB,WACnB,IAAIC,EAAiBC,KAAKC,MAAMC,IAAI,mBACpC,OAAQH,GACJ,IAAK,OACD,OAAOI,EAAAT,QAAaU,uBACxB,IAAK,SAfrB,OAAAD,EAAAT,QAAAW,uBACIb,IAAS,cACb,OAAAW,EAAAT,QAAAY,8BAiBgB,IAAK,YAfjBV,OAAmBJ,EAAAA,QAAAe,8BAEf,MAAA,IAAAC,UAAA,4BAAAT,IAKIU,sBAAIV,WAGI,OAFRC,KAAAU,IAAQX,KAAR,0BAEQP,EAAAmB,UAAOF,sBAAaL,KAAAA,MAAAA,QAAAA,KAApBQ,yBAIAA,oBAAO,WAAA,IAAAC,EAAAb,KACXc,EAAKd,KAAAC,MAALC,IAAA,WACI,OAAA,EAAAa,EAAArB,UARRsB,MAAAF,GAAA,EAAAG,EAAAvB,SAAA,0CAAA,EAAAuB,EAAAvB,SAAA,UAUAwB,QAAUV,aAjBuBW,OAAA,WAmC7BC,SAAUN,EAflBO,QAAA,WAEAZ,EAAAA,IAAAA,KAAuB,wBAAAa,QAAW,YAC9BT,EAAAZ,MAAA,aAM4BsB,SAAA,WAC5B,MAAA,qBAiBkBvB,KAAKC,MAAL,GAAgBD,KAAKC,MAAU,cAjBjD,kBAOQL,iBAAAA","file":"../../../scripts/mvc/history/hdca-li-edit.js","sourcesContent":["import HDCA_LI from \"mvc/history/hdca-li\";\nimport DC_VIEW_EDIT from \"mvc/collection/collection-view-edit\";\nimport faIconButton from \"ui/fa-icon-button\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = HDCA_LI.HDCAListItemView;\n/** @class Editing view for HistoryDatasetCollectionAssociation.\n */\nvar HDCAListItemEdit = _super.extend(\n /** @lends HDCAListItemEdit.prototype */ {\n /** logger used to record this.log messages, commonly set to console */\n //logger : console,\n\n /** Override to return editable versions of the collection panels */\n _getFoldoutPanelClass: function() {\n var collectionType = this.model.get(\"collection_type\");\n switch (collectionType) {\n case \"list\":\n return DC_VIEW_EDIT.ListCollectionViewEdit;\n case \"paired\":\n return DC_VIEW_EDIT.PairCollectionViewEdit;\n case \"list:paired\":\n return DC_VIEW_EDIT.ListOfPairsCollectionViewEdit;\n case \"list:list\":\n return DC_VIEW_EDIT.ListOfListsCollectionViewEdit;\n }\n throw new TypeError(`Unknown collection_type: ${collectionType}`);\n },\n\n // ......................................................................... delete\n /** In this override, add the delete button. */\n _renderPrimaryActions: function() {\n this.log(`${this}._renderPrimaryActions`);\n // render the display, edit attr and delete icon-buttons\n return _super.prototype._renderPrimaryActions.call(this).concat([this._renderDeleteButton()]);\n },\n\n /** Render icon-button to delete this collection. */\n _renderDeleteButton: function() {\n var deleted = this.model.get(\"deleted\");\n return faIconButton({\n title: deleted ? _l(\"Dataset collection is already deleted\") : _l(\"Delete\"),\n classes: \"delete-btn\",\n faIcon: \"fa-times\",\n disabled: deleted,\n onclick: () => {\n // ...bler... tooltips being left behind in DOM (hover out never called on deletion)\n this.$el.find(\".icon-btn.delete-btn\").trigger(\"mouseout\");\n this.model[\"delete\"]();\n }\n });\n },\n\n // ......................................................................... misc\n /** string rep */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDCAListItemEdit(${modelString})`;\n }\n }\n);\n\n//==============================================================================\nexport default {\n HDCAListItemEdit: HDCAListItemEdit\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/hdca-li.js.map b/static/maps/mvc/history/hdca-li.js.map index 845368abc522..bdcd4585d300 100644 --- a/static/maps/mvc/history/hdca-li.js.map +++ b/static/maps/mvc/history/hdca-li.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/hdca-li.js"],"names":["_super","_collectionLi2","default","DCListItemView","HDCAListItemView","extend","className","prototype","_setUpListeners","call","this","listenTo","model","change:tags change:populated change:visible","options","render","_getFoldoutPanelClass","get","_collectionView2","ListCollectionView","PairCollectionView","ListOfPairsCollectionView","TypeError","_swapNewRender","$newRender","state","_states2","OK","RUNNING","$el","addClass","toString","templates","warnings","_","hidden","_baseMvc2","_localization2","titleBarTemplate","titleBar"],"mappings":"gVAOIA,EAASC,EAAAC,QAAMC,eAGfC,EAAmBJ,EAAOK,QAEtBC,UAAcN,EAAOO,UAAUD,UAA/B,mBAGAE,gBAAiB,WACbR,EAAOO,UAAUC,gBAAgBC,KAAKC,MACtCA,KAAKC,SAASD,KAAKE,OACfC,8CAA+C,SAASD,EAAOE,GAC3DJ,KAAKK,aAXzBC,sBAAA,WAkBY,OAAQN,KAAKE,MAAMK,IAAI,oBAhB/Bb,IAAAA,OACA,OAAAc,EAAAhB,QAAAiB,mBACIb,IAAcN,SAkBF,OAAOkB,EAAAhB,QAAQkB,mBAhB3B,IAAA,cACAZ,OAAiBU,EAAAhB,QAAAmB,0BACbrB,IAAOO,YACFI,OAASO,EAAAhB,QAAKU,0BAEX,MAAA,IAAAU,UAAA,2BAAAZ,KAAAE,MAAAK,IAAA,qBAqBZM,eAAgB,SAASC,GAhBzBxB,EAAAO,UAAAgB,eAAAd,KAAAC,KAAAc,GAEI,IAAAC,EAAab,KAALA,MAAeK,IAAA,aAAvBS,EAAAxB,QAAAyB,GAAAD,EAAAxB,QAAA0B,QAIQ,OAFAlB,KAAAmB,IAAAC,SAAA,SAAOL,GAEPf,KAAAmB,KAJRE,SAAA,WAfiC,MAAA,qBAyBvBT,KAAJV,MAAIU,GAAJZ,KAAAE,MAAyC,cAzBd,OAgCjCR,EAAIqB,UAASO,UAAe,WAC5B,IAAAC,EAAAC,EAAA7B,UAAAL,EAAAO,UAAAyB,UAAAC,UACAE,OAAAC,EAAAlC,QAAS4B,cAlCwB,mCAuD7B,gDAhBR,EAAAO,EAAAnC,SAAA,mCACA,SACA6B,WAEI,gBAMZ3B,EAAiBG,EAAAA,QAAUyB,cAIX,6CACA,mCAJZ,sBAcA,kDACIM,mDAEI,SACA,+BAGA,0BACA,2FAMA,wCAUR,4DACIL,UACAM,YAFJ,UAvCJ,UA6CA,cACe,OAPJL,EAAE7B,UAAWL,EAAOO,UAAUyB,WACjCC,SAAUA,EACVM,SAAUD,IA1DsB,cAgEpClC,iBAAkBA","file":"../../../scripts/mvc/history/hdca-li.js","sourcesContent":["import STATES from \"mvc/dataset/states\";\nimport DC_LI from \"mvc/collection/collection-li\";\nimport DC_VIEW from \"mvc/collection/collection-view\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = DC_LI.DCListItemView;\n/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n */\nvar HDCAListItemView = _super.extend(\n /** @lends HDCAListItemView.prototype */ {\n className: `${_super.prototype.className} history-content`,\n\n /** event listeners */\n _setUpListeners: function() {\n _super.prototype._setUpListeners.call(this);\n this.listenTo(this.model, {\n \"change:tags change:populated change:visible\": function(model, options) {\n this.render();\n }\n });\n },\n\n /** Override to provide the proper collections panels as the foldout */\n _getFoldoutPanelClass: function() {\n switch (this.model.get(\"collection_type\")) {\n case \"list\":\n return DC_VIEW.ListCollectionView;\n case \"paired\":\n return DC_VIEW.PairCollectionView;\n case \"list:paired\":\n return DC_VIEW.ListOfPairsCollectionView;\n case \"list:list\":\n return DC_VIEW.ListOfListsCollectionView;\n }\n throw new TypeError(`Uknown collection_type: ${this.model.get(\"collection_type\")}`);\n },\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender: function($newRender) {\n _super.prototype._swapNewRender.call(this, $newRender);\n //TODO: model currently has no state\n var state = !this.model.get(\"populated\") ? STATES.RUNNING : STATES.OK;\n //if( this.model.has( 'state' ) ){\n this.$el.addClass(`state-${state}`);\n //}\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDCAListItemView(${modelString})`;\n }\n }\n);\n\n/** underscore templates */\nHDCAListItemView.prototype.templates = (() => {\n var warnings = _.extend({}, _super.prototype.templates.warnings, {\n hidden: BASE_MVC.wrapTemplate(\n [\n // add a warning when hidden\n \"<% if( !collection.visible ){ %>\",\n '
',\n _l(\"This collection has been hidden\"),\n \"
\",\n \"<% } %>\"\n ],\n \"collection\"\n )\n });\n\n // could steal this from hda-base (or use mixed content)\n var titleBarTemplate = BASE_MVC.wrapTemplate(\n [\n // adding the hid display to the title\n '
',\n '',\n '
',\n //TODO: remove whitespace and use margin-right\n '<%- collection.hid %> ',\n '<%- collection.name %>',\n \"
\",\n '
',\n '',\n \"<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>\",\n '<% if (tag.indexOf(\"name:\") == 0){ %>',\n '<%- tag.slice(5) %>',\n \"<% } %>\",\n \"<% }); %>\",\n \"\",\n \"
\"\n ],\n \"collection\"\n );\n\n return _.extend({}, _super.prototype.templates, {\n warnings: warnings,\n titleBar: titleBarTemplate\n });\n})();\n\n//==============================================================================\nexport default {\n HDCAListItemView: HDCAListItemView\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/hdca-li.js"],"names":["_super","_collectionLi2","default","DCListItemView","HDCAListItemView","extend","className","prototype","_setUpListeners","call","this","listenTo","model","change:tags change:populated change:visible","options","render","collectionType","get","_collectionView2","ListCollectionView","PairCollectionView","ListOfPairsCollectionView","TypeError","_swapNewRender","$newRender","_states2","OK","RUNNING","$el","addClass","state","toString","templates","warnings","hidden","collection","_localization2","_","titleBar","hid","escape","name"],"mappings":"uXAQIA,EAASC,EAAAC,QAAMC,eAGfC,EAAmBJ,EAAOK,QAEtBC,UAAcN,EAAOO,UAAUD,UAA/B,mBAGAE,gBAAiB,WACbR,EAAOO,UAAUC,gBAAgBC,KAAKC,MACtCA,KAAKC,SAASD,KAAKE,OACfC,8CAA+C,SAASD,EAAOE,GAC3DJ,KAAKK,aAZrBf,sBAAS,WACb,IAAAgB,EAAAN,KAAAE,MAAAK,IAAA,mBAmBY,OAAQD,GAjBhBZ,IAAAA,OACA,OAAAc,EAAAhB,QAAAiB,mBACIb,IAAcN,SAmBF,OAAOkB,EAAAhB,QAAQkB,mBAjB3B,IAAA,cACAZ,OAAiBU,EAAAhB,QAAAmB,0BACbrB,IAAOO,YACFI,OAASO,EAAAhB,QAAKU,0BAEX,MAAA,IAAAU,UAAA,4BAAAN,IAsBZO,eAAgB,SAASC,GAjBzBxB,EAAAO,UAAAgB,eAAAd,KAAAC,KAAAc,GAEI,IAAIR,EAAAA,KAAAA,MAAiBC,IAAKL,aAA1Ba,EAAAvB,QAAAwB,GAAoCD,EAAAvB,QAAAyB,QAIhC,OAFAjB,KAAAkB,IAAKC,SAAL,SAAAC,GAEApB,KAAKkB,KAKDG,SAAA,WAER,MAAA,qBAVArB,KAAAE,MAAA,GAAAF,KAAAE,MAAA,cAUA,OAMAR,EAAAG,UAAAyB,UAAA,WACA,IAAAC,EAAIH,EAAAA,UAAclB,EAALL,UAAeyB,UAAeC,UAC3CC,OAAA,SAAAC,GACAA,EAASN,UAET,EAAAO,EAAAlC,SAAA,sCAcyD,OAAjEmC,EAAAhC,UAAAL,EAAAO,UAAAyB,WAsBIC,SAAUA,EAddK,SAjBc,SAAAH,GAAA,MAAA,0KA3ClBA,EAAAI,IA2CkB,+CAuBmBF,EAAEG,OAAOL,EAAWM,MAvBvC,sFASVR,EAAAA,QAAa5B,gBAAkBE,GATrB,4BAVN,cAyCJ0B,iBAAUA","file":"../../../scripts/mvc/history/hdca-li.js","sourcesContent":["import STATES from \"mvc/dataset/states\";\nimport DC_LI from \"mvc/collection/collection-li\";\nimport DC_VIEW from \"mvc/collection/collection-view\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport HISTORY_ITEM_LI from \"mvc/history/history-item-li\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\nvar _super = DC_LI.DCListItemView;\n/** @class Read only view for HistoryDatasetCollectionAssociation (a dataset collection inside a history).\n */\nvar HDCAListItemView = _super.extend(\n /** @lends HDCAListItemView.prototype */ {\n className: `${_super.prototype.className} history-content`,\n\n /** event listeners */\n _setUpListeners: function() {\n _super.prototype._setUpListeners.call(this);\n this.listenTo(this.model, {\n \"change:tags change:populated change:visible\": function(model, options) {\n this.render();\n }\n });\n },\n\n /** Override to provide the proper collections panels as the foldout */\n _getFoldoutPanelClass: function() {\n var collectionType = this.model.get(\"collection_type\");\n switch (collectionType) {\n case \"list\":\n return DC_VIEW.ListCollectionView;\n case \"paired\":\n return DC_VIEW.PairCollectionView;\n case \"list:paired\":\n return DC_VIEW.ListOfPairsCollectionView;\n case \"list:list\":\n return DC_VIEW.ListOfListsCollectionView;\n }\n throw new TypeError(`Unknown collection_type: ${collectionType}`);\n },\n\n /** In this override, add the state as a class for use with state-based CSS */\n _swapNewRender: function($newRender) {\n _super.prototype._swapNewRender.call(this, $newRender);\n //TODO: model currently has no state\n var state = !this.model.get(\"populated\") ? STATES.RUNNING : STATES.OK;\n //if( this.model.has( 'state' ) ){\n this.$el.addClass(`state-${state}`);\n //}\n return this.$el;\n },\n\n // ......................................................................... misc\n /** String representation */\n toString: function() {\n var modelString = this.model ? `${this.model}` : \"(no model)\";\n return `HDCAListItemView(${modelString})`;\n }\n }\n);\n\n/** underscore templates */\nHDCAListItemView.prototype.templates = (() => {\n var warnings = _.extend({}, _super.prototype.templates.warnings, {\n hidden: collection => {\n collection.visible\n ? \"\"\n : `
${_l(\"This collection has been hidden\")}
`;\n }\n });\n\n // could steal this from hda-base (or use mixed content)\n var titleBarTemplate = collection => `\n
\n \n
\n ${collection.hid}\n ${_.escape(collection.name)}\n
\n
\n ${HISTORY_ITEM_LI.nametagTemplate(collection)}\n
\n `;\n\n return _.extend({}, _super.prototype.templates, {\n warnings: warnings,\n titleBar: titleBarTemplate\n });\n})();\n\n//==============================================================================\nexport default {\n HDCAListItemView: HDCAListItemView\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/hdca-model.js.map b/static/maps/mvc/history/hdca-model.js.map index 85924a60435e..f0bddd8b7bc5 100644 --- a/static/maps/mvc/history/hdca-model.js.map +++ b/static/maps/mvc/history/hdca-model.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/hdca-model.js"],"names":["buildHDCASave","_super","attributes","options","ListDC","this","isNew","url","urlRoot","get","hcontentMixin","call","ListDatasetCollection","_historyContentModel2","default","HistoryContentMixin","_collectionModel2","PairDC","PairDatasetCollection","ListPairedDC","ListPairedDatasetCollection","ListOfListsDC","ListOfListsDatasetCollection","HistoryListDatasetCollection","extend","defaults","_","clone","prototype","save","toString","HistoryPairDatasetCollection","history_content_type","collection_type","HistoryListPairedDatasetCollection","model_class","HistoryListOf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H,gBAAM7B,YAcFmC,YAAa,wCAThBN,KAAA7B,EAAAqB,EAAAO,UAAAC,MAGLC,SAAA,WACA,OAAA,uCAAAzB,KAAAI,IAAA,QAAA,KAAA4B,KAAA,kBAEkEd,6BADmBA,EAmBjFQ,6BAA8BA,EAZ9BG,mCAAAA,EACAL,oCAAoBR","file":"../../../scripts/mvc/history/hdca-model.js","sourcesContent":["import DC_MODEL from \"mvc/collection/collection-model\";\nimport HISTORY_CONTENT from \"mvc/history/history-content-model\";\nimport _l from \"utils/localization\";\n\n/*==============================================================================\n\nModels for DatasetCollections contained within a history.\n\nTODO:\n these might be compactable to one class if some duplication with\n collection-model is used.\n\n==============================================================================*/\nvar hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n\nvar ListDC = DC_MODEL.ListDatasetCollection;\nvar PairDC = DC_MODEL.PairDatasetCollection;\nvar ListPairedDC = DC_MODEL.ListPairedDatasetCollection;\nvar ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\n//==============================================================================\n/** Override to post to contents route w/o id. */\nfunction buildHDCASave(_super) {\n return function _save(attributes, options) {\n if (this.isNew()) {\n options = options || {};\n options.url = `${this.urlRoot + this.get(\"history_id\")}/contents`;\n attributes = attributes || {};\n attributes.type = \"dataset_collection\";\n }\n return _super.call(this, attributes, options);\n };\n}\n\n//==============================================================================\n/** @class Backbone model for List Dataset Collection within a History.\n */\nvar HistoryListDatasetCollection = ListDC.extend(hcontentMixin).extend(\n /** @lends HistoryListDatasetCollection.prototype */ {\n defaults: _.extend(_.clone(ListDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${ListDC.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for Pair Dataset Collection within a History.\n * @constructs\n */\nvar HistoryPairDatasetCollection = PairDC.extend(hcontentMixin).extend(\n /** @lends HistoryPairDatasetCollection.prototype */ {\n defaults: _.extend(_.clone(PairDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"paired\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(PairDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${PairDC.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for List of Pairs Dataset Collection within a History. */\nvar HistoryListPairedDatasetCollection = ListPairedDC.extend(hcontentMixin).extend({\n defaults: _.extend(_.clone(ListPairedDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list:paired\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListPairedDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${ListPairedDC.prototype.toString.call(this)}`;\n }\n});\n\n//==============================================================================\n/** @class Backbone model for List of Lists Dataset Collection within a History. */\nvar HistoryListOfListsDatasetCollection = ListOfListsDC.extend(hcontentMixin).extend({\n defaults: _.extend(_.clone(ListOfListsDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list:list\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListOfListsDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return [\"HistoryListOfListsDatasetCollection(\", this.get(\"name\"), \")\"].join(\"\");\n }\n});\n\n//==============================================================================\nexport default {\n HistoryListDatasetCollection: HistoryListDatasetCollection,\n HistoryPairDatasetCollection: HistoryPairDatasetCollection,\n HistoryListPairedDatasetCollection: HistoryListPairedDatasetCollection,\n HistoryListOfListsDatasetCollection: HistoryListOfListsDatasetCollection\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/hdca-model.js"],"names":["buildHDCASave","_super","attributes","options","ListDC","this","isNew","url","urlRoot","get","hcontentMixin","call","ListDatasetCollection","_historyContentModel2","default","HistoryContentMixin","_collectionModel2","PairDC","PairDatasetCollection","ListPairedDC","ListPairedDatasetCollection","ListOfListsDC","ListOfListsDatasetCollection","HistoryListDatasetCollection","extend","defaults","_","clone","prototype","save","toString","HistoryPairDatasetCollection","history_content_type","collection_type","HistoryListPairedDatasetCollection","model_class","HistoryListOfListsDatasetCollection"],"mappings":"yNAsBA,SAASA,EAAcC,GACnB,OAAO,SAAeC,EAAYC,GARlCC,OASQC,KAAKC,WACLH,EAAUA,OACFI,IAASF,KAAKG,QAAUH,KAAKI,IAAI,cAAzC,aACAP,EAAaA,OAdrBQ,KAAgB,sBAEhBN,EAASO,KAAAN,KAAAH,EAASU,uEAFlBF,QAAgBG,EAAAC,QAAgBC,qBAEhCX,EAASY,EAAAF,QAASF,sBAClBK,EAASD,EAAAF,QAASI,sBAClBC,EAAeH,EAAAF,QAASM,4BACxBC,EAAgBL,EAAAF,QAASQ,6BAI7BC,EAA+BnB,EAAAoB,OAAAd,GAAAc,QAEvBC,SAAIC,EAAAF,OAAAE,EAAJC,MAAkBvB,EAAAwB,UAAAH,WACdtB,qBAAUA,qBACVA,gBAAA,OACAD,YAAAA,wCAIP2B,KARD7B,EAAAI,EAAAwB,UAAAC,MAWJC,SAAA,WACA,MAAA,UAAA1B,EAAAwB,UAAAE,SAAAnB,KAAAN,SAwBI0B,EAA+Bd,EAAOO,OAAOd,GAAec,QAbxDK,SAAM7B,EAAAA,OAAAA,EAAcI,MAAOwB,EAAAA,UARsBH,WAwB7CO,qBAAsB,qBAd1BC,gBAAA,SACAH,YAAU,wCAmBVD,KAAM7B,EAAciB,EAAOW,UAAUC,MAGrCC,SAAU,WACN,MAAA,UAAiBb,EAAOW,UAAUE,SAASnB,KAAKN,SAXG6B,EADNf,EAAAK,OAAAd,GAAAc,QAoBrDC,SAAUC,EAAEF,OAAOE,EAAEC,MAAMR,EAAaS,UAAUH,WAb9CO,qBAAA,qBACAH,gBAAM7B,cAeNmC,YAAa,wCAVZN,KAAA7B,EAAAmB,EAAAS,UAAAC,MAITC,SAAA,WACA,MAAA,UAAAX,EAAAS,UAAAE,SAAAnB,KAAAN,SAEiE+B,EADkBf,EAAAG,OAAAd,GAAAc,QAmB/EC,SAAUC,EAAEF,OAAOE,EAAEC,MAAMN,EAAcO,UAAUH,WAZnDO,qBAAA,qBACAH,gBAAM7B,YAcFmC,YAAa,wCAThBN,KAAA7B,EAAAqB,EAAAO,UAAAC,MAGLC,SAAA,WACA,MAAA,uCAAAzB,KAAAI,IAAA,QAAA,kBAEkEc,6BADmBA,EAmBjFQ,6BAA8BA,EAZ9BG,mCAAAA,EACAL,oCAAoBR","file":"../../../scripts/mvc/history/hdca-model.js","sourcesContent":["import DC_MODEL from \"mvc/collection/collection-model\";\nimport HISTORY_CONTENT from \"mvc/history/history-content-model\";\nimport _l from \"utils/localization\";\n\n/*==============================================================================\n\nModels for DatasetCollections contained within a history.\n\nTODO:\n these might be compactable to one class if some duplication with\n collection-model is used.\n\n==============================================================================*/\nvar hcontentMixin = HISTORY_CONTENT.HistoryContentMixin;\n\nvar ListDC = DC_MODEL.ListDatasetCollection;\nvar PairDC = DC_MODEL.PairDatasetCollection;\nvar ListPairedDC = DC_MODEL.ListPairedDatasetCollection;\nvar ListOfListsDC = DC_MODEL.ListOfListsDatasetCollection;\n\n//==============================================================================\n/** Override to post to contents route w/o id. */\nfunction buildHDCASave(_super) {\n return function _save(attributes, options) {\n if (this.isNew()) {\n options = options || {};\n options.url = `${this.urlRoot + this.get(\"history_id\")}/contents`;\n attributes = attributes || {};\n attributes.type = \"dataset_collection\";\n }\n return _super.call(this, attributes, options);\n };\n}\n\n//==============================================================================\n/** @class Backbone model for List Dataset Collection within a History.\n */\nvar HistoryListDatasetCollection = ListDC.extend(hcontentMixin).extend(\n /** @lends HistoryListDatasetCollection.prototype */ {\n defaults: _.extend(_.clone(ListDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${ListDC.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for Pair Dataset Collection within a History.\n * @constructs\n */\nvar HistoryPairDatasetCollection = PairDC.extend(hcontentMixin).extend(\n /** @lends HistoryPairDatasetCollection.prototype */ {\n defaults: _.extend(_.clone(PairDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"paired\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(PairDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${PairDC.prototype.toString.call(this)}`;\n }\n }\n);\n\n//==============================================================================\n/** @class Backbone model for List of Pairs Dataset Collection within a History. */\nvar HistoryListPairedDatasetCollection = ListPairedDC.extend(hcontentMixin).extend({\n defaults: _.extend(_.clone(ListPairedDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list:paired\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListPairedDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `History${ListPairedDC.prototype.toString.call(this)}`;\n }\n});\n\n//==============================================================================\n/** @class Backbone model for List of Lists Dataset Collection within a History. */\nvar HistoryListOfListsDatasetCollection = ListOfListsDC.extend(hcontentMixin).extend({\n defaults: _.extend(_.clone(ListOfListsDC.prototype.defaults), {\n history_content_type: \"dataset_collection\",\n collection_type: \"list:list\",\n model_class: \"HistoryDatasetCollectionAssociation\"\n }),\n\n /** Override to post to contents route w/o id. */\n save: buildHDCASave(ListOfListsDC.prototype.save),\n\n /** String representation. */\n toString: function() {\n return `HistoryListOfListsDatasetCollection(${this.get(\"name\")})`;\n }\n});\n\n//==============================================================================\nexport default {\n HistoryListDatasetCollection: HistoryListDatasetCollection,\n HistoryPairDatasetCollection: HistoryPairDatasetCollection,\n HistoryListPairedDatasetCollection: HistoryListPairedDatasetCollection,\n HistoryListOfListsDatasetCollection: HistoryListOfListsDatasetCollection\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/history-content-model.js.map b/static/maps/mvc/history/history-content-model.js.map index 0e5a8a0ad936..95b631536b97 100644 --- a/static/maps/mvc/history/history-content-model.js.map +++ b/static/maps/mvc/history/history-content-model.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/history-content-model.js"],"names":["HistoryContentMixin","defaults","history_id","history_content_type","hid","visible","this","get","isVisible","includeDeleted","includeHidden","idAttribute","hidden","urlRoot","Galaxy","root","url","hide","options","jQuery","when","save","toString","join"],"mappings":"sQAOIA,GAEAC,UAEIC,WAAY,KAEZC,qBAAsB,KAEtBC,IAAK,KAELC,SAAS,GARbJ,YAAAA,UAIIE,OAAAA,WACA,OAAAG,KAAAC,IAAA,YASJC,UAAA,SAAAC,EAAAC,GACAC,IAAAA,GAAa,EAsBT,OANKF,IAAmBH,KAAKC,IAAI,aAAcD,KAAKC,IAAI,YAd5DC,GAAA,GAEAI,GAAQN,KAAWC,IAAA,aACfC,GAAQ,GAiBDA,GAMXK,QAAYC,OAAOC,KAAnB,iBAZIC,IAAA,WACIR,IAAAA,EAAAA,KAAAA,QAAAF,KAAAC,IAAA,cAAAC,aAAAF,KAAAC,IAAA,wBAAAC,KAAAF,KAAAC,IACH,MAEGC,OAAAA,GAmBRS,KAAM,SAASC,GAdf,OAAAZ,KAAAC,IAAA,WAGAM,KAAYC,MAAOC,SAAnB,GAAAG,GAFAC,OAAAC,QAKAJ,OAAAA,SAAKE,GACD,OAAAZ,KAAIU,IAAAA,WAGGA,OAAPI,OAeOd,KAAKe,MAAOhB,SAAS,GAAQa,IAThCI,SAAA,WACH,OAAAhB,KAAAC,IAAA,WAAAD,KAAAC,IAAA,OAAAD,KAAAC,IAAA,SAAAgB,KAAA,kBAMGvB,oBAAOmB","file":"../../../scripts/mvc/history/history-content-model.js","sourcesContent":["import STATES from \"mvc/dataset/states\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/** @class Mixin for HistoryContents content (HDAs, HDCAs).\n */\nvar HistoryContentMixin = {\n /** default attributes for a model */\n defaults: {\n /** parent (containing) history */\n history_id: null,\n /** some content_type (HistoryContents can contain mixed model classes) */\n history_content_type: null,\n /** indicating when/what order the content was generated in the context of the history */\n hid: null,\n /** whether the user wants the content shown (visible) */\n visible: true\n },\n\n // ........................................................................ mixed content element\n // In order to be part of a MIXED bbone collection, we can't rely on the id\n // (which may collide btwn models of different classes)\n // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n idAttribute: \"type_id\",\n\n // ........................................................................ common queries\n /** the more common alias of visible */\n hidden: function() {\n return !this.get(\"visible\");\n },\n\n //TODO: remove\n /** based on includeDeleted, includeHidden (gen. from the container control),\n * would this ds show in the list of ds's?\n * @param {Boolean} includeDeleted are we showing deleted hdas?\n * @param {Boolean} includeHidden are we showing hidden hdas?\n */\n isVisible: function(includeDeleted, includeHidden) {\n var isVisible = true;\n if (!includeDeleted && (this.get(\"deleted\") || this.get(\"purged\"))) {\n isVisible = false;\n }\n if (!includeHidden && !this.get(\"visible\")) {\n isVisible = false;\n }\n return isVisible;\n },\n\n // ........................................................................ ajax\n //TODO?: these are probably better done on the leaf classes\n /** history content goes through the 'api/histories' API */\n urlRoot: `${Galaxy.root}api/histories/`,\n\n /** full url spec. for this content */\n url: function() {\n var url = `${this.urlRoot + this.get(\"history_id\")}/contents/${this.get(\"history_content_type\")}s/${this.get(\n \"id\"\n )}`;\n return url;\n },\n\n /** save this content as not visible */\n hide: function(options) {\n if (!this.get(\"visible\")) {\n return jQuery.when();\n }\n return this.save({ visible: false }, options);\n },\n /** save this content as visible */\n unhide: function(options) {\n if (this.get(\"visible\")) {\n return jQuery.when();\n }\n return this.save({ visible: true }, options);\n },\n\n // ........................................................................ misc\n toString: function() {\n return [this.get(\"type_id\"), this.get(\"hid\"), this.get(\"name\")].join(\":\");\n }\n};\n\n//==============================================================================\nexport default {\n HistoryContentMixin: HistoryContentMixin\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/history-content-model.js"],"names":["HistoryContentMixin","defaults","history_id","history_content_type","hid","visible","this","get","isVisible","includeDeleted","includeHidden","idAttribute","hidden","urlRoot","Galaxy","root","url","historyContentId","historyContentType","hide","options","save","jQuery","when","unhide","historyId","join"],"mappings":"sQAOIA,GAEAC,UAEIC,WAAY,KAEZC,qBAAsB,KAEtBC,IAAK,KAELC,SAAS,GARbJ,YAAAA,UAIIE,OAAAA,WACA,OAAAG,KAAAC,IAAA,YASJC,UAAA,SAAAC,EAAAC,GACAC,IAAAA,GAAa,EAsBT,OANKF,IAAmBH,KAAKC,IAAI,aAAcD,KAAKC,IAAI,YAd5DC,GAAA,GAEAI,GAAQN,KAAWC,IAAA,aACfC,GAAQ,GAiBDA,GAMXK,QAAYC,OAAOC,KAAnB,iBAZIC,IAAA,WACIR,IAAAA,EAAAF,KAAAC,IAAA,wBAEJU,GADCX,KAAAC,IAAA,cACGD,KAAmBC,IAAKA,OACxBC,EAAAA,KAAAA,QAAAA,oCAAAU,EAAAV,KAAAS,EACH,OAAAD,GAILG,KAAA,SAAAC,GACA,OAAAd,KAAAC,IAAA,WAkBWD,KAAKe,MAAOhB,SAAS,GAASe,GAjBzCE,OAAAC,QAKIC,OAAA,SAAIN,GACJ,OAAAZ,KAAImB,IAAAA,WACAR,OAAAA,OAEJX,KAAOU,MAAPX,SAAA,GAAAe,IAIJD,SAAM,WACF,OAAIb,KAACC,IAAA,WAALD,KAA0BC,IAAA,OAAAD,KAAAC,IAAA,SAAAmB,KAAA,kBAM9BF,oBAAQxB","file":"../../../scripts/mvc/history/history-content-model.js","sourcesContent":["import STATES from \"mvc/dataset/states\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/** @class Mixin for HistoryContents content (HDAs, HDCAs).\n */\nvar HistoryContentMixin = {\n /** default attributes for a model */\n defaults: {\n /** parent (containing) history */\n history_id: null,\n /** some content_type (HistoryContents can contain mixed model classes) */\n history_content_type: null,\n /** indicating when/what order the content was generated in the context of the history */\n hid: null,\n /** whether the user wants the content shown (visible) */\n visible: true\n },\n\n // ........................................................................ mixed content element\n // In order to be part of a MIXED bbone collection, we can't rely on the id\n // (which may collide btwn models of different classes)\n // Instead, use type_id which prefixes the history_content_type so the bbone collection can differentiate\n idAttribute: \"type_id\",\n\n // ........................................................................ common queries\n /** the more common alias of visible */\n hidden: function() {\n return !this.get(\"visible\");\n },\n\n //TODO: remove\n /** based on includeDeleted, includeHidden (gen. from the container control),\n * would this ds show in the list of ds's?\n * @param {Boolean} includeDeleted are we showing deleted hdas?\n * @param {Boolean} includeHidden are we showing hidden hdas?\n */\n isVisible: function(includeDeleted, includeHidden) {\n var isVisible = true;\n if (!includeDeleted && (this.get(\"deleted\") || this.get(\"purged\"))) {\n isVisible = false;\n }\n if (!includeHidden && !this.get(\"visible\")) {\n isVisible = false;\n }\n return isVisible;\n },\n\n // ........................................................................ ajax\n //TODO?: these are probably better done on the leaf classes\n /** history content goes through the 'api/histories' API */\n urlRoot: `${Galaxy.root}api/histories/`,\n\n /** full url spec. for this content */\n url: function() {\n var historyContentType = this.get(\"history_content_type\");\n var historyId = this.get(\"history_id\");\n var historyContentId = this.get(\"id\");\n var url = `${this.urlRoot}{this.get(\"historyId\")}/contents/${historyContentType}s/${historyContentId}`;\n return url;\n },\n\n /** save this content as not visible */\n hide: function(options) {\n if (!this.get(\"visible\")) {\n return jQuery.when();\n }\n return this.save({ visible: false }, options);\n },\n /** save this content as visible */\n unhide: function(options) {\n if (this.get(\"visible\")) {\n return jQuery.when();\n }\n return this.save({ visible: true }, options);\n },\n\n // ........................................................................ misc\n toString: function() {\n return [this.get(\"type_id\"), this.get(\"hid\"), this.get(\"name\")].join(\":\");\n }\n};\n\n//==============================================================================\nexport default {\n HistoryContentMixin: HistoryContentMixin\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/history-contents.js.map b/static/maps/mvc/history/history-contents.js.map index 73b18f95ba98..c0de7cea2817 100644 --- a/static/maps/mvc/history/history-contents.js.map +++ b/static/maps/mvc/history/history-contents.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/history-contents.js"],"names":["_super","_controlledFetchCollection2","default","PaginatedCollection","HistoryContents","extend","_baseMvc2","LoggableMixin","_logNamespace","limitPerPage","limitPerProgressiveFetch","order","urlRoot","Galaxy","root","url","this","historyId","initialize","models","options","prototype","call","setHistoryId","includeDeleted","includeHidden","model","_hdaModel2","HistoryDatasetAssociation","attrs","history","history_content_type","_hdcaModel2","HistoryListPairedDatasetCollection","HistoryListOfListsDatasetCollection","msg","collection_type","console","validationError","newId","_setUpWebStorage","initialSettings","storage","id","_historyPreferences2","HistoryPrefs","historyStorageKey","on","include-deleted","newVal","include-hidden","comparators","trigger","_","clone","name","buildComparator","ascending","name-dsc","hid","hid-asc","running","c","inReadyState","runningAndActive","filter","get","getByHid","findWhere","all","hasDetails","hidden","deleted","visibleAndUndeleted","haveDetails","setting","isBoolean","result","setIncludeHidden","fetch","details","prefs","toJSON","isEmpty","expandedIds","values","join","_buildFetchData","v","_fetchParams","concat","_buildFetchFilters","superFilters","filters","purged","defaults","contentsShown","fetchUpdated","since","update_time-ge","toISOString","visible","getTotalItemCount","self","always","fetchHidden","data","detailsFlag","remove","_filterAndUpdate","filterParams","updateWhat","fetchAllDetails","idAttribute","updateArgs","then","fetched","reduce","modelArray","currJson","i","fetchCollectionCounts","ajaxQueue","collection","_ajaxQueue2","AjaxQueue","slice","reverse","fn","isString","ajaxFn","content","deferred","progressivelyFetchDetails","offset","_options","view","keys","detailKeys","limit","reset","limitPerCall","done","response","searchAttributes","allFetched","_recursivelyFetch","jQuery","Deferred","notify","contains","copyableModelClasses","contentsJSON","model_class","copy","json","type","contentType","isCopyable","LibraryDatasetDatasetAssociation","HistoryDatasetCollectionAssociation","method","parse","fail","xhr","message","JSON","collectionType","hideSourceItems","history_id","hide_source_items","element_identifiers","elementIdentifiers","haveSearchDetails","has","attributes","matches","matchesWhat","Backbone","Collection","toString","length"],"mappings":"qYAQIA,EAASC,EAAAC,QAA4BC,oBASrCC,EAAkBJ,EAAOK,OAAOC,EAAAJ,QAASK,eAAeF,QACxDG,cAAe,UAGfC,aAAc,IAGdC,yBAA0B,IAf9BC,MAAA,MAqBIC,QAAYC,OAAOC,KAAnB,gBAGAC,IAAK,WACD,OAAUC,KAAKJ,QAAf,IAA0BI,KAAKC,UAA/B,aAdJC,WAAA,SAAAC,EAAAC,GACAX,EAAAA,MAmBIT,EAAOqB,UAAUH,WAAWI,KAAKN,KAAMG,EAAQC,GAhBnDV,KAAAA,QAAAA,EAAAA,SAP+D,KA0B3DM,KAAKO,aAAaH,EAAQH,WAAa,MAhB3CN,KAAAA,eAV+DS,EAAAI,gBAAAR,KAAAQ,eAY/DR,KAAAS,cAAAL,EAAAK,eAAAT,KAAAS,cAKIT,KAAAU,MAAUL,UAAKT,YAAW,WAK1BQ,MAAAA,SAAAA,EAAUA,GACVpB,GAA4BsB,YAA5BtB,EAAAA,qBAmBI,OAAO,IAAI2B,EAAAzB,QAAU0B,0BAA0BC,EAAOT,GAjB1D,GAAA,uBAAKU,EAALC,qBAAA,CACA,OAAKR,EAAAA,iBACL,IAAA,OACKC,OAAAA,IAALQ,EAAA9B,QAA8BsB,6BAAuBA,EAAAA,GACrD,IAAA,SACKC,OAAAA,IAALO,EAAA9B,QAA6BuB,6BAAsBA,EAAnDL,GAmBQ,IAAK,cAjBb,OAAA,IAAAY,EAAA9B,QAAA+B,mCAAAJ,EAAAT,GACA,IAAA,YACA,OAAA,IAAAY,EAAA9B,QAAAgC,oCAAAL,EAAAT,GAMJM,IAAOS,EAAAA,4BAAyBN,EAAAO,gBAExB,OADJC,QAAIR,KAAME,EAAAA,IACNO,gBA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C,KAAAN,MAEI,OADJgK,EAAAA,UAAShK,KAAAC,UACLqC,GAYJ8H,SAAU,WATV,OAAA,oBAAApK,KAAAC,UAAAD,KAAAqK,QAAA/F,OAAA,KAAAA,KAAA,kBAMClF,gBAxd8DA","file":"../../../scripts/mvc/history/history-contents.js","sourcesContent":["import CONTROLLED_FETCH_COLLECTION from \"mvc/base/controlled-fetch-collection\";\nimport HDA_MODEL from \"mvc/history/hda-model\";\nimport HDCA_MODEL from \"mvc/history/hdca-model\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport AJAX_QUEUE from \"utils/ajax-queue\";\n\n//==============================================================================\nvar _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n/** @class Backbone collection for history content.\n * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n * the same level.\n * Dataset collections on the other hand are not mixed and (so far) can only contain either\n * HDAs or child dataset collections on one level.\n * This is why this does not inherit from any of the DatasetCollections (currently).\n */\nvar HistoryContents = _super.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: \"history\",\n\n // ........................................................................ set up\n limitPerPage: 500,\n\n /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n limitPerProgressiveFetch: 500,\n\n /** @type {String} order used here and when fetching from server */\n order: \"hid\",\n\n /** root api url */\n urlRoot: `${Galaxy.root}api/histories`,\n\n /** complete api url */\n url: function() {\n return `${this.urlRoot}/${this.historyId}/contents`;\n },\n\n /** Set up */\n initialize: function(models, options) {\n options = options || {};\n _super.prototype.initialize.call(this, models, options);\n\n this.history = options.history || null;\n this.setHistoryId(options.historyId || null);\n /** @type {Boolean} does this collection contain and fetch deleted elements */\n this.includeDeleted = options.includeDeleted || this.includeDeleted;\n /** @type {Boolean} does this collection contain and fetch non-visible elements */\n this.includeHidden = options.includeHidden || this.includeHidden;\n\n // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n // manually here - if we don't, contents will not merge but be replaced/swapped.\n this.model.prototype.idAttribute = \"type_id\";\n },\n\n // ........................................................................ composite collection\n /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n model: function(attrs, options) {\n if (attrs.history_content_type === \"dataset\") {\n return new HDA_MODEL.HistoryDatasetAssociation(attrs, options);\n } else if (attrs.history_content_type === \"dataset_collection\") {\n switch (attrs.collection_type) {\n case \"list\":\n return new HDCA_MODEL.HistoryListDatasetCollection(attrs, options);\n case \"paired\":\n return new HDCA_MODEL.HistoryPairDatasetCollection(attrs, options);\n case \"list:paired\":\n return new HDCA_MODEL.HistoryListPairedDatasetCollection(attrs, options);\n case \"list:list\":\n return new HDCA_MODEL.HistoryListOfListsDatasetCollection(attrs, options);\n }\n // This is a hack inside a hack:\n // Raise a plain object with validationError to fake a model.validationError\n // (since we don't have a model to use validate with)\n // (the outer hack being the mixed content/model function in this collection)\n var msg = `Unknown collection_type: ${attrs.collection_type}`;\n console.warn(msg, attrs);\n return { validationError: msg };\n }\n return {\n validationError: `Unknown history_content_type: ${attrs.history_content_type}`\n };\n },\n\n setHistoryId: function(newId) {\n this.historyId = newId;\n this._setUpWebStorage();\n },\n\n /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n _setUpWebStorage: function(initialSettings) {\n // TODO: use initialSettings\n if (!this.historyId) {\n return;\n }\n this.storage = new HISTORY_PREFS.HistoryPrefs({\n id: HISTORY_PREFS.HistoryPrefs.historyStorageKey(this.historyId)\n });\n this.trigger(\"new-storage\", this.storage, this);\n\n this.on({\n \"include-deleted\": function(newVal) {\n this.storage.includeDeleted(newVal);\n },\n \"include-hidden\": function(newVal) {\n this.storage.includeHidden(newVal);\n }\n });\n\n this.includeDeleted = this.storage.includeDeleted() || false;\n this.includeHidden = this.storage.includeHidden() || false;\n return this;\n },\n\n // ........................................................................ common queries\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators: _.extend(_.clone(_super.prototype.comparators), {\n name: BASE_MVC.buildComparator(\"name\", { ascending: true }),\n \"name-dsc\": BASE_MVC.buildComparator(\"name\", {\n ascending: false\n }),\n hid: BASE_MVC.buildComparator(\"hid\", { ascending: false }),\n \"hid-asc\": BASE_MVC.buildComparator(\"hid\", { ascending: true })\n }),\n\n /** Get every model in this collection not in a 'ready' state (running). */\n running: function() {\n return this.filter(c => !c.inReadyState());\n },\n\n /** return contents that are not ready and not deleted/hidden */\n runningAndActive: function() {\n return this.filter(\n c =>\n !c.inReadyState() &&\n c.get(\"visible\") &&\n // TODO: deletedOrPurged?\n !c.get(\"deleted\")\n );\n },\n\n /** Get the model with the given hid\n * @param {Int} hid the hid to search for\n * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n */\n getByHid: function(hid) {\n // note: there *can* be more than one content with a given hid, this finds the first based on order\n return this.findWhere({ hid: hid });\n },\n\n /** return true if all contents have details */\n haveDetails: function() {\n return this.all(c => c.hasDetails());\n },\n\n // ........................................................................ hidden / deleted\n /** return a new contents collection of only hidden items */\n hidden: function() {\n return this.filter(c => c.hidden());\n },\n\n /** return a new contents collection of only hidden items */\n deleted: function() {\n return this.filter(c => c.get(\"deleted\"));\n },\n\n /** return a new contents collection of only hidden items */\n visibleAndUndeleted: function() {\n return this.filter(\n c =>\n c.get(\"visible\") &&\n // TODO: deletedOrPurged?\n !c.get(\"deleted\")\n );\n },\n\n /** create a setter in order to publish the change */\n setIncludeDeleted: function(setting, options) {\n if (_.isBoolean(setting) && setting !== this.includeDeleted) {\n this.includeDeleted = setting;\n if (_.result(options, \"silent\")) {\n return;\n }\n this.trigger(\"include-deleted\", setting, this);\n }\n },\n\n /** create a setter in order to publish the change */\n setIncludeHidden: function(setting, options) {\n if (_.isBoolean(setting) && setting !== this.includeHidden) {\n this.includeHidden = setting;\n options = options || {};\n if (_.result(options, \"silent\")) {\n return;\n }\n this.trigger(\"include-hidden\", setting, this);\n }\n },\n\n // ........................................................................ ajax\n // ............ controlled fetch collection\n /** override to get expanded ids from sessionStorage and pass to API as details */\n fetch: function(options) {\n options = options || {};\n if (this.historyId && !options.details) {\n var prefs = HISTORY_PREFS.HistoryPrefs.get(this.historyId).toJSON();\n if (!_.isEmpty(prefs.expandedIds)) {\n options.details = _.values(prefs.expandedIds).join(\",\");\n }\n }\n return _super.prototype.fetch.call(this, options);\n },\n\n // ............. ControlledFetch stuff\n /** override to include the API versioning flag */\n _buildFetchData: function(options) {\n return _.extend(_super.prototype._buildFetchData.call(this, options), {\n v: \"dev\"\n });\n },\n\n /** Extend to include details and version */\n _fetchParams: _super.prototype._fetchParams.concat([\n // TODO: remove (the need for) both\n /** version */\n \"v\",\n /** dataset ids to get full details of */\n \"details\"\n ]),\n\n /** override to add deleted/hidden filters */\n _buildFetchFilters: function(options) {\n var superFilters = _super.prototype._buildFetchFilters.call(this, options) || {};\n var filters = {};\n if (!this.includeDeleted) {\n filters.deleted = false;\n filters.purged = false;\n }\n if (!this.includeHidden) {\n filters.visible = true;\n }\n return _.defaults(superFilters, filters);\n },\n\n // ............ paginated collection\n getTotalItemCount: function() {\n return this.history.contentsShown();\n },\n\n // ............ history contents specific ajax\n /** override to filter requested contents to those updated after the Date 'since' */\n fetchUpdated: function(since, options) {\n if (since) {\n options = options || { filters: {} };\n options.remove = false;\n options.filters = {\n \"update_time-ge\": since.toISOString(),\n // workflows will produce hidden datasets (non-output datasets) that still\n // need to be updated in the collection or they'll update forever\n // we can remove the default visible filter by using an 'empty' value\n visible: \"\"\n };\n }\n return this.fetch(options);\n },\n\n /** fetch all the deleted==true contents of this collection */\n fetchDeleted: function(options) {\n options = options || {};\n var self = this;\n options.filters = _.extend(options.filters, {\n // all deleted, purged or not\n deleted: true,\n purged: undefined\n });\n options.remove = false;\n\n self.trigger(\"fetching-deleted\", self);\n return self.fetch(options).always(() => {\n self.trigger(\"fetching-deleted-done\", self);\n });\n },\n\n /** fetch all the visible==false contents of this collection */\n fetchHidden: function(options) {\n options = options || {};\n var self = this;\n options.filters = _.extend(options.filters, {\n visible: false\n });\n options.remove = false;\n\n self.trigger(\"fetching-hidden\", self);\n return self.fetch(options).always(() => {\n self.trigger(\"fetching-hidden-done\", self);\n });\n },\n\n /** fetch detailed model data for all contents in this collection */\n fetchAllDetails: function(options) {\n options = options || {};\n var detailsFlag = { details: \"all\" };\n options.data = _.extend(options.data || {}, detailsFlag);\n return this.fetch(options);\n },\n\n /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n fetchCollectionCounts: function(options) {\n options = options || {};\n options.keys = [\"type_id\", \"element_count\"].join(\",\");\n options.filters = _.extend(options.filters || {}, {\n history_content_type: \"dataset_collection\"\n });\n options.remove = false;\n return this.fetch(options);\n },\n\n // ............. quasi-batch ops\n // TODO: to batch\n /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n _filterAndUpdate: function(filterParams, updateWhat) {\n var self = this;\n var idAttribute = self.model.prototype.idAttribute;\n var updateArgs = [updateWhat];\n\n return self.fetch({ filters: filterParams, remove: false }).then(fetched => {\n // convert filtered json array to model array\n fetched = fetched.reduce((modelArray, currJson, i) => {\n var model = self.get(currJson[idAttribute]);\n return model ? modelArray.concat(model) : modelArray;\n }, []);\n return self.ajaxQueue(\"save\", updateArgs, fetched);\n });\n },\n\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue: function(ajaxFn, args, collection) {\n collection = collection || this.models;\n return new AJAX_QUEUE.AjaxQueue(\n collection\n .slice()\n .reverse()\n .map((content, i) => {\n var fn = _.isString(ajaxFn) ? content[ajaxFn] : ajaxFn;\n return () => fn.apply(content, args);\n })\n ).deferred;\n },\n\n /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n progressivelyFetchDetails: function(options) {\n options = options || {};\n var deferred = jQuery.Deferred();\n var self = this;\n var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n // TODO: only fetch tags and annotations if specifically requested\n var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n var detailKeys = searchAttributes.join(\",\");\n\n function _recursivelyFetch(offset) {\n offset = offset || 0;\n var _options = _.extend(_.clone(options), {\n view: \"summary\",\n keys: detailKeys,\n limit: limit,\n offset: offset,\n reset: offset === 0,\n remove: false\n });\n\n _.defer(() => {\n self.fetch\n .call(self, _options)\n .fail(deferred.reject)\n .done(response => {\n deferred.notify(response, limit, offset);\n if (response.length !== limit) {\n self.allFetched = true;\n deferred.resolve(response, limit, offset);\n } else {\n _recursivelyFetch(offset + limit);\n }\n });\n });\n }\n _recursivelyFetch();\n return deferred;\n },\n\n /** does some bit of JSON represent something that can be copied into this contents collection */\n isCopyable: function(contentsJSON) {\n var copyableModelClasses = [\"HistoryDatasetAssociation\", \"HistoryDatasetCollectionAssociation\"];\n return (\n _.isObject(contentsJSON) && contentsJSON.id && _.contains(copyableModelClasses, contentsJSON.model_class)\n );\n },\n\n /** copy an existing, accessible hda into this collection */\n copy: function(json) {\n // TODO: somehow showhorn all this into 'save'\n var id;\n\n var type;\n var contentType;\n if (_.isString(json)) {\n id = json;\n contentType = \"hda\";\n type = \"dataset\";\n } else {\n id = json.id;\n contentType =\n {\n HistoryDatasetAssociation: \"hda\",\n LibraryDatasetDatasetAssociation: \"ldda\",\n HistoryDatasetCollectionAssociation: \"hdca\"\n }[json.model_class] || \"hda\";\n type = contentType === \"hdca\" ? \"dataset_collection\" : \"dataset\";\n }\n var collection = this;\n\n var xhr = jQuery\n .ajax(this.url(), {\n method: \"POST\",\n contentType: \"application/json\",\n data: JSON.stringify({\n content: id,\n source: contentType,\n type: type\n })\n })\n .done(response => {\n collection.add([response], { parse: true });\n })\n .fail((error, status, message) => {\n collection.trigger(\"error\", collection, xhr, {}, \"Error copying contents\", {\n type: type,\n id: id,\n source: contentType\n });\n });\n\n return xhr;\n },\n\n /** create a new HDCA in this collection */\n createHDCA: function(elementIdentifiers, collectionType, name, hideSourceItems, options) {\n // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n //precondition: elementIdentifiers is an array of plain js objects\n // in the proper form to create the collectionType\n var hdca = this.model({\n history_content_type: \"dataset_collection\",\n collection_type: collectionType,\n history_id: this.historyId,\n name: name,\n hide_source_items: hideSourceItems || false,\n // should probably be able to just send in a bunch of json here and restruct per class\n // note: element_identifiers is now (incorrectly) an attribute\n element_identifiers: elementIdentifiers\n // do not create the model on the client until the ajax returns\n });\n return hdca.save(options);\n },\n\n // ........................................................................ searching\n /** return true if all contents have the searchable attributes */\n haveSearchDetails: function() {\n return (\n this.allFetched &&\n this.all((\n content // null (which is a valid returned annotation value)\n ) =>\n // will return false when using content.has( 'annotation' )\n //TODO: a bit hacky - formalize\n _.has(content.attributes, \"annotation\")\n )\n );\n },\n\n /** return a new collection of contents whose attributes contain the substring matchesWhat */\n matches: function(matchesWhat) {\n return this.filter(content => content.matches(matchesWhat));\n },\n\n // ........................................................................ misc\n /** In this override, copy the historyId to the clone */\n clone: function() {\n var clone = Backbone.Collection.prototype.clone.call(this);\n clone.historyId = this.historyId;\n return clone;\n },\n\n /** String representation. */\n toString: function() {\n return [\"HistoryContents(\", [this.historyId, this.length].join(), \")\"].join(\"\");\n }\n});\n\n//==============================================================================\nexport default {\n HistoryContents: HistoryContents\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/history-contents.js"],"names":["_super","_controlledFetchCollection2","default","PaginatedCollection","HistoryContents","extend","_baseMvc2","LoggableMixin","_logNamespace","limitPerPage","limitPerProgressiveFetch","order","urlRoot","Galaxy","root","url","this","historyId","initialize","models","options","prototype","call","setHistoryId","includeDeleted","includeHidden","model","_hdaModel2","HistoryDatasetAssociation","attrs","history","history_content_type","_hdcaModel2","HistoryListPairedDatasetCollection","HistoryListOfListsDatasetCollection","msg","collection_type","console","validationError","newId","_setUpWebStorage","initialSettings","storage","id","_historyPreferences2","HistoryPrefs","historyStorageKey","on","include-deleted","newVal","include-hidden","comparators","trigger","_","clone","name","buildComparator","ascending","name-dsc","hid","hid-asc","running","c","inReadyState","runningAndActive","filter","get","getByHid","findWhere","all","hasDetails","hidden","deleted","visibleAndUndeleted","haveDetails","setting","isBoolean","result","setIncludeHidden","fetch","details","prefs","toJSON","isEmpty","expandedIds","values","join","_buildFetchData","v","_fetchParams","concat","_buildFetchFilters","superFilters","filters","purged","defaults","contentsShown","fetchUpdated","since","update_time-ge","toISOString","visible","getTotalItemCount","_this","undefined","always","fetchHidden","self","fetchDeleted","remove","detailsFlag","data","fetchCollectionCounts","_filterAndUpdate","filterParams","updateWhat","idAttribute","fetchAllDetails","then","fetched","modelArray","currJson","i","updateArgs","ajaxQueue","ajaxFn","args","collection","_ajaxQueue2","slice","reverse","map","content","fn","isString","apply","deferred","progressivelyFetchDetails","_recursivelyFetch","offset","view","keys","limit","reset","defer","Deferred","response","limitPerCall","length","searchAttributes","detailKeys","jQuery","isCopyable","contentsJSON","copyableModelClasses","model_class","type","json","contentType","LibraryDatasetDatasetAssociation","HistoryDatasetCollectionAssociation","xhr","JSON","stringify","done","parse","fail","message","method","createHDCA","elementIdentifiers","hideSourceItems","source","collectionType","history_id","hide_source_items","save","allFetched","element_identifiers","has","attributes","matches","matchesWhat","Backbone","Collection","toString"],"mappings":"qYAQIA,EAASC,EAAAC,QAA4BC,oBASrCC,EAAkBJ,EAAOK,OAAOC,EAAAJ,QAASK,eAAeF,QACxDG,cAAe,UAGfC,aAAc,IAGdC,yBAA0B,IAf9BC,MAAA,MAqBIC,QAAYC,OAAOC,KAAnB,gBAGAC,IAAK,WACD,OAAUC,KAAKJ,QAAf,IAA0BI,KAAKC,UAA/B,aAdJC,WAAA,SAAAC,EAAAC,GACAX,EAAAA,MAmBIT,EAAOqB,UAAUH,WAAWI,KAAKN,KAAMG,EAAQC,GAhBnDV,KAAAA,QAAAA,EAAAA,SAP+D,KA0B3DM,KAAKO,aAAaH,EAAQH,WAAa,MAhB3CN,KAAAA,eAV+DS,EAAAI,gBAAAR,KAAAQ,eAY/DR,KAAAS,cAAAL,EAAAK,eAAAT,KAAAS,cAKIT,KAAAU,MAAUL,UA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AQ7H,EACRmH,OAAAA,MAIIF,OAAAA,GAKPa,WACAH,SAAKI,EAAgBH,EAAYhH,EAAAoH,EAAAvJ,GAetC,OAXYwJ,KAAAA,OAHuE7I,qBAA3E,qBAKHK,gBAnBLyI,EAgCIC,WAAY9J,KAAKC,UAXrBsC,KAAAA,EAva2DwH,kBAAAJ,IAAA,EA2a/DF,oBAAYC,IAGRM,KAAA5J,IAKImC,kBAAMA,WACNwH,OACA/J,KAAAiK,YACAjK,KAAAqD,IAAA,SACA6G,GADA,OAtbuD7H,EAAA8H,IAAA/C,EAAAgD,WAAA,iBAkc9CC,QAAA,SAAAC,GAAA,OAAAtK,KAAAiD,OAAA,SAAAmE,GAAA,OAAAA,EAAAiD,QAAAC,MAAAhI,MAAA,WAQhB,IA1c8DA,EAAAiI,SAAAC,WAAAnK,UAAAiC,MAAAhC,KAAAN,MA4c/D,OASIsC,EAAMrC,UAAYD,KAAKC,UAT3BqC,GAEuBmI,SAAnB,WACH,OA/c8D,oBAAAzK,KAAAC,UAAAD,KAAAoI,QAAA9D,OAAA,KAAAA,KAAA,kBAqd3DhC,gBAAMrC","file":"../../../scripts/mvc/history/history-contents.js","sourcesContent":["import CONTROLLED_FETCH_COLLECTION from \"mvc/base/controlled-fetch-collection\";\nimport HDA_MODEL from \"mvc/history/hda-model\";\nimport HDCA_MODEL from \"mvc/history/hdca-model\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport AJAX_QUEUE from \"utils/ajax-queue\";\n\n//==============================================================================\nvar _super = CONTROLLED_FETCH_COLLECTION.PaginatedCollection;\n/** @class Backbone collection for history content.\n * NOTE: history content seems like a dataset collection, but differs in that it is mixed:\n * each element can be either an HDA (dataset) or a DatasetCollection and co-exist on\n * the same level.\n * Dataset collections on the other hand are not mixed and (so far) can only contain either\n * HDAs or child dataset collections on one level.\n * This is why this does not inherit from any of the DatasetCollections (currently).\n */\nvar HistoryContents = _super.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: \"history\",\n\n // ........................................................................ set up\n limitPerPage: 500,\n\n /** @type {Integer} how many contents per call to fetch when using progressivelyFetchDetails */\n limitPerProgressiveFetch: 500,\n\n /** @type {String} order used here and when fetching from server */\n order: \"hid\",\n\n /** root api url */\n urlRoot: `${Galaxy.root}api/histories`,\n\n /** complete api url */\n url: function() {\n return `${this.urlRoot}/${this.historyId}/contents`;\n },\n\n /** Set up */\n initialize: function(models, options) {\n options = options || {};\n _super.prototype.initialize.call(this, models, options);\n\n this.history = options.history || null;\n this.setHistoryId(options.historyId || null);\n /** @type {Boolean} does this collection contain and fetch deleted elements */\n this.includeDeleted = options.includeDeleted || this.includeDeleted;\n /** @type {Boolean} does this collection contain and fetch non-visible elements */\n this.includeHidden = options.includeHidden || this.includeHidden;\n\n // backbonejs uses collection.model.prototype.idAttribute to determine if a model is *already* in a collection\n // and either merged or replaced. In this case, our 'model' is a function so we need to add idAttribute\n // manually here - if we don't, contents will not merge but be replaced/swapped.\n this.model.prototype.idAttribute = \"type_id\";\n },\n\n // ........................................................................ composite collection\n /** since history content is a mix, override model fn into a factory, creating based on history_content_type */\n model: function(attrs, options) {\n if (attrs.history_content_type === \"dataset\") {\n return new HDA_MODEL.HistoryDatasetAssociation(attrs, options);\n } else if (attrs.history_content_type === \"dataset_collection\") {\n switch (attrs.collection_type) {\n case \"list\":\n return new HDCA_MODEL.HistoryListDatasetCollection(attrs, options);\n case \"paired\":\n return new HDCA_MODEL.HistoryPairDatasetCollection(attrs, options);\n case \"list:paired\":\n return new HDCA_MODEL.HistoryListPairedDatasetCollection(attrs, options);\n case \"list:list\":\n return new HDCA_MODEL.HistoryListOfListsDatasetCollection(attrs, options);\n }\n // This is a hack inside a hack:\n // Raise a plain object with validationError to fake a model.validationError\n // (since we don't have a model to use validate with)\n // (the outer hack being the mixed content/model function in this collection)\n var msg = `Unknown collection_type: ${attrs.collection_type}`;\n console.warn(msg, attrs);\n return { validationError: msg };\n }\n return {\n validationError: `Unknown history_content_type: ${attrs.history_content_type}`\n };\n },\n\n setHistoryId: function(newId) {\n this.historyId = newId;\n this._setUpWebStorage();\n },\n\n /** Set up client side storage. Currently PersistanStorage keyed under 'history:' */\n _setUpWebStorage: function(initialSettings) {\n // TODO: use initialSettings\n if (!this.historyId) {\n return;\n }\n this.storage = new HISTORY_PREFS.HistoryPrefs({\n id: HISTORY_PREFS.HistoryPrefs.historyStorageKey(this.historyId)\n });\n this.trigger(\"new-storage\", this.storage, this);\n\n this.on({\n \"include-deleted\": function(newVal) {\n this.storage.includeDeleted(newVal);\n },\n \"include-hidden\": function(newVal) {\n this.storage.includeHidden(newVal);\n }\n });\n\n this.includeDeleted = this.storage.includeDeleted() || false;\n this.includeHidden = this.storage.includeHidden() || false;\n return this;\n },\n\n // ........................................................................ common queries\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators: _.extend(_.clone(_super.prototype.comparators), {\n name: BASE_MVC.buildComparator(\"name\", { ascending: true }),\n \"name-dsc\": BASE_MVC.buildComparator(\"name\", {\n ascending: false\n }),\n hid: BASE_MVC.buildComparator(\"hid\", { ascending: false }),\n \"hid-asc\": BASE_MVC.buildComparator(\"hid\", { ascending: true })\n }),\n\n /** Get every model in this collection not in a 'ready' state (running). */\n running: function() {\n return this.filter(c => !c.inReadyState());\n },\n\n /** return contents that are not ready and not deleted/hidden */\n runningAndActive: function() {\n return this.filter(\n c =>\n !c.inReadyState() &&\n c.get(\"visible\") &&\n // TODO: deletedOrPurged?\n !c.get(\"deleted\")\n );\n },\n\n /** Get the model with the given hid\n * @param {Int} hid the hid to search for\n * @returns {HistoryDatasetAssociation} the model with the given hid or undefined if not found\n */\n getByHid: function(hid) {\n // note: there *can* be more than one content with a given hid, this finds the first based on order\n return this.findWhere({ hid: hid });\n },\n\n /** return true if all contents have details */\n haveDetails: function() {\n return this.all(c => c.hasDetails());\n },\n\n // ........................................................................ hidden / deleted\n /** return a new contents collection of only hidden items */\n hidden: function() {\n return this.filter(c => c.hidden());\n },\n\n /** return a new contents collection of only hidden items */\n deleted: function() {\n return this.filter(c => c.get(\"deleted\"));\n },\n\n /** return a new contents collection of only hidden items */\n visibleAndUndeleted: function() {\n return this.filter(\n c =>\n c.get(\"visible\") &&\n // TODO: deletedOrPurged?\n !c.get(\"deleted\")\n );\n },\n\n /** create a setter in order to publish the change */\n setIncludeDeleted: function(setting, options) {\n if (_.isBoolean(setting) && setting !== this.includeDeleted) {\n this.includeDeleted = setting;\n if (_.result(options, \"silent\")) {\n return;\n }\n this.trigger(\"include-deleted\", setting, this);\n }\n },\n\n /** create a setter in order to publish the change */\n setIncludeHidden: function(setting, options) {\n if (_.isBoolean(setting) && setting !== this.includeHidden) {\n this.includeHidden = setting;\n options = options || {};\n if (_.result(options, \"silent\")) {\n return;\n }\n this.trigger(\"include-hidden\", setting, this);\n }\n },\n\n // ........................................................................ ajax\n // ............ controlled fetch collection\n /** override to get expanded ids from sessionStorage and pass to API as details */\n fetch: function(options) {\n options = options || {};\n if (this.historyId && !options.details) {\n var prefs = HISTORY_PREFS.HistoryPrefs.get(this.historyId).toJSON();\n if (!_.isEmpty(prefs.expandedIds)) {\n options.details = _.values(prefs.expandedIds).join(\",\");\n }\n }\n return _super.prototype.fetch.call(this, options);\n },\n\n // ............. ControlledFetch stuff\n /** override to include the API versioning flag */\n _buildFetchData: function(options) {\n return _.extend(_super.prototype._buildFetchData.call(this, options), {\n v: \"dev\"\n });\n },\n\n /** Extend to include details and version */\n _fetchParams: _super.prototype._fetchParams.concat([\n // TODO: remove (the need for) both\n /** version */\n \"v\",\n /** dataset ids to get full details of */\n \"details\"\n ]),\n\n /** override to add deleted/hidden filters */\n _buildFetchFilters: function(options) {\n var superFilters = _super.prototype._buildFetchFilters.call(this, options) || {};\n var filters = {};\n if (!this.includeDeleted) {\n filters.deleted = false;\n filters.purged = false;\n }\n if (!this.includeHidden) {\n filters.visible = true;\n }\n return _.defaults(superFilters, filters);\n },\n\n // ............ paginated collection\n getTotalItemCount: function() {\n return this.history.contentsShown();\n },\n\n // ............ history contents specific ajax\n /** override to filter requested contents to those updated after the Date 'since' */\n fetchUpdated: function(since, options) {\n if (since) {\n options = options || { filters: {} };\n options.remove = false;\n options.filters = {\n \"update_time-ge\": since.toISOString(),\n // workflows will produce hidden datasets (non-output datasets) that still\n // need to be updated in the collection or they'll update forever\n // we can remove the default visible filter by using an 'empty' value\n visible: \"\"\n };\n }\n return this.fetch(options);\n },\n\n /** fetch all the deleted==true contents of this collection */\n fetchDeleted: function(options) {\n options = options || {};\n options.filters = _.extend(options.filters, {\n // all deleted, purged or not\n deleted: true,\n purged: undefined\n });\n options.remove = false;\n\n this.trigger(\"fetching-deleted\", this);\n return this.fetch(options).always(() => {\n this.trigger(\"fetching-deleted-done\", this);\n });\n },\n\n /** fetch all the visible==false contents of this collection */\n fetchHidden: function(options) {\n options = options || {};\n var self = this;\n options.filters = _.extend(options.filters, {\n visible: false\n });\n options.remove = false;\n\n self.trigger(\"fetching-hidden\", self);\n return self.fetch(options).always(() => {\n self.trigger(\"fetching-hidden-done\", self);\n });\n },\n\n /** fetch detailed model data for all contents in this collection */\n fetchAllDetails: function(options) {\n options = options || {};\n var detailsFlag = { details: \"all\" };\n options.data = _.extend(options.data || {}, detailsFlag);\n return this.fetch(options);\n },\n\n /** specialty fetch method for retrieving the element_counts of all hdcas in the history */\n fetchCollectionCounts: function(options) {\n options = options || {};\n options.keys = [\"type_id\", \"element_count\"].join(\",\");\n options.filters = _.extend(options.filters || {}, {\n history_content_type: \"dataset_collection\"\n });\n options.remove = false;\n return this.fetch(options);\n },\n\n // ............. quasi-batch ops\n // TODO: to batch\n /** helper that fetches using filterParams then calls save on each fetched using updateWhat as the save params */\n _filterAndUpdate: function(filterParams, updateWhat) {\n var self = this;\n var idAttribute = self.model.prototype.idAttribute;\n var updateArgs = [updateWhat];\n\n return self.fetch({ filters: filterParams, remove: false }).then(fetched => {\n // convert filtered json array to model array\n fetched = fetched.reduce((modelArray, currJson, i) => {\n var model = self.get(currJson[idAttribute]);\n return model ? modelArray.concat(model) : modelArray;\n }, []);\n return self.ajaxQueue(\"save\", updateArgs, fetched);\n });\n },\n\n /** using a queue, perform ajaxFn on each of the models in this collection */\n ajaxQueue: function(ajaxFn, args, collection) {\n collection = collection || this.models;\n return new AJAX_QUEUE.AjaxQueue(\n collection\n .slice()\n .reverse()\n .map((content, i) => {\n var fn = _.isString(ajaxFn) ? content[ajaxFn] : ajaxFn;\n return () => fn.apply(content, args);\n })\n ).deferred;\n },\n\n /** fetch contents' details in batches of limitPerCall - note: only get searchable details here */\n progressivelyFetchDetails: function(options) {\n options = options || {};\n var deferred = jQuery.Deferred();\n var self = this;\n var limit = options.limitPerCall || self.limitPerProgressiveFetch;\n // TODO: only fetch tags and annotations if specifically requested\n var searchAttributes = HDA_MODEL.HistoryDatasetAssociation.prototype.searchAttributes;\n var detailKeys = searchAttributes.join(\",\");\n\n function _recursivelyFetch(offset) {\n offset = offset || 0;\n var _options = _.extend(_.clone(options), {\n view: \"summary\",\n keys: detailKeys,\n limit: limit,\n offset: offset,\n reset: offset === 0,\n remove: false\n });\n\n _.defer(() => {\n self.fetch\n .call(self, _options)\n .fail(deferred.reject)\n .done(response => {\n deferred.notify(response, limit, offset);\n if (response.length !== limit) {\n self.allFetched = true;\n deferred.resolve(response, limit, offset);\n } else {\n _recursivelyFetch(offset + limit);\n }\n });\n });\n }\n _recursivelyFetch();\n return deferred;\n },\n\n /** does some bit of JSON represent something that can be copied into this contents collection */\n isCopyable: function(contentsJSON) {\n var copyableModelClasses = [\"HistoryDatasetAssociation\", \"HistoryDatasetCollectionAssociation\"];\n return (\n _.isObject(contentsJSON) && contentsJSON.id && _.contains(copyableModelClasses, contentsJSON.model_class)\n );\n },\n\n /** copy an existing, accessible hda into this collection */\n copy: function(json) {\n // TODO: somehow showhorn all this into 'save'\n var id;\n\n var type;\n var contentType;\n if (_.isString(json)) {\n id = json;\n contentType = \"hda\";\n type = \"dataset\";\n } else {\n id = json.id;\n contentType =\n {\n HistoryDatasetAssociation: \"hda\",\n LibraryDatasetDatasetAssociation: \"ldda\",\n HistoryDatasetCollectionAssociation: \"hdca\"\n }[json.model_class] || \"hda\";\n type = contentType === \"hdca\" ? \"dataset_collection\" : \"dataset\";\n }\n var collection = this;\n\n var xhr = jQuery\n .ajax(this.url(), {\n method: \"POST\",\n contentType: \"application/json\",\n data: JSON.stringify({\n content: id,\n source: contentType,\n type: type\n })\n })\n .done(response => {\n collection.add([response], { parse: true });\n })\n .fail((error, status, message) => {\n collection.trigger(\"error\", collection, xhr, {}, \"Error copying contents\", {\n type: type,\n id: id,\n source: contentType\n });\n });\n\n return xhr;\n },\n\n /** create a new HDCA in this collection */\n createHDCA: function(elementIdentifiers, collectionType, name, hideSourceItems, options) {\n // normally collection.create returns the new model, but we need the promise from the ajax, so we fake create\n //precondition: elementIdentifiers is an array of plain js objects\n // in the proper form to create the collectionType\n var hdca = this.model({\n history_content_type: \"dataset_collection\",\n collection_type: collectionType,\n history_id: this.historyId,\n name: name,\n hide_source_items: hideSourceItems || false,\n // should probably be able to just send in a bunch of json here and restruct per class\n // note: element_identifiers is now (incorrectly) an attribute\n element_identifiers: elementIdentifiers\n // do not create the model on the client until the ajax returns\n });\n return hdca.save(options);\n },\n\n // ........................................................................ searching\n /** return true if all contents have the searchable attributes */\n haveSearchDetails: function() {\n return (\n this.allFetched &&\n this.all((\n content // null (which is a valid returned annotation value)\n ) =>\n // will return false when using content.has( 'annotation' )\n //TODO: a bit hacky - formalize\n _.has(content.attributes, \"annotation\")\n )\n );\n },\n\n /** return a new collection of contents whose attributes contain the substring matchesWhat */\n matches: function(matchesWhat) {\n return this.filter(content => content.matches(matchesWhat));\n },\n\n // ........................................................................ misc\n /** In this override, copy the historyId to the clone */\n clone: function() {\n var clone = Backbone.Collection.prototype.clone.call(this);\n clone.historyId = this.historyId;\n return clone;\n },\n\n /** String representation. */\n toString: function() {\n return [\"HistoryContents(\", [this.historyId, this.length].join(), \")\"].join(\"\");\n }\n});\n\n//==============================================================================\nexport default {\n HistoryContents: HistoryContents\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/history-item-li.js.map b/static/maps/mvc/history/history-item-li.js.map new file mode 100644 index 000000000000..956c96b0a3a5 --- /dev/null +++ b/static/maps/mvc/history/history-item-li.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["mvc/history/history-item-li.js"],"names":["_labelIfName","tag","indexOf","_","escape","slice","nametagTemplate","historyItem","sortBy","uniq","tags","map","join"],"mappings":"0EAAA,SAASA,EAAaC,GAClB,OAA4B,GAAxBA,EAAIC,QAAQ,SACZ,kCAAyCC,EAAEC,OAAOH,EAAII,MAAM,IAA5D,UAEO,+DAKXC,gBAPI,SAAAC,GACH,MAAA,0BAAMJ,EAAAK,OAAAL,EAAAM,KAAAF,EAAAG,OACHC,IAAAX,GACHY,KAAA,IAFA","file":"../../../scripts/mvc/history/history-item-li.js","sourcesContent":["function _labelIfName(tag) {\n if (tag.indexOf(\"name:\") == 0) {\n return `${_.escape(tag.slice(5))}`;\n } else {\n return \"\";\n }\n}\n\nfunction nametagTemplate(historyItem) {\n return `${_.sortBy(_.uniq(historyItem.tags))\n .map(_labelIfName)\n .join(\"\")}`;\n}\n\nexport default {\n nametagTemplate: nametagTemplate\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/history-model.js.map b/static/maps/mvc/history/history-model.js.map index fa47fa74a133..374140eacdd9 100644 --- a/static/maps/mvc/history/history-model.js.map +++ b/static/maps/mvc/history/history-model.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/history-model.js"],"names":["History","Backbone","Model","extend","_baseMvc2","default","LoggableMixin","mixin","SearchableModelMixin","_logNamespace","UPDATE_DELAY","defaults","model_class","id","name","state","deleted","contents_active","urlRoot","Galaxy","root","_historyContents2","HistoryContents","tag","contentsClass","historyJSON","options","this","logger","searchAttributes","searchAliases","history","historyId","get","order","_setUpListeners","_setUpCollectionListeners","initialize","updateTimeoutId","on","clearUpdateTimeout","model","newId","contents","error","trigger","apply","arguments","contentsShown","contentsActive","active","shown","includeDeleted","includeHidden","hidden","nice_size","size","_utils2","bytesToString","_localization2","toJSON","_","prototype","call","key","user","isAnonymous","numOfUnfinishedJobs","unfinishedJobIds","length","numOfUnfinishedShownContents","runningAndActive","_fetchContentRelatedAttributes","contentRelatedAttrs","fetch","data","$","param","keys","join","refresh","self","lastUpdateTime","allFetched","fetchPage","currentPage","fetchUpdated","done","response","status","xhr","serverResponseDatetime","Date","getResponseHeader","checkForUpdates","delay","_delayThenUpdate","historyData","clearTimeout","parse","parsed","create_time","update_time","fetchWithContents","contentsOptions","then","setHistoryId","fetchContents","view","fetchCurrentPage","save","jQuery","when","purged","undelete","copy","current","allDatasets","Error","postData","all_datasets","post","setAsCurrent","getJSON","newHistory","toString","_collectionSuper","InfinitelyScrollingCollection","HistoryCollection","limitOnFirstFetch","limitPerFetch","models","log","currentHistoryId","url","setUpListeners","change:deleted","debug","remove","copied","newData","setCurrent","oldCurrentId","_buildFetchData","_buildFetchFilters","superFilters","filters","fetchFirst","silent","limit","encoded_id-in","comparators","clone","name-dsc","buildComparator","ascending","size-asc","fetchMore","currentHistory","sort","unshift","create","hdas","historyOptions","xhrOptions","collection"],"mappings":"gYAaIA,EAAUC,SAASC,MAAMC,OAAOC,EAAAC,QAASC,eAAeH,OACxDC,EAAAC,QAASE,MACLH,EAAAC,QAASG,sBAELC,cAAe,UAGfC,aAAc,IAGdC,UACIC,YAAa,UAjB7BC,GAAA,KACAC,KAAA,kBAmBgBC,MAAO,MAEPC,SAAS,EACTC,mBAjBZjB,oBAqBQkB,QAAYC,OAAOC,KAAnB,gBAdAV,cAJ4BW,EAAAhB,QAAAiB,gBAO5BX,kBAAU,OAAA,aAAA,QAGNG,eACAC,MAAO,OAiBPQ,IAAK,QARTC,WAAe,SAAAC,EAAAC,GAiBXA,EAAUA,MAfdC,KAAAC,OAAAF,EAAAE,QAAA,KACAC,KAAAA,IAAmBF,KAAnBE,eAAkBJ,EAvBUC,G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AMC,EAAgBC,GAbpDL,IAAAA,EAAMpI,KAGF,OADIyH,OAAS1H,QAAQ0H,OAArBhI,KAAIgI,8BACAU,KAAAA,SAAAA,GACJhC,EAAAA,WAAiBhE,IAAjB9D,EAAgC+D,KAAapD,WAQjDkI,WAAA,SAAA9G,EAAAL,GAQK,OAPLuI,EAAQvI,MAEJC,KAAAqI,QAAIK,EAAa3I,GAgBjBC,KAAK0G,iBAAmBtG,EAAQE,IAAI,MAdpCP,EAAIgE,QACJ/D,KAAAkB,QAAW0C,cAAKxD,EAAWJ,MAA3BA,MAKJkG,SAAA,WAgBI,MAAA,qBAA4BlG,KAAK0C,OAAjC,YAAmD1C,KAAK0G,iBAAxD,kBATArI,QAAAA,EACAgI,kBAAKK","file":"../../../scripts/mvc/history/history-model.js","sourcesContent":["import HISTORY_CONTENTS from \"mvc/history/history-contents\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport CONTROLLED_FETCH_COLLECTION from \"mvc/base/controlled-fetch-collection\";\nimport UTILS from \"utils/utils\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/** @class Model for a Galaxy history resource - both a record of user\n * tool use and a collection of the datasets those tools produced.\n * @name History\n * @augments Backbone.Model\n */\nvar History = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(\n BASE_MVC.mixin(\n BASE_MVC.SearchableModelMixin,\n /** @lends History.prototype */ {\n _logNamespace: \"history\",\n\n /** ms between fetches when checking running jobs/datasets for updates */\n UPDATE_DELAY: 4000,\n\n // values from api (may need more)\n defaults: {\n model_class: \"History\",\n id: null,\n name: \"Unnamed History\",\n state: \"new\",\n\n deleted: false,\n contents_active: {},\n contents_states: {}\n },\n\n urlRoot: `${Galaxy.root}api/histories`,\n\n contentsClass: HISTORY_CONTENTS.HistoryContents,\n\n /** What model fields to search with */\n searchAttributes: [\"name\", \"annotation\", \"tags\"],\n\n /** Adding title and singular tag */\n searchAliases: {\n title: \"name\",\n tag: \"tags\"\n },\n\n // ........................................................................ set up/tear down\n /** Set up the model\n * @param {Object} historyJSON model data for this History\n * @param {Object} options any extra settings including logger\n */\n initialize: function(historyJSON, options) {\n options = options || {};\n this.logger = options.logger || null;\n this.log(`${this}.initialize:`, historyJSON, options);\n\n /** HistoryContents collection of the HDAs contained in this history. */\n this.contents = new this.contentsClass([], {\n history: this,\n historyId: this.get(\"id\"),\n order: options.order\n });\n\n this._setUpListeners();\n this._setUpCollectionListeners();\n\n /** cached timeout id for the dataset updater */\n this.updateTimeoutId = null;\n },\n\n /** set up any event listeners for this history including those to the contained HDAs\n * events: error:contents if an error occurred with the contents collection\n */\n _setUpListeners: function() {\n // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n return this.on({\n error: function(model, xhr, options, msg, details) {\n this.clearUpdateTimeout();\n },\n \"change:id\": function(model, newId) {\n if (this.contents) {\n this.contents.historyId = newId;\n }\n }\n });\n },\n\n /** event handlers for the contents submodels */\n _setUpCollectionListeners: function() {\n if (!this.contents) {\n return this;\n }\n // bubble up errors\n return this.listenTo(this.contents, {\n error: function() {\n this.trigger.apply(this, jQuery.makeArray(arguments));\n }\n });\n },\n\n // ........................................................................ derived attributes\n /** */\n contentsShown: function() {\n var contentsActive = this.get(\"contents_active\");\n var shown = contentsActive.active || 0;\n shown += this.contents.includeDeleted ? contentsActive.deleted : 0;\n shown += this.contents.includeHidden ? contentsActive.hidden : 0;\n return shown;\n },\n\n /** convert size in bytes to a more human readable version */\n nice_size: function() {\n var size = this.get(\"size\");\n return size ? UTILS.bytesToString(size, true, 2) : _l(\"(empty)\");\n },\n\n /** override to add nice_size */\n toJSON: function() {\n return _.extend(Backbone.Model.prototype.toJSON.call(this), {\n nice_size: this.nice_size()\n });\n },\n\n /** override to allow getting nice_size */\n get: function(key) {\n if (key === \"nice_size\") {\n return this.nice_size();\n }\n return Backbone.Model.prototype.get.apply(this, arguments);\n },\n\n // ........................................................................ common queries\n /** T/F is this history owned by the current user (Galaxy.user)\n * Note: that this will return false for an anon user even if the history is theirs.\n */\n ownedByCurrUser: function() {\n // no currUser\n if (!Galaxy || !Galaxy.user) {\n return false;\n }\n // user is anon or history isn't owned\n if (Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get(\"user_id\")) {\n return false;\n }\n return true;\n },\n\n /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n numOfUnfinishedJobs: function() {\n var unfinishedJobIds = this.get(\"non_ready_jobs\");\n return unfinishedJobIds ? unfinishedJobIds.length : 0;\n },\n\n /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n numOfUnfinishedShownContents: function() {\n return this.contents.runningAndActive().length || 0;\n },\n\n // ........................................................................ updates\n _fetchContentRelatedAttributes: function() {\n var contentRelatedAttrs = [\"size\", \"non_ready_jobs\", \"contents_active\", \"hid_counter\"];\n return this.fetch({\n data: $.param({\n keys: contentRelatedAttrs.join(\",\")\n })\n });\n },\n\n /** check for any changes since the last time we updated (or fetch all if ) */\n refresh: function(options) {\n // console.log( this + '.refresh' );\n options = options || {};\n var self = this;\n\n // note if there was no previous update time, all summary contents will be fetched\n var lastUpdateTime = self.lastUpdateTime;\n // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n this.contents.allFetched = false;\n var fetchFn =\n self.contents.currentPage !== 0\n ? () => self.contents.fetchPage(self.contents.currentPage)\n : () => self.contents.fetchUpdated(lastUpdateTime);\n // note: if there was no previous update time, all summary contents will be fetched\n return fetchFn().done((response, status, xhr) => {\n var serverResponseDatetime;\n try {\n serverResponseDatetime = new Date(xhr.getResponseHeader(\"Date\"));\n } catch (err) {}\n self.lastUpdateTime = serverResponseDatetime || new Date();\n self.checkForUpdates(options);\n });\n },\n\n /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n checkForUpdates: function(options) {\n // console.log( this + '.checkForUpdates' );\n options = options || {};\n var delay = this.UPDATE_DELAY;\n var self = this;\n if (!self.id) {\n return;\n }\n\n function _delayThenUpdate() {\n // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n self.clearUpdateTimeout();\n self.updateTimeoutId = setTimeout(() => {\n self.refresh(options);\n }, delay);\n }\n\n // if there are still datasets in the non-ready state, recurse into this function with the new time\n var nonReadyContentCount = this.numOfUnfinishedShownContents();\n // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n if (nonReadyContentCount > 0) {\n _delayThenUpdate();\n } else {\n // no datasets are running, but currently runnning jobs may still produce new datasets\n // see if the history has any running jobs and continue to update if so\n // (also update the size for the user in either case)\n self._fetchContentRelatedAttributes().done(historyData => {\n // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n if (self.numOfUnfinishedJobs() > 0) {\n _delayThenUpdate();\n } else {\n // otherwise, let listeners know that all updates have stopped\n self.trigger(\"ready\");\n }\n });\n }\n },\n\n /** clear the timeout and the cached timeout id */\n clearUpdateTimeout: function() {\n if (this.updateTimeoutId) {\n clearTimeout(this.updateTimeoutId);\n this.updateTimeoutId = null;\n }\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse: function(response, options) {\n var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n if (parsed.create_time) {\n parsed.create_time = new Date(parsed.create_time);\n }\n if (parsed.update_time) {\n parsed.update_time = new Date(parsed.update_time);\n }\n return parsed;\n },\n\n /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n fetchWithContents: function(options, contentsOptions) {\n options = options || {};\n var self = this;\n\n // console.log( this + '.fetchWithContents' );\n // TODO: push down to a base class\n options.view = \"dev-detailed\";\n\n // fetch history then use history data to fetch (paginated) contents\n return this.fetch(options).then(function getContents(history) {\n self.contents.history = self;\n self.contents.setHistoryId(history.id);\n return self.fetchContents(contentsOptions);\n });\n },\n\n /** fetch this histories contents, adjusting options based on the stored history preferences */\n fetchContents: function(options) {\n options = options || {};\n var self = this;\n\n // we're updating, reset the update time\n self.lastUpdateTime = new Date();\n return self.contents.fetchCurrentPage(options);\n },\n\n /** save this history, _Mark_ing it as deleted (just a flag) */\n _delete: function(options) {\n if (this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true }, options);\n },\n /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n purge: function(options) {\n if (this.get(\"purged\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true, purged: true }, options);\n },\n /** save this history, _Mark_ing it as undeleted */\n undelete: function(options) {\n if (!this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: false }, options);\n },\n\n /** Make a copy of this history on the server\n * @param {Boolean} current if true, set the copy as the new current history (default: true)\n * @param {String} name name of new history (default: none - server sets to: Copy of )\n * @fires copied passed this history and the response JSON from the copy\n * @returns {xhr}\n */\n copy: function(current, name, allDatasets) {\n current = current !== undefined ? current : true;\n if (!this.id) {\n throw new Error(\"You must set the history ID before copying it.\");\n }\n\n var postData = { history_id: this.id };\n if (current) {\n postData.current = true;\n }\n if (name) {\n postData.name = name;\n }\n if (!allDatasets) {\n postData.all_datasets = false;\n }\n postData.view = \"dev-detailed\";\n\n var history = this;\n var copy = jQuery.post(this.urlRoot, postData);\n // if current - queue to setAsCurrent before firing 'copied'\n if (current) {\n return copy.then(response => {\n var newHistory = new History(response);\n return newHistory.setAsCurrent().done(() => {\n history.trigger(\"copied\", history, response);\n });\n });\n }\n return copy.done(response => {\n history.trigger(\"copied\", history, response);\n });\n },\n\n setAsCurrent: function() {\n var history = this;\n\n var xhr = jQuery.getJSON(`${Galaxy.root}history/set_as_current?id=${this.id}`);\n\n xhr.done(() => {\n history.trigger(\"set-as-current\", history);\n });\n return xhr;\n },\n\n // ........................................................................ misc\n toString: function() {\n return `History(${this.get(\"id\")},${this.get(\"name\")})`;\n }\n }\n )\n);\n\n//==============================================================================\nvar _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n/** @class A collection of histories (per user)\n * that maintains the current history as the first in the collection.\n * New or copied histories become the current history.\n */\nvar HistoryCollection = _collectionSuper.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: \"history\",\n\n model: History,\n /** @type {String} initial order used by collection */\n order: \"update_time\",\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch: 10,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch: 10,\n\n initialize: function(models, options) {\n options = options || {};\n this.log(\"HistoryCollection.initialize\", models, options);\n _collectionSuper.prototype.initialize.call(this, models, options);\n\n /** @type {boolean} should deleted histories be included */\n this.includeDeleted = options.includeDeleted || false;\n\n /** @type {String} encoded id of the history that's current */\n this.currentHistoryId = options.currentHistoryId;\n\n this.setUpListeners();\n // note: models are sent to reset *after* this fn ends; up to this point\n // the collection *is empty*\n },\n\n urlRoot: `${Galaxy.root}api/histories`,\n url: function() {\n return this.urlRoot;\n },\n\n /** set up reflexive event handlers */\n setUpListeners: function setUpListeners() {\n return this.on({\n // when a history is deleted, remove it from the collection (if optionally set to do so)\n \"change:deleted\": function(history) {\n // TODO: this becomes complicated when more filters are used\n this.debug(\"change:deleted\", this.includeDeleted, history.get(\"deleted\"));\n if (!this.includeDeleted && history.get(\"deleted\")) {\n this.remove(history);\n }\n },\n // listen for a history copy, setting it to current\n copied: function(original, newData) {\n this.setCurrent(new History(newData, []));\n },\n // when a history is made current, track the id in the collection\n \"set-as-current\": function(history) {\n var oldCurrentId = this.currentHistoryId;\n this.trigger(\"no-longer-current\", oldCurrentId);\n this.currentHistoryId = history.id;\n }\n });\n },\n\n /** override to change view */\n _buildFetchData: function(options) {\n return _.extend(_collectionSuper.prototype._buildFetchData.call(this, options), {\n view: \"dev-detailed\"\n });\n },\n\n /** override to filter out deleted and purged */\n _buildFetchFilters: function(options) {\n var superFilters = _collectionSuper.prototype._buildFetchFilters.call(this, options) || {};\n var filters = {};\n if (!this.includeDeleted) {\n filters.deleted = false;\n filters.purged = false;\n } else {\n // force API to return both deleted and non\n //TODO: when the API is updated, remove this\n filters.deleted = null;\n }\n return _.defaults(superFilters, filters);\n },\n\n /** override to fetch current as well (as it may be outside the first 10, etc.) */\n fetchFirst: function(options) {\n var self = this;\n // TODO: batch?\n var xhr = $.when();\n if (this.currentHistoryId) {\n xhr = _collectionSuper.prototype.fetchFirst.call(self, {\n silent: true,\n limit: 1,\n filters: {\n // without these a deleted current history will return [] here and block the other xhr\n purged: \"\",\n deleted: \"\",\n \"encoded_id-in\": this.currentHistoryId\n }\n });\n }\n return xhr.then(() => {\n options = options || {};\n options.offset = 0;\n return self.fetchMore(options);\n });\n },\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators: _.extend(_.clone(_collectionSuper.prototype.comparators), {\n name: BASE_MVC.buildComparator(\"name\", {\n ascending: true\n }),\n \"name-dsc\": BASE_MVC.buildComparator(\"name\", {\n ascending: false\n }),\n size: BASE_MVC.buildComparator(\"size\", {\n ascending: false\n }),\n \"size-asc\": BASE_MVC.buildComparator(\"size\", {\n ascending: true\n })\n }),\n\n /** override to always have the current history first */\n sort: function(options) {\n options = options || {};\n var silent = options.silent;\n var currentHistory = this.remove(this.get(this.currentHistoryId));\n _collectionSuper.prototype.sort.call(this, _.defaults({ silent: true }, options));\n this.unshift(currentHistory, { silent: true });\n if (!silent) {\n this.trigger(\"sort\", this, options);\n }\n return this;\n },\n\n /** create a new history and by default set it to be the current history */\n create: function create(data, hdas, historyOptions, xhrOptions) {\n //TODO: .create is actually a collection function that's overridden here\n var collection = this;\n\n var xhr = jQuery.getJSON(`${Galaxy.root}history/create_new_current`);\n return xhr.done(newData => {\n collection.setCurrent(new History(newData, [], historyOptions || {}));\n });\n },\n\n /** set the current history to the given history, placing it first in the collection.\n * Pass standard bbone options for use in unshift.\n * @triggers new-current passed history and this collection\n */\n setCurrent: function(history, options) {\n options = options || {};\n // new histories go in the front\n this.unshift(history, options);\n this.currentHistoryId = history.get(\"id\");\n if (!options.silent) {\n this.trigger(\"new-current\", history, this);\n }\n return this;\n },\n\n toString: function toString() {\n return `HistoryCollection(${this.length},current:${this.currentHistoryId})`;\n }\n});\n\n//==============================================================================\nexport default {\n History: History,\n HistoryCollection: HistoryCollection\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/history-model.js"],"names":["History","Backbone","Model","extend","_baseMvc2","default","LoggableMixin","mixin","SearchableModelMixin","_logNamespace","UPDATE_DELAY","defaults","model_class","id","name","state","deleted","contents_active","urlRoot","Galaxy","root","_historyContents2","HistoryContents","tag","contentsClass","historyJSON","options","this","logger","searchAttributes","searchAliases","history","historyId","get","order","_setUpListeners","_setUpCollectionListeners","initialize","updateTimeoutId","on","clearUpdateTimeout","model","newId","contents","error","trigger","apply","arguments","contentsShown","contentsActive","active","shown","includeDeleted","includeHidden","hidden","nice_size","size","_utils2","bytesToString","_localization2","toJSON","_","prototype","call","key","user","isAnonymous","numOfUnfinishedJobs","unfinishedJobIds","length","numOfUnfinishedShownContents","runningAndActive","_fetchContentRelatedAttributes","contentRelatedAttrs","fetch","data","$","param","keys","join","refresh","_this","lastUpdateTime","currentPage","fetchUpdated","done","response","status","xhr","serverResponseDatetime","Date","getResponseHeader","err","checkForUpdates","_this2","fetchFn","delay","_delayThenUpdate","historyData","nonReadyContentCount","parse","parsed","create_time","update_time","contentsOptions","clearTimeout","view","setHistoryId","fetchContents","self","fetchCurrentPage","jQuery","when","purge","save","undelete","copy","current","allDatasets","undefined","postData","history_id","all_datasets","post","setAsCurrent","getJSON","_collectionSuper","_controlledFetchCollection2","InfinitelyScrollingCollection","HistoryCollection","limitOnFirstFetch","limitPerFetch","models","log","currentHistoryId","change:deleted","debug","remove","copied","original","newData","setCurrent","set-as-current","oldCurrentId","_buildFetchData","_buildFetchFilters","superFilters","filters","purged","fetchFirst","limit","encoded_id-in","then","offset","fetchMore","silent","name-dsc","buildComparator","ascending","size-asc","sort","comparators","clone","create","hdas","historyOptions","collection","unshift"],"mappings":"gYAaIA,EAAUC,SAASC,MAAMC,OAAOC,EAAAC,QAASC,eAAeH,OACxDC,EAAAC,QAASE,MACLH,EAAAC,QAASG,sBAELC,cAAe,UAGfC,aAAc,IAGdC,UACIC,YAAa,UA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AAAC,QAAAwJ,gBAAA,QACDC,WAAWN,MAKdQ,KApG0E,SAAAtI,GAsG3E,IAAAiI,GAkBIjI,EAAUA,OAlBdiI,OACAM,EAAatI,KAAWuI,OAAMpC,KAAAA,IAAAA,KAAiBhE,mBAIE,OAH7ChD,EAAMgD,UAAAkG,KAASH,KAAAA,KAAThG,EAAyBlD,UAAQgJ,QAAA,GAAAjI,IACnCoI,KAAAA,QAAAA,GAAWH,QAAA,IADTA,GAGNhI,KAAAkB,QAAY,OAAAlB,KAAAD,GAJuDC,MAUnEwI,OAAA,SAAYxF,EAAAyF,EAAAC,EAASR,GAAwB,IAAAS,EAAjC3I,KAKhB,OAkBcoF,OAAOc,QAAW1G,OAAOC,KAAzB,8BAlBdiE,KAAA,SAAAuD,GACAoB,EAAMnB,WAASnH,IAAS1B,EAAA4I,KAAAyB,WAQnBxB,WAAA,SAAA9G,EAAAL,GA2BD,OA1BAA,EAAAA,MAqBAC,KAAK4I,QAAQxI,EAASL,GAlB1BC,KAAA2G,iBAAAvG,EAAAE,IAAA,MACAkI,EAAQR,QACJhI,KAAAkB,QAAA,cAAAd,EAAAJ,MAqBOA,MAhBH2I,SAAAA,WACH,MAAA,qBAFD3I,KAAA0C,OAEC,YAFD1C,KAAA2G,iBAEC,kBAyBLtI,QAASA,EAlBT6I,kBAAYZ","file":"../../../scripts/mvc/history/history-model.js","sourcesContent":["import HISTORY_CONTENTS from \"mvc/history/history-contents\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport CONTROLLED_FETCH_COLLECTION from \"mvc/base/controlled-fetch-collection\";\nimport UTILS from \"utils/utils\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\n\n//==============================================================================\n/** @class Model for a Galaxy history resource - both a record of user\n * tool use and a collection of the datasets those tools produced.\n * @name History\n * @augments Backbone.Model\n */\nvar History = Backbone.Model.extend(BASE_MVC.LoggableMixin).extend(\n BASE_MVC.mixin(\n BASE_MVC.SearchableModelMixin,\n /** @lends History.prototype */ {\n _logNamespace: \"history\",\n\n /** ms between fetches when checking running jobs/datasets for updates */\n UPDATE_DELAY: 4000,\n\n // values from api (may need more)\n defaults: {\n model_class: \"History\",\n id: null,\n name: \"Unnamed History\",\n state: \"new\",\n\n deleted: false,\n contents_active: {},\n contents_states: {}\n },\n\n urlRoot: `${Galaxy.root}api/histories`,\n\n contentsClass: HISTORY_CONTENTS.HistoryContents,\n\n /** What model fields to search with */\n searchAttributes: [\"name\", \"annotation\", \"tags\"],\n\n /** Adding title and singular tag */\n searchAliases: {\n title: \"name\",\n tag: \"tags\"\n },\n\n // ........................................................................ set up/tear down\n /** Set up the model\n * @param {Object} historyJSON model data for this History\n * @param {Object} options any extra settings including logger\n */\n initialize: function(historyJSON, options) {\n options = options || {};\n this.logger = options.logger || null;\n this.log(`${this}.initialize:`, historyJSON, options);\n\n /** HistoryContents collection of the HDAs contained in this history. */\n this.contents = new this.contentsClass([], {\n history: this,\n historyId: this.get(\"id\"),\n order: options.order\n });\n\n this._setUpListeners();\n this._setUpCollectionListeners();\n\n /** cached timeout id for the dataset updater */\n this.updateTimeoutId = null;\n },\n\n /** set up any event listeners for this history including those to the contained HDAs\n * events: error:contents if an error occurred with the contents collection\n */\n _setUpListeners: function() {\n // if the model's id changes ('current' or null -> an actual id), update the contents history_id\n return this.on({\n error: function(model, xhr, options, msg, details) {\n this.clearUpdateTimeout();\n },\n \"change:id\": function(model, newId) {\n if (this.contents) {\n this.contents.historyId = newId;\n }\n }\n });\n },\n\n /** event handlers for the contents submodels */\n _setUpCollectionListeners: function() {\n if (!this.contents) {\n return this;\n }\n // bubble up errors\n return this.listenTo(this.contents, {\n error: function() {\n this.trigger.apply(this, jQuery.makeArray(arguments));\n }\n });\n },\n\n // ........................................................................ derived attributes\n /** */\n contentsShown: function() {\n var contentsActive = this.get(\"contents_active\");\n var shown = contentsActive.active || 0;\n shown += this.contents.includeDeleted ? contentsActive.deleted : 0;\n shown += this.contents.includeHidden ? contentsActive.hidden : 0;\n return shown;\n },\n\n /** convert size in bytes to a more human readable version */\n nice_size: function() {\n var size = this.get(\"size\");\n return size ? UTILS.bytesToString(size, true, 2) : _l(\"(empty)\");\n },\n\n /** override to add nice_size */\n toJSON: function() {\n return _.extend(Backbone.Model.prototype.toJSON.call(this), {\n nice_size: this.nice_size()\n });\n },\n\n /** override to allow getting nice_size */\n get: function(key) {\n if (key === \"nice_size\") {\n return this.nice_size();\n }\n return Backbone.Model.prototype.get.apply(this, arguments);\n },\n\n // ........................................................................ common queries\n /** T/F is this history owned by the current user (Galaxy.user)\n * Note: that this will return false for an anon user even if the history is theirs.\n */\n ownedByCurrUser: function() {\n // no currUser\n if (!Galaxy || !Galaxy.user) {\n return false;\n }\n // user is anon or history isn't owned\n if (Galaxy.user.isAnonymous() || Galaxy.user.id !== this.get(\"user_id\")) {\n return false;\n }\n return true;\n },\n\n /** Return the number of running jobs assoc with this history (note: unknown === 0) */\n numOfUnfinishedJobs: function() {\n var unfinishedJobIds = this.get(\"non_ready_jobs\");\n return unfinishedJobIds ? unfinishedJobIds.length : 0;\n },\n\n /** Return the number of running hda/hdcas in this history (note: unknown === 0) */\n numOfUnfinishedShownContents: function() {\n return this.contents.runningAndActive().length || 0;\n },\n\n // ........................................................................ updates\n _fetchContentRelatedAttributes: function() {\n var contentRelatedAttrs = [\"size\", \"non_ready_jobs\", \"contents_active\", \"hid_counter\"];\n return this.fetch({\n data: $.param({\n keys: contentRelatedAttrs.join(\",\")\n })\n });\n },\n\n /** check for any changes since the last time we updated (or fetch all if ) */\n refresh: function(options) {\n // console.log( this + '.refresh' );\n options = options || {};\n\n // note if there was no previous update time, all summary contents will be fetched\n var lastUpdateTime = this.lastUpdateTime;\n // if we don't flip this, then a fully-fetched list will not be re-checked via fetch\n this.contents.allFetched = false;\n var fetchFn =\n this.contents.currentPage !== 0\n ? () => this.contents.fetchPage(this.contents.currentPage)\n : () => this.contents.fetchUpdated(lastUpdateTime);\n // note: if there was no previous update time, all summary contents will be fetched\n return fetchFn().done((response, status, xhr) => {\n var serverResponseDatetime;\n try {\n serverResponseDatetime = new Date(xhr.getResponseHeader(\"Date\"));\n } catch (err) {}\n this.lastUpdateTime = serverResponseDatetime || new Date();\n this.checkForUpdates(options);\n });\n },\n\n /** continuously fetch updated contents every UPDATE_DELAY ms if this history's datasets or jobs are unfinished */\n checkForUpdates: function(options) {\n // console.log( this + '.checkForUpdates' );\n options = options || {};\n var delay = this.UPDATE_DELAY;\n if (!this.id) {\n return;\n }\n\n var _delayThenUpdate = () => {\n // prevent buildup of updater timeouts by clearing previous if any, then set new and cache id\n this.clearUpdateTimeout();\n this.updateTimeoutId = setTimeout(() => {\n this.refresh(options);\n }, delay);\n };\n\n // if there are still datasets in the non-ready state, recurse into this function with the new time\n var nonReadyContentCount = this.numOfUnfinishedShownContents();\n // console.log( 'nonReadyContentCount:', nonReadyContentCount );\n if (nonReadyContentCount > 0) {\n _delayThenUpdate();\n } else {\n // no datasets are running, but currently runnning jobs may still produce new datasets\n // see if the history has any running jobs and continue to update if so\n // (also update the size for the user in either case)\n this._fetchContentRelatedAttributes().done(historyData => {\n // console.log( 'non_ready_jobs:', historyData.non_ready_jobs );\n if (this.numOfUnfinishedJobs() > 0) {\n _delayThenUpdate();\n } else {\n // otherwise, let listeners know that all updates have stopped\n this.trigger(\"ready\");\n }\n });\n }\n },\n\n /** clear the timeout and the cached timeout id */\n clearUpdateTimeout: function() {\n if (this.updateTimeoutId) {\n clearTimeout(this.updateTimeoutId);\n this.updateTimeoutId = null;\n }\n },\n\n // ........................................................................ ajax\n /** override to use actual Dates objects for create/update times */\n parse: function(response, options) {\n var parsed = Backbone.Model.prototype.parse.call(this, response, options);\n if (parsed.create_time) {\n parsed.create_time = new Date(parsed.create_time);\n }\n if (parsed.update_time) {\n parsed.update_time = new Date(parsed.update_time);\n }\n return parsed;\n },\n\n /** fetch this histories data (using options) then it's contents (using contentsOptions) */\n fetchWithContents: function(options, contentsOptions) {\n options = options || {};\n var self = this;\n\n // console.log( this + '.fetchWithContents' );\n // TODO: push down to a base class\n options.view = \"dev-detailed\";\n\n // fetch history then use history data to fetch (paginated) contents\n return this.fetch(options).then(function getContents(history) {\n self.contents.history = self;\n self.contents.setHistoryId(history.id);\n return self.fetchContents(contentsOptions);\n });\n },\n\n /** fetch this histories contents, adjusting options based on the stored history preferences */\n fetchContents: function(options) {\n options = options || {};\n var self = this;\n\n // we're updating, reset the update time\n self.lastUpdateTime = new Date();\n return self.contents.fetchCurrentPage(options);\n },\n\n /** save this history, _Mark_ing it as deleted (just a flag) */\n _delete: function(options) {\n if (this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true }, options);\n },\n /** purge this history, _Mark_ing it as purged and removing all dataset data from the server */\n purge: function(options) {\n if (this.get(\"purged\")) {\n return jQuery.when();\n }\n return this.save({ deleted: true, purged: true }, options);\n },\n /** save this history, _Mark_ing it as undeleted */\n undelete: function(options) {\n if (!this.get(\"deleted\")) {\n return jQuery.when();\n }\n return this.save({ deleted: false }, options);\n },\n\n /** Make a copy of this history on the server\n * @param {Boolean} current if true, set the copy as the new current history (default: true)\n * @param {String} name name of new history (default: none - server sets to: Copy of )\n * @fires copied passed this history and the response JSON from the copy\n * @returns {xhr}\n */\n copy: function(current, name, allDatasets) {\n current = current !== undefined ? current : true;\n if (!this.id) {\n throw new Error(\"You must set the history ID before copying it.\");\n }\n\n var postData = { history_id: this.id };\n if (current) {\n postData.current = true;\n }\n if (name) {\n postData.name = name;\n }\n if (!allDatasets) {\n postData.all_datasets = false;\n }\n postData.view = \"dev-detailed\";\n\n var history = this;\n var copy = jQuery.post(this.urlRoot, postData);\n // if current - queue to setAsCurrent before firing 'copied'\n if (current) {\n return copy.then(response => {\n var newHistory = new History(response);\n return newHistory.setAsCurrent().done(() => {\n history.trigger(\"copied\", history, response);\n });\n });\n }\n return copy.done(response => {\n history.trigger(\"copied\", history, response);\n });\n },\n\n setAsCurrent: function() {\n var history = this;\n\n var xhr = jQuery.getJSON(`${Galaxy.root}history/set_as_current?id=${this.id}`);\n\n xhr.done(() => {\n history.trigger(\"set-as-current\", history);\n });\n return xhr;\n },\n\n // ........................................................................ misc\n toString: function() {\n return `History(${this.get(\"id\")},${this.get(\"name\")})`;\n }\n }\n )\n);\n\n//==============================================================================\nvar _collectionSuper = CONTROLLED_FETCH_COLLECTION.InfinitelyScrollingCollection;\n/** @class A collection of histories (per user)\n * that maintains the current history as the first in the collection.\n * New or copied histories become the current history.\n */\nvar HistoryCollection = _collectionSuper.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: \"history\",\n\n model: History,\n /** @type {String} initial order used by collection */\n order: \"update_time\",\n /** @type {Number} limit used for the first fetch (or a reset) */\n limitOnFirstFetch: 10,\n /** @type {Number} limit used for each subsequent fetch */\n limitPerFetch: 10,\n\n initialize: function(models, options) {\n options = options || {};\n this.log(\"HistoryCollection.initialize\", models, options);\n _collectionSuper.prototype.initialize.call(this, models, options);\n\n /** @type {boolean} should deleted histories be included */\n this.includeDeleted = options.includeDeleted || false;\n\n /** @type {String} encoded id of the history that's current */\n this.currentHistoryId = options.currentHistoryId;\n\n this.setUpListeners();\n // note: models are sent to reset *after* this fn ends; up to this point\n // the collection *is empty*\n },\n\n urlRoot: `${Galaxy.root}api/histories`,\n url: function() {\n return this.urlRoot;\n },\n\n /** set up reflexive event handlers */\n setUpListeners: function setUpListeners() {\n return this.on({\n // when a history is deleted, remove it from the collection (if optionally set to do so)\n \"change:deleted\": function(history) {\n // TODO: this becomes complicated when more filters are used\n this.debug(\"change:deleted\", this.includeDeleted, history.get(\"deleted\"));\n if (!this.includeDeleted && history.get(\"deleted\")) {\n this.remove(history);\n }\n },\n // listen for a history copy, setting it to current\n copied: function(original, newData) {\n this.setCurrent(new History(newData, []));\n },\n // when a history is made current, track the id in the collection\n \"set-as-current\": function(history) {\n var oldCurrentId = this.currentHistoryId;\n this.trigger(\"no-longer-current\", oldCurrentId);\n this.currentHistoryId = history.id;\n }\n });\n },\n\n /** override to change view */\n _buildFetchData: function(options) {\n return _.extend(_collectionSuper.prototype._buildFetchData.call(this, options), {\n view: \"dev-detailed\"\n });\n },\n\n /** override to filter out deleted and purged */\n _buildFetchFilters: function(options) {\n var superFilters = _collectionSuper.prototype._buildFetchFilters.call(this, options) || {};\n var filters = {};\n if (!this.includeDeleted) {\n filters.deleted = false;\n filters.purged = false;\n } else {\n // force API to return both deleted and non\n //TODO: when the API is updated, remove this\n filters.deleted = null;\n }\n return _.defaults(superFilters, filters);\n },\n\n /** override to fetch current as well (as it may be outside the first 10, etc.) */\n fetchFirst: function(options) {\n var self = this;\n // TODO: batch?\n var xhr = $.when();\n if (this.currentHistoryId) {\n xhr = _collectionSuper.prototype.fetchFirst.call(self, {\n silent: true,\n limit: 1,\n filters: {\n // without these a deleted current history will return [] here and block the other xhr\n purged: \"\",\n deleted: \"\",\n \"encoded_id-in\": this.currentHistoryId\n }\n });\n }\n return xhr.then(() => {\n options = options || {};\n options.offset = 0;\n return self.fetchMore(options);\n });\n },\n\n /** @type {Object} map of collection available sorting orders containing comparator fns */\n comparators: _.extend(_.clone(_collectionSuper.prototype.comparators), {\n name: BASE_MVC.buildComparator(\"name\", {\n ascending: true\n }),\n \"name-dsc\": BASE_MVC.buildComparator(\"name\", {\n ascending: false\n }),\n size: BASE_MVC.buildComparator(\"size\", {\n ascending: false\n }),\n \"size-asc\": BASE_MVC.buildComparator(\"size\", {\n ascending: true\n })\n }),\n\n /** override to always have the current history first */\n sort: function(options) {\n options = options || {};\n var silent = options.silent;\n var currentHistory = this.remove(this.get(this.currentHistoryId));\n _collectionSuper.prototype.sort.call(this, _.defaults({ silent: true }, options));\n this.unshift(currentHistory, { silent: true });\n if (!silent) {\n this.trigger(\"sort\", this, options);\n }\n return this;\n },\n\n /** create a new history and by default set it to be the current history */\n create: function create(data, hdas, historyOptions, xhrOptions) {\n //TODO: .create is actually a collection function that's overridden here\n var collection = this;\n\n var xhr = jQuery.getJSON(`${Galaxy.root}history/create_new_current`);\n return xhr.done(newData => {\n collection.setCurrent(new History(newData, [], historyOptions || {}));\n });\n },\n\n /** set the current history to the given history, placing it first in the collection.\n * Pass standard bbone options for use in unshift.\n * @triggers new-current passed history and this collection\n */\n setCurrent: function(history, options) {\n options = options || {};\n // new histories go in the front\n this.unshift(history, options);\n this.currentHistoryId = history.get(\"id\");\n if (!options.silent) {\n this.trigger(\"new-current\", history, this);\n }\n return this;\n },\n\n toString: function toString() {\n return `HistoryCollection(${this.length},current:${this.currentHistoryId})`;\n }\n});\n\n//==============================================================================\nexport default {\n History: History,\n HistoryCollection: HistoryCollection\n};\n"]} \ No newline at end of file diff --git a/static/maps/mvc/history/history-view.js.map b/static/maps/mvc/history/history-view.js.map index db32cd71843a..0c22511889cf 100644 --- a/static/maps/mvc/history/history-view.js.map +++ b/static/maps/mvc/history/history-view.js.map @@ -1 +1 @@ -{"version":3,"sources":["mvc/history/history-view.js"],"names":["_super","_listView2","default","ModelListPanel","HistoryView","extend","_logNamespace","HDAViewClass","_hdaLi2","HDAListItemView","HDCAViewClass","_hdcaLi2","HDCAListItemView","collectionClass","_historyContents2","HistoryContents","modelCollectionKey","tagName","className","prototype","emptyMsg","_localization2","noneFoundMsg","initialize","attributes","call","this","linkTarget","detailedFetchTimeoutId","_createDefaultCollection","history","model","freeModel","_clearDetailedFetchTimeout","clearTimeout","_setUpListeners","error","xhr","options","msg","details","clearUpdateTimeout","loading-done","self","_","delay","fetchCollectionCounts","views:ready view:attached view:removed","view","_renderSelectButton","view:attached","scrollTo","loadHistory","errorHandler","contentsOptions","silent","info","historyId","setModel","_historyModel2","History","id","FETCH_COLLECTION_COUNTS_DELAY","always","render","trigger","refreshContents","refresh","$","when","_setUpCollectionListeners","collection","_toggleContentsLoadingIndicator","fetchWithContents","_showLoadingIndicator","speed","callback","$indicator","$el","text","slideDown","isUndefined","fxSpeed","remove","_buildNewRender","$newRender","$where","html","_hideLoadingIndicator","hideSelectors","find","$existing","length","title","classes","faIcon","_renderEmptyMessage","$whereTo","$emptyMsg","$emptyMessage","get","active","empty","append","contents","haveSearchDetails","views","show","$scrollContainer","$list","renderItems","_filterCollection","models","_renderSomeItems","toggle","$paginationControls","searchFor","shouldPaginate","currentPage","last","getLastPage","map","m","_createItemView","push","_renderItemView$el","_filterItem","includeHidden","hidden","includeDeleted","isDeletedOrPurged","_getItemViewClass","contentType","TypeError","_getItemViewOptions","storage","isExpanded","expanded","ownedByCurrUser","_setUpItemViewListeners","panel","listenTo","addExpanded","v","collapsed","removeExpanded","collapseAll","clearExpanded","getSelectedModels","events","clone","click > .controls .prev","click > .controls .next","change > .controls .pages","click .messages [class$=message]","_clickPrevPage","ev","_clickNextPage","_changePageSelect","page","val","currentTarget","toggleShowDeleted","undefined","setIncludeDeleted","fetchCurrentPage","renderAll","toggleShowHidden","store","setIncludeHidden","_firstSearch","inputSelector","searchInput","progressivelyFetchDetails","limit","offset","done","searchItems","clearSearch","status","readyState","isString","errorModal","message","_errorModal2","badGatewayErrorModal","ajaxErrorModal","$messages","children","fadeOut","scrollToHid","hid","scrollToItem","first","viewsWhereModel","ordinalIndicator","number","numStr","charAt","toString","templates","mainTemplate","controlsTemplate","wrapTemplate","controls","pagination","paginationTemplate","_baseMvc2","el"],"mappings":"oiBAyBIA,EAASC,EAAAC,QAAUC,eACnBC,EAAcJ,EAAOK,QAEjBC,cAAe,UAGfC,aAAcC,EAAAN,QAAOO,gBAErBC,cAAeC,EAAAT,QAAQU,iBApB/BC,gBAAAC,EAAAZ,QAAAa,gBAwBQC,mBAAoB,WApB5BC,QAAA,MAuBQC,UAAclB,EAAOmB,UAAUD,UAA/B,iBAGAE,UAAU,EAAAC,EAAAnB,SAAG,yBAEboB,cAAc,EAAAD,EAAAnB,SAAG,8BApBrBF,mBAAS,EAAAqB,EAAAnB,SAAA,mBAGLI,8BADgC,IAOhCiB,WAAA,SAAAC,GACAX,EAAAA,UAAiBU,WAAAE,KAAAC,KAAiBX,GAIlCE,KAASU,WAZuBH,EAAAG,YAAA,SAehCD,KAAAE,u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,WAU/B,IAAAC,EAAIC,EAAAA,QAAmBC,cA4Bf,QAlCJ,+BAwCI,+BACA,qDAtCJ,WAmFJD,EAAkBpD,EAAAA,QAAMtJ,cAEpB4M,yBACAC,sBAHJ,8CA1FJ,SAgBY,+BAiFZ,2DAEIzM,8BA9EQ,yBACA,iDACA,iDACA,EAAAiB,EAAAnB,SAAG,4CACH,SACA,sCACA,iDACA,EAAAmB,EAAAnB,SAAG,iCACH,SACA,qCACA,iDACA,EAAAmB,EAAAnB,SAAG,gCACH,SACA,UAEA,+BAEA,mEACA,8BACA,SACA,UACA,SAGA,mCACA,yCAEA,uBACA,mCACA,SAEA,6BACA,0BACA,6CACA,uBACA,EAAAmB,EAAAnB,SAAG,OACH,YACA,+CACA,uBACA,EAAAmB,EAAAnB,SAAG,QACH,YACA,SACA,2CACA,SACA,SACA,kDACA,UAEJ,WAGA4M,EAAqBC,EAAA7M,QAASyM,cAE1B,sFACA,sCACA,WACA,EAAAtL,EAAAnB,SAAG,4EACH,KACA,6DACA,6EACA,+DACA,YACA,YACA,YACA,4FAEJ,SAGJ,OAAO0C,EAAEvC,OAAOuC,EAAE0G,MAAMtJ,EAAOmB,UAAUqL,YACrCQ,GAAIP,EACJG,SAAUF,EACVG,WAAYC,IA7Fe,cAmG/B1M,YAAaA","file":"../../../scripts/mvc/history/history-view.js","sourcesContent":["import LIST_VIEW from \"mvc/list/list-view\";\nimport HISTORY_MODEL from \"mvc/history/history-model\";\nimport HISTORY_CONTENTS from \"mvc/history/history-contents\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport HDA_LI from \"mvc/history/hda-li\";\nimport HDCA_LI from \"mvc/history/hdca-li\";\nimport USER from \"mvc/user/user-model\";\nimport ERROR_MODAL from \"mvc/ui/error-modal\";\nimport faIconButton from \"ui/fa-icon-button\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\nimport \"ui/search-input\";\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a history model.\n * Allows:\n * changing the loaded history\n * displaying data, info, and download\n * tracking history attrs: size, tags, annotations, name, etc.\n * Does not allow:\n * changing the name\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar HistoryView = _super.extend(\n /** @lends HistoryView.prototype */ {\n _logNamespace: \"history\",\n\n /** class to use for constructing the HDA views */\n HDAViewClass: HDA_LI.HDAListItemView,\n /** class to use for constructing the HDCA views */\n HDCAViewClass: HDCA_LI.HDCAListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass: HISTORY_CONTENTS.HistoryContents,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey: \"contents\",\n\n tagName: \"div\",\n className: `${_super.prototype.className} history-panel`,\n\n /** string to display when the collection is empty */\n emptyMsg: _l(\"This history is empty\"),\n /** displayed when no items match the search terms */\n noneFoundMsg: _l(\"No matching datasets found\"),\n /** string used for search placeholder */\n searchPlaceholder: _l(\"search datasets\"),\n\n /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n FETCH_COLLECTION_COUNTS_DELAY: 2000,\n\n // ......................................................................... SET UP\n /** Set up the view, bind listeners.\n * @param {Object} attributes optional settings for the panel\n */\n initialize: function(attributes) {\n _super.prototype.initialize.call(this, attributes);\n // ---- instance vars\n // control contents/behavior based on where (and in what context) the panel is being used\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || \"_blank\";\n\n /** timeout id for detailed fetch of collection counts, etc... */\n this.detailedFetchTimeoutId = null;\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection: function() {\n // override\n return new this.collectionClass([], {\n history: this.model\n });\n },\n\n /** In this override, clear the update timer on the model */\n freeModel: function() {\n _super.prototype.freeModel.call(this);\n if (this.model) {\n this.model.clearUpdateTimeout();\n }\n this._clearDetailedFetchTimeout();\n return this;\n },\n\n /** clear the timeout and the cached timeout id */\n _clearDetailedFetchTimeout: function() {\n if (this.detailedFetchTimeoutId) {\n clearTimeout(this.detailedFetchTimeoutId);\n this.detailedFetchTimeoutId = null;\n }\n },\n\n /** create any event listeners for the panel\n * @fires: rendered:initial on the first render\n * @fires: empty-history when switching to a history with no contents or creating a new history\n */\n _setUpListeners: function() {\n _super.prototype._setUpListeners.call(this);\n this.on({\n error: function(model, xhr, options, msg, details) {\n this.errorHandler(model, xhr, options, msg, details);\n },\n \"loading-done\": function() {\n var self = this;\n // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n self.detailedFetchTimeoutId = _.delay(() => {\n self.detailedFetchTimeoutId = null;\n self.model.contents.fetchCollectionCounts();\n }, self.FETCH_COLLECTION_COUNTS_DELAY);\n },\n \"views:ready view:attached view:removed\": function(view) {\n this._renderSelectButton();\n },\n \"view:attached\": function(view) {\n this.scrollTo(0);\n }\n });\n // this.on( 'all', function(){ console.debug( arguments ); });\n },\n\n // ------------------------------------------------------------------------ loading history/hda models\n /** load the history with the given id then it's contents, sending ajax options to both */\n loadHistory: function(historyId, options, contentsOptions) {\n contentsOptions = _.extend(contentsOptions || { silent: true });\n this.info(\"loadHistory:\", historyId, options, contentsOptions);\n var self = this;\n self.setModel(new HISTORY_MODEL.History({ id: historyId }));\n\n contentsOptions.silent = true;\n self.trigger(\"loading\");\n return self.model.fetchWithContents(options, contentsOptions).always(() => {\n self.render();\n self.trigger(\"loading-done\");\n });\n },\n\n /** convenience alias to the model. Updates the item list only (not the history) */\n refreshContents: function(options) {\n if (this.model) {\n return this.model.refresh(options);\n }\n // may have callbacks - so return an empty promise\n return $.when();\n },\n\n /** Override to reset web storage when the id changes (since it needs the id) */\n _setUpCollectionListeners: function() {\n _super.prototype._setUpCollectionListeners.call(this);\n return this.listenTo(this.collection, {\n // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n \"fetching-more\": function() {\n this._toggleContentsLoadingIndicator(true);\n this.$emptyMessage().hide();\n },\n \"fetching-more-done\": function() {\n this._toggleContentsLoadingIndicator(false);\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator: function(msg, speed, callback) {\n var $indicator = $('
');\n this.$el.html($indicator.text(msg).slideDown(!_.isUndefined(speed) ? speed : this.fxSpeed));\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator: function(speed) {\n // make speed a bit slower to compensate for slow rendering of up to 500 contents\n this.$(\".loading-indicator\").slideUp(!_.isUndefined(speed) ? speed : this.fxSpeed + 200, function() {\n $(this).remove();\n });\n },\n\n /** In this override, add a btn to toggle the selectors */\n _buildNewRender: function() {\n var $newRender = _super.prototype._buildNewRender.call(this);\n this._renderSelectButton($newRender);\n return $newRender;\n },\n\n /** button for starting select mode */\n _renderSelectButton: function($where) {\n $where = $where || this.$el;\n // do not render selector option if no actions\n if (!this.multiselectActions().length) {\n return null;\n }\n // do not render (and remove even) if nothing to select\n if (!this.views.length) {\n this.hideSelectors();\n $where.find(\".controls .actions .show-selectors-btn\").remove();\n return null;\n }\n // don't bother rendering if there's one already\n var $existing = $where.find(\".controls .actions .show-selectors-btn\");\n if ($existing.length) {\n return $existing;\n }\n\n return faIconButton({\n title: _l(\"Operations on multiple datasets\"),\n classes: \"show-selectors-btn\",\n faIcon: \"fa-check-square-o\"\n }).prependTo($where.find(\".controls .actions\"));\n },\n\n /** override to avoid showing intial empty message using contents_active */\n _renderEmptyMessage: function($whereTo) {\n var self = this;\n var $emptyMsg = self.$emptyMessage($whereTo);\n\n var empty = self.model.get(\"contents_active\").active <= 0;\n if (empty) {\n return $emptyMsg\n .empty()\n .append(self.emptyMsg)\n .show();\n } else if (self.searchFor && self.model.contents.haveSearchDetails() && !self.views.length) {\n return $emptyMsg\n .empty()\n .append(self.noneFoundMsg)\n .show();\n }\n $emptyMsg.hide();\n return $();\n },\n\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer: function($where) {\n // override or set via attributes.$scrollContainer\n return this.$list($where);\n },\n\n // ------------------------------------------------------------------------ subviews\n _toggleContentsLoadingIndicator: function(show) {\n if (!show) {\n this.$list()\n .find(\".contents-loading-indicator\")\n .remove();\n } else {\n this.$list().html(\n '
' + '
'\n );\n }\n },\n\n /** override to render pagination also */\n renderItems: function($whereTo) {\n // console.log( this + '.renderItems-----------------', new Date() );\n $whereTo = $whereTo || this.$el;\n var self = this;\n var $list = self.$list($whereTo);\n\n // TODO: bootstrap hack to remove orphaned tooltips\n $(\".tooltip\").remove();\n\n $list.empty();\n self.views = [];\n\n var models = self._filterCollection();\n if (models.length) {\n self._renderPagination($whereTo);\n self.views = self._renderSomeItems(models, $list);\n } else {\n // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n $whereTo.find(\"> .controls .list-pagination\").empty();\n }\n self._renderEmptyMessage($whereTo).toggle(!models.length);\n\n self.trigger(\"views:ready\", self.views);\n return self.views;\n },\n\n /** render pagination controls if not searching and contents says we're paginating */\n _renderPagination: function($whereTo) {\n var $paginationControls = $whereTo.find(\"> .controls .list-pagination\");\n if (this.searchFor || !this.model.contents.shouldPaginate()) return $paginationControls.empty();\n\n $paginationControls.html(\n this.templates.pagination(\n {\n // pagination is 1-based for the user\n current: this.model.contents.currentPage + 1,\n last: this.model.contents.getLastPage() + 1\n },\n this\n )\n );\n $paginationControls.find(\"select.pages\").tooltip();\n return $paginationControls;\n },\n\n /** render a subset of the entire collection (client-side pagination) */\n _renderSomeItems: function(models, $list) {\n var self = this;\n var views = [];\n $list.append(\n models.map(m => {\n var view = self._createItemView(m);\n views.push(view);\n return self._renderItemView$el(view);\n })\n );\n return views;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** in this override, check if the contents would also display based on includeDeleted/hidden */\n _filterItem: function(model) {\n var self = this;\n var contents = self.model.contents;\n return (\n (contents.includeHidden || !model.hidden()) &&\n (contents.includeDeleted || !model.isDeletedOrPurged()) &&\n _super.prototype._filterItem.call(self, model)\n );\n },\n\n /** In this override, since history contents are mixed,\n * get the appropo view class based on history_content_type\n */\n _getItemViewClass: function(model) {\n var contentType = model.get(\"history_content_type\");\n switch (contentType) {\n case \"dataset\":\n return this.HDAViewClass;\n case \"dataset_collection\":\n return this.HDCAViewClass;\n }\n throw new TypeError(`Unknown history_content_type: ${contentType}`);\n },\n\n /** in this override, add a linktarget, and expand if id is in web storage */\n _getItemViewOptions: function(model) {\n var options = _super.prototype._getItemViewOptions.call(this, model);\n return _.extend(options, {\n linkTarget: this.linkTarget,\n expanded: this.model.contents.storage.isExpanded(model.id),\n hasUser: this.model.ownedByCurrUser()\n });\n },\n\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners: function(view) {\n var panel = this;\n _super.prototype._setUpItemViewListeners.call(panel, view);\n //TODO: send from content view: this.model.collection.storage.addExpanded\n // maintain a list of items whose bodies are expanded\n return panel.listenTo(view, {\n expanded: function(v) {\n panel.model.contents.storage.addExpanded(v.model);\n },\n collapsed: function(v) {\n panel.model.contents.storage.removeExpanded(v.model);\n }\n });\n },\n\n /** override to remove expandedIds from webstorage */\n collapseAll: function() {\n this.model.contents.storage.clearExpanded();\n _super.prototype.collapseAll.call(this);\n },\n\n // ------------------------------------------------------------------------ selection\n /** Override to correctly set the historyId of the new collection */\n getSelectedModels: function() {\n var collection = _super.prototype.getSelectedModels.call(this);\n collection.historyId = this.collection.historyId;\n return collection;\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events: _.extend(_.clone(_super.prototype.events), {\n \"click .show-selectors-btn\": \"toggleSelectors\",\n \"click > .controls .prev\": \"_clickPrevPage\",\n \"click > .controls .next\": \"_clickNextPage\",\n \"change > .controls .pages\": \"_changePageSelect\",\n // allow (error) messages to be clicked away\n \"click .messages [class$=message]\": \"clearMessages\"\n }),\n\n _clickPrevPage: function(ev) {\n this.model.clearUpdateTimeout();\n this.model.contents.fetchPrevPage();\n },\n\n _clickNextPage: function(ev) {\n this.model.clearUpdateTimeout();\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect: function(ev) {\n this.model.clearUpdateTimeout();\n var page = $(ev.currentTarget).val();\n this.model.contents.fetchPage(page);\n },\n\n /** Toggle and store the deleted visibility and re-render items\n * @returns {Boolean} new setting\n */\n toggleShowDeleted: function(show, options) {\n show = show !== undefined ? show : !this.model.contents.includeDeleted;\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeDeleted(show, options);\n self.trigger(\"show-deleted\", show);\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** Toggle and store whether to render explicity hidden contents\n * @returns {Boolean} new setting\n */\n toggleShowHidden: function(show, store, options) {\n // console.log( 'toggleShowHidden', show, store );\n show = show !== undefined ? show : !this.model.contents.includeHidden;\n var self = this;\n var contents = self.model.contents;\n contents.setIncludeHidden(show, options);\n self.trigger(\"show-hidden\", show);\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** On the first search, if there are no details - load them, then search */\n _firstSearch: function(searchFor) {\n var self = this;\n var inputSelector = \"> .controls .search-input\";\n this.log(\"onFirstSearch\", searchFor);\n\n // if the contents already have enough details to search, search and return now\n if (self.model.contents.haveSearchDetails()) {\n self.searchItems(searchFor);\n return;\n }\n\n // otherwise, load the details progressively here\n self.$(inputSelector).searchInput(\"toggle-loading\");\n // set this now so that only results will show during progress\n self.searchFor = searchFor;\n var xhr = self.model.contents\n .progressivelyFetchDetails({ silent: true })\n .progress((response, limit, offset) => {\n self.renderItems();\n self.trigger(\"search:loading-progress\", limit, offset);\n })\n .always(() => {\n self.$el.find(inputSelector).searchInput(\"toggle-loading\");\n })\n .done(() => {\n self.searchItems(searchFor, \"force\");\n });\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch: function(searchFor) {\n var self = this;\n if (!self.searchFor) return self;\n //self.log( 'onSearchClear', self );\n self.searchFor = \"\";\n self.trigger(\"search:clear\", self);\n self.$(\"> .controls .search-query\").val(\"\");\n // NOTE: silent + render prevents collection update event with merge only\n // - which causes an empty page due to event handler above\n self.model.contents.fetchCurrentPage({ silent: true }).done(() => {\n self.renderItems();\n });\n return self;\n },\n\n // ........................................................................ error handling\n /** Event handler for errors (from the panel, the history, or the history's contents)\n * Alternately use two strings for model and xhr to use custom message and title (respectively)\n * @param {Model or View} model the (Backbone) source of the error\n * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n * @param {Object} options the options map commonly used with bbone ajax\n */\n errorHandler: function(model, xhr, options) {\n //TODO: to mixin or base model\n // interrupted ajax or no connection\n if (xhr && xhr.status === 0 && xhr.readyState === 0) {\n // return ERROR_MODAL.offlineErrorModal();\n // fail silently\n return;\n }\n // otherwise, leave something to report in the console\n this.error(model, xhr, options);\n // and feedback to a modal\n // if sent two strings (and possibly details as 'options'), use those as message and title\n if (_.isString(model) && _.isString(xhr)) {\n var message = model;\n var title = xhr;\n return ERROR_MODAL.errorModal(message, title, options);\n }\n // bad gateway\n // TODO: possibly to global handler\n if (xhr && xhr.status === 502) {\n return ERROR_MODAL.badGatewayErrorModal();\n }\n return ERROR_MODAL.ajaxErrorModal(model, xhr, options);\n },\n\n /** Remove all messages from the panel. */\n clearMessages: function(ev) {\n var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n $target.fadeOut(this.fxSpeed, function() {\n $(this).remove();\n });\n return this;\n },\n\n // ........................................................................ scrolling\n /** Scrolls the panel to show the content sub-view with the given hid.\n * @param {Integer} hid the hid of item to scroll into view\n * @returns {HistoryView} the panel\n */\n scrollToHid: function(hid) {\n return this.scrollToItem(_.first(this.viewsWhereModel({ hid: hid })));\n },\n\n // ........................................................................ misc\n /** utility for adding -st, -nd, -rd, -th to numbers */\n ordinalIndicator: function(number) {\n var numStr = `${number}`;\n switch (numStr.charAt(numStr.length - 1)) {\n case \"1\":\n return `${numStr}st`;\n case \"2\":\n return `${numStr}nd`;\n case \"3\":\n return `${numStr}rd`;\n default:\n return `${numStr}th`;\n }\n },\n\n /** Return a string rep of the history */\n toString: function() {\n return `HistoryView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryView.prototype.templates = (() => {\n var mainTemplate = BASE_MVC.wrapTemplate([\n // temp container\n \"
\",\n '
',\n '
    ',\n '
    ',\n \"
    \"\n ]);\n\n var controlsTemplate = BASE_MVC.wrapTemplate(\n [\n '
    ',\n '
    ',\n '
    <%- history.name %>
    ',\n \"
    \",\n '
    ',\n '
    <%- history.nice_size %>
    ',\n\n '
    ',\n\n '
    ',\n \"<% if( history.deleted && history.purged ){ %>\",\n '
    ',\n _l(\"This history has been purged and deleted\"),\n \"
    \",\n \"<% } else if( history.deleted ){ %>\",\n '
    ',\n _l(\"This history has been deleted\"),\n \"
    \",\n \"<% } else if( history.purged ){ %>\",\n '
    ',\n _l(\"This history has been purged\"),\n \"
    \",\n \"<% } %>\",\n\n \"<% if( history.message ){ %>\",\n // should already be localized\n '
    messagesmall\">',\n \"<%= history.message.text %>\",\n \"
    \",\n \"<% } %>\",\n \"
    \",\n\n // add tags and annotations\n '
    ',\n '
    ',\n\n '
    ',\n '
    ',\n \"
    \",\n\n '
    ',\n '
    ',\n '\",\n '\",\n \"
    \",\n '
    ',\n \"
    \",\n \"
    \",\n '
    ',\n \"
    \"\n ],\n \"history\"\n );\n\n var paginationTemplate = BASE_MVC.wrapTemplate(\n [\n '',\n '\",\n ''\n ],\n \"pages\"\n );\n\n return _.extend(_.clone(_super.prototype.templates), {\n el: mainTemplate,\n controls: controlsTemplate,\n pagination: paginationTemplate\n });\n})();\n\n//==============================================================================\nexport default {\n HistoryView: HistoryView\n};\n"]} \ No newline at end of file +{"version":3,"sources":["mvc/history/history-view.js"],"names":["_super","_listView2","default","ModelListPanel","HistoryView","extend","_logNamespace","HDAViewClass","_hdaLi2","HDAListItemView","HDCAViewClass","_hdcaLi2","HDCAListItemView","collectionClass","_historyContents2","HistoryContents","modelCollectionKey","tagName","className","prototype","emptyMsg","_localization2","noneFoundMsg","initialize","attributes","call","this","linkTarget","detailedFetchTimeoutId","_createDefaultCollection","history","model","freeModel","_clearDetailedFetchTimeout","clearTimeout","_setUpListeners","_this","error","xhr","options","msg","details","clearUpdateTimeout","loading-done","_","delay","contents","fetchCollectionCounts","view","view:attached","scrollTo","contentsOptions","_this2","silent","setModel","errorHandler","History","historyId","trigger","always","render","refreshContents","refresh","$","when","_setUpCollectionListeners","loadHistory","listenTo","collection","info","_toggleContentsLoadingIndicator","$emptyMessage","hide","_showLoadingIndicator","speed","callback","$el","$indicator","text","slideDown","isUndefined","fxSpeed","_hideLoadingIndicator","slideUp","remove","_buildNewRender","$newRender","_renderSelectButton","$where","multiselectActions","length","html","hideSelectors","find","$existing","_faIconButton2","faIcon","prependTo","$whereTo","get","active","$emptyMsg","empty","append","show","haveSearchDetails","views","title","$list","_renderEmptyMessage","searchFor","renderItems","models","_renderPagination","_renderSomeItems","toggle","_filterCollection","shouldPaginate","$paginationControls","templates","pagination","current","currentPage","tooltip","_this3","m","last","getLastPage","push","_filterItem","map","includeHidden","hidden","includeDeleted","_renderItemView$el","_getItemViewClass","contentType","_getItemViewOptions","TypeError","expanded","storage","isExpanded","id","hasUser","ownedByCurrUser","_setUpItemViewListeners","panel","v","addExpanded","removeExpanded","collapsed","clearExpanded","collapseAll","events","getSelectedModels","click > .controls .prev","click > .controls .next","change > .controls .pages","click .messages [class$=message]","_clickPrevPage","ev","fetchPrevPage","_clickNextPage","fetchNextPage","_changePageSelect","currentTarget","val","page","toggleShowDeleted","fetchPage","setIncludeDeleted","fetchCurrentPage","renderAll","undefined","setIncludeHidden","toggleShowHidden","_firstSearch","searchItems","log","searchInput","progressivelyFetchDetails","progress","response","limit","offset","_this4","inputSelector","clearSearch","done","_this5","status","readyState","isString","message","_errorModal2","errorModal","badGatewayErrorModal","ajaxErrorModal","clearMessages","$messages","children","fadeOut","scrollToHid","hid","scrollToItem","first","viewsWhereModel","ordinalIndicator","number","numStr","toString","controlsTemplate","_baseMvc2","wrapTemplate","el","controls","paginationTemplate","clone"],"mappings":"oiBAyBIA,EAASC,EAAAC,QAAUC,eACnBC,EAAc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AAMnL,KAAKoL,iBAAkBH,IAAKA,OAKjEI,iBAAkB,SAASC,GAN3BN,IAAAA,EAAAA,GAAaM,EACT,OAAOC,EAAKL,OAAAA,EAAeC,OAAWC,IAteV,IAAA,IA+epB,OAAUG,EAAV,KANZ,IAAA,IACA,OAAAA,EAAA,KACAF,IAAAA,IACQE,OAAYD,EAAZC,KACJ,QACI,OAAAA,EAAA,OAKIC,SAAA,WACJ,MAAA,gBAAAxL,KAAAK,MAAAL,KAAAK,MAAAoE,IAAA,QAAA,IAAA,OAMR+G,EAAAA,UAAU3F,UAAA,WACN,IAOW4F,EAAAC,EAAAlN,QAAAmN,cASX,yBAFJF,sBA2BI,8CACA,SAtBA,+BA4BA,2DAzBA,8BAEA,yBAqER,iDACIG,iDACAC,EAAAA,EAAAA,SAAAA,4CACA/F,SAHJ,sCAxFJ,iDA0BY,EAAAnG,EAAAnB,SAAG,iCAqEf,SAnEY,qCAqERE,iDAnEQ,EAAAiB,EAAAnB,SAAG,gCACH,SACA,UAEA,+BAEA,mEACA,8BACA,SACA,UACA,SAGA,mCACA,yCAEA,uBACA,mCACA,SAEA,6BACA,0BACA,6CACA,uBACA,EAAAmB,EAAAnB,SAAG,OACH,YACA,+CACA,uBACA,EAAAmB,EAAAnB,SAAG,QACH,YACA,SACA,2CACA,SACA,SACA,kDACA,UAEJ,WAGAsN,EAAqBJ,EAAAlN,QAASmN,cAE1B,sFACA,sCACA,WACA,EAAAhM,EAAAnB,SAAG,4EACH,KACA,6DACA,6EACA,+DACA,YACA,YACA,YACA,4FAEJ,SAGJ,OAAO0C,EAAEvC,OAAOuC,EAAE6K,MAAMzN,EAAOmB,UAAUoG,YACrC+F,GA/FI,WAAA,MAAA,gLAgGJC,SAAUJ,EACV3F,WAAYgG,IAlGF,cAwGdpN,YAAaA","file":"../../../scripts/mvc/history/history-view.js","sourcesContent":["import LIST_VIEW from \"mvc/list/list-view\";\nimport HISTORY_MODEL from \"mvc/history/history-model\";\nimport HISTORY_CONTENTS from \"mvc/history/history-contents\";\nimport HISTORY_PREFS from \"mvc/history/history-preferences\";\nimport HDA_LI from \"mvc/history/hda-li\";\nimport HDCA_LI from \"mvc/history/hdca-li\";\nimport USER from \"mvc/user/user-model\";\nimport ERROR_MODAL from \"mvc/ui/error-modal\";\nimport faIconButton from \"ui/fa-icon-button\";\nimport BASE_MVC from \"mvc/base-mvc\";\nimport _l from \"utils/localization\";\nimport \"ui/search-input\";\n\n/* =============================================================================\nTODO:\n\n============================================================================= */\n/** @class non-editable, read-only View/Controller for a history model.\n * Allows:\n * changing the loaded history\n * displaying data, info, and download\n * tracking history attrs: size, tags, annotations, name, etc.\n * Does not allow:\n * changing the name\n */\nvar _super = LIST_VIEW.ModelListPanel;\nvar HistoryView = _super.extend(\n /** @lends HistoryView.prototype */ {\n _logNamespace: \"history\",\n\n /** class to use for constructing the HDA views */\n HDAViewClass: HDA_LI.HDAListItemView,\n /** class to use for constructing the HDCA views */\n HDCAViewClass: HDCA_LI.HDCAListItemView,\n /** class to used for constructing collection of sub-view models */\n collectionClass: HISTORY_CONTENTS.HistoryContents,\n /** key of attribute in model to assign to this.collection */\n modelCollectionKey: \"contents\",\n\n tagName: \"div\",\n className: `${_super.prototype.className} history-panel`,\n\n /** string to display when the collection is empty */\n emptyMsg: _l(\"This history is empty\"),\n /** displayed when no items match the search terms */\n noneFoundMsg: _l(\"No matching datasets found\"),\n /** string used for search placeholder */\n searchPlaceholder: _l(\"search datasets\"),\n\n /** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */\n FETCH_COLLECTION_COUNTS_DELAY: 2000,\n\n // ......................................................................... SET UP\n /** Set up the view, bind listeners.\n * @param {Object} attributes optional settings for the panel\n */\n initialize: function(attributes) {\n _super.prototype.initialize.call(this, attributes);\n // ---- instance vars\n // control contents/behavior based on where (and in what context) the panel is being used\n /** where should pages from links be displayed? (default to new tab/window) */\n this.linkTarget = attributes.linkTarget || \"_blank\";\n\n /** timeout id for detailed fetch of collection counts, etc... */\n this.detailedFetchTimeoutId = null;\n },\n\n /** create and return a collection for when none is initially passed */\n _createDefaultCollection: function() {\n // override\n return new this.collectionClass([], {\n history: this.model\n });\n },\n\n /** In this override, clear the update timer on the model */\n freeModel: function() {\n _super.prototype.freeModel.call(this);\n if (this.model) {\n this.model.clearUpdateTimeout();\n }\n this._clearDetailedFetchTimeout();\n return this;\n },\n\n /** clear the timeout and the cached timeout id */\n _clearDetailedFetchTimeout: function() {\n if (this.detailedFetchTimeoutId) {\n clearTimeout(this.detailedFetchTimeoutId);\n this.detailedFetchTimeoutId = null;\n }\n },\n\n /** create any event listeners for the panel\n * @fires: rendered:initial on the first render\n * @fires: empty-history when switching to a history with no contents or creating a new history\n */\n _setUpListeners: function() {\n _super.prototype._setUpListeners.call(this);\n this.on({\n error: function(model, xhr, options, msg, details) {\n this.errorHandler(model, xhr, options, msg, details);\n },\n \"loading-done\": () => {\n // after the initial load, decorate with more time consuming fields (like HDCA element_counts)\n this.detailedFetchTimeoutId = _.delay(() => {\n this.detailedFetchTimeoutId = null;\n this.model.contents.fetchCollectionCounts();\n }, this.FETCH_COLLECTION_COUNTS_DELAY);\n },\n \"views:ready view:attached view:removed\": function(view) {\n this._renderSelectButton();\n },\n \"view:attached\": function(view) {\n this.scrollTo(0);\n }\n });\n // this.on( 'all', function(){ console.debug( arguments ); });\n },\n\n // ------------------------------------------------------------------------ loading history/hda models\n /** load the history with the given id then it's contents, sending ajax options to both */\n loadHistory: function(historyId, options, contentsOptions) {\n contentsOptions = _.extend(contentsOptions || { silent: true });\n this.info(\"loadHistory:\", historyId, options, contentsOptions);\n this.setModel(new HISTORY_MODEL.History({ id: historyId }));\n\n contentsOptions.silent = true;\n this.trigger(\"loading\");\n return this.model.fetchWithContents(options, contentsOptions).always(() => {\n this.render();\n this.trigger(\"loading-done\");\n });\n },\n\n /** convenience alias to the model. Updates the item list only (not the history) */\n refreshContents: function(options) {\n if (this.model) {\n return this.model.refresh(options);\n }\n // may have callbacks - so return an empty promise\n return $.when();\n },\n\n /** Override to reset web storage when the id changes (since it needs the id) */\n _setUpCollectionListeners: function() {\n _super.prototype._setUpCollectionListeners.call(this);\n return this.listenTo(this.collection, {\n // 'all' : function(){ console.log( this.collection + ':', arguments ); },\n \"fetching-more\": function() {\n this._toggleContentsLoadingIndicator(true);\n this.$emptyMessage().hide();\n },\n \"fetching-more-done\": function() {\n this._toggleContentsLoadingIndicator(false);\n }\n });\n },\n\n // ------------------------------------------------------------------------ panel rendering\n /** hide the $el and display a loading indicator (in the $el's parent) when loading new data */\n _showLoadingIndicator: function(msg, speed, callback) {\n var $indicator = $('
    ');\n this.$el.html($indicator.text(msg).slideDown(!_.isUndefined(speed) ? speed : this.fxSpeed));\n },\n\n /** hide the loading indicator */\n _hideLoadingIndicator: function(speed) {\n // make speed a bit slower to compensate for slow rendering of up to 500 contents\n this.$(\".loading-indicator\").slideUp(!_.isUndefined(speed) ? speed : this.fxSpeed + 200, function() {\n $(this).remove();\n });\n },\n\n /** In this override, add a btn to toggle the selectors */\n _buildNewRender: function() {\n var $newRender = _super.prototype._buildNewRender.call(this);\n this._renderSelectButton($newRender);\n return $newRender;\n },\n\n /** button for starting select mode */\n _renderSelectButton: function($where) {\n $where = $where || this.$el;\n // do not render selector option if no actions\n if (!this.multiselectActions().length) {\n return null;\n }\n // do not render (and remove even) if nothing to select\n if (!this.views.length) {\n this.hideSelectors();\n $where.find(\".controls .actions .show-selectors-btn\").remove();\n return null;\n }\n // don't bother rendering if there's one already\n var $existing = $where.find(\".controls .actions .show-selectors-btn\");\n if ($existing.length) {\n return $existing;\n }\n\n return faIconButton({\n title: _l(\"Operations on multiple datasets\"),\n classes: \"show-selectors-btn\",\n faIcon: \"fa-check-square-o\"\n }).prependTo($where.find(\".controls .actions\"));\n },\n\n /** override to avoid showing intial empty message using contents_active */\n _renderEmptyMessage: function($whereTo) {\n var $emptyMsg = this.$emptyMessage($whereTo);\n var empty = this.model.get(\"contents_active\").active <= 0;\n if (empty) {\n return $emptyMsg\n .empty()\n .append(this.emptyMsg)\n .show();\n } else if (this.searchFor && this.model.contents.haveSearchDetails() && !this.views.length) {\n return $emptyMsg\n .empty()\n .append(this.noneFoundMsg)\n .show();\n }\n $emptyMsg.hide();\n return $();\n },\n\n /** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */\n $scrollContainer: function($where) {\n // override or set via attributes.$scrollContainer\n return this.$list($where);\n },\n\n // ------------------------------------------------------------------------ subviews\n _toggleContentsLoadingIndicator: function(show) {\n if (!show) {\n this.$list()\n .find(\".contents-loading-indicator\")\n .remove();\n } else {\n this.$list().html(\n '
    ' + '
    '\n );\n }\n },\n\n /** override to render pagination also */\n renderItems: function($whereTo) {\n // console.log( this + '.renderItems-----------------', new Date() );\n $whereTo = $whereTo || this.$el;\n var $list = this.$list($whereTo);\n\n // TODO: bootstrap hack to remove orphaned tooltips\n $(\".tooltip\").remove();\n\n $list.empty();\n this.views = [];\n\n var models = this._filterCollection();\n if (models.length) {\n this._renderPagination($whereTo);\n this.views = this._renderSomeItems(models, $list);\n } else {\n // TODO: consolidate with _renderPagination above by (???) passing in models/length?\n $whereTo.find(\"> .controls .list-pagination\").empty();\n }\n this._renderEmptyMessage($whereTo).toggle(!models.length);\n\n this.trigger(\"views:ready\", this.views);\n return this.views;\n },\n\n /** render pagination controls if not searching and contents says we're paginating */\n _renderPagination: function($whereTo) {\n var $paginationControls = $whereTo.find(\"> .controls .list-pagination\");\n if (this.searchFor || !this.model.contents.shouldPaginate()) return $paginationControls.empty();\n\n $paginationControls.html(\n this.templates.pagination(\n {\n // pagination is 1-based for the user\n current: this.model.contents.currentPage + 1,\n last: this.model.contents.getLastPage() + 1\n },\n this\n )\n );\n $paginationControls.find(\"select.pages\").tooltip();\n return $paginationControls;\n },\n\n /** render a subset of the entire collection (client-side pagination) */\n _renderSomeItems: function(models, $list) {\n var views = [];\n $list.append(\n models.map(m => {\n var view = this._createItemView(m);\n views.push(view);\n return this._renderItemView$el(view);\n })\n );\n return views;\n },\n\n // ------------------------------------------------------------------------ sub-views\n /** in this override, check if the contents would also display based on includeDeleted/hidden */\n _filterItem: function(model) {\n var contents = this.model.contents;\n return (\n (contents.includeHidden || !model.hidden()) &&\n (contents.includeDeleted || !model.isDeletedOrPurged()) &&\n _super.prototype._filterItem.call(this, model)\n );\n },\n\n /** In this override, since history contents are mixed,\n * get the appropo view class based on history_content_type\n */\n _getItemViewClass: function(model) {\n var contentType = model.get(\"history_content_type\");\n switch (contentType) {\n case \"dataset\":\n return this.HDAViewClass;\n case \"dataset_collection\":\n return this.HDCAViewClass;\n }\n throw new TypeError(`Unknown history_content_type: ${contentType}`);\n },\n\n /** in this override, add a linktarget, and expand if id is in web storage */\n _getItemViewOptions: function(model) {\n var options = _super.prototype._getItemViewOptions.call(this, model);\n return _.extend(options, {\n linkTarget: this.linkTarget,\n expanded: this.model.contents.storage.isExpanded(model.id),\n hasUser: this.model.ownedByCurrUser()\n });\n },\n\n /** In this override, add/remove expanded/collapsed model ids to/from web storage */\n _setUpItemViewListeners: function(view) {\n var panel = this;\n _super.prototype._setUpItemViewListeners.call(panel, view);\n //TODO: send from content view: this.model.collection.storage.addExpanded\n // maintain a list of items whose bodies are expanded\n return panel.listenTo(view, {\n expanded: function(v) {\n panel.model.contents.storage.addExpanded(v.model);\n },\n collapsed: function(v) {\n panel.model.contents.storage.removeExpanded(v.model);\n }\n });\n },\n\n /** override to remove expandedIds from webstorage */\n collapseAll: function() {\n this.model.contents.storage.clearExpanded();\n _super.prototype.collapseAll.call(this);\n },\n\n // ------------------------------------------------------------------------ selection\n /** Override to correctly set the historyId of the new collection */\n getSelectedModels: function() {\n var collection = _super.prototype.getSelectedModels.call(this);\n collection.historyId = this.collection.historyId;\n return collection;\n },\n\n // ------------------------------------------------------------------------ panel events\n /** event map */\n events: _.extend(_.clone(_super.prototype.events), {\n \"click .show-selectors-btn\": \"toggleSelectors\",\n \"click > .controls .prev\": \"_clickPrevPage\",\n \"click > .controls .next\": \"_clickNextPage\",\n \"change > .controls .pages\": \"_changePageSelect\",\n // allow (error) messages to be clicked away\n \"click .messages [class$=message]\": \"clearMessages\"\n }),\n\n _clickPrevPage: function(ev) {\n this.model.clearUpdateTimeout();\n this.model.contents.fetchPrevPage();\n },\n\n _clickNextPage: function(ev) {\n this.model.clearUpdateTimeout();\n this.model.contents.fetchNextPage();\n },\n\n _changePageSelect: function(ev) {\n this.model.clearUpdateTimeout();\n var page = $(ev.currentTarget).val();\n this.model.contents.fetchPage(page);\n },\n\n /** Toggle and store the deleted visibility and re-render items\n * @returns {Boolean} new setting\n */\n toggleShowDeleted: function(show, options) {\n show = show !== undefined ? show : !this.model.contents.includeDeleted;\n var contents = this.model.contents;\n contents.setIncludeDeleted(show, options);\n this.trigger(\"show-deleted\", show);\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** Toggle and store whether to render explicity hidden contents\n * @returns {Boolean} new setting\n */\n toggleShowHidden: function(show, store, options) {\n // console.log( 'toggleShowHidden', show, store );\n show = show !== undefined ? show : !this.model.contents.includeHidden;\n var contents = this.model.contents;\n contents.setIncludeHidden(show, options);\n this.trigger(\"show-hidden\", show);\n\n contents.fetchCurrentPage({ renderAll: true });\n return show;\n },\n\n /** On the first search, if there are no details - load them, then search */\n _firstSearch: function(searchFor) {\n var inputSelector = \"> .controls .search-input\";\n this.log(\"onFirstSearch\", searchFor);\n\n // if the contents already have enough details to search, search and return now\n if (this.model.contents.haveSearchDetails()) {\n this.searchItems(searchFor);\n return;\n }\n\n // otherwise, load the details progressively here\n this.$(inputSelector).searchInput(\"toggle-loading\");\n // set this now so that only results will show during progress\n this.searchFor = searchFor;\n var xhr = this.model.contents\n .progressivelyFetchDetails({ silent: true })\n .progress((response, limit, offset) => {\n this.renderItems();\n this.trigger(\"search:loading-progress\", limit, offset);\n })\n .always(() => {\n this.$el.find(inputSelector).searchInput(\"toggle-loading\");\n })\n .done(() => {\n this.searchItems(searchFor, \"force\");\n });\n },\n\n /** clear the search filters and show all views that are normally shown */\n clearSearch: function(searchFor) {\n if (!this.searchFor) return this;\n //this.log( 'onSearchClear', this );\n this.searchFor = \"\";\n this.trigger(\"search:clear\", this);\n this.$(\"> .controls .search-query\").val(\"\");\n // NOTE: silent + render prevents collection update event with merge only\n // - which causes an empty page due to event handler above\n this.model.contents.fetchCurrentPage({ silent: true }).done(() => {\n this.renderItems();\n });\n return this;\n },\n\n // ........................................................................ error handling\n /** Event handler for errors (from the panel, the history, or the history's contents)\n * Alternately use two strings for model and xhr to use custom message and title (respectively)\n * @param {Model or View} model the (Backbone) source of the error\n * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error\n * @param {Object} options the options map commonly used with bbone ajax\n */\n errorHandler: function(model, xhr, options) {\n //TODO: to mixin or base model\n // interrupted ajax or no connection\n if (xhr && xhr.status === 0 && xhr.readyState === 0) {\n // return ERROR_MODAL.offlineErrorModal();\n // fail silently\n return;\n }\n // otherwise, leave something to report in the console\n this.error(model, xhr, options);\n // and feedback to a modal\n // if sent two strings (and possibly details as 'options'), use those as message and title\n if (_.isString(model) && _.isString(xhr)) {\n var message = model;\n var title = xhr;\n return ERROR_MODAL.errorModal(message, title, options);\n }\n // bad gateway\n // TODO: possibly to global handler\n if (xhr && xhr.status === 502) {\n return ERROR_MODAL.badGatewayErrorModal();\n }\n return ERROR_MODAL.ajaxErrorModal(model, xhr, options);\n },\n\n /** Remove all messages from the panel. */\n clearMessages: function(ev) {\n var $target = !_.isUndefined(ev) ? $(ev.currentTarget) : this.$messages().children('[class$=\"message\"]');\n $target.fadeOut(this.fxSpeed, function() {\n $(this).remove();\n });\n return this;\n },\n\n // ........................................................................ scrolling\n /** Scrolls the panel to show the content sub-view with the given hid.\n * @param {Integer} hid the hid of item to scroll into view\n * @returns {HistoryView} the panel\n */\n scrollToHid: function(hid) {\n return this.scrollToItem(_.first(this.viewsWhereModel({ hid: hid })));\n },\n\n // ........................................................................ misc\n /** utility for adding -st, -nd, -rd, -th to numbers */\n ordinalIndicator: function(number) {\n var numStr = `${number}`;\n switch (numStr.charAt(numStr.length - 1)) {\n case \"1\":\n return `${numStr}st`;\n case \"2\":\n return `${numStr}nd`;\n case \"3\":\n return `${numStr}rd`;\n default:\n return `${numStr}th`;\n }\n },\n\n /** Return a string rep of the history */\n toString: function() {\n return `HistoryView(${this.model ? this.model.get(\"name\") : \"\"})`;\n }\n }\n);\n\n//------------------------------------------------------------------------------ TEMPLATES\nHistoryView.prototype.templates = (() => {\n var mainTemplate = () =>\n `
    \n
    \n
      \n
      ',\n
      `;\n\n var controlsTemplate = BASE_MVC.wrapTemplate(\n [\n '
      ',\n '
      ',\n '
      <%- history.name %>
      ',\n \"
      \",\n '
      ',\n '
      <%- history.nice_size %>
      ',\n\n '
      ',\n\n '
      ',\n \"<% if( history.deleted && history.purged ){ %>\",\n '
      ',\n _l(\"This history has been purged and deleted\"),\n \"
      \",\n \"<% } else if( history.deleted ){ %>\",\n '
      ',\n _l(\"This history has been deleted\"),\n \"
      \",\n \"<% } else if( history.purged ){ %>\",\n '
      ',\n _l(\"This history has been purged\"),\n \"
      \",\n \"<% } %>\",\n\n \"<% if( history.message ){ %>\",\n // should already be localized\n '
      messagesmall\">',\n \"<%= history.message.text %>\",\n \"
      \",\n \"<% } %>\",\n \"
      \",\n\n // add tags and annotations\n '
      ',\n '
      ',\n\n '
      ',\n '
      ',\n \"
      \",\n\n '
      ',\n '
      ',\n '\",\n '\",\n \"
      \",\n '
      ',\n \"
      \",\n \"
      \",\n '
      ',\n \"
      \"\n ],\n \"history\"\n );\n\n var paginationTemplate = BASE_MVC.wrapTemplate(\n [\n '',\n '\",\n ''\n ],\n \"pages\"\n );\n\n return _.extend(_.clone(_super.prototype.templates), {\n el: mainTemplate,\n controls: controlsTemplate,\n pagination: paginationTemplate\n });\n})();\n\n//==============================================================================\nexport default {\n HistoryView: HistoryView\n};\n"]} \ No newline at end of file diff --git a/static/scripts/bundled/admin.bundled.js b/static/scripts/bundled/admin.bundled.js index 70c700339f81..c82568a03077 100644 --- a/static/scripts/bundled/admin.bundled.js +++ b/static/scripts/bundled/admin.bundled.js @@ -1,2 +1,2 @@ -webpackJsonp([1],{171:function(e,t,a){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var s=a(0),i=t(s),r=a(24),o=t(r),n=a(172),l=t(n),u=a(44),d=t(u),_=a(12),m=t(_),c=a(6),p=(t(c),a(8)),f=t(p),g=a(30),h=t(g),w=a(3),y=t(w),b=a(25),v=t(b),x=i.default;window.app=function(t,a){window.Galaxy=new o.default.GalaxyApp(t,a),Galaxy.debug("admin app");var s=h.default.extend({routes:{"(/)admin(/)users":"show_users","(/)admin(/)roles":"show_roles","(/)admin(/)groups":"show_groups","(/)admin(/)tool_versions":"show_tool_versions","(/)admin(/)quotas":"show_quotas","(/)admin(/)repositories":"show_repositories","(/)admin(/)forms":"show_forms","(/)admin(/)form(/)(:form_id)":"show_form"},authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id&&Galaxy.user.get("is_admin")},show_users:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/users_list",url_data:Galaxy.params,dict_format:!0}))},show_roles:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/roles_list",url_data:Galaxy.params,dict_format:!0}))},show_groups:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/groups_list",url_data:Galaxy.params,dict_format:!0}))},show_repositories:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin_toolshed/browse_repositories",url_data:Galaxy.params,dict_format:!0}))},show_tool_versions:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/tool_versions_list",url_data:Galaxy.params,dict_format:!0}))},show_quotas:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/quotas_list",url_data:Galaxy.params,dict_format:!0}))},show_forms:function(){this.page.display(new m.default({url_base:Galaxy.root+"forms/forms_list",url_data:Galaxy.params,dict_format:!0}))},show_form:function(e){var t="?id="+f.default.get("id"),a={reset_user_password:{title:"Reset passwords",url:"admin/reset_user_password"+t,icon:"fa-user",submit_title:"Save new password",redirect:"admin/users"},manage_roles_and_groups_for_user:{url:"admin/manage_roles_and_groups_for_user"+t,icon:"fa-users",redirect:"admin/users"},manage_users_and_groups_for_role:{url:"admin/manage_users_and_groups_for_role"+t,redirect:"admin/roles"},manage_users_and_roles_for_group:{url:"admin/manage_users_and_roles_for_group"+t,redirect:"admin/groups"},manage_users_and_groups_for_quota:{url:"admin/manage_users_and_groups_for_quota"+t,redirect:"admin/quotas"},create_role:{url:"admin/create_role",redirect:"admin/roles"},create_group:{url:"admin/create_group",redirect:"admin/groups"},create_quota:{url:"admin/create_quota",redirect:"admin/quotas"},rename_role:{url:"admin/rename_role"+t,redirect:"admin/roles"},rename_group:{url:"admin/rename_group"+t,redirect:"admin/groups"},rename_quota:{url:"admin/rename_quota"+t,redirect:"admin/quotas"},edit_quota:{url:"admin/edit_quota"+t,redirect:"admin/quotas"},set_quota_default:{url:"admin/set_quota_default"+t,redirect:"admin/quotas"},create_form:{url:"forms/create_form",redirect:"admin/forms"},edit_form:{url:"forms/edit_form"+t,redirect:"admin/forms"}};this.page.display(new d.default.View(a[e]))}});x(function(){e.extend(t.config,{active_view:"admin"}),y.default.setWindowTitle("Administration"),Galaxy.page=new v.default.View(e.extend(t,{Left:l.default,Router:s}))})}}).call(t,a(1))},172:function(e,t,a){"use strict";(function(e,s,i){Object.defineProperty(t,"__esModule",{value:!0});var r=a(4),o=function(e){return e&&e.__esModule?e:{default:e}}(r),n=e.View.extend({initialize:function(t,a){var s=this;this.page=t,this.root=a.root,this.config=a.config,this.settings=a.settings,this.message=a.message,this.status=a.status,this.model=new e.Model({title:(0,o.default)("Administration")}),this.categories=new e.Collection([{title:"Server",items:[{title:"Data types",url:"admin/view_datatypes_registry"},{title:"Data tables",url:"admin/view_tool_data_tables"},{title:"Display applications",url:"admin/display_applications"},{title:"Manage jobs",url:"admin/jobs"},{title:"Local data",url:"data_manager"}]},{title:"User Management",items:[{title:"Users",url:"admin/users",target:"__use_router__"},{title:"Quotas",url:"admin/quotas",target:"__use_router__",enabled:s.config.enable_quotas},{title:"Groups",url:"admin/groups",target:"__use_router__"},{title:"Roles",url:"admin/roles",target:"__use_router__"},{title:"Forms",url:"admin/forms",target:"__use_router__"},{title:"API keys",url:"userskeys/all_users"},{title:"Impersonate a user",url:"admin/impersonate",enabled:s.config.allow_user_impersonation}]},{title:"Tool Management",items:[{title:"Install new tools",url:"admin_toolshed/browse_tool_sheds",enabled:s.settings.is_tool_shed_installed},{title:"Install new tools (Beta)",url:"admin_toolshed/browse_toolsheds",enabled:s.settings.is_tool_shed_installed&&s.config.enable_beta_ts_api_install},{title:"Monitor installation",url:"admin_toolshed/monitor_repository_installation",enabled:s.settings.installing_repository_ids},{title:"Manage tools",url:"admin/repositories",enabled:s.settings.is_repo_installed,target:"__use_router__"},{title:"Manage metadata",url:"admin_toolshed/reset_metadata_on_selected_installed_repositories",enabled:s.settings.is_repo_installed},{title:"Manage whitelist",url:"admin/sanitize_whitelist"},{title:"Manage dependencies",url:"admin/manage_tool_dependencies"},{title:"View lineage",url:"admin/tool_versions",target:"__use_router__"},{title:"View migration stages",url:"admin/review_tool_migration_stages"},{title:"View error logs",url:"admin/tool_errors"}]}]),this.setElement(this._template())},render:function(){var e=this;this.$el.empty(),this.categories.each(function(t){var a=s(e._templateSection(t.attributes)),r=a.find(".ui-side-section-body");i.each(t.get("items"),function(t){if(void 0===t.enabled||t.enabled){var a=s("").attr({href:e.root+t.url}).text((0,o.default)(t.title));"__use_router__"==t.target?a.on("click",function(a){a.preventDefault(),e.page.router.push(t.url)}):a.attr("target","galaxy_main"),r.append(s("
      ").addClass("ui-side-section-body-title").append(a))}}),e.$el.append(a)}),this.page.$("#galaxy_main").prop("src",this.root+"admin/center?message="+this.message+"&status="+this.status)},_templateSection:function(e){return["
      ",'
      '+(0,o.default)(e.title)+"
      ",'
      ',"
      "].join("")},_template:function(){return'
      '},toString:function(){return"adminPanel"}});t.default=n}).call(t,a(2),a(0),a(1))},30:function(e,t,a){"use strict";(function(e){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=a(0),r=s(i),o=a(8),n=s(o),l=a(6),u=s(l),d=r.default,_=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),d.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=d.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,a){Galaxy.debug("router execute:",e,t,a);var s=n.default.parse(t.pop());t.push(s),e&&(this.authenticate(t,a)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new u.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=_}).call(t,a(2))},44:function(e,t,a){"use strict";(function(e,s){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=a(9),o=i(r),n=a(6),l=i(n),u=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
      "),this.render()},render:function(){var e=this;s.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var a=s.extend({},e.model.attributes,t),i=new o.default({title:a.title,message:a.message,status:a.status||"warning",icon:a.icon,inputs:a.inputs,buttons:{submit:new l.default.Button({tooltip:a.submit_tooltip,title:a.submit_title||"Save",icon:a.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(i)}})}});e.$el.empty().append(i.$el)}).fail(function(t){e.$el.empty().append(new l.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;s.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(a){var i={message:a.message,status:"success",persistent:!1};t.redirect?window.location=Galaxy.root+t.redirect+"?"+s.param(i):(e.data.matchModel(a,function(t,a){e.field_list[a].value(t.value)}),t._showMessage(e,i))}).fail(function(a){t._showMessage(e,{message:a.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(s(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:u}}).call(t,a(2),a(0))}},[171]); +webpackJsonp([1],{172:function(e,t,a){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var s=a(0),i=t(s),r=a(24),o=t(r),n=a(173),l=t(n),u=a(44),d=t(u),_=a(12),m=t(_),c=a(6),p=(t(c),a(8)),f=t(p),g=a(30),h=t(g),w=a(3),y=t(w),b=a(25),v=t(b),x=i.default;window.app=function(t,a){window.Galaxy=new o.default.GalaxyApp(t,a),Galaxy.debug("admin app");var s=h.default.extend({routes:{"(/)admin(/)users":"show_users","(/)admin(/)roles":"show_roles","(/)admin(/)groups":"show_groups","(/)admin(/)tool_versions":"show_tool_versions","(/)admin(/)quotas":"show_quotas","(/)admin(/)repositories":"show_repositories","(/)admin(/)forms":"show_forms","(/)admin(/)form(/)(:form_id)":"show_form"},authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id&&Galaxy.user.get("is_admin")},show_users:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/users_list",url_data:Galaxy.params,dict_format:!0}))},show_roles:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/roles_list",url_data:Galaxy.params,dict_format:!0}))},show_groups:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/groups_list",url_data:Galaxy.params,dict_format:!0}))},show_repositories:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin_toolshed/browse_repositories",url_data:Galaxy.params,dict_format:!0}))},show_tool_versions:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/tool_versions_list",url_data:Galaxy.params,dict_format:!0}))},show_quotas:function(){this.page.display(new m.default({url_base:Galaxy.root+"admin/quotas_list",url_data:Galaxy.params,dict_format:!0}))},show_forms:function(){this.page.display(new m.default({url_base:Galaxy.root+"forms/forms_list",url_data:Galaxy.params,dict_format:!0}))},show_form:function(e){var t="?id="+f.default.get("id"),a={reset_user_password:{title:"Reset passwords",url:"admin/reset_user_password"+t,icon:"fa-user",submit_title:"Save new password",redirect:"admin/users"},manage_roles_and_groups_for_user:{url:"admin/manage_roles_and_groups_for_user"+t,icon:"fa-users",redirect:"admin/users"},manage_users_and_groups_for_role:{url:"admin/manage_users_and_groups_for_role"+t,redirect:"admin/roles"},manage_users_and_roles_for_group:{url:"admin/manage_users_and_roles_for_group"+t,redirect:"admin/groups"},manage_users_and_groups_for_quota:{url:"admin/manage_users_and_groups_for_quota"+t,redirect:"admin/quotas"},create_role:{url:"admin/create_role",redirect:"admin/roles"},create_group:{url:"admin/create_group",redirect:"admin/groups"},create_quota:{url:"admin/create_quota",redirect:"admin/quotas"},rename_role:{url:"admin/rename_role"+t,redirect:"admin/roles"},rename_group:{url:"admin/rename_group"+t,redirect:"admin/groups"},rename_quota:{url:"admin/rename_quota"+t,redirect:"admin/quotas"},edit_quota:{url:"admin/edit_quota"+t,redirect:"admin/quotas"},set_quota_default:{url:"admin/set_quota_default"+t,redirect:"admin/quotas"},create_form:{url:"forms/create_form",redirect:"admin/forms"},edit_form:{url:"forms/edit_form"+t,redirect:"admin/forms"}};this.page.display(new d.default.View(a[e]))}});x(function(){e.extend(t.config,{active_view:"admin"}),y.default.setWindowTitle("Administration"),Galaxy.page=new v.default.View(e.extend(t,{Left:l.default,Router:s}))})}}).call(t,a(1))},173:function(e,t,a){"use strict";(function(e,s,i){Object.defineProperty(t,"__esModule",{value:!0});var r=a(4),o=function(e){return e&&e.__esModule?e:{default:e}}(r),n=e.View.extend({initialize:function(t,a){var s=this;this.page=t,this.root=a.root,this.config=a.config,this.settings=a.settings,this.message=a.message,this.status=a.status,this.model=new e.Model({title:(0,o.default)("Administration")}),this.categories=new e.Collection([{title:"Server",items:[{title:"Data types",url:"admin/view_datatypes_registry"},{title:"Data tables",url:"admin/view_tool_data_tables"},{title:"Display applications",url:"admin/display_applications"},{title:"Manage jobs",url:"admin/jobs"},{title:"Local data",url:"data_manager"}]},{title:"User Management",items:[{title:"Users",url:"admin/users",target:"__use_router__"},{title:"Quotas",url:"admin/quotas",target:"__use_router__",enabled:s.config.enable_quotas},{title:"Groups",url:"admin/groups",target:"__use_router__"},{title:"Roles",url:"admin/roles",target:"__use_router__"},{title:"Forms",url:"admin/forms",target:"__use_router__"},{title:"API keys",url:"userskeys/all_users"},{title:"Impersonate a user",url:"admin/impersonate",enabled:s.config.allow_user_impersonation}]},{title:"Tool Management",items:[{title:"Install new tools",url:"admin_toolshed/browse_tool_sheds",enabled:s.settings.is_tool_shed_installed},{title:"Install new tools (Beta)",url:"admin_toolshed/browse_toolsheds",enabled:s.settings.is_tool_shed_installed&&s.config.enable_beta_ts_api_install},{title:"Monitor installation",url:"admin_toolshed/monitor_repository_installation",enabled:s.settings.installing_repository_ids},{title:"Manage tools",url:"admin/repositories",enabled:s.settings.is_repo_installed,target:"__use_router__"},{title:"Manage metadata",url:"admin_toolshed/reset_metadata_on_selected_installed_repositories",enabled:s.settings.is_repo_installed},{title:"Manage whitelist",url:"admin/sanitize_whitelist"},{title:"Manage dependencies",url:"admin/manage_tool_dependencies"},{title:"View lineage",url:"admin/tool_versions",target:"__use_router__"},{title:"View migration stages",url:"admin/review_tool_migration_stages"},{title:"View error logs",url:"admin/tool_errors"}]}]),this.setElement(this._template())},render:function(){var e=this;this.$el.empty(),this.categories.each(function(t){var a=s(e._templateSection(t.attributes)),r=a.find(".ui-side-section-body");i.each(t.get("items"),function(t){if(void 0===t.enabled||t.enabled){var a=s("").attr({href:e.root+t.url}).text((0,o.default)(t.title));"__use_router__"==t.target?a.on("click",function(a){a.preventDefault(),e.page.router.push(t.url)}):a.attr("target","galaxy_main"),r.append(s("
      ").addClass("ui-side-section-body-title").append(a))}}),e.$el.append(a)}),this.page.$("#galaxy_main").prop("src",this.root+"admin/center?message="+this.message+"&status="+this.status)},_templateSection:function(e){return["
      ",'
      '+(0,o.default)(e.title)+"
      ",'
      ',"
      "].join("")},_template:function(){return'
      '},toString:function(){return"adminPanel"}});t.default=n}).call(t,a(2),a(0),a(1))},30:function(e,t,a){"use strict";(function(e){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=a(0),r=s(i),o=a(8),n=s(o),l=a(6),u=s(l),d=r.default,_=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),d.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=d.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,a){Galaxy.debug("router execute:",e,t,a);var s=n.default.parse(t.pop());t.push(s),e&&(this.authenticate(t,a)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new u.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=_}).call(t,a(2))},44:function(e,t,a){"use strict";(function(e,s){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=a(9),o=i(r),n=a(6),l=i(n),u=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
      "),this.render()},render:function(){var e=this;s.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var a=s.extend({},e.model.attributes,t),i=new o.default({title:a.title,message:a.message,status:a.status||"warning",icon:a.icon,inputs:a.inputs,buttons:{submit:new l.default.Button({tooltip:a.submit_tooltip,title:a.submit_title||"Save",icon:a.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(i)}})}});e.$el.empty().append(i.$el)}).fail(function(t){e.$el.empty().append(new l.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;s.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(a){var i={message:a.message,status:"success",persistent:!1};t.redirect?window.location=Galaxy.root+t.redirect+"?"+s.param(i):(e.data.matchModel(a,function(t,a){e.field_list[a].value(t.value)}),t._showMessage(e,i))}).fail(function(a){t._showMessage(e,{message:a.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(s(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:u}}).call(t,a(2),a(0))}},[172]); //# sourceMappingURL=admin.bundled.js.map \ No newline at end of file diff --git a/static/scripts/bundled/admin.bundled.js.map b/static/scripts/bundled/admin.bundled.js.map index 82a639ed8745..8468bad9d296 100644 --- a/static/scripts/bundled/admin.bundled.js.map +++ b/static/scripts/bundled/admin.bundled.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin.bundled.js","webpack:///./galaxy/scripts/apps/admin.js","webpack:///./galaxy/scripts/apps/panels/admin-panel.js","webpack:///./galaxy/scripts/layout/router.js","webpack:///./galaxy/scripts/mvc/form/form-wrapper.js"],"names":["webpackJsonp","171","module","exports","__webpack_require__","_","_interopRequireDefault","obj","__esModule","default","_jquery","_jquery2","_galaxy","_galaxy2","_adminPanel","_adminPanel2","_formWrapper","_formWrapper2","_gridView","_gridView2","_uiMisc","_queryStringParsing","_queryStringParsing2","_router","_router2","_utils","_utils2","_page","_page2","$","window","app","options","bootstrapped","Galaxy","GalaxyApp","debug","AdminRouter","extend","routes","(/)admin(/)users","(/)admin(/)roles","(/)admin(/)groups","(/)admin(/)tool_versions","(/)admin(/)quotas","(/)admin(/)repositories","(/)admin(/)forms","(/)admin(/)form(/)(:form_id)","authenticate","args","name","user","id","get","show_users","this","page","display","url_base","root","url_data","params","dict_format","show_roles","show_groups","show_repositories","show_tool_versions","show_quotas","show_forms","show_form","form_id","form_defs","reset_user_password","title","url","icon","submit_title","redirect","manage_roles_and_groups_for_user","manage_users_and_groups_for_role","manage_users_and_roles_for_group","manage_users_and_groups_for_quota","create_role","create_group","create_quota","rename_role","rename_group","rename_quota","edit_quota","set_quota_default","create_form","edit_form","View","config","active_view","setWindowTitle","Left","Router","call","172","Backbone","Object","defineProperty","value","_localization","_localization2","AdminPanel","initialize","self","settings","message","status","model","Model","categories","Collection","items","target","enabled","enable_quotas","allow_user_impersonation","is_tool_shed_installed","enable_beta_ts_api_install","installing_repository_ids","is_repo_installed","setElement","_template","render","$el","empty","each","category","$section","_templateSection","attributes","$entries","find","item","undefined","$link","attr","href","text","on","e","preventDefault","router","push","append","addClass","prop","join","toString","30","_uiMisc2","data","__identifer","Math","random","substr","isEmptyObject","indexOf","param","navigate","trigger","execute","callback","queryObj","parse","pop","apply","access_denied","Message","persistent","44","_formView","_formView2","ajax","type","done","response","form","inputs","buttons","submit","Button","tooltip","submit_tooltip","submit_icon","cls","onclick","_submit","fail","JSON","stringify","create","contentType","success_message","location","matchModel","input","input_id","field_list","_showMessage","responseJSON","err_msg","parents","filter","css","first","animate","scrollTop","update"],"mappings":"AAAAA,cAAc,IAERC,IACA,SAAUC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GA0CrC,QAASC,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,QAASF,GChDvF,GAAAG,GAAAN,EAAA,GDUIO,EAAWL,EAAuBI,GCRtCE,EAAAR,EAAA,IDYIS,EAAWP,EAAuBM,GCXtCE,EAAAV,EAAA,KDeIW,EAAeT,EAAuBQ,GCd1CE,EAAAZ,EAAA,IDkBIa,EAAgBX,EAAuBU,GCjB3CE,EAAAd,EAAA,IDqBIe,EAAab,EAAuBY,GCpBxCE,EAAAhB,EAAA,GACAiB,GDuBef,EAAuBc,GCvBtChB,EAAA,ID2BIkB,EAAuBhB,EAAuBe,GC1BlDE,EAAAnB,EAAA,ID8BIoB,EAAWlB,EAAuBiB,GC7BtCE,EAAArB,EAAA,GDiCIsB,EAAUpB,EAAuBmB,GChCrCE,EAAAvB,E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lC,IAAzC,IACAqC,OAAQ,SACR8D,YAAY,IACb7C,QAKnB+D,QAAS,SAASV,GACd,GAAIzE,GAAOrD,IACX1B,GAAEoJ,MACEvG,IAAKxC,OAAOyB,KAAOiD,EAAKlC,IACxBiF,KAAMsC,KAAKC,UAAUb,EAAK1B,KAAKwC,UAC/BjB,KAAM,MACNkB,YAAa,qBAEZjB,KAAK,SAAAC,GACF,GAAIiB,IACAvF,QAASsE,EAAStE,QAClBC,OAAQ,UACR8D,YAAY,EAEZjE,GAAK/B,SACL/C,OAAOwK,SAAcpK,OAAOyB,KAAOiD,EAAK/B,SAAxC,IAAoDhD,EAAEqI,MAAMmC,IAE5DhB,EAAK1B,KAAK4C,WAAWnB,EAAU,SAACoB,EAAOC,GACnCpB,EAAKqB,WAAWD,GAAUlG,MAAMiG,EAAMjG,SAE1CK,EAAK+F,aAAatB,EAAMgB,MAG/BL,KAAK,SAAAZ,GACFxE,EAAK+F,aAAatB,GACdvE,QAASsE,EAASwB,aAAaC,QAC/B9F,OAAQ,SACR8D,YAAY,OAK5B8B,aAAc,SAAStB,EAAMrJ,GACZqJ,EAAKrD,IACb8E,UACAC,OAAO,WACJ,OAA+D,IAAvD,OAAQ,UAAU9C,QAAQpI,EAAE0B,MAAMyJ,IAAI,eAEjDC,QACEC,SAAUC,UAAW,GAAK,KACjC9B,EAAKvE,QAAQsG,OAAOpL,KJud5B7B,GAAQM,SIldJmF,KAAMA,KJqdmBM,KAAK/F,EAASC,EAAoB,GAAIA,EAAoB,OAIpF","file":"admin.bundled.js","sourcesContent":["webpackJsonp([1],{\n\n/***/ 171:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _galaxy = __webpack_require__(24);\n\nvar _galaxy2 = _interopRequireDefault(_galaxy);\n\nvar _adminPanel = __webpack_require__(172);\n\nvar _adminPanel2 = _interopRequireDefault(_adminPanel);\n\nvar _formWrapper = __webpack_require__(44);\n\nvar _formWrapper2 = _interopRequireDefault(_formWrapper);\n\nvar _gridView = __webpack_require__(12);\n\nvar _gridView2 = _interopRequireDefault(_gridView);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nvar _queryStringParsing = __webpack_require__(8);\n\nvar _queryStringParsing2 = _interopRequireDefault(_queryStringParsing);\n\nvar _router = __webpack_require__(30);\n\nvar _router2 = _interopRequireDefault(_router);\n\nvar _utils = __webpack_require__(3);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _page = __webpack_require__(25);\n\nvar _page2 = _interopRequireDefault(_page);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar $ = _jquery2.default;\n\n\nwindow.app = function app(options, bootstrapped) {\n window.Galaxy = new _galaxy2.default.GalaxyApp(options, bootstrapped);\n Galaxy.debug(\"admin app\");\n\n /** Routes */\n var AdminRouter = _router2.default.extend({\n routes: {\n \"(/)admin(/)users\": \"show_users\",\n \"(/)admin(/)roles\": \"show_roles\",\n \"(/)admin(/)groups\": \"show_groups\",\n \"(/)admin(/)tool_versions\": \"show_tool_versions\",\n \"(/)admin(/)quotas\": \"show_quotas\",\n \"(/)admin(/)repositories\": \"show_repositories\",\n \"(/)admin(/)forms\": \"show_forms\",\n \"(/)admin(/)form(/)(:form_id)\": \"show_form\"\n },\n\n authenticate: function authenticate(args, name) {\n return Galaxy.user && Galaxy.user.id && Galaxy.user.get(\"is_admin\");\n },\n\n show_users: function show_users() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/users_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_roles: function show_roles() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/roles_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_groups: function show_groups() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/groups_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_repositories: function show_repositories() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin_toolshed/browse_repositories\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_tool_versions: function show_tool_versions() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/tool_versions_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_quotas: function show_quotas() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/quotas_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_forms: function show_forms() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"forms/forms_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_form: function show_form(form_id) {\n var id = \"?id=\" + _queryStringParsing2.default.get(\"id\");\n var form_defs = {\n reset_user_password: {\n title: \"Reset passwords\",\n url: \"admin/reset_user_password\" + id,\n icon: \"fa-user\",\n submit_title: \"Save new password\",\n redirect: \"admin/users\"\n },\n manage_roles_and_groups_for_user: {\n url: \"admin/manage_roles_and_groups_for_user\" + id,\n icon: \"fa-users\",\n redirect: \"admin/users\"\n },\n manage_users_and_groups_for_role: {\n url: \"admin/manage_users_and_groups_for_role\" + id,\n redirect: \"admin/roles\"\n },\n manage_users_and_roles_for_group: {\n url: \"admin/manage_users_and_roles_for_group\" + id,\n redirect: \"admin/groups\"\n },\n manage_users_and_groups_for_quota: {\n url: \"admin/manage_users_and_groups_for_quota\" + id,\n redirect: \"admin/quotas\"\n },\n create_role: {\n url: \"admin/create_role\",\n redirect: \"admin/roles\"\n },\n create_group: {\n url: \"admin/create_group\",\n redirect: \"admin/groups\"\n },\n create_quota: {\n url: \"admin/create_quota\",\n redirect: \"admin/quotas\"\n },\n rename_role: {\n url: \"admin/rename_role\" + id,\n redirect: \"admin/roles\"\n },\n rename_group: {\n url: \"admin/rename_group\" + id,\n redirect: \"admin/groups\"\n },\n rename_quota: {\n url: \"admin/rename_quota\" + id,\n redirect: \"admin/quotas\"\n },\n edit_quota: {\n url: \"admin/edit_quota\" + id,\n redirect: \"admin/quotas\"\n },\n set_quota_default: {\n url: \"admin/set_quota_default\" + id,\n redirect: \"admin/quotas\"\n },\n create_form: {\n url: \"forms/create_form\",\n redirect: \"admin/forms\"\n },\n edit_form: {\n url: \"forms/edit_form\" + id,\n redirect: \"admin/forms\"\n }\n };\n this.page.display(new _formWrapper2.default.View(form_defs[form_id]));\n }\n });\n\n $(function () {\n _.extend(options.config, { active_view: \"admin\" });\n _utils2.default.setWindowTitle(\"Administration\");\n Galaxy.page = new _page2.default.View(_.extend(options, {\n Left: _adminPanel2.default,\n Router: AdminRouter\n }));\n });\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n\n/***/ 172:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _localization = __webpack_require__(4);\n\nvar _localization2 = _interopRequireDefault(_localization);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar AdminPanel = Backbone.View.extend({\n initialize: function initialize(page, options) {\n var self = this;\n this.page = page;\n this.root = options.root;\n this.config = options.config;\n this.settings = options.settings;\n this.message = options.message;\n this.status = options.status;\n this.model = new Backbone.Model({\n title: (0, _localization2.default)(\"Administration\")\n });\n this.categories = new Backbone.Collection([{\n title: \"Server\",\n items: [{\n title: \"Data types\",\n url: \"admin/view_datatypes_registry\"\n }, {\n title: \"Data tables\",\n url: \"admin/view_tool_data_tables\"\n }, {\n title: \"Display applications\",\n url: \"admin/display_applications\"\n }, {\n title: \"Manage jobs\",\n url: \"admin/jobs\"\n }, {\n title: \"Local data\",\n url: \"data_manager\"\n }]\n }, {\n title: \"User Management\",\n items: [{\n title: \"Users\",\n url: \"admin/users\",\n target: \"__use_router__\"\n }, {\n title: \"Quotas\",\n url: \"admin/quotas\",\n target: \"__use_router__\",\n enabled: self.config.enable_quotas\n }, {\n title: \"Groups\",\n url: \"admin/groups\",\n target: \"__use_router__\"\n }, {\n title: \"Roles\",\n url: \"admin/roles\",\n target: \"__use_router__\"\n }, {\n title: \"Forms\",\n url: \"admin/forms\",\n target: \"__use_router__\"\n }, {\n title: \"API keys\",\n url: \"userskeys/all_users\"\n }, {\n title: \"Impersonate a user\",\n url: \"admin/impersonate\",\n enabled: self.config.allow_user_impersonation\n }]\n }, {\n title: \"Tool Management\",\n items: [{\n title: \"Install new tools\",\n url: \"admin_toolshed/browse_tool_sheds\",\n enabled: self.settings.is_tool_shed_installed\n }, {\n title: \"Install new tools (Beta)\",\n url: \"admin_toolshed/browse_toolsheds\",\n enabled: self.settings.is_tool_shed_installed && self.config.enable_beta_ts_api_install\n }, {\n title: \"Monitor installation\",\n url: \"admin_toolshed/monitor_repository_installation\",\n enabled: self.settings.installing_repository_ids\n }, {\n title: \"Manage tools\",\n url: \"admin/repositories\",\n enabled: self.settings.is_repo_installed,\n target: \"__use_router__\"\n }, {\n title: \"Manage metadata\",\n url: \"admin_toolshed/reset_metadata_on_selected_installed_repositories\",\n enabled: self.settings.is_repo_installed\n }, {\n title: \"Manage whitelist\",\n url: \"admin/sanitize_whitelist\"\n }, {\n title: \"Manage dependencies\",\n url: \"admin/manage_tool_dependencies\"\n }, {\n title: \"View lineage\",\n url: \"admin/tool_versions\",\n target: \"__use_router__\"\n }, {\n title: \"View migration stages\",\n url: \"admin/review_tool_migration_stages\"\n }, {\n title: \"View error logs\",\n url: \"admin/tool_errors\"\n }]\n }]);\n this.setElement(this._template());\n },\n\n render: function render() {\n var self = this;\n this.$el.empty();\n this.categories.each(function (category) {\n var $section = $(self._templateSection(category.attributes));\n var $entries = $section.find(\".ui-side-section-body\");\n _.each(category.get(\"items\"), function (item) {\n if (item.enabled === undefined || item.enabled) {\n var $link = $(\"\").attr({ href: self.root + item.url }).text((0, _localization2.default)(item.title));\n if (item.target == \"__use_router__\") {\n $link.on(\"click\", function (e) {\n e.preventDefault();\n self.page.router.push(item.url);\n });\n } else {\n $link.attr(\"target\", \"galaxy_main\");\n }\n $entries.append($(\"
      \").addClass(\"ui-side-section-body-title\").append($link));\n }\n });\n self.$el.append($section);\n });\n this.page.$(\"#galaxy_main\").prop(\"src\", this.root + \"admin/center?message=\" + this.message + \"&status=\" + this.status);\n },\n\n _templateSection: function _templateSection(options) {\n return [\"
      \", \"
      \" + (0, _localization2.default)(options.title) + \"
      \", '
      ', \"
      \"].join(\"\");\n },\n\n _template: function _template() {\n return '
      ';\n },\n\n toString: function toString() {\n return \"adminPanel\";\n }\n});\n\nexports.default = AdminPanel;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n\n/***/ 30:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _queryStringParsing = __webpack_require__(8);\n\nvar _queryStringParsing2 = _interopRequireDefault(_queryStringParsing);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar $ = _jquery2.default;\n\n\nvar Router = Backbone.Router.extend({\n // TODO: not many client routes at this point - fill and remove from server.\n // since we're at root here, this may be the last to be routed entirely on the client.\n initialize: function initialize(page, options) {\n this.page = page;\n this.options = options;\n },\n\n /** helper to push a new navigation state */\n push: function push(url, data) {\n data = data || {};\n data.__identifer = Math.random().toString(36).substr(2);\n if (!$.isEmptyObject(data)) {\n url += url.indexOf(\"?\") == -1 ? \"?\" : \"&\";\n url += $.param(data, true);\n }\n Galaxy.params = data;\n this.navigate(url, { trigger: true });\n },\n\n /** override to parse query string into obj and send to each route */\n execute: function execute(callback, args, name) {\n Galaxy.debug(\"router execute:\", callback, args, name);\n var queryObj = _queryStringParsing2.default.parse(args.pop());\n args.push(queryObj);\n if (callback) {\n if (this.authenticate(args, name)) {\n callback.apply(this, args);\n } else {\n this.access_denied();\n }\n }\n },\n\n authenticate: function authenticate(args, name) {\n return true;\n },\n\n access_denied: function access_denied() {\n this.page.display(new _uiMisc2.default.Message({\n status: \"danger\",\n message: \"You must be logged in with proper credentials to make this request.\",\n persistent: true\n }));\n }\n});\n\nexports.default = Router;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ }),\n\n/***/ 44:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _formView = __webpack_require__(9);\n\nvar _formView2 = _interopRequireDefault(_formView);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/** Generic form view */\nvar View = Backbone.View.extend({\n initialize: function initialize(options) {\n this.model = new Backbone.Model(options);\n this.url = this.model.get(\"url\");\n this.redirect = this.model.get(\"redirect\");\n this.setElement(\"
      \");\n this.render();\n },\n\n render: function render() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.url,\n type: \"GET\"\n }).done(function (response) {\n var options = $.extend({}, self.model.attributes, response);\n var form = new _formView2.default({\n title: options.title,\n message: options.message,\n status: options.status || \"warning\",\n icon: options.icon,\n inputs: options.inputs,\n buttons: {\n submit: new _uiMisc2.default.Button({\n tooltip: options.submit_tooltip,\n title: options.submit_title || \"Save\",\n icon: options.submit_icon || \"fa-save\",\n cls: \"btn btn-primary ui-clear-float\",\n onclick: function onclick() {\n self._submit(form);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n }).fail(function (response) {\n self.$el.empty().append(new _uiMisc2.default.Message({\n message: \"Failed to load resource \" + self.url + \".\",\n status: \"danger\",\n persistent: true\n }).$el);\n });\n },\n\n _submit: function _submit(form) {\n var self = this;\n $.ajax({\n url: Galaxy.root + self.url,\n data: JSON.stringify(form.data.create()),\n type: \"PUT\",\n contentType: \"application/json\"\n }).done(function (response) {\n var success_message = {\n message: response.message,\n status: \"success\",\n persistent: false\n };\n if (self.redirect) {\n window.location = Galaxy.root + self.redirect + \"?\" + $.param(success_message);\n } else {\n form.data.matchModel(response, function (input, input_id) {\n form.field_list[input_id].value(input.value);\n });\n self._showMessage(form, success_message);\n }\n }).fail(function (response) {\n self._showMessage(form, {\n message: response.responseJSON.err_msg,\n status: \"danger\",\n persistent: false\n });\n });\n },\n\n _showMessage: function _showMessage(form, options) {\n var $panel = form.$el.parents().filter(function () {\n return [\"auto\", \"scroll\"].indexOf($(this).css(\"overflow\")) != -1;\n }).first();\n $panel.animate({ scrollTop: 0 }, 500);\n form.message.update(options);\n }\n});\n\nexports.default = {\n View: View\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0)))\n\n/***/ })\n\n},[171]);\n\n\n// WEBPACK FOOTER //\n// admin.bundled.js","import jQuery from \"jquery\";\nvar $ = jQuery;\nimport GalaxyApp from \"galaxy\";\nimport AdminPanel from \"./panels/admin-panel\";\nimport FormWrapper from \"mvc/form/form-wrapper\";\nimport GridView from \"mvc/grid/grid-view\";\nimport Ui from \"mvc/ui/ui-misc\";\nimport QueryStringParsing from \"utils/query-string-parsing\";\nimport Router from \"layout/router\";\nimport Utils from \"utils/utils\";\nimport Page from \"layout/page\";\n\nwindow.app = function app(options, bootstrapped) {\n window.Galaxy = new GalaxyApp.GalaxyApp(options, bootstrapped);\n Galaxy.debug(\"admin app\");\n\n /** Routes */\n var AdminRouter = Router.extend({\n routes: {\n \"(/)admin(/)users\": \"show_users\",\n \"(/)admin(/)roles\": \"show_roles\",\n \"(/)admin(/)groups\": \"show_groups\",\n \"(/)admin(/)tool_versions\": \"show_tool_versions\",\n \"(/)admin(/)quotas\": \"show_quotas\",\n \"(/)admin(/)repositories\": \"show_repositories\",\n \"(/)admin(/)forms\": \"show_forms\",\n \"(/)admin(/)form(/)(:form_id)\": \"show_form\"\n },\n\n authenticate: function(args, name) {\n return Galaxy.user && Galaxy.user.id && Galaxy.user.get(\"is_admin\");\n },\n\n show_users: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/users_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_roles: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/roles_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_groups: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/groups_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_repositories: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin_toolshed/browse_repositories`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_tool_versions: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/tool_versions_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_quotas: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/quotas_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_forms: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}forms/forms_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_form: function(form_id) {\n var id = `?id=${QueryStringParsing.get(\"id\")}`;\n var form_defs = {\n reset_user_password: {\n title: \"Reset passwords\",\n url: `admin/reset_user_password${id}`,\n icon: \"fa-user\",\n submit_title: \"Save new password\",\n redirect: \"admin/users\"\n },\n manage_roles_and_groups_for_user: {\n url: `admin/manage_roles_and_groups_for_user${id}`,\n icon: \"fa-users\",\n redirect: \"admin/users\"\n },\n manage_users_and_groups_for_role: {\n url: `admin/manage_users_and_groups_for_role${id}`,\n redirect: \"admin/roles\"\n },\n manage_users_and_roles_for_group: {\n url: `admin/manage_users_and_roles_for_group${id}`,\n redirect: \"admin/groups\"\n },\n manage_users_and_groups_for_quota: {\n url: `admin/manage_users_and_groups_for_quota${id}`,\n redirect: \"admin/quotas\"\n },\n create_role: {\n url: \"admin/create_role\",\n redirect: \"admin/roles\"\n },\n create_group: {\n url: \"admin/create_group\",\n redirect: \"admin/groups\"\n },\n create_quota: {\n url: \"admin/create_quota\",\n redirect: \"admin/quotas\"\n },\n rename_role: {\n url: `admin/rename_role${id}`,\n redirect: \"admin/roles\"\n },\n rename_group: {\n url: `admin/rename_group${id}`,\n redirect: \"admin/groups\"\n },\n rename_quota: {\n url: `admin/rename_quota${id}`,\n redirect: \"admin/quotas\"\n },\n edit_quota: {\n url: `admin/edit_quota${id}`,\n redirect: \"admin/quotas\"\n },\n set_quota_default: {\n url: `admin/set_quota_default${id}`,\n redirect: \"admin/quotas\"\n },\n create_form: {\n url: \"forms/create_form\",\n redirect: \"admin/forms\"\n },\n edit_form: {\n url: `forms/edit_form${id}`,\n redirect: \"admin/forms\"\n }\n };\n this.page.display(new FormWrapper.View(form_defs[form_id]));\n }\n });\n\n $(() => {\n _.extend(options.config, { active_view: \"admin\" });\n Utils.setWindowTitle(\"Administration\");\n Galaxy.page = new Page.View(\n _.extend(options, {\n Left: AdminPanel,\n Router: AdminRouter\n })\n );\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/admin.js","import _l from \"utils/localization\";\n\nvar AdminPanel = Backbone.View.extend({\n initialize: function(page, options) {\n var self = this;\n this.page = page;\n this.root = options.root;\n this.config = options.config;\n this.settings = options.settings;\n this.message = options.message;\n this.status = options.status;\n this.model = new Backbone.Model({\n title: _l(\"Administration\")\n });\n this.categories = new Backbone.Collection([\n {\n title: \"Server\",\n items: [\n {\n title: \"Data types\",\n url: \"admin/view_datatypes_registry\"\n },\n {\n title: \"Data tables\",\n url: \"admin/view_tool_data_tables\"\n },\n {\n title: \"Display applications\",\n url: \"admin/display_applications\"\n },\n {\n title: \"Manage jobs\",\n url: \"admin/jobs\"\n },\n {\n title: \"Local data\",\n url: \"data_manager\"\n }\n ]\n },\n {\n title: \"User Management\",\n items: [\n {\n title: \"Users\",\n url: \"admin/users\",\n target: \"__use_router__\"\n },\n {\n title: \"Quotas\",\n url: \"admin/quotas\",\n target: \"__use_router__\",\n enabled: self.config.enable_quotas\n },\n {\n title: \"Groups\",\n url: \"admin/groups\",\n target: \"__use_router__\"\n },\n {\n title: \"Roles\",\n url: \"admin/roles\",\n target: \"__use_router__\"\n },\n {\n title: \"Forms\",\n url: \"admin/forms\",\n target: \"__use_router__\"\n },\n {\n title: \"API keys\",\n url: \"userskeys/all_users\"\n },\n {\n title: \"Impersonate a user\",\n url: \"admin/impersonate\",\n enabled: self.config.allow_user_impersonation\n }\n ]\n },\n {\n title: \"Tool Management\",\n items: [\n {\n title: \"Install new tools\",\n url: \"admin_toolshed/browse_tool_sheds\",\n enabled: self.settings.is_tool_shed_installed\n },\n {\n title: \"Install new tools (Beta)\",\n url: \"admin_toolshed/browse_toolsheds\",\n enabled: self.settings.is_tool_shed_installed && self.config.enable_beta_ts_api_install\n },\n {\n title: \"Monitor installation\",\n url: \"admin_toolshed/monitor_repository_installation\",\n enabled: self.settings.installing_repository_ids\n },\n {\n title: \"Manage tools\",\n url: \"admin/repositories\",\n enabled: self.settings.is_repo_installed,\n target: \"__use_router__\"\n },\n {\n title: \"Manage metadata\",\n url: \"admin_toolshed/reset_metadata_on_selected_installed_repositories\",\n enabled: self.settings.is_repo_installed\n },\n {\n title: \"Manage whitelist\",\n url: \"admin/sanitize_whitelist\"\n },\n {\n title: \"Manage dependencies\",\n url: \"admin/manage_tool_dependencies\"\n },\n {\n title: \"View lineage\",\n url: \"admin/tool_versions\",\n target: \"__use_router__\"\n },\n {\n title: \"View migration stages\",\n url: \"admin/review_tool_migration_stages\"\n },\n {\n title: \"View error logs\",\n url: \"admin/tool_errors\"\n }\n ]\n }\n ]);\n this.setElement(this._template());\n },\n\n render: function() {\n var self = this;\n this.$el.empty();\n this.categories.each(category => {\n var $section = $(self._templateSection(category.attributes));\n var $entries = $section.find(\".ui-side-section-body\");\n _.each(category.get(\"items\"), item => {\n if (item.enabled === undefined || item.enabled) {\n var $link = $(\"\")\n .attr({ href: self.root + item.url })\n .text(_l(item.title));\n if (item.target == \"__use_router__\") {\n $link.on(\"click\", e => {\n e.preventDefault();\n self.page.router.push(item.url);\n });\n } else {\n $link.attr(\"target\", \"galaxy_main\");\n }\n $entries.append(\n $(\"
      \")\n .addClass(\"ui-side-section-body-title\")\n .append($link)\n );\n }\n });\n self.$el.append($section);\n });\n this.page\n .$(\"#galaxy_main\")\n .prop(\"src\", `${this.root}admin/center?message=${this.message}&status=${this.status}`);\n },\n\n _templateSection: function(options) {\n return [\n \"
      \",\n `
      ${_l(options.title)}
      `,\n '
      ',\n \"
      \"\n ].join(\"\");\n },\n\n _template: function() {\n return '
      ';\n },\n\n toString: function() {\n return \"adminPanel\";\n }\n});\n\nexport default AdminPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/admin-panel.js","import jQuery from \"jquery\";\nvar $ = jQuery;\nimport QUERY_STRING from \"utils/query-string-parsing\";\nimport Ui from \"mvc/ui/ui-misc\";\n\nvar Router = Backbone.Router.extend({\n // TODO: not many client routes at this point - fill and remove from server.\n // since we're at root here, this may be the last to be routed entirely on the client.\n initialize: function(page, options) {\n this.page = page;\n this.options = options;\n },\n\n /** helper to push a new navigation state */\n push: function(url, data) {\n data = data || {};\n data.__identifer = Math.random()\n .toString(36)\n .substr(2);\n if (!$.isEmptyObject(data)) {\n url += url.indexOf(\"?\") == -1 ? \"?\" : \"&\";\n url += $.param(data, true);\n }\n Galaxy.params = data;\n this.navigate(url, { trigger: true });\n },\n\n /** override to parse query string into obj and send to each route */\n execute: function(callback, args, name) {\n Galaxy.debug(\"router execute:\", callback, args, name);\n var queryObj = QUERY_STRING.parse(args.pop());\n args.push(queryObj);\n if (callback) {\n if (this.authenticate(args, name)) {\n callback.apply(this, args);\n } else {\n this.access_denied();\n }\n }\n },\n\n authenticate: function(args, name) {\n return true;\n },\n\n access_denied: function() {\n this.page.display(\n new Ui.Message({\n status: \"danger\",\n message: \"You must be logged in with proper credentials to make this request.\",\n persistent: true\n })\n );\n }\n});\n\nexport default Router;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/layout/router.js","/** Generic form view */\nimport Form from \"mvc/form/form-view\";\nimport Ui from \"mvc/ui/ui-misc\";\nvar View = Backbone.View.extend({\n initialize: function(options) {\n this.model = new Backbone.Model(options);\n this.url = this.model.get(\"url\");\n this.redirect = this.model.get(\"redirect\");\n this.setElement(\"
      \");\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.url,\n type: \"GET\"\n })\n .done(response => {\n var options = $.extend({}, self.model.attributes, response);\n var form = new Form({\n title: options.title,\n message: options.message,\n status: options.status || \"warning\",\n icon: options.icon,\n inputs: options.inputs,\n buttons: {\n submit: new Ui.Button({\n tooltip: options.submit_tooltip,\n title: options.submit_title || \"Save\",\n icon: options.submit_icon || \"fa-save\",\n cls: \"btn btn-primary ui-clear-float\",\n onclick: function() {\n self._submit(form);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n })\n .fail(response => {\n self.$el.empty().append(\n new Ui.Message({\n message: `Failed to load resource ${self.url}.`,\n status: \"danger\",\n persistent: true\n }).$el\n );\n });\n },\n\n _submit: function(form) {\n var self = this;\n $.ajax({\n url: Galaxy.root + self.url,\n data: JSON.stringify(form.data.create()),\n type: \"PUT\",\n contentType: \"application/json\"\n })\n .done(response => {\n var success_message = {\n message: response.message,\n status: \"success\",\n persistent: false\n };\n if (self.redirect) {\n window.location = `${Galaxy.root + self.redirect}?${$.param(success_message)}`;\n } else {\n form.data.matchModel(response, (input, input_id) => {\n form.field_list[input_id].value(input.value);\n });\n self._showMessage(form, success_message);\n }\n })\n .fail(response => {\n self._showMessage(form, {\n message: response.responseJSON.err_msg,\n status: \"danger\",\n persistent: false\n });\n });\n },\n\n _showMessage: function(form, options) {\n var $panel = form.$el\n .parents()\n .filter(function() {\n return [\"auto\", \"scroll\"].indexOf($(this).css(\"overflow\")) != -1;\n })\n .first();\n $panel.animate({ scrollTop: 0 }, 500);\n form.message.update(options);\n }\n});\n\nexport default {\n View: View\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/form/form-wrapper.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin.bundled.js","webpack:///./galaxy/scripts/apps/admin.js","webpack:///./galaxy/scripts/apps/panels/admin-panel.js","webpack:///./galaxy/scripts/layout/router.js","webpack:///./galaxy/scripts/mvc/form/form-wrapper.js"],"names":["webpackJsonp","172","module","exports","__webpack_require__","_","_interopRequireDefault","obj","__esModule","default","_jquery","_jquery2","_galaxy","_galaxy2","_adminPanel","_adminPanel2","_formWrapper","_formWrapper2","_gridView","_gridView2","_uiMisc","_queryStringParsing","_queryStringParsing2","_router","_router2","_utils","_utils2","_page","_page2","$","window","app","options","bootstrapped","Galaxy","GalaxyApp","debug","AdminRouter","extend","routes","(/)admin(/)users","(/)admin(/)roles","(/)admin(/)groups","(/)admin(/)tool_versions","(/)admin(/)quotas","(/)admin(/)repositories","(/)admin(/)forms","(/)admin(/)form(/)(:form_id)","authenticate","args","name","user","id","get","show_users","this","page","display","url_base","root","url_data","params","dict_format","show_roles","show_groups","show_repositories","show_tool_versions","show_quotas","show_forms","show_form","form_id","form_defs","reset_user_password","title","url","icon","submit_title","redirect","manage_roles_and_groups_for_user","manage_users_and_groups_for_role","manage_users_and_roles_for_group","manage_users_and_groups_for_quota","create_role","create_group","create_quota","rename_role","rename_group","rename_quota","edit_quota","set_quota_default","create_form","edit_form","View","config","active_view","setWindowTitle","Left","Router","call","173","Backbone","Object","defineProperty","value","_localization","_localization2","AdminPanel","initialize","self","settings","message","status","model","Model","categories","Collection","items","target","enabled","enable_quotas","allow_user_impersonation","is_tool_shed_installed","enable_beta_ts_api_install","installing_repository_ids","is_repo_installed","setElement","_template","render","$el","empty","each","category","$section","_templateSection","attributes","$entries","find","item","undefined","$link","attr","href","text","on","e","preventDefault","router","push","append","addClass","prop","join","toString","30","_uiMisc2","data","__identifer","Math","random","substr","isEmptyObject","indexOf","param","navigate","trigger","execute","callback","queryObj","parse","pop","apply","access_denied","Message","persistent","44","_formView","_formView2","ajax","type","done","response","form","inputs","buttons","submit","Button","tooltip","submit_tooltip","submit_icon","cls","onclick","_submit","fail","JSON","stringify","create","contentType","success_message","location","matchModel","input","input_id","field_list","_showMessage","responseJSON","err_msg","parents","filter","css","first","animate","scrollTop","update"],"mappings":"AAAAA,cAAc,IAERC,IACA,SAAUC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GA0CrC,QAASC,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,QAASF,GChDvF,GAAAG,GAAAN,EAAA,GDUIO,EAAWL,EAAuBI,GCRtCE,EAAAR,EAAA,IDYIS,EAAWP,EAAuBM,GCXtCE,EAAAV,EAAA,KDeIW,EAAeT,EAAuBQ,GCd1CE,EAAAZ,EAAA,IDkBIa,EAAgBX,EAAuBU,GCjB3CE,EAAAd,EAAA,IDqBIe,EAAab,EAAuBY,GCpBxCE,EAAAhB,EAAA,GACAiB,GDuBef,EAAuBc,GCvBtChB,EAAA,ID2BIkB,EAAuBhB,EAAuBe,GC1BlDE,EAAAnB,EAAA,ID8BIoB,EAAWlB,EAAuBiB,GC7BtCE,EAAArB,EAAA,GDiCIsB,EAAUpB,EAAuBmB,GChCrCE,EAAAvB,EAAA,IDoCIwB,EAAStB,EAAuBqB,GC7ChCE,WAWJC,QAAOC,IAAM,SAAaC,EAASC,GAC/BH,OAAOI,OAAS,GAA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EoJ,MACEvG,IAAKxC,OAAOyB,KAAOiD,EAAKlC,IACxBiF,KAAMsC,KAAKC,UAAUb,EAAK1B,KAAKwC,UAC/BjB,KAAM,MACNkB,YAAa,qBAEZjB,KAAK,SAAAC,GACF,GAAIiB,IACAvF,QAASsE,EAAStE,QAClBC,OAAQ,UACR8D,YAAY,EAEZjE,GAAK/B,SACL/C,OAAOwK,SAAcpK,OAAOyB,KAAOiD,EAAK/B,SAAxC,IAAoDhD,EAAEqI,MAAMmC,IAE5DhB,EAAK1B,KAAK4C,WAAWnB,EAAU,SAACoB,EAAOC,GACnCpB,EAAKqB,WAAWD,GAAUlG,MAAMiG,EAAMjG,SAE1CK,EAAK+F,aAAatB,EAAMgB,MAG/BL,KAAK,SAAAZ,GACFxE,EAAK+F,aAAatB,GACdvE,QAASsE,EAASwB,aAAaC,QAC/B9F,OAAQ,SACR8D,YAAY,OAK5B8B,aAAc,SAAStB,EAAMrJ,GACZqJ,EAAKrD,IACb8E,UACAC,OAAO,WACJ,OAA+D,IAAvD,OAAQ,UAAU9C,QAAQpI,EAAE0B,MAAMyJ,IAAI,eAEjDC,QACEC,SAAUC,UAAW,GAAK,KACjC9B,EAAKvE,QAAQsG,OAAOpL,KJud5B7B,GAAQM,SIldJmF,KAAMA,KJqdmBM,KAAK/F,EAASC,EAAoB,GAAIA,EAAoB,OAIpF","file":"admin.bundled.js","sourcesContent":["webpackJsonp([1],{\n\n/***/ 172:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _galaxy = __webpack_require__(24);\n\nvar _galaxy2 = _interopRequireDefault(_galaxy);\n\nvar _adminPanel = __webpack_require__(173);\n\nvar _adminPanel2 = _interopRequireDefault(_adminPanel);\n\nvar _formWrapper = __webpack_require__(44);\n\nvar _formWrapper2 = _interopRequireDefault(_formWrapper);\n\nvar _gridView = __webpack_require__(12);\n\nvar _gridView2 = _interopRequireDefault(_gridView);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nvar _queryStringParsing = __webpack_require__(8);\n\nvar _queryStringParsing2 = _interopRequireDefault(_queryStringParsing);\n\nvar _router = __webpack_require__(30);\n\nvar _router2 = _interopRequireDefault(_router);\n\nvar _utils = __webpack_require__(3);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _page = __webpack_require__(25);\n\nvar _page2 = _interopRequireDefault(_page);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar $ = _jquery2.default;\n\n\nwindow.app = function app(options, bootstrapped) {\n window.Galaxy = new _galaxy2.default.GalaxyApp(options, bootstrapped);\n Galaxy.debug(\"admin app\");\n\n /** Routes */\n var AdminRouter = _router2.default.extend({\n routes: {\n \"(/)admin(/)users\": \"show_users\",\n \"(/)admin(/)roles\": \"show_roles\",\n \"(/)admin(/)groups\": \"show_groups\",\n \"(/)admin(/)tool_versions\": \"show_tool_versions\",\n \"(/)admin(/)quotas\": \"show_quotas\",\n \"(/)admin(/)repositories\": \"show_repositories\",\n \"(/)admin(/)forms\": \"show_forms\",\n \"(/)admin(/)form(/)(:form_id)\": \"show_form\"\n },\n\n authenticate: function authenticate(args, name) {\n return Galaxy.user && Galaxy.user.id && Galaxy.user.get(\"is_admin\");\n },\n\n show_users: function show_users() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/users_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_roles: function show_roles() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/roles_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_groups: function show_groups() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/groups_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_repositories: function show_repositories() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin_toolshed/browse_repositories\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_tool_versions: function show_tool_versions() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/tool_versions_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_quotas: function show_quotas() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"admin/quotas_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_forms: function show_forms() {\n this.page.display(new _gridView2.default({\n url_base: Galaxy.root + \"forms/forms_list\",\n url_data: Galaxy.params,\n dict_format: true\n }));\n },\n\n show_form: function show_form(form_id) {\n var id = \"?id=\" + _queryStringParsing2.default.get(\"id\");\n var form_defs = {\n reset_user_password: {\n title: \"Reset passwords\",\n url: \"admin/reset_user_password\" + id,\n icon: \"fa-user\",\n submit_title: \"Save new password\",\n redirect: \"admin/users\"\n },\n manage_roles_and_groups_for_user: {\n url: \"admin/manage_roles_and_groups_for_user\" + id,\n icon: \"fa-users\",\n redirect: \"admin/users\"\n },\n manage_users_and_groups_for_role: {\n url: \"admin/manage_users_and_groups_for_role\" + id,\n redirect: \"admin/roles\"\n },\n manage_users_and_roles_for_group: {\n url: \"admin/manage_users_and_roles_for_group\" + id,\n redirect: \"admin/groups\"\n },\n manage_users_and_groups_for_quota: {\n url: \"admin/manage_users_and_groups_for_quota\" + id,\n redirect: \"admin/quotas\"\n },\n create_role: {\n url: \"admin/create_role\",\n redirect: \"admin/roles\"\n },\n create_group: {\n url: \"admin/create_group\",\n redirect: \"admin/groups\"\n },\n create_quota: {\n url: \"admin/create_quota\",\n redirect: \"admin/quotas\"\n },\n rename_role: {\n url: \"admin/rename_role\" + id,\n redirect: \"admin/roles\"\n },\n rename_group: {\n url: \"admin/rename_group\" + id,\n redirect: \"admin/groups\"\n },\n rename_quota: {\n url: \"admin/rename_quota\" + id,\n redirect: \"admin/quotas\"\n },\n edit_quota: {\n url: \"admin/edit_quota\" + id,\n redirect: \"admin/quotas\"\n },\n set_quota_default: {\n url: \"admin/set_quota_default\" + id,\n redirect: \"admin/quotas\"\n },\n create_form: {\n url: \"forms/create_form\",\n redirect: \"admin/forms\"\n },\n edit_form: {\n url: \"forms/edit_form\" + id,\n redirect: \"admin/forms\"\n }\n };\n this.page.display(new _formWrapper2.default.View(form_defs[form_id]));\n }\n });\n\n $(function () {\n _.extend(options.config, { active_view: \"admin\" });\n _utils2.default.setWindowTitle(\"Administration\");\n Galaxy.page = new _page2.default.View(_.extend(options, {\n Left: _adminPanel2.default,\n Router: AdminRouter\n }));\n });\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n\n/***/ 173:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $, _) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _localization = __webpack_require__(4);\n\nvar _localization2 = _interopRequireDefault(_localization);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar AdminPanel = Backbone.View.extend({\n initialize: function initialize(page, options) {\n var self = this;\n this.page = page;\n this.root = options.root;\n this.config = options.config;\n this.settings = options.settings;\n this.message = options.message;\n this.status = options.status;\n this.model = new Backbone.Model({\n title: (0, _localization2.default)(\"Administration\")\n });\n this.categories = new Backbone.Collection([{\n title: \"Server\",\n items: [{\n title: \"Data types\",\n url: \"admin/view_datatypes_registry\"\n }, {\n title: \"Data tables\",\n url: \"admin/view_tool_data_tables\"\n }, {\n title: \"Display applications\",\n url: \"admin/display_applications\"\n }, {\n title: \"Manage jobs\",\n url: \"admin/jobs\"\n }, {\n title: \"Local data\",\n url: \"data_manager\"\n }]\n }, {\n title: \"User Management\",\n items: [{\n title: \"Users\",\n url: \"admin/users\",\n target: \"__use_router__\"\n }, {\n title: \"Quotas\",\n url: \"admin/quotas\",\n target: \"__use_router__\",\n enabled: self.config.enable_quotas\n }, {\n title: \"Groups\",\n url: \"admin/groups\",\n target: \"__use_router__\"\n }, {\n title: \"Roles\",\n url: \"admin/roles\",\n target: \"__use_router__\"\n }, {\n title: \"Forms\",\n url: \"admin/forms\",\n target: \"__use_router__\"\n }, {\n title: \"API keys\",\n url: \"userskeys/all_users\"\n }, {\n title: \"Impersonate a user\",\n url: \"admin/impersonate\",\n enabled: self.config.allow_user_impersonation\n }]\n }, {\n title: \"Tool Management\",\n items: [{\n title: \"Install new tools\",\n url: \"admin_toolshed/browse_tool_sheds\",\n enabled: self.settings.is_tool_shed_installed\n }, {\n title: \"Install new tools (Beta)\",\n url: \"admin_toolshed/browse_toolsheds\",\n enabled: self.settings.is_tool_shed_installed && self.config.enable_beta_ts_api_install\n }, {\n title: \"Monitor installation\",\n url: \"admin_toolshed/monitor_repository_installation\",\n enabled: self.settings.installing_repository_ids\n }, {\n title: \"Manage tools\",\n url: \"admin/repositories\",\n enabled: self.settings.is_repo_installed,\n target: \"__use_router__\"\n }, {\n title: \"Manage metadata\",\n url: \"admin_toolshed/reset_metadata_on_selected_installed_repositories\",\n enabled: self.settings.is_repo_installed\n }, {\n title: \"Manage whitelist\",\n url: \"admin/sanitize_whitelist\"\n }, {\n title: \"Manage dependencies\",\n url: \"admin/manage_tool_dependencies\"\n }, {\n title: \"View lineage\",\n url: \"admin/tool_versions\",\n target: \"__use_router__\"\n }, {\n title: \"View migration stages\",\n url: \"admin/review_tool_migration_stages\"\n }, {\n title: \"View error logs\",\n url: \"admin/tool_errors\"\n }]\n }]);\n this.setElement(this._template());\n },\n\n render: function render() {\n var self = this;\n this.$el.empty();\n this.categories.each(function (category) {\n var $section = $(self._templateSection(category.attributes));\n var $entries = $section.find(\".ui-side-section-body\");\n _.each(category.get(\"items\"), function (item) {\n if (item.enabled === undefined || item.enabled) {\n var $link = $(\"\").attr({ href: self.root + item.url }).text((0, _localization2.default)(item.title));\n if (item.target == \"__use_router__\") {\n $link.on(\"click\", function (e) {\n e.preventDefault();\n self.page.router.push(item.url);\n });\n } else {\n $link.attr(\"target\", \"galaxy_main\");\n }\n $entries.append($(\"
      \").addClass(\"ui-side-section-body-title\").append($link));\n }\n });\n self.$el.append($section);\n });\n this.page.$(\"#galaxy_main\").prop(\"src\", this.root + \"admin/center?message=\" + this.message + \"&status=\" + this.status);\n },\n\n _templateSection: function _templateSection(options) {\n return [\"
      \", \"
      \" + (0, _localization2.default)(options.title) + \"
      \", '
      ', \"
      \"].join(\"\");\n },\n\n _template: function _template() {\n return '
      ';\n },\n\n toString: function toString() {\n return \"adminPanel\";\n }\n});\n\nexports.default = AdminPanel;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n\n/***/ 30:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _queryStringParsing = __webpack_require__(8);\n\nvar _queryStringParsing2 = _interopRequireDefault(_queryStringParsing);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar $ = _jquery2.default;\n\n\nvar Router = Backbone.Router.extend({\n // TODO: not many client routes at this point - fill and remove from server.\n // since we're at root here, this may be the last to be routed entirely on the client.\n initialize: function initialize(page, options) {\n this.page = page;\n this.options = options;\n },\n\n /** helper to push a new navigation state */\n push: function push(url, data) {\n data = data || {};\n data.__identifer = Math.random().toString(36).substr(2);\n if (!$.isEmptyObject(data)) {\n url += url.indexOf(\"?\") == -1 ? \"?\" : \"&\";\n url += $.param(data, true);\n }\n Galaxy.params = data;\n this.navigate(url, { trigger: true });\n },\n\n /** override to parse query string into obj and send to each route */\n execute: function execute(callback, args, name) {\n Galaxy.debug(\"router execute:\", callback, args, name);\n var queryObj = _queryStringParsing2.default.parse(args.pop());\n args.push(queryObj);\n if (callback) {\n if (this.authenticate(args, name)) {\n callback.apply(this, args);\n } else {\n this.access_denied();\n }\n }\n },\n\n authenticate: function authenticate(args, name) {\n return true;\n },\n\n access_denied: function access_denied() {\n this.page.display(new _uiMisc2.default.Message({\n status: \"danger\",\n message: \"You must be logged in with proper credentials to make this request.\",\n persistent: true\n }));\n }\n});\n\nexports.default = Router;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))\n\n/***/ }),\n\n/***/ 44:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _formView = __webpack_require__(9);\n\nvar _formView2 = _interopRequireDefault(_formView);\n\nvar _uiMisc = __webpack_require__(6);\n\nvar _uiMisc2 = _interopRequireDefault(_uiMisc);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/** Generic form view */\nvar View = Backbone.View.extend({\n initialize: function initialize(options) {\n this.model = new Backbone.Model(options);\n this.url = this.model.get(\"url\");\n this.redirect = this.model.get(\"redirect\");\n this.setElement(\"
      \");\n this.render();\n },\n\n render: function render() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.url,\n type: \"GET\"\n }).done(function (response) {\n var options = $.extend({}, self.model.attributes, response);\n var form = new _formView2.default({\n title: options.title,\n message: options.message,\n status: options.status || \"warning\",\n icon: options.icon,\n inputs: options.inputs,\n buttons: {\n submit: new _uiMisc2.default.Button({\n tooltip: options.submit_tooltip,\n title: options.submit_title || \"Save\",\n icon: options.submit_icon || \"fa-save\",\n cls: \"btn btn-primary ui-clear-float\",\n onclick: function onclick() {\n self._submit(form);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n }).fail(function (response) {\n self.$el.empty().append(new _uiMisc2.default.Message({\n message: \"Failed to load resource \" + self.url + \".\",\n status: \"danger\",\n persistent: true\n }).$el);\n });\n },\n\n _submit: function _submit(form) {\n var self = this;\n $.ajax({\n url: Galaxy.root + self.url,\n data: JSON.stringify(form.data.create()),\n type: \"PUT\",\n contentType: \"application/json\"\n }).done(function (response) {\n var success_message = {\n message: response.message,\n status: \"success\",\n persistent: false\n };\n if (self.redirect) {\n window.location = Galaxy.root + self.redirect + \"?\" + $.param(success_message);\n } else {\n form.data.matchModel(response, function (input, input_id) {\n form.field_list[input_id].value(input.value);\n });\n self._showMessage(form, success_message);\n }\n }).fail(function (response) {\n self._showMessage(form, {\n message: response.responseJSON.err_msg,\n status: \"danger\",\n persistent: false\n });\n });\n },\n\n _showMessage: function _showMessage(form, options) {\n var $panel = form.$el.parents().filter(function () {\n return [\"auto\", \"scroll\"].indexOf($(this).css(\"overflow\")) != -1;\n }).first();\n $panel.animate({ scrollTop: 0 }, 500);\n form.message.update(options);\n }\n});\n\nexports.default = {\n View: View\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0)))\n\n/***/ })\n\n},[172]);\n\n\n// WEBPACK FOOTER //\n// admin.bundled.js","import jQuery from \"jquery\";\nvar $ = jQuery;\nimport GalaxyApp from \"galaxy\";\nimport AdminPanel from \"./panels/admin-panel\";\nimport FormWrapper from \"mvc/form/form-wrapper\";\nimport GridView from \"mvc/grid/grid-view\";\nimport Ui from \"mvc/ui/ui-misc\";\nimport QueryStringParsing from \"utils/query-string-parsing\";\nimport Router from \"layout/router\";\nimport Utils from \"utils/utils\";\nimport Page from \"layout/page\";\n\nwindow.app = function app(options, bootstrapped) {\n window.Galaxy = new GalaxyApp.GalaxyApp(options, bootstrapped);\n Galaxy.debug(\"admin app\");\n\n /** Routes */\n var AdminRouter = Router.extend({\n routes: {\n \"(/)admin(/)users\": \"show_users\",\n \"(/)admin(/)roles\": \"show_roles\",\n \"(/)admin(/)groups\": \"show_groups\",\n \"(/)admin(/)tool_versions\": \"show_tool_versions\",\n \"(/)admin(/)quotas\": \"show_quotas\",\n \"(/)admin(/)repositories\": \"show_repositories\",\n \"(/)admin(/)forms\": \"show_forms\",\n \"(/)admin(/)form(/)(:form_id)\": \"show_form\"\n },\n\n authenticate: function(args, name) {\n return Galaxy.user && Galaxy.user.id && Galaxy.user.get(\"is_admin\");\n },\n\n show_users: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/users_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_roles: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/roles_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_groups: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/groups_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_repositories: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin_toolshed/browse_repositories`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_tool_versions: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/tool_versions_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_quotas: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}admin/quotas_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_forms: function() {\n this.page.display(\n new GridView({\n url_base: `${Galaxy.root}forms/forms_list`,\n url_data: Galaxy.params,\n dict_format: true\n })\n );\n },\n\n show_form: function(form_id) {\n var id = `?id=${QueryStringParsing.get(\"id\")}`;\n var form_defs = {\n reset_user_password: {\n title: \"Reset passwords\",\n url: `admin/reset_user_password${id}`,\n icon: \"fa-user\",\n submit_title: \"Save new password\",\n redirect: \"admin/users\"\n },\n manage_roles_and_groups_for_user: {\n url: `admin/manage_roles_and_groups_for_user${id}`,\n icon: \"fa-users\",\n redirect: \"admin/users\"\n },\n manage_users_and_groups_for_role: {\n url: `admin/manage_users_and_groups_for_role${id}`,\n redirect: \"admin/roles\"\n },\n manage_users_and_roles_for_group: {\n url: `admin/manage_users_and_roles_for_group${id}`,\n redirect: \"admin/groups\"\n },\n manage_users_and_groups_for_quota: {\n url: `admin/manage_users_and_groups_for_quota${id}`,\n redirect: \"admin/quotas\"\n },\n create_role: {\n url: \"admin/create_role\",\n redirect: \"admin/roles\"\n },\n create_group: {\n url: \"admin/create_group\",\n redirect: \"admin/groups\"\n },\n create_quota: {\n url: \"admin/create_quota\",\n redirect: \"admin/quotas\"\n },\n rename_role: {\n url: `admin/rename_role${id}`,\n redirect: \"admin/roles\"\n },\n rename_group: {\n url: `admin/rename_group${id}`,\n redirect: \"admin/groups\"\n },\n rename_quota: {\n url: `admin/rename_quota${id}`,\n redirect: \"admin/quotas\"\n },\n edit_quota: {\n url: `admin/edit_quota${id}`,\n redirect: \"admin/quotas\"\n },\n set_quota_default: {\n url: `admin/set_quota_default${id}`,\n redirect: \"admin/quotas\"\n },\n create_form: {\n url: \"forms/create_form\",\n redirect: \"admin/forms\"\n },\n edit_form: {\n url: `forms/edit_form${id}`,\n redirect: \"admin/forms\"\n }\n };\n this.page.display(new FormWrapper.View(form_defs[form_id]));\n }\n });\n\n $(() => {\n _.extend(options.config, { active_view: \"admin\" });\n Utils.setWindowTitle(\"Administration\");\n Galaxy.page = new Page.View(\n _.extend(options, {\n Left: AdminPanel,\n Router: AdminRouter\n })\n );\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/admin.js","import _l from \"utils/localization\";\n\nvar AdminPanel = Backbone.View.extend({\n initialize: function(page, options) {\n var self = this;\n this.page = page;\n this.root = options.root;\n this.config = options.config;\n this.settings = options.settings;\n this.message = options.message;\n this.status = options.status;\n this.model = new Backbone.Model({\n title: _l(\"Administration\")\n });\n this.categories = new Backbone.Collection([\n {\n title: \"Server\",\n items: [\n {\n title: \"Data types\",\n url: \"admin/view_datatypes_registry\"\n },\n {\n title: \"Data tables\",\n url: \"admin/view_tool_data_tables\"\n },\n {\n title: \"Display applications\",\n url: \"admin/display_applications\"\n },\n {\n title: \"Manage jobs\",\n url: \"admin/jobs\"\n },\n {\n title: \"Local data\",\n url: \"data_manager\"\n }\n ]\n },\n {\n title: \"User Management\",\n items: [\n {\n title: \"Users\",\n url: \"admin/users\",\n target: \"__use_router__\"\n },\n {\n title: \"Quotas\",\n url: \"admin/quotas\",\n target: \"__use_router__\",\n enabled: self.config.enable_quotas\n },\n {\n title: \"Groups\",\n url: \"admin/groups\",\n target: \"__use_router__\"\n },\n {\n title: \"Roles\",\n url: \"admin/roles\",\n target: \"__use_router__\"\n },\n {\n title: \"Forms\",\n url: \"admin/forms\",\n target: \"__use_router__\"\n },\n {\n title: \"API keys\",\n url: \"userskeys/all_users\"\n },\n {\n title: \"Impersonate a user\",\n url: \"admin/impersonate\",\n enabled: self.config.allow_user_impersonation\n }\n ]\n },\n {\n title: \"Tool Management\",\n items: [\n {\n title: \"Install new tools\",\n url: \"admin_toolshed/browse_tool_sheds\",\n enabled: self.settings.is_tool_shed_installed\n },\n {\n title: \"Install new tools (Beta)\",\n url: \"admin_toolshed/browse_toolsheds\",\n enabled: self.settings.is_tool_shed_installed && self.config.enable_beta_ts_api_install\n },\n {\n title: \"Monitor installation\",\n url: \"admin_toolshed/monitor_repository_installation\",\n enabled: self.settings.installing_repository_ids\n },\n {\n title: \"Manage tools\",\n url: \"admin/repositories\",\n enabled: self.settings.is_repo_installed,\n target: \"__use_router__\"\n },\n {\n title: \"Manage metadata\",\n url: \"admin_toolshed/reset_metadata_on_selected_installed_repositories\",\n enabled: self.settings.is_repo_installed\n },\n {\n title: \"Manage whitelist\",\n url: \"admin/sanitize_whitelist\"\n },\n {\n title: \"Manage dependencies\",\n url: \"admin/manage_tool_dependencies\"\n },\n {\n title: \"View lineage\",\n url: \"admin/tool_versions\",\n target: \"__use_router__\"\n },\n {\n title: \"View migration stages\",\n url: \"admin/review_tool_migration_stages\"\n },\n {\n title: \"View error logs\",\n url: \"admin/tool_errors\"\n }\n ]\n }\n ]);\n this.setElement(this._template());\n },\n\n render: function() {\n var self = this;\n this.$el.empty();\n this.categories.each(category => {\n var $section = $(self._templateSection(category.attributes));\n var $entries = $section.find(\".ui-side-section-body\");\n _.each(category.get(\"items\"), item => {\n if (item.enabled === undefined || item.enabled) {\n var $link = $(\"\")\n .attr({ href: self.root + item.url })\n .text(_l(item.title));\n if (item.target == \"__use_router__\") {\n $link.on(\"click\", e => {\n e.preventDefault();\n self.page.router.push(item.url);\n });\n } else {\n $link.attr(\"target\", \"galaxy_main\");\n }\n $entries.append(\n $(\"
      \")\n .addClass(\"ui-side-section-body-title\")\n .append($link)\n );\n }\n });\n self.$el.append($section);\n });\n this.page\n .$(\"#galaxy_main\")\n .prop(\"src\", `${this.root}admin/center?message=${this.message}&status=${this.status}`);\n },\n\n _templateSection: function(options) {\n return [\n \"
      \",\n `
      ${_l(options.title)}
      `,\n '
      ',\n \"
      \"\n ].join(\"\");\n },\n\n _template: function() {\n return '
      ';\n },\n\n toString: function() {\n return \"adminPanel\";\n }\n});\n\nexport default AdminPanel;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/panels/admin-panel.js","import jQuery from \"jquery\";\nvar $ = jQuery;\nimport QUERY_STRING from \"utils/query-string-parsing\";\nimport Ui from \"mvc/ui/ui-misc\";\n\nvar Router = Backbone.Router.extend({\n // TODO: not many client routes at this point - fill and remove from server.\n // since we're at root here, this may be the last to be routed entirely on the client.\n initialize: function(page, options) {\n this.page = page;\n this.options = options;\n },\n\n /** helper to push a new navigation state */\n push: function(url, data) {\n data = data || {};\n data.__identifer = Math.random()\n .toString(36)\n .substr(2);\n if (!$.isEmptyObject(data)) {\n url += url.indexOf(\"?\") == -1 ? \"?\" : \"&\";\n url += $.param(data, true);\n }\n Galaxy.params = data;\n this.navigate(url, { trigger: true });\n },\n\n /** override to parse query string into obj and send to each route */\n execute: function(callback, args, name) {\n Galaxy.debug(\"router execute:\", callback, args, name);\n var queryObj = QUERY_STRING.parse(args.pop());\n args.push(queryObj);\n if (callback) {\n if (this.authenticate(args, name)) {\n callback.apply(this, args);\n } else {\n this.access_denied();\n }\n }\n },\n\n authenticate: function(args, name) {\n return true;\n },\n\n access_denied: function() {\n this.page.display(\n new Ui.Message({\n status: \"danger\",\n message: \"You must be logged in with proper credentials to make this request.\",\n persistent: true\n })\n );\n }\n});\n\nexport default Router;\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/layout/router.js","/** Generic form view */\nimport Form from \"mvc/form/form-view\";\nimport Ui from \"mvc/ui/ui-misc\";\nvar View = Backbone.View.extend({\n initialize: function(options) {\n this.model = new Backbone.Model(options);\n this.url = this.model.get(\"url\");\n this.redirect = this.model.get(\"redirect\");\n this.setElement(\"
      \");\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.url,\n type: \"GET\"\n })\n .done(response => {\n var options = $.extend({}, self.model.attributes, response);\n var form = new Form({\n title: options.title,\n message: options.message,\n status: options.status || \"warning\",\n icon: options.icon,\n inputs: options.inputs,\n buttons: {\n submit: new Ui.Button({\n tooltip: options.submit_tooltip,\n title: options.submit_title || \"Save\",\n icon: options.submit_icon || \"fa-save\",\n cls: \"btn btn-primary ui-clear-float\",\n onclick: function() {\n self._submit(form);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n })\n .fail(response => {\n self.$el.empty().append(\n new Ui.Message({\n message: `Failed to load resource ${self.url}.`,\n status: \"danger\",\n persistent: true\n }).$el\n );\n });\n },\n\n _submit: function(form) {\n var self = this;\n $.ajax({\n url: Galaxy.root + self.url,\n data: JSON.stringify(form.data.create()),\n type: \"PUT\",\n contentType: \"application/json\"\n })\n .done(response => {\n var success_message = {\n message: response.message,\n status: \"success\",\n persistent: false\n };\n if (self.redirect) {\n window.location = `${Galaxy.root + self.redirect}?${$.param(success_message)}`;\n } else {\n form.data.matchModel(response, (input, input_id) => {\n form.field_list[input_id].value(input.value);\n });\n self._showMessage(form, success_message);\n }\n })\n .fail(response => {\n self._showMessage(form, {\n message: response.responseJSON.err_msg,\n status: \"danger\",\n persistent: false\n });\n });\n },\n\n _showMessage: function(form, options) {\n var $panel = form.$el\n .parents()\n .filter(function() {\n return [\"auto\", \"scroll\"].indexOf($(this).css(\"overflow\")) != -1;\n })\n .first();\n $panel.animate({ scrollTop: 0 }, 500);\n form.message.update(options);\n }\n});\n\nexport default {\n View: View\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/form/form-wrapper.js"],"sourceRoot":""} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index f852efa58c0f..f432f1a30f7b 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,4 +1,4 @@ -webpackJsonp([0],[,,,,,,,,,,function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=function(e){return e&&e.__esModule?e:{default:e}}(a),l=e.View.extend({optionsDefault:{with_close:!0,title:null,placement:"top",container:"body",body:null},initialize:function(e){this.setElement(this._template()),this.uid=o.default.uid(),this.options=n.defaults(e||{},this.optionsDefault),this.options.container.parent().append(this.el),this.$title=this.$(".popover-title-label"),this.$close=this.$(".popover-close"),this.$body=this.$(".popover-content"),this.options.body&&this.append(this.options.body);var t=this;s("body").on("mousedown."+this.uid,function(e){t.visible&&!s(t.options.container).is(e.target)&&!s(t.el).is(e.target)&&0===s(t.el).has(e.target).length&&t.hide()})},render:function(){this.$title.html(this.options.title),this.$el.removeClass().addClass("ui-popover popover fade in").addClass(this.options.placement),this.$el.css(this._get_placement(this.options.placement));var e=this;this.options.with_close?this.$close.on("click",function(){e.hide()}).show():this.$close.off().hide()},title:function(e){void 0!==e&&(this.options.title=e,this.$title.html(e))},show:function(){this.render(),this.$el.show(),this.visible=!0},hide:function(){this.$el.hide(),this.visible=!1},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},remove:function(){s("body").off("mousedown."+this.uid),this.$el.remove()},_get_placement:function(e){var t,i,n=this._get_width(this.$el),s=this.$el.height(),a=this.options.container,o=this._get_width(a),l=this._get_height(a),r=a.position();if(t=i=0,-1!=["top","bottom"].indexOf(e))switch(i=r.left-n+(o+n)/2,e){case"top":t=r.top-s-5;break;case"bottom":t=r.top+l+5}else switch(t=r.top-s+(l+s)/2,e){case"right":i=r.left+o}return{top:t,left:i}},_get_width:function(e){return e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("margin-left"))+parseInt(e.css("padding-right"))+parseInt(e.css("margin-right"))},_get_height:function(e){return e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"))},_template:function(e){return'
      '}});t.default={View:l}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};n.READY_STATES=[n.OK,n.EMPTY,n.PAUSED,n.FAILED_METADATA,n.NOT_VIEWABLE,n.DISCARDED,n.ERROR],n.NOT_READY_STATES=[n.UPLOAD,n.QUEUED,n.RUNNING,n.SETTING_METADATA,n.NEW],t.default=n},,function(e,t,i){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var s=i(3),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=e.View.extend({optionsDefault:{css:"",placeholder:"No data available",data:[],value:null,multiple:!1,minimumInputLength:0,initialData:""},initialize:function(e){if(this.options=a.default.merge(e,this.optionsDefault),this.setElement(this._template(this.options)),!this.options.container)return void console.log("ui-select::initialize() : container not specified.");if(this.options.container.append(this.$el),this.select_data=this.options.data,this._refresh(),!this.options.multiple){this.options.value&&this._setValue(this.options.value);var t=this;this.options.onchange&&this.$el.on("change",function(){t.options.onchange(t.value())})}},value:function(e){var t=this._getValue();void 0!==e&&this._setValue(e);var i=this._getValue();return i!=t&&this.options.onchange&&this.options.onchange(i),i},text:function(){return this.$el.select2("data").text},disabled:function(){return!this.$el.select2("enable")},enable:function(){this.$el.select2("enable",!0)},disable:function(){this.$el.select2("enable",!1)},add:function(e){this.select_data.push({id:e.id,text:e.text}),this._refresh()},del:function(e){var t=this._getIndex(e);-1!=t&&(this.select_data.splice(t,1),this._refresh())},remove:function(){this.$el.select2("destroy")},update:function(e){this.select_data=[];for(var t in e.data)this.select_data.push(e.data[t]);this._refresh()},_refresh:function(){if(this.options.multiple){var e={multiple:this.options.multiple,containerCssClass:this.options.css,placeholder:this.options.placeholder,minimumInputLength:this.options.minimumInputLength,ajax:this.options.ajax,dropdownCssClass:this.options.dropdownCssClass,escapeMarkup:this.options.escapeMarkup,formatResult:this.options.formatResult,formatSelection:this.options.formatSelection,initSelection:this.options.initSelection,initialData:this.options.initialData};this.$el.select2(e)}else{var t=this._getValue(),e={data:this.select_data,containerCssClass:this.options.css,placeholder:this.options.placeholder,dropdownAutoWidth:!0};this.$el.select2(e),this._setValue(t)}},_getIndex:function(e){n.findIndex(this.select_data,{id:e})},_getValue:function(){return this.$el.select2("val")},_setValue:function(e){-1==this._getIndex(e)&&this.select_data.length>0&&(e=this.select_data[0].id),this.$el.select2("val",e)},_template:function(e){return''}});t.default={View:o}}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(0),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default,o=function(t){t=t||{},t.tooltipConfig=t.tooltipConfig||{placement:"bottom"},t.classes=["icon-btn"].concat(t.classes||[]),t.disabled&&t.classes.push("disabled");var i=['','',""].join(""),n=a(i).tooltip(t.tooltipConfig);return e.isFunction(t.onclick)&&n.click(t.onclick),n};t.default=o}).call(t,i(1))},,function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=e.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_name:"",file_mode:"",file_size:0,file_type:null,file_path:"",file_data:null,percentage:0,space_to_tab:!1,to_posix_lines:!0,enabled:!0},reset:function(e){this.clear().set(this.defaults).set(e)}}),n=e.Collection.extend({model:i});t.default={Model:i,Collection:n}}).call(t,i(2))},,,,,,function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(5),o=s(a),l=i(4),r=s(l),d=e.View.extend(o.default.LoggableMixin).extend(o.default.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",select_width:"100%",events:{},initialize:function(e){this.show_editor=!1,!1===e.usePrompt?this.label="":this.label='",this.workflow_mode=e.workflow_mode||!1,this.workflow_mode&&(this.events.click="showEditor",this.events.keydown="keydownHandler"),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.workflow_mode?this.$el.html(this._workflowTemplate()):this.$el.html(this._defaultTemplate()),this.$input().select2({placeholder:"Add tags",width:this.workflow_mode?this.width:this.select_width,tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_hashToName:function(e){return e.startsWith("#")?"name:"+e.slice(1):e},_nameToHash:function(e){return e.startsWith("name:")&&(e="#"+e.slice(5)),e},_defaultTemplate:function(){return[this.label,this._renderEditor()].join("")},_workflowTemplate:function(){return[this.show_editor?this._renderEditor():this._renderTags()].join(" ")},keydownHandler:function(e){switch(e.which){case 27:this.hideEditor()}},showEditor:function(){this.show_editor=!0,this.render()},hideEditor:function(){this.show_editor=!1,this.render()},_renderEditor:function(){return''},_renderTags:function(){var e=this.model.get("tags"),t=[];return n.each(e,function(e){e=0==e.indexOf("name:")?e.slice(5):e;var i=''+e+"";t.push(i)}),0===t.length&&t.push(''),t.join(" ")},tagsToCSV:function(){var e=this,t=this.model.get("tags");return!n.isArray(t)||n.isEmpty(t)?"":t.map(function(t){return n.escape(e._nameToHash(t))}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){var e=this;return n.map(Galaxy.user.get("tags_used"),e._nameToHash)},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){t.val=n.map(t.val,e._hashToName),e.model.save({tags:t.val}),t.added&&e._addNewTagToTagsUsed(""+t.added.text)})},_addNewTagToTagsUsed:function(e){var t=Galaxy.user.get("tags_used");n.contains(t,e)||(t.push(e),t.sort(),Galaxy.user.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),e.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",""+this.model,")"].join("")}});t.default={TagsEditor:d}}).call(t,i(2),i(1))},,,,,,,,function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(0),a=n(s),o=i(8),l=n(o),r=i(6),d=n(r),c=a.default,u=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),c.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=c.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=l.default.parse(t.pop());t.push(n),e&&(this.authenticate(t,i)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new d.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=u}).call(t,i(2))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3);!function(e){e&&e.__esModule}(a);t.default=e.View.extend({options:{class_check:"fa-check-square-o",class_uncheck:"fa-square-o",parameters:[{id:"space_to_tab",title:"Convert spaces to tabs"},{id:"to_posix_lines",title:"Use POSIX standard"}]},initialize:function(e){this.model=e.model,this.setElement(n("
      ").addClass("upload-settings")),this.$el.append(n("
      ").addClass("upload-settings-cover")),this.$el.append(n("").addClass("upload-settings-table ui-table-striped").append("")),this.$cover=this.$(".upload-settings-cover"),this.$table=this.$(".upload-settings-table > tbody"),this.listenTo(this.model,"change",this.render,this),this.model.trigger("change")},render:function(){var e=this;this.$table.empty(),s.each(this.options.parameters,function(t){var i=n("
      ").addClass("upload-"+t.id+" upload-icon-button fa").addClass(e.model.get(t.id)&&e.options.class_check||e.options.class_uncheck).on("click",function(){e.model.get("enabled")&&e.model.set(t.id,!e.model.get(t.id))});e.$table.append(n("
      ").append(n(""},_template:function(){return'
      '+this.model.get("help_text")+'
      Available files:   
      ").append(i)).append(n("").append(t.title)))}),this.$cover[this.model.get("enabled")&&"hide"||"show"]()}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=e.View.extend({initialize:function(t){this.model=new e.Model({cls:"upload-ftp",class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o",help_enabled:!0,help_text:"This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at "+t.ftp_upload_site+" using your Galaxy credentials.",collection:null,onchange:function(){},onadd:function(){},onremove:function(){}}).set(t),this.collection=this.model.get("collection"),this.setElement(this._template()),this.$content=this.$(".upload-ftp-content"),this.$wait=this.$(".upload-ftp-wait"),this.$help=this.$(".upload-ftp-help"),this.$number=this.$(".upload-ftp-number"),this.$disk=this.$(".upload-ftp-disk"),this.$body=this.$(".upload-ftp-body"),this.$warning=this.$(".upload-ftp-warning"),this.$select=this.$(".upload-ftp-select-all"),this.render()},render:function(){var e=this;this.$wait.show(),this.$content.hide(),this.$warning.hide(),this.$help.hide(),n.ajax({url:Galaxy.root+"api/remote_files",method:"GET",success:function(t){e.model.set("ftp_files",t),e._index(),e._renderTable()},error:function(){e._renderTable()}})},_renderTable:function(){var e=this,t=this.model.get("ftp_files");if(this.rows=[],t&&t.length>0){this.$body.empty();var i=0;s.each(t,function(t){e.rows.push(e._renderRow(t)),i+=t.size}),this.$number.html(t.length+" files"),this.$disk.html(o.default.bytesToString(i,!0)),this.collection&&(this.$("._has_collection").show(),this.$select.addClass(this.model.get("class_add")).off().on("click",function(){e._all()}),this._refresh()),this.$content.show()}else this.$warning.show();this.model.get("help_enabled")&&this.$help.show(),this.$wait.hide()},_renderRow:function(e){var t=this,i=this.model.attributes,s=n(this._templateRow(e)),a=s.find(".icon");if(this.$body.append(s),this.collection){var o=this.ftp_index[e.path];a.addClass(void 0===o?i.class_add:i.class_remove),s.on("click",function(){t._switch(a,e),t._refresh()})}else s.on("click",function(){i.onchange(e)});return a},_index:function(){var e=this;this.ftp_index={},this.collection&&this.collection.each(function(t){"ftp"==t.get("file_mode")&&(e.ftp_index[t.get("file_path")]=t.id)})},_all:function(){var e=this.model.attributes,t=this.model.get("ftp_files"),i=this.$select.hasClass(e.class_add);for(var n in t){var s=t[n],a=this.ftp_index[s.path];(void 0===a&&i||void 0!==a&&!i)&&this._switch(this.rows[n],s)}this._refresh()},_switch:function(e,t){e.removeClass();var i=this.model.attributes,n=this.ftp_index[t.path];if(void 0===n){var s=i.onadd(t);e.addClass(i.class_remove),this.ftp_index[t.path]=s}else i.onremove(n),e.addClass(i.class_add),this.ftp_index[t.path]=void 0},_refresh:function(){var e=s.reduce(this.ftp_index,function(e,t){return void 0!==t&&e++,e},0);this.$select.removeClass(),0==e?this.$select.addClass(this.model.get("class_add")):this.$select.addClass(e==this.rows.length?this.model.get("class_remove"):this.model.get("class_partial"))},_templateRow:function(e){return'
      '+s.escape(e.path)+''+o.default.bytesToString(e.size)+''+e.ctime+"
      NameSizeCreated
      Your FTP directory does not contain any files.
      '}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=(s(a),i(10)),l=s(o);t.default=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.setElement("
      "),this.render()},render:function(){var e=this.model.attributes,t=n.findWhere(e.list,{id:e.extension});this.extension_popup&&this.extension_popup.remove(),this.extension_popup=new l.default.View({placement:e.placement||"bottom",container:e.$el}),this.extension_popup.title(e.title),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(t)),this.extension_popup.show()},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (read more)'),t}return"There is no description available for this file extension."}})}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e,t){!function(i){e.event.props.push("dataTransfer"),i.uploadpost=function(t){var n=i.extend({},{data:{},success:function(){},error:function(){},progress:function(){},url:null,maxfilesize:2048,error_filesize:"File exceeds 2GB. Please use a FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in."},t),s=n.data;if(s.error_message)return void n.error(s.error_message);var a=new FormData;for(var o in s.payload)a.append(o,s.payload[o]);var l=0;for(var o in s.files){var r=s.files[o];a.append(r.name,r.file,r.file.name),l+=r.file.size}if(l>1048576*n.maxfilesize)return void n.error(n.error_filesize);var d=new XMLHttpRequest;d.open("POST",n.url,!0),d.setRequestHeader("Accept","application/json"),d.setRequestHeader("Cache-Control","no-cache"),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.onreadystatechange=function(){if(d.readyState==d.DONE){var t=null,i="";if(d.responseText)try{t=e.parseJSON(d.responseText),i=t.err_msg}catch(e){t=d.responseText,i=t}if(d.status<200||d.status>299){var s=d.statusText;403==d.status?s=n.error_login:0==d.status?s=n.error_server:s||(s=n.error_default),n.error(s+" ("+d.status+"). "+i)}else n.success(t)}},d.upload.addEventListener("progress",function(e){e.lengthComputable&&n.progress(Math.round(100*e.loaded/e.total))},!1),Galaxy.emit.debug("uploadbox::uploadpost()","Posting following data.",n),d.send(a)},i.fn.uploadinput=function(e){var t=this,n=i.extend({},{ondragover:function(){},ondragleave:function(){},onchange:function(){},multiple:!1},e),s=i('");return t.append(s.change(function(e){n.onchange(e.target.files),i(this).val("")})),t.on("drop",function(e){n.ondragleave(e),e.dataTransfer&&(n.onchange(e.dataTransfer.files),e.preventDefault())}),t.on("dragover",function(e){e.preventDefault(),n.ondragover(e)}),t.on("dragleave",function(e){e.stopPropagation(),n.ondragleave(e)}),{dialog:function(){s.trigger("click")}}},i.fn.uploadbox=function(e){function n(e){if(e&&e.length&&!g){var i=void 0;return t.each(e,function(e,i){"new"!==e.mode&&t.filter(f,function(t){return t.name===e.name&&t.size===e.size}).length&&(e.duplicate=!0)}),t.each(e,function(e){e.duplicate||(i=String(p++),f[i]=e,h.announce(i,f[i]),m++)}),i}}function s(e){f[e]&&(delete f[e],m--)}function a(){if(0==m||_)return _=!1,g=!1,void h.complete();g=!0;var e=-1;for(var t in f){e=t;break}f[e];s(e),i.uploadpost({url:h.url,data:h.initialize(e),success:function(t){h.success(e,t),a()},error:function(t){h.error(e,t),a()},progress:function(t){h.progress(e,t)}})}function o(){v.dialog()}function l(e){for(e in f)s(e)}function r(){g||(g=!0,a())}function d(){_=!0}function c(e){return h=i.extend({},h,e)}function u(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}var h=i.extend({},{dragover:function(){},dragleave:function(){},announce:function(e){},initialize:function(e){},progress:function(e,t){},success:function(e,t){},error:function(e,t){alert(t)},complete:function(){}},e),f={},p=0,m=0,g=!1,_=!1,v=i(this).uploadinput({multiple:!0,onchange:function(e){n(e)},ondragover:e.ondragover,ondragleave:e.ondragleave});return{select:o,add:n,remove:s,start:r,stop:d,reset:l,configure:c,compatible:u}}}(e)}).call(t,i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var i=e.toJSON();return $(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i,n)}})}Object.defineProperty(t,"__esModule",{value:!0});var r=i(36),d=o(r),c=i(11),u=o(c),h=i(5),f=o(h),p=i(74),m=o(p),g=i(7),_=o(g),v=i(75),w=(o(v),i(4)),y=o(w);i(76);var b=e.View.extend(f.default.LoggableMixin).extend({_logNamespace:"collections",tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){this.dragStartHandler=n.bind(this._dragstart,this),this.dragEndHandler=n.bind(this._dragend,this);var e=this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})).get(0);return e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1),this.selected&&this.$el.addClass("selected"),this},template:n.template(['',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([(0,y.default)("Enter a new name for the element"),":\n(",(0,y.default)("Note that changing the name here will not rename the dataset"),")"].join(""),prompt((0,y.default)("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),x=e.View.extend(f.default.LoggableMixin).extend(m.default.CollectionCreatorMixin).extend({_logNamespace:"collections",elementViewClass:b,collectionClass:d.default.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},footerSettings:{".hide-originals":"hideOriginals"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;n.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._setUpCommonSettings(e),this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=n.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?(0,y.default)("is not a dataset"):e.state===u.default.OK||n.contains(u.default.NOT_READY_STATES,e.state)?e.deleted||e.purged?(0,y.default)("has been deleted or purged"):null:(0,y.default)("has errored, is paused, or is not accessible")},_mangleDuplicateNames:function(){var e=1,t={};this.workingElements.forEach(function(i){for(var n=i.name;t.hasOwnProperty(n);)if(n=i.name+" ("+e+")",(e+=1)>=900)throw new Error("Safety hit in while loop - thats impressive");i.name=n,t[i.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,s=a("
      "),o=i.$list();n.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);s.append(t.$el)}),i._renderClearSelected(),o.empty().append(s.children()),n.invoke(i.elementViews,"render"),o.height()>o.css("max-height")?o.css("border-width","1px 0px 1px 0px"):o.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:n.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=n.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=(0,y.default)("No valid elements for final list")+". ";return t+=''+(0,y.default)("Cancel")+" ",t+=(0,y.default)("or"),t+=' '+(0,y.default)("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e,i.hideOriginals).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:(0,y.default)("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=n.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this,i=e.message||(0,y.default)("An error occurred");if(e.xhr){var n=e.xhr,s=e.message;0===n.readyState&&0===n.status?i+=": "+(0,y.default)("Galaxy could not be reached and may be updating.")+(0,y.default)(" Try again in a few minutes."):n.responseJSON?i+=":
      "+JSON.stringify(n.responseJSON)+"
      ":i+=": "+s}t._showAlert(i,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","change .hide-originals":"_changeHideOriginals","click .cancel-create":"_cancelCreate","click .create-collection":"_clickCreate"},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=s('
      ');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=e.offset(),n=e.scrollTop(),s=t-i.top,a=i.top+e.outerHeight()-t;s>=0&&s=0&&ae&&a-o','',(0,y.default)("More help"),"",'","
      ",'
      ','','',"
      "].join("")),middle:n.template(['",'
      ',"
      "].join("")),footer:n.template(['
      ','
      ','","
      ",'
      ','','
      ',(0,y.default)("Name"),":
      ","
      ","
      ",'
      ','
      ','",'
      ','",'","
      ","
      ",'
      ','","
      ","
      "].join("")),helpContent:n.template(["

      ",(0,y.default)(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

      ","
        ","
      • ",(0,y.default)(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
      • ","
      • ",(0,y.default)(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
      • ","
      • ",(0,y.default)(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
      • ","
      • ",(0,y.default)(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
      • ","
      • ",(0,y.default)(['Click the "Cancel" button to exit the interface.'].join("")),"
      • ","

      ","

      ",(0,y.default)(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

      "].join("")),invalidElements:n.template([(0,y.default)("The following selections could not be included due to problems:"),"
        <% _.each( problems, function( problem ){ %>","
      • <%- problem.element.name %>: <%- problem.text %>
      • ","<% }); %>
      "].join("")),noElementsLeft:n.template(['
    • ',(0,y.default)("No elements left! "),(0,y.default)("Would you like to "),'',(0,y.default)("start over"),"?","
    • "].join("")),invalidInitial:n.template(['
      ','
      ','',"<% if( _.size( problems ) ){ %>",(0,y.default)("The following selections could not be included due to problems"),":","
        <% _.each( problems, function( problem ){ %>","
      • <%- problem.element.name %>: <%- problem.text %>
      • ","<% }); %>
      ","<% } else if( _.size( elements ) < 1 ){ %>",(0,y.default)("No datasets were selected"),".","<% } %>","
      ",(0,y.default)("At least one element is needed for the collection"),". ",(0,y.default)("You may need to "),'',(0,y.default)("cancel")," ",(0,y.default)("and reselect new elements"),".","
      ","
      ","
      ",'"].join(""))}),toString:function(){return"ListCollectionCreator"}}),C=function(e,t,i){var s,o=a.Deferred(),l=Galaxy.modal||new _.default.View;return t=n.defaults(t||{},{elements:e,oncancel:function(){l.hide(),o.reject("cancelled")},oncreate:function(e,t){l.hide(),o.resolve(t)}}),s=new i(t),l.show({title:t.title||(0,y.default)("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,o},$=function(e,t){return t=t||{},t.title=(0,y.default)("Create a collection from a list of datasets"),C(e,t,x)};t.default={DatasetCollectionElementView:b,ListCollectionCreator:x,collectionCreatorModal:C,listCollectionCreatorModal:$,createListCollection:l}}).call(t,i(2),i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function s(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(37),o=n(a),l=i(73),r=n(l),d=i(4),c=(n(d),r.default.HistoryContentMixin),u=o.default.ListDatasetCollection,h=o.default.PairDatasetCollection,f=o.default.ListPairedDatasetCollection,p=o.default.ListOfListsDatasetCollection,m=u.extend(c).extend({defaults:e.extend(e.clone(u.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),save:s(u.prototype.save),toString:function(){return"History"+u.prototype.toString.call(this)}}),g=h.extend(c).extend({defaults:e.extend(e.clone(h.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),save:s(h.prototype.save),toString:function(){return"History"+h.prototype.toString.call(this)}}),_=f.extend(c).extend({defaults:e.extend(e.clone(f.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),save:s(f.prototype.save),toString:function(){return"History"+f.prototype.toString.call(this)}}),v=p.extend(c).extend({defaults:e.extend(e.clone(p.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),save:s(p.prototype.save),toString:function(){return["HistoryListOfListsDatasetCollection(",this.get("name"),")"].join("")}});t.default={HistoryListDatasetCollection:m,HistoryPairDatasetCollection:g,HistoryListPairedDatasetCollection:_,HistoryListOfListsDatasetCollection:v}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(72),l=a(o),r=i(5),d=a(r),c=i(4),u=(a(c),{defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(t){return e.extend(t,t.object,{element_id:t.id}),delete t.object,t},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",n.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}}),h=n.Model.extend(d.default.LoggableMixin).extend(u).extend({_logNamespace:"collections"}),f=n.Collection.extend(d.default.LoggableMixin).extend({_logNamespace:"collections",model:h,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),p=l.default.DatasetAssociation.extend(d.default.mixin(u,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:e.extend({},l.default.DatasetAssociation.prototype.defaults,u.defaults),_downloadQueryParameters:function(){return"?to_ext="+this.get("file_ext")+"&hdca_id="+this.get("parent_hdca_id")+"&element_identifier="+this.get("element_identifier")},constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),u.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){return["DatasetDCE(",this.get("element_identifier"),")"].join("")}})),m=f.extend({model:p,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),g=n.Model.extend(d.default.LoggableMixin).extend(d.default.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:f,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var t=this.get("elements")||[];this.unset("elements",{silent:!0});var i=this;return e.each(t,function(t,n){e.extend(t,{parent_hdca_id:i.get("id")})}),this.elements=new this.collectionClass(t),this.elements},toJSON:function(){var e=n.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=n.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},delete:function(e){return this.get("deleted")?s.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?s.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name","tags"],toString:function(){return"DatasetCollection("+[this.get("id"),this.get("name")||this.get("element_identifier")].join(",")+")"}}),_=g.extend({collectionClass:m,toString:function(){return"List"+g.prototype.toString.call(this)}}),v=_.extend({toString:function(){return"Pair"+g.prototype.toString.call(this)}}),w=g.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),y=f.extend({model:w,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),b=v.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedPairDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedPairDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),x=y.extend({model:b,toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),C=g.extend({collectionClass:x,toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),$=_.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedListDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedListDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),k=y.extend({model:$,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),S=g.extend({collectionClass:k,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});t.default={ListDatasetCollection:_,PairDatasetCollection:v,ListPairedDatasetCollection:C,ListOfListsDatasetCollection:S}}).call(t,i(1),i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(39),r=o(l),d=i(40),c=(o(d),i(80)),u=o(c),h=i(3),f=o(h),p=i(5),m=o(p),g=i(4),_=o(g),v=e.Model.extend(m.default.LoggableMixin).extend(m.default.mixin(m.default.SearchableModelMixin,{_logNamespace:"history",UPDATE_DELAY:4e3,defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",deleted:!1,contents_active:{},contents_states:{}},urlRoot:Galaxy.root+"api/histories",contentsClass:r.default.HistoryContents,searchAttributes:["name","annotation","tags"],searchAliases:{title:"name",tag:"tags"},initialize:function(e,t){t=t||{},this.logger=t.logger||null,this.log(this+".initialize:",e,t),this.contents=new this.contentsClass([],{history:this,historyId:this.get("id"),order:t.order}),this._setUpListeners(),this._setUpCollectionListeners(),this.updateTimeoutId=null},_setUpListeners:function(){return this.on({error:function(e,t,i,n,s){this.clearUpdateTimeout()},"change:id":function(e,t){this.contents&&(this.contents.historyId=t)}})},_setUpCollectionListeners:function(){return this.contents?this.listenTo(this.contents,{error:function(){this.trigger.apply(this,n.makeArray(arguments))}}):this},contentsShown:function(){var e=this.get("contents_active"),t=e.active||0;return t+=this.contents.includeDeleted?e.deleted:0,t+=this.contents.includeHidden?e.hidden:0},nice_size:function(){var e=this.get("size");return e?f.default.bytesToString(e,!0,2):(0,_.default)("(empty)")},toJSON:function(){return s.extend(e.Model.prototype.toJSON.call(this),{nice_size:this.nice_size()})},get:function(t){return"nice_size"===t?this.nice_size():e.Model.prototype.get.apply(this,arguments)},ownedByCurrUser:function(){return!(!Galaxy||!Galaxy.user)&&(!Galaxy.user.isAnonymous()&&Galaxy.user.id===this.get("user_id"))},numOfUnfinishedJobs:function(){var e=this.get("non_ready_jobs");return e?e.length:0},numOfUnfinishedShownContents:function(){return this.contents.runningAndActive().length||0},_fetchContentRelatedAttributes:function(){var e=["size","non_ready_jobs","contents_active","hid_counter"];return this.fetch({data:a.param({keys:e.join(",")})})},refresh:function(e){e=e||{};var t=this,i=t.lastUpdateTime;return this.contents.allFetched=!1,(0!==t.contents.currentPage?function(){return t.contents.fetchPage(t.contents.currentPage)}:function(){return t.contents.fetchUpdated(i)})().done(function(i,n,s){var a;try{a=new Date(s.getResponseHeader("Date"))}catch(e){}t.lastUpdateTime=a||new Date,t.checkForUpdates(e)})},checkForUpdates:function(e){function t(){n.clearUpdateTimeout(),n.updateTimeoutId=setTimeout(function(){n.refresh(e)},i)}e=e||{};var i=this.UPDATE_DELAY,n=this;if(n.id){this.numOfUnfinishedShownContents()>0?t():n._fetchContentRelatedAttributes().done(function(e){n.numOfUnfinishedJobs()>0?t():n.trigger("ready")})}},clearUpdateTimeout:function(){this.updateTimeoutId&&(clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)},parse:function(t,i){var n=e.Model.prototype.parse.call(this,t,i);return n.create_time&&(n.create_time=new Date(n.create_time)),n.update_time&&(n.update_time=new Date(n.update_time)),n},fetchWithContents:function(e,t){e=e||{};var i=this;return e.view="dev-detailed",this.fetch(e).then(function(e){return i.contents.history=i,i.contents.setHistoryId(e.id),i.fetchContents(t)})},fetchContents:function(e){e=e||{};var t=this;return t.lastUpdateTime=new Date,t.contents.fetchCurrentPage(e)},_delete:function(e){return this.get("deleted")?n.when():this.save({deleted:!0},e)},purge:function(e){return this.get("purged")?n.when():this.save({deleted:!0,purged:!0},e)},undelete:function(e){return this.get("deleted")?this.save({deleted:!1},e):n.when()},copy:function(e,t,i){if(e=void 0===e||e,!this.id)throw new Error("You must set the history ID before copying it.");var s={history_id:this.id};e&&(s.current=!0),t&&(s.name=t),i||(s.all_datasets=!1),s.view="dev-detailed";var a=this,o=n.post(this.urlRoot,s);return e?o.then(function(e){return new v(e).setAsCurrent().done(function(){a.trigger("copied",a,e)})}):o.done(function(e){a.trigger("copied",a,e)})},setAsCurrent:function(){var e=this,t=n.getJSON(Galaxy.root+"history/set_as_current?id="+this.id);return t.done(function(){e.trigger("set-as-current",e)}),t},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}})),w=u.default.InfinitelyScrollingCollection,y=w.extend(m.default.LoggableMixin).extend({_logNamespace:"history",model:v,order:"update_time",limitOnFirstFetch:10,limitPerFetch:10,initialize:function(e,t){t=t||{},this.log("HistoryCollection.initialize",e,t),w.prototype.initialize.call(this,e,t),this.includeDeleted=t.includeDeleted||!1,this.currentHistoryId=t.currentHistoryId,this.setUpListeners()},urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot},setUpListeners:function(){return this.on({"change:deleted":function(e){this.debug("change:deleted",this.includeDeleted,e.get("deleted")),!this.includeDeleted&&e.get("deleted")&&this.remove(e)},copied:function(e,t){this.setCurrent(new v(t,[]))},"set-as-current":function(e){var t=this.currentHistoryId;this.trigger("no-longer-current",t),this.currentHistoryId=e.id}})},_buildFetchData:function(e){return s.extend(w.prototype._buildFetchData.call(this,e),{view:"dev-detailed"})},_buildFetchFilters:function(e){var t=w.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted?i.deleted=null:(i.deleted=!1,i.purged=!1),s.defaults(t,i)},fetchFirst:function(e){var t=this,i=a.when();return this.currentHistoryId&&(i=w.prototype.fetchFirst.call(t,{silent:!0,limit:1,filters:{purged:"",deleted:"","encoded_id-in":this.currentHistoryId}})),i.then(function(){return e=e||{},e.offset=0,t.fetchMore(e)})},comparators:s.extend(s.clone(w.prototype.comparators),{name:m.default.buildComparator("name",{ascending:!0}),"name-dsc":m.default.buildComparator("name",{ascending:!1}),size:m.default.buildComparator("size",{ascending:!1}),"size-asc":m.default.buildComparator("size",{ascending:!0})}),sort:function(e){e=e||{};var t=e.silent,i=this.remove(this.get(this.currentHistoryId));return w.prototype.sort.call(this,s.defaults({silent:!0},e)),this.unshift(i,{silent:!0}),t||this.trigger("sort",this,e),this},create:function(e,t,i,s){var a=this;return n.getJSON(Galaxy.root+"history/create_new_current").done(function(e){a.setCurrent(new v(e,[],i||{}))})},setCurrent:function(e,t){return t=t||{},this.unshift(e,t),this.currentHistoryId=e.get("id"),t.silent||this.trigger("new-current",e,this),this},toString:function(){return"HistoryCollection("+this.length+",current:"+this.currentHistoryId+")"}});t.default={History:v,HistoryCollection:y}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(80),l=a(o),r=i(81),d=a(r),c=i(36),u=a(c),h=i(40),f=a(h),p=i(5),m=a(p),g=i(152),_=a(g),v=l.default.PaginatedCollection,w=v.extend(m.default.LoggableMixin).extend({_logNamespace:"history",limitPerPage:500,limitPerProgressiveFetch:500,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){t=t||{},v.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},model:function(e,t){if("dataset"===e.history_content_type)return new d.default.HistoryDatasetAssociation(e,t);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new u.default.HistoryListDatasetCollection(e,t);case"paired":return new u.default.HistoryPairDatasetCollection(e,t);case"list:paired":return new u.default.HistoryListPairedDatasetCollection(e,t);case"list:list":return new u.default.HistoryListOfListsDatasetCollection(e,t)}var i="Unknown collection_type: "+e.collection_type;return console.warn(i,e),{validationError:i}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},setHistoryId:function(e){this.historyId=e,this._setUpWebStorage()},_setUpWebStorage:function(e){if(this.historyId)return this.storage=new f.default.HistoryPrefs({id:f.default.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:e.extend(e.clone(v.prototype.comparators),{name:m.default.buildComparator("name",{ascending:!0}),"name-dsc":m.default.buildComparator("name",{ascending:!1}),hid:m.default.buildComparator("hid",{ascending:!1}),"hid-asc":m.default.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(t,i){if(e.isBoolean(t)&&t!==this.includeDeleted){if(this.includeDeleted=t,e.result(i,"silent"))return;this.trigger("include-deleted",t,this)}},setIncludeHidden:function(t,i){if(e.isBoolean(t)&&t!==this.includeHidden){if(this.includeHidden=t,i=i||{},e.result(i,"silent"))return;this.trigger("include-hidden",t,this)}},fetch:function(t){if(t=t||{},this.historyId&&!t.details){var i=f.default.HistoryPrefs.get(this.historyId).toJSON();e.isEmpty(i.expandedIds)||(t.details=e.values(i.expandedIds).join(","))}return v.prototype.fetch.call(this,t)},_buildFetchData:function(t){return e.extend(v.prototype._buildFetchData.call(this,t),{v:"dev"})},_fetchParams:v.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(t){var i=v.prototype._buildFetchFilters.call(this,t)||{},n={};return this.includeDeleted||(n.deleted=!1,n.purged=!1),this.includeHidden||(n.visible=!0),e.defaults(i,n)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(t){t=t||{};var i=this;return t.filters=e.extend(t.filters,{deleted:!0,purged:void 0}),t.remove=!1,i.trigger("fetching-deleted",i),i.fetch(t).always(function(){i.trigger("fetching-deleted-done",i)})},fetchHidden:function(t){t=t||{};var i=this;return t.filters=e.extend(t.filters,{visible:!1}),t.remove=!1,i.trigger("fetching-hidden",i),i.fetch(t).always(function(){i.trigger("fetching-hidden-done",i)})},fetchAllDetails:function(t){t=t||{};var i={details:"all"};return t.data=e.extend(t.data||{},i),this.fetch(t)},fetchCollectionCounts:function(t){return t=t||{},t.keys=["type_id","element_count"].join(","),t.filters=e.extend(t.filters||{},{history_content_type:"dataset_collection"}),t.remove=!1,this.fetch(t)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var a=i.get(t[n]);return a?e.concat(a):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(t,i,n){return n=n||this.models,new _.default.AjaxQueue(n.slice().reverse().map(function(n,s){var a=e.isString(t)?n[t]:t;return function(){return a.apply(n,i)}})).deferred},progressivelyFetchDetails:function(t){function i(n){n=n||0;var l=e.extend(e.clone(t),{view:"summary",keys:r,limit:o,offset:n,reset:0===n,remove:!1});e.defer(function(){a.fetch.call(a,l).fail(s.reject).done(function(e){s.notify(e,o,n),e.length!==o?(a.allFetched=!0,s.resolve(e,o,n)):i(n+o)})})}t=t||{};var s=n.Deferred(),a=this,o=t.limitPerCall||a.limitPerProgressiveFetch,l=d.default.HistoryDatasetAssociation.prototype.searchAttributes,r=l.join(",");return i(),s},isCopyable:function(t){var i=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return e.isObject(t)&&t.id&&e.contains(i,t.model_class)},copy:function(t){var i,s,a;e.isString(t)?(i=t,a="hda",s="dataset"):(i=t.id,a={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[t.model_class]||"hda",s="hdca"===a?"dataset_collection":"dataset");var o=this,l=n.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:i,source:a,type:s})}).done(function(e){o.add([e],{parse:!0})}).fail(function(e,t,n){o.trigger("error",o,l,{},"Error copying contents",{type:s,id:i,source:a})});return l},createHDCA:function(e,t,i,n,s){return this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,hide_source_items:n||!1,element_identifiers:e}).save(s)},haveSearchDetails:function(){return this.allFetched&&this.all(function(t){return e.has(t.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=s.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});t.default={HistoryContents:w}}).call(t,i(1),i(0),i(2))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(5),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(t){return e.result(this.get("expandedIds"),t,!1)},allExpanded:function(){return e.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(t){return e.isUndefined(t)||this.set("show_deleted",t),this.get("show_deleted")},includeHidden:function(t){return e.isUndefined(t)||this.set("show_hidden",t),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return a.storageKeyPrefix+e},get:function(e){return new a({id:a.historyStorageKey(e)})},clearAll:function(e){for(var t in sessionStorage)0===t.indexOf(a.storageKeyPrefix)&&sessionStorage.removeItem(t)}});t.default={HistoryPrefs:a}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(5),r=o(l),d=i(4),c=(o(d),e.View.extend(r.default.LoggableMixin).extend({_logNamespace:"list",initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=n(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):n(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",s.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=n(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?a.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}})),u=c.extend(r.default.mixin(r.default.SelectableViewMixin,r.default.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(e){c.prototype.initialize.call(this,e),r.default.SelectableViewMixin.initialize.call(this,e),r.default.DraggableViewMixin.initialize.call(this,e),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=c.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return c.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=n('
      '),i=e.model.toJSON();return s.each(e.templates.warnings,function(s){t.append(n(s(i,e)))}),t},_renderTitleBar:function(){return n(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){return!e||"keydown"!==e.type||32!==e.keyCode&&13!==e.keyCode||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){return"ListItemView("+(this.model?""+this.model:"(no model)")+")"}}));u.prototype.templates=function(){return{el:r.default.wrapTemplate(['
      ','
      ','
      ','',"
      ",'
      ','
      ','
      ',"
      "]),warnings:{},titleBar:r.default.wrapTemplate(['
      ','','
      ','<%- element.name %>',"
      ",'
      ',"
      "],"element"),subtitle:r.default.wrapTemplate(['
      ']),details:r.default.wrapTemplate(['
      '])}}();var h=u.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,u.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return n();var e=u.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e);return new t(s.extend(i,{model:e}))},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});h.prototype.templates=function(){var e=r.default.wrapTemplate(['
      ',"
      "],"collection");return s.extend({},u.prototype.templates,{details:e})}(),t.default={ExpandableView:c,ListItemView:u,FoldoutListItemView:h}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(41),r=o(l),d=i(11),c=o(d),u=i(14),h=o(u),f=i(5),p=o(f),m=i(4),g=o(m),_=r.default.ListItemView,v=_.extend({_logNamespace:"dataset",className:_.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),_.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){_.prototype._setUpListeners.call(this);var t=this;return t.listenTo(t.model,{change:function(i){t.model.changedAttributes().state&&t.model.inReadyState()&&t.expanded&&!t.model.hasDetails()?t.model.fetch({silent:!0}).done(function(){t.render()}):e.has(i.changed,"tags")&&1===e.keys(i.changed).length?t.$(".nametags").html(t._renderNametags()):t.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):n.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){s.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return _.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===c.default.NOT_VIEWABLE||e===c.default.DISCARDED||!this.model.get("accessible"))return null;var t={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))t.disabled=!0,t.title=(0,g.default)("Cannot display datasets removed from disk");else if(e===c.default.UPLOAD)t.disabled=!0,t.title=(0,g.default)("This dataset must finish uploading before it can be viewed");else if(e===c.default.NEW)t.disabled=!0,t.title=(0,g.default)("This dataset is not yet viewable");else{t.title=(0,g.default)("View data"),t.href=this.model.urls.display;var i=this;t.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(i.model.get("id")),e.preventDefault())}}return t.faIcon="fa-eye",(0,h.default)(t)},_renderDetails:function(){if(this.model.get("state")===c.default.NOT_VIEWABLE)return a(this.templates.noAccess(this.model.toJSON(),this));var e=_.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var t=this,i=a('
      '),n=t.model.toJSON();return e.each(t.templates.detailMessages,function(e){i.append(a(e(n,t)))}),i},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case c.default.NOT_VIEWABLE:return[];case c.default.OK:case c.default.FAILED_METADATA:case c.default.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return(0,h.default)({title:(0,g.default)("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Dataset details",url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:e.isEmpty(this.model.get("meta_files"))?a(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var t=this.model.urls;return a(['"].join("\n"))},_renderNametags:function(){return e.template(["<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>"].join(""))({tags:this.model.get("tags")})},events:e.extend(e.clone(_.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){return"DatasetListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=e.extend({},_.prototype.templates.warnings,{failed_metadata:p.default.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
      ',(0,g.default)("An error occurred setting the metadata for this dataset"),"
      ","<% } %>"]),error:p.default.wrapTemplate(["<% if( model.error ){ %>",'
      ',(0,g.default)("There was an error getting the data for this dataset"),": <%- model.error %>","
      ","<% } %>"]),purged:p.default.wrapTemplate(["<% if( model.purged ){ %>",'
      ',(0,g.default)("This dataset has been deleted and removed from disk"),"
      ","<% } %>"]),deleted:p.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
      ',(0,g.default)("This dataset has been deleted"),"
      ","<% } %>"])}),i=p.default.wrapTemplate(['
      ','
      ','
      ','
      ','
      ',"
      ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
      ','
      ','
      ',"<% if( dataset.peek ){ %>",'
      <%= dataset.peek %>
      ',"<% } %>","<% } %>","
      "],"dataset"),n=p.default.wrapTemplate(['
      ','
      ',(0,g.default)("You do not have permission to view this dataset"),"
      ","
      "],"dataset"),s={};s[c.default.OK]=s[c.default.FAILED_METADATA]=p.default.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
      ','<%- dataset.misc_blurb %>',"
      ","<% } %>","<% if( dataset.file_ext ){ %>",'
      ','",'<%- dataset.file_ext %>',"
      ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
      ','",'',"<%- dataset.metadata_dbkey %>","","
      ","<% } %>","<% if( dataset.misc_info ){ %>",'
      ','<%- dataset.misc_info %>',"
      ","<% } %>"],"dataset"),s[c.default.NEW]=p.default.wrapTemplate(["
      ",(0,g.default)("This is a new dataset and not all of its data are available yet"),"
      "],"dataset"),s[c.default.NOT_VIEWABLE]=p.default.wrapTemplate(["
      ",(0,g.default)("You do not have permission to view this dataset"),"
      "],"dataset"),s[c.default.DISCARDED]=p.default.wrapTemplate(["
      ",(0,g.default)("The job creating this dataset was cancelled before completion"),"
      "],"dataset"),s[c.default.QUEUED]=p.default.wrapTemplate(["
      ",(0,g.default)("This job is waiting to run"),"
      "],"dataset"),s[c.default.RUNNING]=p.default.wrapTemplate(["
      ",(0,g.default)("This job is currently running"),"
      "],"dataset"),s[c.default.UPLOAD]=p.default.wrapTemplate(["
      ",(0,g.default)("This dataset is currently uploading"),"
      "],"dataset"),s[c.default.SETTING_METADATA]=p.default.wrapTemplate(["
      ",(0,g.default)("Metadata is being auto-detected"),"
      "],"dataset"),s[c.default.PAUSED]=p.default.wrapTemplate(["
      ",(0,g.default)('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
      "],"dataset"),s[c.default.ERROR]=p.default.wrapTemplate(["<% if( !dataset.purged ){ %>","
      <%- dataset.misc_blurb %>
      ","<% } %>",'',(0,g.default)("An error occurred with this dataset"),":",'
      <%- dataset.misc_info %>
      '],"dataset"),s[c.default.EMPTY]=p.default.wrapTemplate(["
      ",(0,g.default)("No data"),": <%- dataset.misc_blurb %>
      "],"dataset"),s.unknown=p.default.wrapTemplate(['
      Error: unknown dataset state: "<%- dataset.state %>"
      '],"dataset");var a={resubmitted:p.default.wrapTemplate(["<% if( model.resubmitted ){ %>",'
      ',(0,g.default)("The job creating this dataset has been resubmitted"),"
      ","<% } %>"])},o=p.default.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
      ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
      ","<% }); %>"],"apps");return e.extend({},_.prototype.templates,{warnings:t,details:i,noAccess:n,summaries:s,detailMessages:a,displayApplications:o})}(),t.default={DatasetListItemView:v}}).call(t,i(1),i(0),i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(41),l=a(o),r=i(42),d=a(r),c=i(5),u=a(c),h=i(4),f=a(h),p=l.default.FoldoutListItemView,m=l.default.ListItemView,g=p.extend({className:p.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,p.prototype.initialize.call(this,e)},_setUpListeners:function(){p.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(t,i){e.has(t.changed,"deleted")?this.render():e.has(t.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var t=p.prototype._getFoldoutPanelOptions.call(this);return e.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){return"DCListItemView("+(this.model?""+this.model:"(no model)")+")"}});g.prototype.templates=function(){var t=e.extend({},p.prototype.templates.warnings,{error:u.default.wrapTemplate(["<% if( model.error ){ %>",'
      ',(0,f.default)("There was an error getting the data for this collection"),": <%- model.error %>","
      ","<% } %>"]),purged:u.default.wrapTemplate(["<% if( model.purged ){ %>",'
      ',(0,f.default)("This collection has been deleted and removed from disk"),"
      ","<% } %>"]),deleted:u.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
      ',(0,f.default)("This collection has been deleted"),"
      ","<% } %>"])}),i=u.default.wrapTemplate(['
      ','
      ','<%- collection.element_identifier || collection.name %>',"
      ",'
      ',"
      "],"collection"),n=u.default.wrapTemplate(['
      ','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',(0,f.default)("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',(0,f.default)("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',(0,f.default)("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',(0,f.default)("a list of <%- countText %>dataset lists"),"<% } %>","
      "],"collection");return e.extend({},p.prototype.templates,{warnings:t,titleBar:i,subtitle:n})}();var _=m.extend({className:m.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),m.prototype.initialize.call(this,e)},toString:function(){return"DCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});_.prototype.templates=function(){var t=u.default.wrapTemplate(['
      ','
      ','<%- element.element_identifier %>',"
      ",'
      ',"
      "],"element");return e.extend({},m.prototype.templates,{titleBar:t})}();var v=d.default.DatasetListItemView.extend({className:d.default.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),d.default.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):s.when()},toString:function(){return"DatasetDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=u.default.wrapTemplate(['
      ','','
      ','<%- element.element_identifier %>',"
      ","
      "],"element");return e.extend({},d.default.DatasetListItemView.prototype.templates,{titleBar:t})}();var w=g.extend({className:g.prototype.className+" dataset-collection-element",_swapNewRender:function(e){g.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){return"NestedDCDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});t.default={DCListItemView:g,DCEListItemView:_,DatasetDCEListItemView:v,NestedDCDCEListItemView:w}}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(9),o=s(a),l=i(6),r=s(l),d=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
      "),this.render()},render:function(){var e=this;n.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var i=n.extend({},e.model.attributes,t),s=new o.default({title:i.title,message:i.message,status:i.status||"warning",icon:i.icon,inputs:i.inputs,buttons:{submit:new r.default.Button({tooltip:i.submit_tooltip,title:i.submit_title||"Save",icon:i.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(s)}})}});e.$el.empty().append(s.$el)}).fail(function(t){e.$el.empty().append(new r.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;n.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(i){var s={message:i.message,status:"success",persistent:!1};t.redirect?window.location=Galaxy.root+t.redirect+"?"+n.param(s):(e.data.matchModel(i,function(t,i){e.field_list[i].value(t.value)}),t._showMessage(e,s))}).fail(function(i){t._showMessage(e,{message:i.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(n(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:d}}).call(t,i(2),i(0))},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(11),l=a(o),r=i(5),d=a(r),c=i(4),u=a(c),h=d.default.SearchableModelMixin,f=e.Model.extend(d.default.LoggableMixin).extend(d.default.mixin(h,{_logNamespace:"dataset",defaults:{state:l.default.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(e,t){this.debug(this+"(Dataset).initialize",e,t), +webpackJsonp([0],[,,,,,,,,,,function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=function(e){return e&&e.__esModule?e:{default:e}}(a),l=e.View.extend({optionsDefault:{with_close:!0,title:null,placement:"top",container:"body",body:null},initialize:function(e){this.setElement(this._template()),this.uid=o.default.uid(),this.options=n.defaults(e||{},this.optionsDefault),this.options.container.parent().append(this.el),this.$title=this.$(".popover-title-label"),this.$close=this.$(".popover-close"),this.$body=this.$(".popover-content"),this.options.body&&this.append(this.options.body);var t=this;s("body").on("mousedown."+this.uid,function(e){t.visible&&!s(t.options.container).is(e.target)&&!s(t.el).is(e.target)&&0===s(t.el).has(e.target).length&&t.hide()})},render:function(){this.$title.html(this.options.title),this.$el.removeClass().addClass("ui-popover popover fade in").addClass(this.options.placement),this.$el.css(this._get_placement(this.options.placement));var e=this;this.options.with_close?this.$close.on("click",function(){e.hide()}).show():this.$close.off().hide()},title:function(e){void 0!==e&&(this.options.title=e,this.$title.html(e))},show:function(){this.render(),this.$el.show(),this.visible=!0},hide:function(){this.$el.hide(),this.visible=!1},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},remove:function(){s("body").off("mousedown."+this.uid),this.$el.remove()},_get_placement:function(e){var t,i,n=this._get_width(this.$el),s=this.$el.height(),a=this.options.container,o=this._get_width(a),l=this._get_height(a),r=a.position();if(t=i=0,-1!=["top","bottom"].indexOf(e))switch(i=r.left-n+(o+n)/2,e){case"top":t=r.top-s-5;break;case"bottom":t=r.top+l+5}else switch(t=r.top-s+(l+s)/2,e){case"right":i=r.left+o}return{top:t,left:i}},_get_width:function(e){return e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("margin-left"))+parseInt(e.css("padding-right"))+parseInt(e.css("margin-right"))},_get_height:function(e){return e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"))},_template:function(e){return'
      '}});t.default={View:l}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};n.READY_STATES=[n.OK,n.EMPTY,n.PAUSED,n.FAILED_METADATA,n.NOT_VIEWABLE,n.DISCARDED,n.ERROR],n.NOT_READY_STATES=[n.UPLOAD,n.QUEUED,n.RUNNING,n.SETTING_METADATA,n.NEW],t.default=n},,function(e,t,i){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var s=i(3),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=e.View.extend({optionsDefault:{css:"",placeholder:"No data available",data:[],value:null,multiple:!1,minimumInputLength:0,initialData:""},initialize:function(e){if(this.options=a.default.merge(e,this.optionsDefault),this.setElement(this._template(this.options)),!this.options.container)return void console.log("ui-select::initialize() : container not specified.");if(this.options.container.append(this.$el),this.select_data=this.options.data,this._refresh(),!this.options.multiple){this.options.value&&this._setValue(this.options.value);var t=this;this.options.onchange&&this.$el.on("change",function(){t.options.onchange(t.value())})}},value:function(e){var t=this._getValue();void 0!==e&&this._setValue(e);var i=this._getValue();return i!=t&&this.options.onchange&&this.options.onchange(i),i},text:function(){return this.$el.select2("data").text},disabled:function(){return!this.$el.select2("enable")},enable:function(){this.$el.select2("enable",!0)},disable:function(){this.$el.select2("enable",!1)},add:function(e){this.select_data.push({id:e.id,text:e.text}),this._refresh()},del:function(e){var t=this._getIndex(e);-1!=t&&(this.select_data.splice(t,1),this._refresh())},remove:function(){this.$el.select2("destroy")},update:function(e){this.select_data=[];for(var t in e.data)this.select_data.push(e.data[t]);this._refresh()},_refresh:function(){if(this.options.multiple){var e={multiple:this.options.multiple,containerCssClass:this.options.css,placeholder:this.options.placeholder,minimumInputLength:this.options.minimumInputLength,ajax:this.options.ajax,dropdownCssClass:this.options.dropdownCssClass,escapeMarkup:this.options.escapeMarkup,formatResult:this.options.formatResult,formatSelection:this.options.formatSelection,initSelection:this.options.initSelection,initialData:this.options.initialData};this.$el.select2(e)}else{var t=this._getValue(),e={data:this.select_data,containerCssClass:this.options.css,placeholder:this.options.placeholder,dropdownAutoWidth:!0};this.$el.select2(e),this._setValue(t)}},_getIndex:function(e){n.findIndex(this.select_data,{id:e})},_getValue:function(){return this.$el.select2("val")},_setValue:function(e){-1==this._getIndex(e)&&this.select_data.length>0&&(e=this.select_data[0].id),this.$el.select2("val",e)},_template:function(e){return''}});t.default={View:o}}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(0),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default,o=function(t){t=t||{},t.tooltipConfig=t.tooltipConfig||{placement:"bottom"},t.classes=["icon-btn"].concat(t.classes||[]),t.disabled&&t.classes.push("disabled");var i=['','',""].join(""),n=a(i).tooltip(t.tooltipConfig);return e.isFunction(t.onclick)&&n.click(t.onclick),n};t.default=o}).call(t,i(1))},,function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=e.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_name:"",file_mode:"",file_size:0,file_type:null,file_path:"",file_data:null,percentage:0,space_to_tab:!1,to_posix_lines:!0,enabled:!0},reset:function(e){this.clear().set(this.defaults).set(e)}}),n=e.Collection.extend({model:i});t.default={Model:i,Collection:n}}).call(t,i(2))},,,,,,function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(5),o=s(a),l=i(4),r=s(l),d=e.View.extend(o.default.LoggableMixin).extend(o.default.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",select_width:"100%",events:{},initialize:function(e){this.show_editor=!1,!1===e.usePrompt?this.label="":this.label='",this.workflow_mode=e.workflow_mode||!1,this.workflow_mode&&(this.events.click="showEditor",this.events.keydown="keydownHandler"),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.workflow_mode?this.$el.html(this._workflowTemplate()):this.$el.html(this._defaultTemplate()),this.$input().select2({placeholder:"Add tags",width:this.workflow_mode?this.width:this.select_width,tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_hashToName:function(e){return e.startsWith("#")?"name:"+e.slice(1):e},_nameToHash:function(e){return e.startsWith("name:")&&(e="#"+e.slice(5)),e},_defaultTemplate:function(){return[this.label,this._renderEditor()].join("")},_workflowTemplate:function(){return[this.show_editor?this._renderEditor():this._renderTags()].join(" ")},keydownHandler:function(e){switch(e.which){case 27:this.hideEditor()}},showEditor:function(){this.show_editor=!0,this.render()},hideEditor:function(){this.show_editor=!1,this.render()},_renderEditor:function(){return''},_renderTags:function(){var e=this.model.get("tags"),t=[];return n.each(e,function(e){e=0==e.indexOf("name:")?e.slice(5):e;var i=''+e+"";t.push(i)}),0===t.length&&t.push(''),t.join(" ")},tagsToCSV:function(){var e=this,t=this.model.get("tags");return!n.isArray(t)||n.isEmpty(t)?"":t.map(function(t){return n.escape(e._nameToHash(t))}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){var e=this;return n.map(Galaxy.user.get("tags_used"),e._nameToHash)},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){t.val=n.map(t.val,e._hashToName),e.model.save({tags:t.val}),t.added&&e._addNewTagToTagsUsed(""+t.added.text)})},_addNewTagToTagsUsed:function(e){var t=Galaxy.user.get("tags_used");n.contains(t,e)||(t.push(e),t.sort(),Galaxy.user.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),e.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",""+this.model,")"].join("")}});t.default={TagsEditor:d}}).call(t,i(2),i(1))},,,,,,,,function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(0),a=n(s),o=i(8),l=n(o),r=i(6),d=n(r),c=a.default,u=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),c.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=c.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=l.default.parse(t.pop());t.push(n),e&&(this.authenticate(t,i)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new d.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=u}).call(t,i(2))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3);!function(e){e&&e.__esModule}(a);t.default=e.View.extend({options:{class_check:"fa-check-square-o",class_uncheck:"fa-square-o",parameters:[{id:"space_to_tab",title:"Convert spaces to tabs"},{id:"to_posix_lines",title:"Use POSIX standard"}]},initialize:function(e){this.model=e.model,this.setElement(n("
      ").addClass("upload-settings")),this.$el.append(n("
      ").addClass("upload-settings-cover")),this.$el.append(n("").addClass("upload-settings-table ui-table-striped").append("")),this.$cover=this.$(".upload-settings-cover"),this.$table=this.$(".upload-settings-table > tbody"),this.listenTo(this.model,"change",this.render,this),this.model.trigger("change")},render:function(){var e=this;this.$table.empty(),s.each(this.options.parameters,function(t){var i=n("
      ").addClass("upload-"+t.id+" upload-icon-button fa").addClass(e.model.get(t.id)&&e.options.class_check||e.options.class_uncheck).on("click",function(){e.model.get("enabled")&&e.model.set(t.id,!e.model.get(t.id))});e.$table.append(n("
      ").append(n(""},_template:function(){return'
      '+this.model.get("help_text")+'
      Available files:   
      ").append(i)).append(n("").append(t.title)))}),this.$cover[this.model.get("enabled")&&"hide"||"show"]()}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=e.View.extend({initialize:function(t){this.model=new e.Model({cls:"upload-ftp",class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o",help_enabled:!0,help_text:"This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at "+t.ftp_upload_site+" using your Galaxy credentials.",collection:null,onchange:function(){},onadd:function(){},onremove:function(){}}).set(t),this.collection=this.model.get("collection"),this.setElement(this._template()),this.$content=this.$(".upload-ftp-content"),this.$wait=this.$(".upload-ftp-wait"),this.$help=this.$(".upload-ftp-help"),this.$number=this.$(".upload-ftp-number"),this.$disk=this.$(".upload-ftp-disk"),this.$body=this.$(".upload-ftp-body"),this.$warning=this.$(".upload-ftp-warning"),this.$select=this.$(".upload-ftp-select-all"),this.render()},render:function(){var e=this;this.$wait.show(),this.$content.hide(),this.$warning.hide(),this.$help.hide(),n.ajax({url:Galaxy.root+"api/remote_files",method:"GET",success:function(t){e.model.set("ftp_files",t),e._index(),e._renderTable()},error:function(){e._renderTable()}})},_renderTable:function(){var e=this,t=this.model.get("ftp_files");if(this.rows=[],t&&t.length>0){this.$body.empty();var i=0;s.each(t,function(t){e.rows.push(e._renderRow(t)),i+=t.size}),this.$number.html(t.length+" files"),this.$disk.html(o.default.bytesToString(i,!0)),this.collection&&(this.$("._has_collection").show(),this.$select.addClass(this.model.get("class_add")).off().on("click",function(){e._all()}),this._refresh()),this.$content.show()}else this.$warning.show();this.model.get("help_enabled")&&this.$help.show(),this.$wait.hide()},_renderRow:function(e){var t=this,i=this.model.attributes,s=n(this._templateRow(e)),a=s.find(".icon");if(this.$body.append(s),this.collection){var o=this.ftp_index[e.path];a.addClass(void 0===o?i.class_add:i.class_remove),s.on("click",function(){t._switch(a,e),t._refresh()})}else s.on("click",function(){i.onchange(e)});return a},_index:function(){var e=this;this.ftp_index={},this.collection&&this.collection.each(function(t){"ftp"==t.get("file_mode")&&(e.ftp_index[t.get("file_path")]=t.id)})},_all:function(){var e=this.model.attributes,t=this.model.get("ftp_files"),i=this.$select.hasClass(e.class_add);for(var n in t){var s=t[n],a=this.ftp_index[s.path];(void 0===a&&i||void 0!==a&&!i)&&this._switch(this.rows[n],s)}this._refresh()},_switch:function(e,t){e.removeClass();var i=this.model.attributes,n=this.ftp_index[t.path];if(void 0===n){var s=i.onadd(t);e.addClass(i.class_remove),this.ftp_index[t.path]=s}else i.onremove(n),e.addClass(i.class_add),this.ftp_index[t.path]=void 0},_refresh:function(){var e=s.reduce(this.ftp_index,function(e,t){return void 0!==t&&e++,e},0);this.$select.removeClass(),0==e?this.$select.addClass(this.model.get("class_add")):this.$select.addClass(e==this.rows.length?this.model.get("class_remove"):this.model.get("class_partial"))},_templateRow:function(e){return'
      '+s.escape(e.path)+''+o.default.bytesToString(e.size)+''+e.ctime+"
      NameSizeCreated
      Your FTP directory does not contain any files.
      '}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(3),o=(s(a),i(10)),l=s(o);t.default=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.setElement("
      "),this.render()},render:function(){var e=this.model.attributes,t=n.findWhere(e.list,{id:e.extension});this.extension_popup&&this.extension_popup.remove(),this.extension_popup=new l.default.View({placement:e.placement||"bottom",container:e.$el}),this.extension_popup.title(e.title),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(t)),this.extension_popup.show()},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (read more)'),t}return"There is no description available for this file extension."}})}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e,t){!function(i){e.event.props.push("dataTransfer"),i.uploadpost=function(t){var n=i.extend({},{data:{},success:function(){},error:function(){},progress:function(){},url:null,maxfilesize:2048,error_filesize:"File exceeds 2GB. Please use a FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in."},t),s=n.data;if(s.error_message)return void n.error(s.error_message);var a=new FormData;for(var o in s.payload)a.append(o,s.payload[o]);var l=0;for(var o in s.files){var r=s.files[o];a.append(r.name,r.file,r.file.name),l+=r.file.size}if(l>1048576*n.maxfilesize)return void n.error(n.error_filesize);var d=new XMLHttpRequest;d.open("POST",n.url,!0),d.setRequestHeader("Accept","application/json"),d.setRequestHeader("Cache-Control","no-cache"),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.onreadystatechange=function(){if(d.readyState==d.DONE){var t=null,i="";if(d.responseText)try{t=e.parseJSON(d.responseText),i=t.err_msg}catch(e){t=d.responseText,i=t}if(d.status<200||d.status>299){var s=d.statusText;403==d.status?s=n.error_login:0==d.status?s=n.error_server:s||(s=n.error_default),n.error(s+" ("+d.status+"). "+i)}else n.success(t)}},d.upload.addEventListener("progress",function(e){e.lengthComputable&&n.progress(Math.round(100*e.loaded/e.total))},!1),Galaxy.emit.debug("uploadbox::uploadpost()","Posting following data.",n),d.send(a)},i.fn.uploadinput=function(e){var t=this,n=i.extend({},{ondragover:function(){},ondragleave:function(){},onchange:function(){},multiple:!1},e),s=i('");return t.append(s.change(function(e){n.onchange(e.target.files),i(this).val("")})),t.on("drop",function(e){n.ondragleave(e),e.dataTransfer&&(n.onchange(e.dataTransfer.files),e.preventDefault())}),t.on("dragover",function(e){e.preventDefault(),n.ondragover(e)}),t.on("dragleave",function(e){e.stopPropagation(),n.ondragleave(e)}),{dialog:function(){s.trigger("click")}}},i.fn.uploadbox=function(e){function n(e){if(e&&e.length&&!g){var i=void 0;return t.each(e,function(e,i){"new"!==e.mode&&t.filter(f,function(t){return t.name===e.name&&t.size===e.size}).length&&(e.duplicate=!0)}),t.each(e,function(e){e.duplicate||(i=String(p++),f[i]=e,h.announce(i,f[i]),m++)}),i}}function s(e){f[e]&&(delete f[e],m--)}function a(){if(0==m||_)return _=!1,g=!1,void h.complete();g=!0;var e=-1;for(var t in f){e=t;break}f[e];s(e),i.uploadpost({url:h.url,data:h.initialize(e),success:function(t){h.success(e,t),a()},error:function(t){h.error(e,t),a()},progress:function(t){h.progress(e,t)}})}function o(){v.dialog()}function l(e){for(e in f)s(e)}function r(){g||(g=!0,a())}function d(){_=!0}function c(e){return h=i.extend({},h,e)}function u(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}var h=i.extend({},{dragover:function(){},dragleave:function(){},announce:function(e){},initialize:function(e){},progress:function(e,t){},success:function(e,t){},error:function(e,t){alert(t)},complete:function(){}},e),f={},p=0,m=0,g=!1,_=!1,v=i(this).uploadinput({multiple:!0,onchange:function(e){n(e)},ondragover:e.ondragover,ondragleave:e.ondragleave});return{select:o,add:n,remove:s,start:r,stop:d,reset:l,configure:c,compatible:u}}}(e)}).call(t,i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var i=e.toJSON();return $(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i,n)}})}Object.defineProperty(t,"__esModule",{value:!0});var r=i(36),d=o(r),c=i(11),u=o(c),h=i(5),f=o(h),p=i(74),m=o(p),g=i(7),_=o(g),v=i(75),w=(o(v),i(4)),y=o(w);i(76);var b=e.View.extend(f.default.LoggableMixin).extend({_logNamespace:"collections",tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){this.dragStartHandler=n.bind(this._dragstart,this),this.dragEndHandler=n.bind(this._dragend,this);var e=this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})).get(0);return e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1),this.selected&&this.$el.addClass("selected"),this},template:n.template(['',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([(0,y.default)("Enter a new name for the element"),":\n(",(0,y.default)("Note that changing the name here will not rename the dataset"),")"].join(""),prompt((0,y.default)("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),x=e.View.extend(f.default.LoggableMixin).extend(m.default.CollectionCreatorMixin).extend({_logNamespace:"collections",elementViewClass:b,collectionClass:d.default.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},footerSettings:{".hide-originals":"hideOriginals"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;n.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._setUpCommonSettings(e),this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=n.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?(0,y.default)("is not a dataset"):e.state===u.default.OK||n.contains(u.default.NOT_READY_STATES,e.state)?e.deleted||e.purged?(0,y.default)("has been deleted or purged"):null:(0,y.default)("has errored, is paused, or is not accessible")},_mangleDuplicateNames:function(){var e=1,t={};this.workingElements.forEach(function(i){for(var n=i.name;t.hasOwnProperty(n);)if(n=i.name+" ("+e+")",(e+=1)>=900)throw new Error("Safety hit in while loop - thats impressive");i.name=n,t[i.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,s=a("
      "),o=i.$list();n.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);s.append(t.$el)}),i._renderClearSelected(),o.empty().append(s.children()),n.invoke(i.elementViews,"render"),o.height()>o.css("max-height")?o.css("border-width","1px 0px 1px 0px"):o.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:n.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=n.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=(0,y.default)("No valid elements for final list")+". ";return t+=''+(0,y.default)("Cancel")+" ",t+=(0,y.default)("or"),t+=' '+(0,y.default)("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e,i.hideOriginals).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:(0,y.default)("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=n.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this,i=e.message||(0,y.default)("An error occurred");if(e.xhr){var n=e.xhr,s=e.message;0===n.readyState&&0===n.status?i+=": "+(0,y.default)("Galaxy could not be reached and may be updating.")+(0,y.default)(" Try again in a few minutes."):n.responseJSON?i+=":
      "+JSON.stringify(n.responseJSON)+"
      ":i+=": "+s}t._showAlert(i,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","change .hide-originals":"_changeHideOriginals","click .cancel-create":"_cancelCreate","click .create-collection":"_clickCreate"},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=s('
      ');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=e.offset(),n=e.scrollTop(),s=t-i.top,a=i.top+e.outerHeight()-t;s>=0&&s=0&&ae&&a-o','',(0,y.default)("More help"),"",'","
      ",'
      ','','',"
      "].join("")),middle:n.template(['",'
      ',"
      "].join("")),footer:n.template(['
      ','
      ','","
      ",'
      ','','
      ',(0,y.default)("Name"),":
      ","
      ","
      ",'
      ','
      ','",'
      ','",'","
      ","
      ",'
      ','","
      ","
      "].join("")),helpContent:n.template(["

      ",(0,y.default)(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

      ","
        ","
      • ",(0,y.default)(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
      • ","
      • ",(0,y.default)(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
      • ","
      • ",(0,y.default)(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
      • ","
      • ",(0,y.default)(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
      • ","
      • ",(0,y.default)(['Click the "Cancel" button to exit the interface.'].join("")),"
      • ","

      ","

      ",(0,y.default)(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

      "].join("")),invalidElements:n.template([(0,y.default)("The following selections could not be included due to problems:"),"
        <% _.each( problems, function( problem ){ %>","
      • <%- problem.element.name %>: <%- problem.text %>
      • ","<% }); %>
      "].join("")),noElementsLeft:n.template(['
    • ',(0,y.default)("No elements left! "),(0,y.default)("Would you like to "),'',(0,y.default)("start over"),"?","
    • "].join("")),invalidInitial:n.template(['
      ','
      ','',"<% if( _.size( problems ) ){ %>",(0,y.default)("The following selections could not be included due to problems"),":","
        <% _.each( problems, function( problem ){ %>","
      • <%- problem.element.name %>: <%- problem.text %>
      • ","<% }); %>
      ","<% } else if( _.size( elements ) < 1 ){ %>",(0,y.default)("No datasets were selected"),".","<% } %>","
      ",(0,y.default)("At least one element is needed for the collection"),". ",(0,y.default)("You may need to "),'',(0,y.default)("cancel")," ",(0,y.default)("and reselect new elements"),".","
      ","
      ","
      ",'"].join(""))}),toString:function(){return"ListCollectionCreator"}}),C=function(e,t,i){var s,o=a.Deferred(),l=Galaxy.modal||new _.default.View;return t=n.defaults(t||{},{elements:e,oncancel:function(){l.hide(),o.reject("cancelled")},oncreate:function(e,t){l.hide(),o.resolve(t)}}),s=new i(t),l.show({title:t.title||(0,y.default)("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,o},$=function(e,t){return t=t||{},t.title=(0,y.default)("Create a collection from a list of datasets"),C(e,t,x)};t.default={DatasetCollectionElementView:b,ListCollectionCreator:x,collectionCreatorModal:C,listCollectionCreatorModal:$,createListCollection:l}}).call(t,i(2),i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function s(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(37),o=n(a),l=i(73),r=n(l),d=i(4),c=(n(d),r.default.HistoryContentMixin),u=o.default.ListDatasetCollection,h=o.default.PairDatasetCollection,f=o.default.ListPairedDatasetCollection,p=o.default.ListOfListsDatasetCollection,m=u.extend(c).extend({defaults:e.extend(e.clone(u.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),save:s(u.prototype.save),toString:function(){return"History"+u.prototype.toString.call(this)}}),g=h.extend(c).extend({defaults:e.extend(e.clone(h.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),save:s(h.prototype.save),toString:function(){return"History"+h.prototype.toString.call(this)}}),_=f.extend(c).extend({defaults:e.extend(e.clone(f.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),save:s(f.prototype.save),toString:function(){return"History"+f.prototype.toString.call(this)}}),v=p.extend(c).extend({defaults:e.extend(e.clone(p.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),save:s(p.prototype.save),toString:function(){return"HistoryListOfListsDatasetCollection("+this.get("name")+")"}});t.default={HistoryListDatasetCollection:m,HistoryPairDatasetCollection:g,HistoryListPairedDatasetCollection:_,HistoryListOfListsDatasetCollection:v}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(72),l=a(o),r=i(5),d=a(r),c=i(4),u=(a(c),{defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(t){return e.extend(t,t.object,{element_id:t.id}),delete t.object,t},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",n.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}}),h=n.Model.extend(d.default.LoggableMixin).extend(u).extend({_logNamespace:"collections"}),f=n.Collection.extend(d.default.LoggableMixin).extend({_logNamespace:"collections",model:h,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),p=l.default.DatasetAssociation.extend(d.default.mixin(u,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:e.extend({},l.default.DatasetAssociation.prototype.defaults,u.defaults),_downloadQueryParameters:function(){var e=this.get("file_ext"),t=this.get("element_identifier");return"?to_ext="+e+"&hdca_id="+this.get("parent_hdca_id")+"&element_identifier="+t},constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),u.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){this.get("element_identifier");return"DatasetDCE({objStr})"}})),m=f.extend({model:p,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),g=n.Model.extend(d.default.LoggableMixin).extend(d.default.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:f,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var t=this.get("elements")||[];this.unset("elements",{silent:!0});var i=this;return e.each(t,function(t,n){e.extend(t,{parent_hdca_id:i.get("id")})}),this.elements=new this.collectionClass(t),this.elements},toJSON:function(){var e=n.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=n.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},delete:function(e){return this.get("deleted")?s.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?s.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name","tags"],toString:function(){return"DatasetCollection("+[this.get("id"),this.get("name")||this.get("element_identifier")].join(",")+")"}}),_=g.extend({collectionClass:m,toString:function(){return"List"+g.prototype.toString.call(this)}}),v=_.extend({toString:function(){return"Pair"+g.prototype.toString.call(this)}}),w=g.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),y=f.extend({model:w,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),b=v.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedPairDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedPairDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),x=y.extend({model:b,toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),C=g.extend({collectionClass:x,toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),$=_.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedListDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedListDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),k=y.extend({model:$,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),S=g.extend({collectionClass:k,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});t.default={ListDatasetCollection:_,PairDatasetCollection:v,ListPairedDatasetCollection:C,ListOfListsDatasetCollection:S}}).call(t,i(1),i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(39),r=o(l),d=i(40),c=(o(d),i(80)),u=o(c),h=i(3),f=o(h),p=i(5),m=o(p),g=i(4),_=o(g),v=e.Model.extend(m.default.LoggableMixin).extend(m.default.mixin(m.default.SearchableModelMixin,{_logNamespace:"history",UPDATE_DELAY:4e3,defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",deleted:!1,contents_active:{},contents_states:{}},urlRoot:Galaxy.root+"api/histories",contentsClass:r.default.HistoryContents,searchAttributes:["name","annotation","tags"],searchAliases:{title:"name",tag:"tags"},initialize:function(e,t){t=t||{},this.logger=t.logger||null,this.log(this+".initialize:",e,t),this.contents=new this.contentsClass([],{history:this,historyId:this.get("id"),order:t.order}),this._setUpListeners(),this._setUpCollectionListeners(),this.updateTimeoutId=null},_setUpListeners:function(){return this.on({error:function(e,t,i,n,s){this.clearUpdateTimeout()},"change:id":function(e,t){this.contents&&(this.contents.historyId=t)}})},_setUpCollectionListeners:function(){return this.contents?this.listenTo(this.contents,{error:function(){this.trigger.apply(this,n.makeArray(arguments))}}):this},contentsShown:function(){var e=this.get("contents_active"),t=e.active||0;return t+=this.contents.includeDeleted?e.deleted:0,t+=this.contents.includeHidden?e.hidden:0},nice_size:function(){var e=this.get("size");return e?f.default.bytesToString(e,!0,2):(0,_.default)("(empty)")},toJSON:function(){return s.extend(e.Model.prototype.toJSON.call(this),{nice_size:this.nice_size()})},get:function(t){return"nice_size"===t?this.nice_size():e.Model.prototype.get.apply(this,arguments)},ownedByCurrUser:function(){return!(!Galaxy||!Galaxy.user)&&(!Galaxy.user.isAnonymous()&&Galaxy.user.id===this.get("user_id"))},numOfUnfinishedJobs:function(){var e=this.get("non_ready_jobs");return e?e.length:0},numOfUnfinishedShownContents:function(){return this.contents.runningAndActive().length||0},_fetchContentRelatedAttributes:function(){var e=["size","non_ready_jobs","contents_active","hid_counter"];return this.fetch({data:a.param({keys:e.join(",")})})},refresh:function(e){var t=this;e=e||{};var i=this.lastUpdateTime;return this.contents.allFetched=!1,(0!==this.contents.currentPage?function(){return t.contents.fetchPage(t.contents.currentPage)}:function(){return t.contents.fetchUpdated(i)})().done(function(i,n,s){var a;try{a=new Date(s.getResponseHeader("Date"))}catch(e){}t.lastUpdateTime=a||new Date,t.checkForUpdates(e)})},checkForUpdates:function(e){var t=this;e=e||{};var i=this.UPDATE_DELAY;if(this.id){var n=function(){t.clearUpdateTimeout(),t.updateTimeoutId=setTimeout(function(){t.refresh(e)},i)};this.numOfUnfinishedShownContents()>0?n():this._fetchContentRelatedAttributes().done(function(e){t.numOfUnfinishedJobs()>0?n():t.trigger("ready")})}},clearUpdateTimeout:function(){this.updateTimeoutId&&(clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)},parse:function(t,i){var n=e.Model.prototype.parse.call(this,t,i);return n.create_time&&(n.create_time=new Date(n.create_time)),n.update_time&&(n.update_time=new Date(n.update_time)),n},fetchWithContents:function(e,t){e=e||{};var i=this;return e.view="dev-detailed",this.fetch(e).then(function(e){return i.contents.history=i,i.contents.setHistoryId(e.id),i.fetchContents(t)})},fetchContents:function(e){e=e||{};var t=this;return t.lastUpdateTime=new Date,t.contents.fetchCurrentPage(e)},_delete:function(e){return this.get("deleted")?n.when():this.save({deleted:!0},e)},purge:function(e){return this.get("purged")?n.when():this.save({deleted:!0,purged:!0},e)},undelete:function(e){return this.get("deleted")?this.save({deleted:!1},e):n.when()},copy:function(e,t,i){if(e=void 0===e||e,!this.id)throw new Error("You must set the history ID before copying it.");var s={history_id:this.id};e&&(s.current=!0),t&&(s.name=t),i||(s.all_datasets=!1),s.view="dev-detailed";var a=this,o=n.post(this.urlRoot,s);return e?o.then(function(e){return new v(e).setAsCurrent().done(function(){a.trigger("copied",a,e)})}):o.done(function(e){a.trigger("copied",a,e)})},setAsCurrent:function(){var e=this,t=n.getJSON(Galaxy.root+"history/set_as_current?id="+this.id);return t.done(function(){e.trigger("set-as-current",e)}),t},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}})),w=u.default.InfinitelyScrollingCollection,y=w.extend(m.default.LoggableMixin).extend({_logNamespace:"history",model:v,order:"update_time",limitOnFirstFetch:10,limitPerFetch:10,initialize:function(e,t){t=t||{},this.log("HistoryCollection.initialize",e,t),w.prototype.initialize.call(this,e,t),this.includeDeleted=t.includeDeleted||!1,this.currentHistoryId=t.currentHistoryId,this.setUpListeners()},urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot},setUpListeners:function(){return this.on({"change:deleted":function(e){this.debug("change:deleted",this.includeDeleted,e.get("deleted")),!this.includeDeleted&&e.get("deleted")&&this.remove(e)},copied:function(e,t){this.setCurrent(new v(t,[]))},"set-as-current":function(e){var t=this.currentHistoryId;this.trigger("no-longer-current",t),this.currentHistoryId=e.id}})},_buildFetchData:function(e){return s.extend(w.prototype._buildFetchData.call(this,e),{view:"dev-detailed"})},_buildFetchFilters:function(e){var t=w.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted?i.deleted=null:(i.deleted=!1,i.purged=!1),s.defaults(t,i)},fetchFirst:function(e){var t=this,i=a.when();return this.currentHistoryId&&(i=w.prototype.fetchFirst.call(t,{silent:!0,limit:1,filters:{purged:"",deleted:"","encoded_id-in":this.currentHistoryId}})),i.then(function(){return e=e||{},e.offset=0,t.fetchMore(e)})},comparators:s.extend(s.clone(w.prototype.comparators),{name:m.default.buildComparator("name",{ascending:!0}),"name-dsc":m.default.buildComparator("name",{ascending:!1}),size:m.default.buildComparator("size",{ascending:!1}),"size-asc":m.default.buildComparator("size",{ascending:!0})}),sort:function(e){e=e||{};var t=e.silent,i=this.remove(this.get(this.currentHistoryId));return w.prototype.sort.call(this,s.defaults({silent:!0},e)),this.unshift(i,{silent:!0}),t||this.trigger("sort",this,e),this},create:function(e,t,i,s){var a=this;return n.getJSON(Galaxy.root+"history/create_new_current").done(function(e){a.setCurrent(new v(e,[],i||{}))})},setCurrent:function(e,t){return t=t||{},this.unshift(e,t),this.currentHistoryId=e.get("id"),t.silent||this.trigger("new-current",e,this),this},toString:function(){return"HistoryCollection("+this.length+",current:"+this.currentHistoryId+")"}});t.default={History:v,HistoryCollection:y}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(80),l=a(o),r=i(81),d=a(r),c=i(36),u=a(c),h=i(40),f=a(h),p=i(5),m=a(p),g=i(153),_=a(g),v=l.default.PaginatedCollection,w=v.extend(m.default.LoggableMixin).extend({_logNamespace:"history",limitPerPage:500,limitPerProgressiveFetch:500,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){t=t||{},v.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},model:function(e,t){if("dataset"===e.history_content_type)return new d.default.HistoryDatasetAssociation(e,t);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new u.default.HistoryListDatasetCollection(e,t);case"paired":return new u.default.HistoryPairDatasetCollection(e,t);case"list:paired":return new u.default.HistoryListPairedDatasetCollection(e,t);case"list:list":return new u.default.HistoryListOfListsDatasetCollection(e,t)}var i="Unknown collection_type: "+e.collection_type;return console.warn(i,e),{validationError:i}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},setHistoryId:function(e){this.historyId=e,this._setUpWebStorage()},_setUpWebStorage:function(e){if(this.historyId)return this.storage=new f.default.HistoryPrefs({id:f.default.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:e.extend(e.clone(v.prototype.comparators),{name:m.default.buildComparator("name",{ascending:!0}),"name-dsc":m.default.buildComparator("name",{ascending:!1}),hid:m.default.buildComparator("hid",{ascending:!1}),"hid-asc":m.default.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(t,i){if(e.isBoolean(t)&&t!==this.includeDeleted){if(this.includeDeleted=t,e.result(i,"silent"))return;this.trigger("include-deleted",t,this)}},setIncludeHidden:function(t,i){if(e.isBoolean(t)&&t!==this.includeHidden){if(this.includeHidden=t,i=i||{},e.result(i,"silent"))return;this.trigger("include-hidden",t,this)}},fetch:function(t){if(t=t||{},this.historyId&&!t.details){var i=f.default.HistoryPrefs.get(this.historyId).toJSON();e.isEmpty(i.expandedIds)||(t.details=e.values(i.expandedIds).join(","))}return v.prototype.fetch.call(this,t)},_buildFetchData:function(t){return e.extend(v.prototype._buildFetchData.call(this,t),{v:"dev"})},_fetchParams:v.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(t){var i=v.prototype._buildFetchFilters.call(this,t)||{},n={};return this.includeDeleted||(n.deleted=!1,n.purged=!1),this.includeHidden||(n.visible=!0),e.defaults(i,n)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(t){var i=this;return t=t||{},t.filters=e.extend(t.filters,{deleted:!0,purged:void 0}),t.remove=!1,this.trigger("fetching-deleted",this),this.fetch(t).always(function(){i.trigger("fetching-deleted-done",i)})},fetchHidden:function(t){t=t||{};var i=this;return t.filters=e.extend(t.filters,{visible:!1}),t.remove=!1,i.trigger("fetching-hidden",i),i.fetch(t).always(function(){i.trigger("fetching-hidden-done",i)})},fetchAllDetails:function(t){t=t||{};var i={details:"all"};return t.data=e.extend(t.data||{},i),this.fetch(t)},fetchCollectionCounts:function(t){return t=t||{},t.keys=["type_id","element_count"].join(","),t.filters=e.extend(t.filters||{},{history_content_type:"dataset_collection"}),t.remove=!1,this.fetch(t)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var a=i.get(t[n]);return a?e.concat(a):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(t,i,n){return n=n||this.models,new _.default.AjaxQueue(n.slice().reverse().map(function(n,s){var a=e.isString(t)?n[t]:t;return function(){return a.apply(n,i)}})).deferred},progressivelyFetchDetails:function(t){function i(n){n=n||0;var l=e.extend(e.clone(t),{view:"summary",keys:r,limit:o,offset:n,reset:0===n,remove:!1});e.defer(function(){a.fetch.call(a,l).fail(s.reject).done(function(e){s.notify(e,o,n),e.length!==o?(a.allFetched=!0,s.resolve(e,o,n)):i(n+o)})})}t=t||{};var s=n.Deferred(),a=this,o=t.limitPerCall||a.limitPerProgressiveFetch,l=d.default.HistoryDatasetAssociation.prototype.searchAttributes,r=l.join(",");return i(),s},isCopyable:function(t){var i=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return e.isObject(t)&&t.id&&e.contains(i,t.model_class)},copy:function(t){var i,s,a;e.isString(t)?(i=t,a="hda",s="dataset"):(i=t.id,a={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[t.model_class]||"hda",s="hdca"===a?"dataset_collection":"dataset");var o=this,l=n.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:i,source:a,type:s})}).done(function(e){o.add([e],{parse:!0})}).fail(function(e,t,n){o.trigger("error",o,l,{},"Error copying contents",{type:s,id:i,source:a})});return l},createHDCA:function(e,t,i,n,s){return this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,hide_source_items:n||!1,element_identifiers:e}).save(s)},haveSearchDetails:function(){return this.allFetched&&this.all(function(t){return e.has(t.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=s.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});t.default={HistoryContents:w}}).call(t,i(1),i(0),i(2))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(5),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(t){return e.result(this.get("expandedIds"),t,!1)},allExpanded:function(){return e.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(t){return e.isUndefined(t)||this.set("show_deleted",t),this.get("show_deleted")},includeHidden:function(t){return e.isUndefined(t)||this.set("show_hidden",t),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return a.storageKeyPrefix+e},get:function(e){return new a({id:a.historyStorageKey(e)})},clearAll:function(e){for(var t in sessionStorage)0===t.indexOf(a.storageKeyPrefix)&&sessionStorage.removeItem(t)}});t.default={HistoryPrefs:a}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(5),r=o(l),d=i(4),c=(o(d),e.View.extend(r.default.LoggableMixin).extend({_logNamespace:"list",initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=n(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):n(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",s.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=n(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?a.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}})),u=c.extend(r.default.mixin(r.default.SelectableViewMixin,r.default.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(e){c.prototype.initialize.call(this,e),r.default.SelectableViewMixin.initialize.call(this,e),r.default.DraggableViewMixin.initialize.call(this,e),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=c.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return c.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=n('
      '),i=e.model.toJSON();return s.each(e.templates.warnings,function(s){t.append(n(s(i,e)))}),t},_renderTitleBar:function(){return n(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){return!e||"keydown"!==e.type||32!==e.keyCode&&13!==e.keyCode||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){return"ListItemView("+(this.model?""+this.model:"(no model)")+")"}}));u.prototype.templates=function(){return{el:r.default.wrapTemplate(['
      ','
      ','
      ','',"
      ",'
      ','
      ','
      ',"
      "]),warnings:{},titleBar:r.default.wrapTemplate(['
      ','','
      ','<%- element.name %>',"
      ",'
      ',"
      "],"element"),subtitle:r.default.wrapTemplate(['
      ']),details:r.default.wrapTemplate(['
      '])}}();var h=u.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,u.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return n();var e=u.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e);return new t(s.extend(i,{model:e}))},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});h.prototype.templates=function(){var e=r.default.wrapTemplate(['
      ',"
      "],"collection");return s.extend({},u.prototype.templates,{details:e})}(),t.default={ExpandableView:c,ListItemView:u,FoldoutListItemView:h}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(41),r=o(l),d=i(11),c=o(d),u=i(14),h=o(u),f=i(5),p=o(f),m=i(4),g=o(m),_=r.default.ListItemView,v=_.extend({_logNamespace:"dataset",className:_.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),_.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){_.prototype._setUpListeners.call(this);var t=this;return t.listenTo(t.model,{change:function(i){t.model.changedAttributes().state&&t.model.inReadyState()&&t.expanded&&!t.model.hasDetails()?t.model.fetch({silent:!0}).done(function(){t.render()}):e.has(i.changed,"tags")&&1===e.keys(i.changed).length?t.$(".nametags").html(t._renderNametags()):t.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):n.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){s.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return _.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===c.default.NOT_VIEWABLE||e===c.default.DISCARDED||!this.model.get("accessible"))return null;var t={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))t.disabled=!0,t.title=(0,g.default)("Cannot display datasets removed from disk");else if(e===c.default.UPLOAD)t.disabled=!0,t.title=(0,g.default)("This dataset must finish uploading before it can be viewed");else if(e===c.default.NEW)t.disabled=!0,t.title=(0,g.default)("This dataset is not yet viewable");else{t.title=(0,g.default)("View data"),t.href=this.model.urls.display;var i=this;t.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(i.model.get("id")),e.preventDefault())}}return t.faIcon="fa-eye",(0,h.default)(t)},_renderDetails:function(){if(this.model.get("state")===c.default.NOT_VIEWABLE)return a(this.templates.noAccess(this.model.toJSON(),this));var e=_.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var t=this,i=a('
      '),n=t.model.toJSON();return e.each(t.templates.detailMessages,function(e){i.append(a(e(n,t)))}),i},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case c.default.NOT_VIEWABLE:return[];case c.default.OK:case c.default.FAILED_METADATA:case c.default.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return(0,h.default)({title:(0,g.default)("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Dataset details",url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:e.isEmpty(this.model.get("meta_files"))?a(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var t=this.model.urls;return a(['"].join("\n"))},_renderNametags:function(){return e.template(["<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>"].join(""))({tags:this.model.get("tags")})},events:e.extend(e.clone(_.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){return"DatasetListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=e.extend({},_.prototype.templates.warnings,{failed_metadata:p.default.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
      ',(0,g.default)("An error occurred setting the metadata for this dataset"),"
      ","<% } %>"]),error:p.default.wrapTemplate(["<% if( model.error ){ %>",'
      ',(0,g.default)("There was an error getting the data for this dataset"),": <%- model.error %>","
      ","<% } %>"]),purged:p.default.wrapTemplate(["<% if( model.purged ){ %>",'
      ',(0,g.default)("This dataset has been deleted and removed from disk"),"
      ","<% } %>"]),deleted:p.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
      ',(0,g.default)("This dataset has been deleted"),"
      ","<% } %>"])}),i=p.default.wrapTemplate(['
      ','
      ','
      ','
      ','
      ',"
      ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
      ','
      ','
      ',"<% if( dataset.peek ){ %>",'
      <%= dataset.peek %>
      ',"<% } %>","<% } %>","
      "],"dataset"),n=p.default.wrapTemplate(['
      ','
      ',(0,g.default)("You do not have permission to view this dataset"),"
      ","
      "],"dataset"),s={};s[c.default.OK]=s[c.default.FAILED_METADATA]=p.default.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
      ','<%- dataset.misc_blurb %>',"
      ","<% } %>","<% if( dataset.file_ext ){ %>",'
      ','",'<%- dataset.file_ext %>',"
      ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
      ','",'',"<%- dataset.metadata_dbkey %>","","
      ","<% } %>","<% if( dataset.misc_info ){ %>",'
      ','<%- dataset.misc_info %>',"
      ","<% } %>"],"dataset"),s[c.default.NEW]=p.default.wrapTemplate(["
      ",(0,g.default)("This is a new dataset and not all of its data are available yet"),"
      "],"dataset"),s[c.default.NOT_VIEWABLE]=p.default.wrapTemplate(["
      ",(0,g.default)("You do not have permission to view this dataset"),"
      "],"dataset"),s[c.default.DISCARDED]=p.default.wrapTemplate(["
      ",(0,g.default)("The job creating this dataset was cancelled before completion"),"
      "],"dataset"),s[c.default.QUEUED]=p.default.wrapTemplate(["
      ",(0,g.default)("This job is waiting to run"),"
      "],"dataset"),s[c.default.RUNNING]=p.default.wrapTemplate(["
      ",(0,g.default)("This job is currently running"),"
      "],"dataset"),s[c.default.UPLOAD]=p.default.wrapTemplate(["
      ",(0,g.default)("This dataset is currently uploading"),"
      "],"dataset"),s[c.default.SETTING_METADATA]=p.default.wrapTemplate(["
      ",(0,g.default)("Metadata is being auto-detected"),"
      "],"dataset"),s[c.default.PAUSED]=p.default.wrapTemplate(["
      ",(0,g.default)('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
      "],"dataset"),s[c.default.ERROR]=p.default.wrapTemplate(["<% if( !dataset.purged ){ %>","
      <%- dataset.misc_blurb %>
      ","<% } %>",'',(0,g.default)("An error occurred with this dataset"),":",'
      <%- dataset.misc_info %>
      '],"dataset"),s[c.default.EMPTY]=p.default.wrapTemplate(["
      ",(0,g.default)("No data"),": <%- dataset.misc_blurb %>
      "],"dataset"),s.unknown=p.default.wrapTemplate(['
      Error: unknown dataset state: "<%- dataset.state %>"
      '],"dataset");var a={resubmitted:p.default.wrapTemplate(["<% if( model.resubmitted ){ %>",'
      ',(0,g.default)("The job creating this dataset has been resubmitted"),"
      ","<% } %>"])},o=p.default.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
      ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
      ","<% }); %>"],"apps");return e.extend({},_.prototype.templates,{warnings:t,details:i,noAccess:n,summaries:s,detailMessages:a,displayApplications:o})}(),t.default={DatasetListItemView:v}}).call(t,i(1),i(0),i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(41),l=a(o),r=i(42),d=a(r),c=i(5),u=a(c),h=i(4),f=a(h),p=l.default.FoldoutListItemView,m=l.default.ListItemView,g=p.extend({className:p.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,p.prototype.initialize.call(this,e)},_setUpListeners:function(){p.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(t,i){e.has(t.changed,"deleted")?this.render():e.has(t.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var t=p.prototype._getFoldoutPanelOptions.call(this);return e.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){return"DCListItemView("+(this.model?""+this.model:"(no model)")+")"}});g.prototype.templates=function(){var t=e.extend({},p.prototype.templates.warnings,{error:u.default.wrapTemplate(["<% if( model.error ){ %>",'
      ',(0,f.default)("There was an error getting the data for this collection"),": <%- model.error %>","
      ","<% } %>"]),purged:u.default.wrapTemplate(["<% if( model.purged ){ %>",'
      ',(0,f.default)("This collection has been deleted and removed from disk"),"
      ","<% } %>"]),deleted:u.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
      ',(0,f.default)("This collection has been deleted"),"
      ","<% } %>"])}),i=u.default.wrapTemplate(['
      ','
      ','<%- collection.element_identifier || collection.name %>',"
      ",'
      ',"
      "],"collection"),n=u.default.wrapTemplate(['
      ','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',(0,f.default)("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',(0,f.default)("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',(0,f.default)("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',(0,f.default)("a list of <%- countText %>dataset lists"),"<% } %>","
      "],"collection");return e.extend({},p.prototype.templates,{warnings:t,titleBar:i,subtitle:n})}();var _=m.extend({className:m.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),m.prototype.initialize.call(this,e)},toString:function(){return"DCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});_.prototype.templates=function(){var t=u.default.wrapTemplate(['
      ','
      ','<%- element.element_identifier %>',"
      ",'
      ',"
      "],"element");return e.extend({},m.prototype.templates,{titleBar:t})}();var v=d.default.DatasetListItemView.extend({className:d.default.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),d.default.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):s.when()},toString:function(){return"DatasetDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=u.default.wrapTemplate(['
      ','','
      ','<%- element.element_identifier %>',"
      ","
      "],"element");return e.extend({},d.default.DatasetListItemView.prototype.templates,{titleBar:t})}();var w=g.extend({className:g.prototype.className+" dataset-collection-element",_swapNewRender:function(e){g.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){return"NestedDCDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});t.default={DCListItemView:g,DCEListItemView:_,DatasetDCEListItemView:v,NestedDCDCEListItemView:w}}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(9),o=s(a),l=i(6),r=s(l),d=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
      "),this.render()},render:function(){var e=this;n.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var i=n.extend({},e.model.attributes,t),s=new o.default({title:i.title,message:i.message,status:i.status||"warning",icon:i.icon,inputs:i.inputs,buttons:{submit:new r.default.Button({tooltip:i.submit_tooltip,title:i.submit_title||"Save",icon:i.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(s)}})}});e.$el.empty().append(s.$el)}).fail(function(t){e.$el.empty().append(new r.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;n.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(i){var s={message:i.message,status:"success",persistent:!1};t.redirect?window.location=Galaxy.root+t.redirect+"?"+n.param(s):(e.data.matchModel(i,function(t,i){e.field_list[i].value(t.value)}),t._showMessage(e,s))}).fail(function(i){t._showMessage(e,{message:i.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(n(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:d}}).call(t,i(2),i(0))},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(11),l=a(o),r=i(5),d=a(r),c=i(4),u=a(c),h=d.default.SearchableModelMixin,f=e.Model.extend(d.default.LoggableMixin).extend(d.default.mixin(h,{_logNamespace:"dataset",defaults:{state:l.default.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(e,t){this.debug(this+"(Dataset).initialize",e,t), //!! this state is not in trans.app.model.Dataset.states - set it here - -this.get("accessible")||this.set("state",l.default.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var e=this.get("id");if(!e)return{};var t={purge:"datasets/"+e+"/purge_async",display:"datasets/"+e+"/display/?preview=True",edit:"datasets/edit?dataset_id="+e,download:"datasets/"+e+"/display"+this._downloadQueryParameters(),report_error:"dataset/errors?id="+e,rerun:"tool_runner/rerun?id="+e,show_params:"datasets/"+e+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+e+"&metadata_name="};return n.each(t,function(e,i){t[i]=Galaxy.root+e}),this.urls=t,t},_downloadQueryParameters:function(){return"?to_ext="+this.get("file_ext")},_setUpListeners:function(){this.on("change:state",function(e,t){this.log(this+" has changed state:",e,t),this.inReadyState()&&this.trigger("state:ready",e,t,this.previous("state"))}),this.on("change:id change:file_ext",function(e){this._generateUrls()})},toJSON:function(){var t=e.Model.prototype.toJSON.call(this);return n.extend(t,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var e=n.contains(l.default.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||e},hasDetails:function(){return!this.get("accessible")||this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(t){var i=this;return e.Model.prototype.fetch.call(this,t).always(function(){i._generateUrls()})},parse:function(t,i){var n=e.Model.prototype.parse.call(this,t,i);return n.create_time&&(n.create_time=new Date(n.create_time)),n.update_time&&(n.update_time=new Date(n.update_time)),n},save:function(t,i){return i=i||{},i.wait=!!n.isUndefined(i.wait)||i.wait,e.Model.prototype.save.call(this,t,i)},delete:function(e){return this.get("deleted")?s.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?s.when():this.save({deleted:!1},e)},purge:function(e){if(this.get("purged"))return s.when();e=e||{},e.url=this.urls.purge;var t=this,i=s.ajax(e);return i.done(function(e,i,n){t.set({deleted:!0,purged:!0})}),i.fail(function(i,n,s){var a=(0,u.default)("Unable to purge dataset");i.responseJSON&&i.responseJSON.error?a=i.responseJSON.error:-1!==i.responseText.indexOf("Removal of datasets by users is not allowed in this Galaxy instance")&&(a="Removal of datasets by users is not allowed in this Galaxy instance"),i.responseText=a,t.trigger("error",t,i,e,(0,u.default)(a),{error:a})}),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 e=this.get("id")||"";return this.get("name")&&(e='"'+this.get("name")+'",'+e),"Dataset("+e+")"}})),p=e.Collection.extend(d.default.LoggableMixin).extend({_logNamespace:"dataset",model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},ajaxQueue:function(e,t){var i=s.Deferred(),n=this.length,a=[];if(!n)return i.resolve([]),i;var o=this.chain().reverse().map(function(s,l){return function(){var r=e.call(s,t);r.done(function(e){i.notify({curr:l,total:n,response:e,model:s})}),r.always(function(e){a.push(e),o.length?o.shift()():i.resolve(a)})}}).value();return o.shift()(),i},matches:function(e){return this.filter(function(t){return t.matches(e)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});t.default={DatasetAssociation:f,DatasetAssociationCollection:p}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(11),a=(n(s),i(5)),o=(n(a),i(4)),l=(n(o),{defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",hidden:function(){return!this.get("visible")},isVisible:function(e,t){var i=!0;return e||!this.get("deleted")&&!this.get("purged")||(i=!1),t||this.get("visible")||(i=!1),i},urlRoot:Galaxy.root+"api/histories/",url:function(){return this.urlRoot+this.get("history_id")+"/contents/"+this.get("history_content_type")+"s/"+this.get("id")},hide:function(t){return this.get("visible")?this.save({visible:!1},t):e.when()},unhide:function(t){return this.get("visible")?e.when():this.save({visible:!0},t)},toString:function(){return[this.get("type_id"),this.get("hid"),this.get("name")].join(":")}});t.default={HistoryContentMixin:l}}).call(t,i(0))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i={_validationWarning:function(e,t){"name"===e&&(e=this.$(".collection-name").add(this.$(".collection-name-prompt")),this.$(".collection-name").focus().select()),t?(e=e||this.$(".validation-warning"),e.removeClass("validation-warning")):e.addClass("validation-warning")},_changeHideOriginals:function(e){this.hideOriginals=this.$(".hide-originals").prop("checked")},_changeName:function(e){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return e.escape(this.$(".collection-name").val())},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},_cancelCreate:function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},_clickCreate:function(e){var t=this._getName();t?this.blocking||this.createList(t):this._validationWarning("name")},_setUpCommonSettings:function(e){this.hideOriginals=e.defaultHideSourceItems||!1},_renderFooter:function(t,i){var n=this,s=this.$(".footer").empty().html(this.templates.footer());return e.each(this.footerSettings,function(e,t){n.$(t).prop("checked",n[e])}),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),s},_creatorTemplates:{main:e.template(['
      ','
      ',''].join(""))}};t.default={CollectionCreatorMixin:i}}).call(t,i(1))},function(e,t,i){"use strict";function n(e,t){var i=/(-?[0-9\.]+)/g,n=e.toString().toLowerCase()||"",s=t.toString().toLowerCase()||"",a=String.fromCharCode(0),o=n.replace(i,a+"$1"+a).split(a),l=s.replace(i,a+"$1"+a).split(a),r=new Date(n).getTime(),d=r?new Date(s).getTime():null;if(d){if(rd)return 1}for(var c,u,h=0,f=Math.max(o.length,l.length);hu)return 1}return 0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,i){"use strict";var n=i(0),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default;s.default.fn.extend({hoverhighlight:function(e,t){return e=e||"body",this.length?(a(this).each(function(){var i=a(this),n=i.data("target");n&&i.mouseover(function(i){a(n,e).css({background:t})}).mouseout(function(e){a(n).css({background:""})})}),this):this}})},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=a(o),r=i(67),d=a(r),c=i(6),u=a(c),h=i(9),f=a(h),p=i(70),m=a(p),g=i(66),_=a(g),v=i(7),w=a(v),y=i(17),b=a(y),x=i(148),C=a(x),$=e.View.extend({initialize:function(t){var i=this;this.modal=parent.Galaxy.modal||new w.default.View,this.model=t&&t.model||new e.Model(t),this.deferred=new d.default,this.setElement(n("
      ").addClass("ui-form-composite").append(this.$message=n("
      ")).append(this.$header=n("
      ")).append(this.$steps=n("
      "))),n("body").append(this.$el),this._configure(),this.render(),n(window).resize(function(){i._refresh()})},_refresh:function(e){var t=s.reduce(this.$el.children(),function(e,t){return e+n(t).outerHeight()},0)-this.$steps.height()+90;this.$steps.css("height",n(window).height()-t)},_configure:function(){function e(e,n){for(var s,a=/\$\{(.+?)\}/g;s=a.exec(String(e));){var o=s[1];n(t.wp_inputs[o]=t.wp_inputs[o]||{label:o,name:o,type:"text",color:"hsl( "+100*++i+", 70%, 30% )",style:"ui-form-wp-source",links:[]})}}var t=this;this.forms=[],this.steps=[],this.links=[],this.parms=[],s.each(this.model.get("steps"),function(e,i){Galaxy.emit.debug("tool-form-composite::initialize()",i+" : Preparing workflow step.");var n=C.default[e.step_type],a=parseInt(i+1)+": "+(e.step_label||e.step_name);e.annotation&&(a+=" - "+e.annotation),e.step_version&&(a+=" (Galaxy Version "+e.step_version+")"),e=l.default.merge({index:i,fixed_title:s.escape(a),icon:n||"",help:null,citations:null,collapsible:!0,collapsed:i>0&&!t._isDataStep(e),sustain_version:!0,sustain_repeats:!0,sustain_conditionals:!0,narrow:!0,text_enable:"Edit",text_disable:"Undo",cls_enable:"fa fa-edit",cls_disable:"fa fa-undo",errors:e.messages,initial_errors:!0,cls:"ui-portlet-narrow",hide_operations:!0,needs_refresh:!1,always_refresh:"tool"!=e.step_type},e),t.steps[i]=e,t.links[i]=[],t.parms[i]={}}),s.each(this.steps,function(e,i){m.default.visitInputs(e.inputs,function(e,n){t.parms[i][n]=e})}),s.each(this.steps,function(e,i){s.each(e.output_connections,function(e){s.each(t.steps,function(n,s){n.step_index===e.input_step_index&&t.links[i].push(n)})})}),s.each(this.steps,function(e,i){s.each(t.steps,function(n,a){var o={};s.each(e.output_connections,function(e){n.step_index===e.input_step_index&&(o[e.input_name]=e)}),s.each(t.parms[a],function(t,n){var s=o[n];s&&(t.type="hidden",t.help=t.step_linked?t.help+", ":"",t.help+="Output dataset '"+s.output_name+"' from step "+(parseInt(i)+1),t.step_linked=t.step_linked||[],t.step_linked.push(e))})})});var i=0;this.wp_inputs={},s.each(this.steps,function(i,n){s.each(t.parms[n],function(t,n){e(t.value,function(e){e.links.push(i),t.wp_linked=!0,t.type="text",t.backdrop=!0,t.style="ui-form-wp-target"})}),s.each(i.post_job_actions,function(t){s.each(t.action_arguments,function(t){e(t,function(){})})})}),s.each(this.steps,function(e,i){if("tool"==e.step_type){var n=!0;m.default.visitInputs(e.inputs,function(i,s,a){var o=i.value&&"RuntimeValue"==i.value.__class__,r=-1!=["data","data_collection"].indexOf(i.type),d=a[i.data_ref];i.step_linked&&!t._isDataStep(i.step_linked)&&(n=!1),i.options&&(0==i.options.length&&!n||i.wp_linked)&&(i.is_workflow=!0),d&&(i.is_workflow=d.step_linked&&!t._isDataStep(d.step_linked)||i.wp_linked),(r||i.value&&"RuntimeValue"==i.value.__class__&&!i.step_linked)&&(e.collapsed=!1),o&&(i.value=i.default_value),i.flavor="workflow",o||r||"hidden"===i.type||i.wp_linked||(i.optional||!l.default.isEmpty(i.value)&&""!==i.value)&&(i.collapsible_value=i.value,i.collapsible_preview=!0)})}})},render:function(){var e=this;this.deferred.reset(),this._renderHeader(),this._renderMessage(),this._renderParameters(),this._renderHistory(),s.each(this.steps,function(t){e._renderStep(t)})},_renderHeader:function(){var e=this;this.execute_btn=new u.default.Button({icon:"fa-check",title:"Run workflow",cls:"btn btn-primary",onclick:function(){e._execute()}}),this.$header.addClass("ui-form-header").empty().append(new u.default.Label({title:"Workflow: "+this.model.get("name")}).$el).append(this.execute_btn.$el)},_renderMessage:function(){this.$message.empty(),this.model.get("has_upgrade_messages")&&this.$message.append(new u.default.Message({message:"Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.",status:"warning",persistent:!0,fade:!1}).$el);var e=this.model.get("step_version_changes");e&&e.length>0&&this.$message.append(new u.default.Message({message:"Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.",status:"warning",persistent:!0,fade:!1}).$el)},_renderParameters:function(){var e=this;this.wp_form=null,s.isEmpty(this.wp_inputs)||(this.wp_form=new f.default({title:"Workflow Parameters",inputs:this.wp_inputs,cls:"ui-portlet-narrow",onchange:function(){s.each(e.wp_form.input_list,function(t,i){s.each(t.links,function(t){e._refreshStep(t)})})}}),this._append(this.$steps.empty(),this.wp_form.$el))},_renderHistory:function(){this.history_form=new f.default({cls:"ui-portlet-narrow",title:"History Options",inputs:[{type:"conditional",name:"new_history",test_param:{name:"check",label:"Send results to a new history",type:"boolean",value:"false",help:""},cases:[{value:"true",inputs:[{name:"name",label:"History name",type:"text",value:this.model.get("name")}]}]}]}),this._append(this.$steps,this.history_form.$el)},_renderStep:function(e){var t=this,i=null;this.deferred.execute(function(a){if(t.$steps.addClass("ui-steps"),"tool"==e.step_type)e.postchange=function(t,i){var s={tool_id:e.id,tool_version:e.version,inputs:n.extend(!0,{},i.data.create())};i.wait(!0),Galaxy.emit.debug("tool-form-composite::postchange()","Sending current state.",s),l.default.request({type:"POST",url:Galaxy.root+"api/tools/"+e.id+"/build",data:s,success:function(e){i.update(e),i.wait(!1),Galaxy.emit.debug("tool-form-composite::postchange()","Received new model.",e),t.resolve()},error:function(e){Galaxy.emit.debug("tool-form-composite::postchange()","Refresh request failed.",e),t.reject()}})},i=new _.default(e),e.post_job_actions&&e.post_job_actions.length&&i.portlet.append(n("
      ").addClass("ui-form-element-disabled").append(n("
      ").addClass("ui-form-title").html("Job Post Actions")).append(n("
      ").addClass("ui-form-preview").html(s.reduce(e.post_job_actions,function(e,t){return e+" "+t.short_str},""))));else{var o=-1!=["data_input","data_collection_input"].indexOf(e.step_type);s.each(e.inputs,function(e){e.flavor="module",e.hide_label=o}),i=new f.default(l.default.merge({title:e.fixed_title,onchange:function(){s.each(t.links[e.index],function(e){t._refreshStep(e)})},inputs:e.inputs&&e.inputs.length>0?e.inputs:[{type:"hidden",name:"No options available.",ignore:null}]},e))}t.forms[e.index]=i,t._append(t.$steps,i.$el),t._refresh(),e.needs_refresh&&t._refreshStep(e),i.portlet[t.show_progress?"disable":"enable"](),t.show_progress&&t.execute_btn.model.set({wait:!0,wait_text:"Preparing...",percentage:100*(e.index+1)/t.steps.length}),Galaxy.emit.debug("tool-form-composite::initialize()",e.index+" : Workflow step state ready.",e),setTimeout(function(){a.resolve()},0)})},_refreshStep:function(e){var t=this,i=this.forms[e.index];i?(s.each(t.parms[e.index],function(e,n){if(e.step_linked||e.wp_linked){var a=i.field_list[i.data.match(n)];if(a){var o=void 0;if(e.step_linked)o={values:[]},s.each(e.step_linked,function(e){if(t._isDataStep(e)){var i=t.forms[e.index].data.create().input;i&&s.each(i.values,function(e){o.values.push(e)})}}),!e.multiple&&o.values.length>0&&(o={values:[o.values[0]]});else if(e.wp_linked){o=e.value;for(var l,r=/\$\{(.+?)\}/g;l=r.exec(e.value);){var d=t.wp_form.field_list[t.wp_form.data.match(l[1])],c=d&&d.value();c&&(o=o.split(l[0]).join(c))}}void 0!==o&&a.value(o)}}}),i.trigger("change")):e.needs_refresh=!0},_refreshHistory:function(){var e=this,t=parent.Galaxy&&parent.Galaxy.currHistoryPanel&&parent.Galaxy.currHistoryPanel.model;this._refresh_history&&clearTimeout(this._refresh_history),t&&t.refresh().success(function(){0===t.numOfUnfinishedShownContents()&&(e._refresh_history=setTimeout(function(){e._refreshHistory()},t.UPDATE_DELAY))})},_execute:function(){var e=this;this.show_progress=!0,this._enabled(!1),this.deferred.execute(function(t){setTimeout(function(){t.resolve(),e._submit()},0)})},_submit:function(){var e=this,t=this.history_form.data.create(),i={new_history_name:t["new_history|name"]?t["new_history|name"]:null,history_id:t["new_history|name"]?null:this.model.get("history_id"),replacement_params:this.wp_form?this.wp_form.data.create():{},parameters:{},parameters_normalized:!0,batch:!0},s=!0;for(var a in this.forms){var o=this.forms[a],r=o.data.create(),d=e.steps[a],c=d.step_index;o.trigger("reset");for(var u in r){var h=r[u],f=o.data.match(u),p=(o.field_list[f],o.input_list[f]);if(!p.step_linked){if(!(s=this._isDataStep(d)?h&&h.values&&h.values.length>0:p.optional||p.is_workflow&&""!==h||!p.is_workflow&&null!==h)){o.highlight(f);break}i.parameters[c]=i.parameters[c]||{},i.parameters[c][u]=r[u]}}if(!s)break}s?(Galaxy.emit.debug("tool-form-composite::submit()","Validation complete.",i),l.default.request({type:"POST",url:Galaxy.root+"api/workflows/"+this.model.id+"/invocations",data:i,success:function(t){if(Galaxy.emit.debug("tool-form-composite::submit","Submission successful.",t),e.$el.children().hide(),e.$el.append(e._templateSuccess(t)),n.isArray(t)&&t.length>0){e.$el.append(n("
      ",{id:"webhook-view"}));new b.default.WebhookView({urlRoot:Galaxy.root+"api/webhooks/workflow",toolId:i.tool_id,toolVersion:i.tool_version})}e._refreshHistory()},error:function(t){Galaxy.emit.debug("tool-form-composite::submit","Submission failed.",t);var n=!1;if(t&&t.err_data)for(var s in e.forms){var a=e.forms[s],o=t.err_data[a.model.get("step_index")];if(o){var l=a.data.matchResponse(o);for(var r in l){a.highlight(r,l[r]),n=!0;break}}}n||e.modal.show({title:"Workflow submission failed",body:e._templateError(i,t&&t.err_msg),buttons:{Close:function(){e.modal.hide()}}})},complete:function(){e._enabled(!0)}})):(e._enabled(!0),Galaxy.emit.debug("tool-form-composite::submit()","Validation failed.",i))},_append:function(e,t){e.append("

      ").append(t)},_enabled:function(e){this.execute_btn.model.set({wait:!e,wait_text:"Sending...",percentage:-1}),this.wp_form&&this.wp_form.portlet[e?"enable":"disable"](),this.history_form&&this.history_form.portlet[e?"enable":"disable"](),s.each(this.forms,function(t){t&&t.portlet[e?"enable":"disable"]()})},_isDataStep:function(e){for(var t=n.isArray(e)?e:[e],i=0;i0?n("

      ").addClass("donemessagelarge").append(n("

      ").html("Successfully invoked workflow "+l.default.sanitize(this.model.get("name"))+""+(e.length>1?" "+e.length+" times":"")+".")).append(n("

      ").append("").text("You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.")):this._templateError(e,"Invalid success response. No invocations found.")},_templateError:function(e,t){return n("

      ").addClass("errormessagelarge").append(n("

      ").text("The server could not complete the request. Please contact the Galaxy Team if this error persists. "+(JSON.stringify(t)||""))).append(n("

      ").text(JSON.stringify(e,null,4)))}});t.default={View:$}}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(7),l=a(o),r=i(79),d=a(r),c=i(4),u=a(c),h={defaultName:e.template("Copy of '<%- name %>'"),title:e.template((0,u.default)("Copying history")+' "<%- name %>"'),submitLabel:(0,u.default)("Copy"),errorMessage:(0,u.default)("History could not be copied."),progressive:(0,u.default)("Copying history"),activeLabel:(0,u.default)("Copy only the active, non-deleted datasets"),allLabel:(0,u.default)("Copy all datasets including deleted ones"),anonWarning:(0,u.default)("As an anonymous user, unless you login or register, you will lose your current history ")+(0,u.default)("after copying this history. "),_template:e.template(["<% if( isAnon ){ %>",'
      ',"<%- anonWarning %>",(0,u.default)("You can"),' ',(0,u.default)("login here")," ",(0,u.default)("or")," ",' ',(0,u.default)("register here"),".","
      ","<% } %>","
      ",'
      ",'','","<% if( allowAll ){ %>","
      ","

      ",(0,u.default)("Choose which datasets from the original history to include:"),"

      ",'/>','',"
      ",'/>','',"<% } %>","
      "].join("")),_showAjaxIndicator:function(){var e='

      '+this.progressive+"...

      ";this.modal.$(".modal-body").empty().append(e).css({"margin-top":"8px"})},dialog:function(t,i,a){function o(){var e=t.$("#copy-modal-title").val();if(!e)return void t.$(".invalid-title").show();var n="copy-all"===t.$('input[name="copy-what"]:checked').val();t.$("button").prop("disabled",!0),l._showAjaxIndicator(),i.copy(!0,e,n).done(function(e){r.resolve(e)}).fail(function(t,s,a){var o={name:e,copyAllDatasets:n};d.default.ajaxErrorModal(i,t,o,l.errorMessage),r.rejectWith(r,arguments)}).done(function(){m&&t.hide()})}a=a||{};var l=this,r=n.Deferred(),c=a.nameFn||this.defaultName,h=c({name:i.get("name")}),f=a.allDatasets?"copy-all":"copy-non-deleted",p=!!e.isUndefined(a.allowAll)||a.allowAll,m=!!e.isUndefined(a.autoClose)||a.autoClose;this.modal=t;var g=a.closing_callback;return t.show(e.extend(a,{title:this.title({name:i.get("name")}),body:s(l._template({name:h,isAnon:Galaxy.user.isAnonymous(),allowAll:p,copyWhat:f,activeLabel:this.activeLabel,allLabel:this.allLabel,anonWarning:this.anonWarning})),buttons:e.object([[(0,u.default)("Cancel"),function(){t.hide()}],[this.submitLabel,o]]),height:"auto",closing_events:!0,closing_callback:function(e){e&&r.reject({cancelled:!0}),g&&g(e)}})),t.$("#copy-modal-title").focus().select(),t.$("#copy-modal-title").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),o())}),r}},f=e.extend({},h,{defaultName:e.template("imported: <%- name %>"),title:e.template((0,u.default)("Importing history")+' "<%- name %>"'),submitLabel:(0,u.default)("Import"),errorMessage:(0,u.default)("History could not be imported."),progressive:(0,u.default)("Importing history"),activeLabel:(0,u.default)("Import only the active, non-deleted datasets"),allLabel:(0,u.default)("Import all datasets including deleted ones"),anonWarning:(0,u.default)("As an anonymous user, unless you login or register, you will lose your current history ")+(0,u.default)("after importing this history. ")}),p=function(e,t){t=t||{};var i=window.parent.Galaxy.modal||new l.default.View({});return t.useImport?f.dialog(i,e,t):h.dialog(i,e,t)};t.default=p}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e,n){function s(t,i,n){return Galaxy.modal.show({title:i,body:t,closing_events:!0,buttons:{Ok:function(){Galaxy.modal.hide()}}}),Galaxy.modal.$el.addClass("error-modal"),n&&(Galaxy.modal.$(".error-details").add(Galaxy.modal.$('button:contains("Details")')).remove(),e("
      ").addClass("error-details").hide().appendTo(Galaxy.modal.$(".modal-content")).append([e("

      ").text(p),e("

      ").text(JSON.stringify(n,null,"  "))]),e('").appendTo(Galaxy.modal.$(".buttons")).click(function(){Galaxy.modal.$(".error-details").toggle()})),Galaxy.modal}function a(e,t,i){if(e){if(e=(0,u.default)(e),t=(0,u.default)(t)||(0,u.default)("Error:"),window.Galaxy&&Galaxy.modal)return s(e,t,i);alert(t+"\n\n"+e),console.log("error details:",JSON.stringify(i))}}function o(){return a((0,u.default)("You appear to be offline. Please check your connection and try again."),(0,u.default)("Offline?"))}function l(){return a((0,u.default)("Galaxy is currently unreachable. Please try again in a few minutes.")+" "+h,(0,u.default)("Cannot connect to Galaxy"))}function r(e,t,i,n,s){return n=n||f,n+=" "+h,s=s||(0,u.default)("An error occurred"),a(n,s,d(e,t,i))}function d(e,t,i){return{raven:n.result(window.Raven,"lastEventId"),userAgent:navigator.userAgent,onLine:navigator.onLine,version:n.result(Galaxy.config,"version_major"),xhr:n.omit(t,n.functions(t)),options:n.omit(i,"xhr"),url:n.result(Galaxy.lastAjax,"url"),data:n.result(Galaxy.lastAjax,"data"),model:n.result(e,"toJSON",""+e),user:n.omit(n.result(Galaxy.user,"toJSON"),"email")}}Object.defineProperty(t,"__esModule",{value:!0});var c=i(4),u=function(e){return e&&e.__esModule?e:{default:e}}(c),h=(0,u.default)("Please contact a Galaxy administrator if the problem persists."),f=(0,u.default)("An error occurred while updating information with the server."),p=(0,u.default)("The following information can assist the developers in finding the source of the error:");t.default={errorModal:a,offlineErrorModal:o,badGatewayErrorModal:l,ajaxErrorModal:r}}).call(t,i(0),i(1))},function(e,t,i){"use strict";(function(e){function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var s=i(1),a=n(s),o=i(2),l=n(o),r=i(5),d=function(e){return e&&e.__esModule?e:{default:e}}(r),c=l.Collection.extend({initialize:function(e,t){l.Collection.prototype.initialize.call(this,e,t),this.setOrder(t.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(e){return e=this._buildFetchOptions(e),Galaxy.debug("fetch options:",e),l.Collection.prototype.fetch.call(this,e)},_buildFetchOptions:function(e){e=a.clone(e)||{};var t=this;e.traditional=!0,e.data=e.data||t._buildFetchData(e),Galaxy.debug("data:",e.data);var i=this._buildFetchFilters(e);return Galaxy.debug("filters:",i),a.isEmpty(i)||a.extend(e.data,this._fetchFiltersToAjaxData(i)),Galaxy.debug("data:",e.data),e},_buildFetchData:function(e){var t={};return this.order&&(t.order=this.order),a.defaults(a.pick(e,this._fetchParams),t)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(e){return a.clone(e.filters||{})},_fetchFiltersToAjaxData:function(e){var t={q:[],qv:[]};return a.each(e,function(e,i){void 0!==e&&""!==e&&(!0===e&&(e="True"),!1===e&&(e="False"),null===e&&(e="None"),t.q.push(i),t.qv.push(e))}),t},reset:function(e,t){return this.allFetched=!1,l.Collection.prototype.reset.call(this,e,t)},order:null,comparators:{update_time:d.default.buildComparator("update_time",{ascending:!1}),"update_time-asc":d.default.buildComparator("update_time",{ascending:!0}),create_time:d.default.buildComparator("create_time",{ascending:!1}),"create_time-asc":d.default.buildComparator("create_time",{ascending:!0})},setOrder:function(e,t){t=t||{};var i=this,n=i.comparators[e];if(a.isUndefined(n))throw new Error("unknown order: "+e);if(n!==i.comparator)return i.order=e,i.comparator=n,t.silent||i.trigger("changed-order",t),i}}),u=c.extend({limitPerPage:500,initialize:function(e,t){c.prototype.initialize.call(this,e,t),this.currentPage=t.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(e){return e=this.constrainPageNum(e),{limit:this.limitPerPage,offset:e*this.limitPerPage}},constrainPageNum:function(e){return Math.max(0,Math.min(e,this.getLastPage()))},fetchPage:function(e,t){var i=this;return e=i.constrainPageNum(e),i.currentPage=e,t=a.defaults(t||{},i.getPageLimitOffset(e)),i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")})},fetchCurrentPage:function(e){return this.fetchPage(this.currentPage,e)},fetchPrevPage:function(e){return this.fetchPage(this.currentPage-1,e)},fetchNextPage:function(e){return this.fetchPage(this.currentPage+1,e)}}),h=c.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(e,t){c.prototype.initialize.call(this,e,t),this.limitOnFirstFetch=t.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=t.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=t.lastFetched||0},_buildFetchOptions:function(e){return e.remove=e.remove||!1,c.prototype._buildFetchOptions.call(this,e)},fetchFirst:function(e){return Galaxy.debug("ControlledFetchCollection.fetchFirst:",e),e=e?a.clone(e):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.defaults(e,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(t){Galaxy.debug("ControlledFetchCollection.fetchMore:",t),t=a.clone(t||{});var i=this;if(Galaxy.debug("fetchMore, options.reset:",t.reset),!t.reset&&i.allFetched)return e.when();t.reset?t.offset=0:void 0===t.offset&&(t.offset=i.lastFetched);var n=t.limit=t.limit||i.limitPerFetch||null;return Galaxy.debug("fetchMore, limit:",n,"offset:",t.offset),i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")}).done(function(e){var t=a.isArray(e)?e.length:0;i.lastFetched+=t,Galaxy.debug("fetchMore, lastFetched:",i.lastFetched),(!n||t1?this.renderItems():1===i.added.length?this.addItemView(n.first(i.added),e,t):1===i.removed.length?this.removeItemView(n.first(i.removed),e,t):void 0}}),this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners"),this.on({"view:selected":function(e,t){if(t&&t.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);i&&this.selectRange(e,i)}else t&&t.altKey&&!this.selecting&&this.showSelectors();this.selected.push(e.model.id),this.lastSelected=e.model.id},"view:de-selected":function(e,t){this.selected=n.without(this.selected,e.model.id)}})},render:function(e){this.log(this+".render",e);var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var e=s(this.templates.el({},this));return this._renderControls(e),this._renderTitle(e),this._renderSubtitle(e),this._renderSearch(e),this.renderItems(e),e},_renderControls:function(e){this.debug(this+"(ListPanel)._renderControls");var t=s(this.templates.controls({},this));return e.find(".controls").replaceWith(t),t},_renderTitle:function(e){},_renderSubtitle:function(e){},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;i.log("_queueNewRender:",e,t),s(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",this.className).append(e.children()),this.selecting&&this.showSelectors(0),this},_setUpBehaviors:function(e){return e=e||this.$el,this.$controls(e).find("[title]").tooltip(),this._renderMultiselectActionMenu(e),this},_renderMultiselectActionMenu:function(e){e=e||this.$el;var t=e.find(".list-action-menu"),i=this.multiselectActions();if(!i.length)return t.empty();var n=s(['
      ','",'","
      "].join("")),a=i.map(function(e){var t=['
    • ',e.html,"
    • "].join("");return s(t).click(function(t){return t.preventDefault(),e.func(t)})});return n.find("ul").append(a),t.replaceWith(n),n},multiselectActions:function(){return[]},$scrollContainer:function(e){return(e||this.$el).parent().parent()},$controls:function(e){return(e||this.$el).find("> .controls")},$list:function(e){return(e||this.$el).find("> .list-items")},$messages:function(e){return(e||this.$el).find("> .controls .messages")},$emptyMessage:function(e){return(e||this.$el).find("> .empty-message")},renderItems:function(e){e=e||this.$el;var t=this;t.log(this+".renderItems",e);var i=t.$list(e);t.freeViews();var n=t._filterCollection();return t.views=n.map(function(e){return t._createItemView(e)}),i.empty(),t.views.length&&t._attachItems(e),t._renderEmptyMessage(e).toggle(!t.views.length),t.trigger("views:ready",t.views),t.views},_filterCollection:function(){var e=this;return e.collection.filter(n.bind(e._filterItem,e))},_filterItem:function(e){var t=this;return n.every(t.filters.map(function(t){return t.call(e)}))&&(!t.searchFor||e.matchesAll(t.searchFor))},_createItemView:function(e){var t=this._getItemViewClass(e),i=n.extend(this._getItemViewOptions(e),{model:e}),s=new t(i);return this._setUpItemViewListeners(s),s},_destroyItemView:function(e){this.stopListening(e),this.views=n.without(this.views,e)},_destroyItemViews:function(e){var t=this;return t.views.forEach(function(e){t.stopListening(e)}),t.views=[],t},freeViews:function(){return this._destroyItemViews()},_getItemViewClass:function(e){return this.viewClass},_getItemViewOptions:function(e){return{fxSpeed:this.fxSpeed,expanded:!1,selectable:this.selecting,selected:n.contains(this.selected,e.id),draggable:this.dragItems}},_setUpItemViewListeners:function(e){var t=this;return this.listenTo(e,"all",function(){var e=Array.prototype.slice.call(arguments,0);e[0]="view:"+e[0],t.trigger.apply(t,e)}),this.listenTo(e,"draggable:dragstart",function(e,t){var i={},n=this.getSelectedModels();i=n.length?n.toJSON():[t.model.toJSON()],e.dataTransfer.setData("text",JSON.stringify(i))},this),t},_attachItems:function(e){var t=this;return this.$list(e).append(this.views.map(function(e){return t._renderItemView$el(e)})),this},_renderItemView$el:function(e){return e.render(0).$el},_renderEmptyMessage:function(e){this.debug("_renderEmptyMessage",e,this.searchFor);var t=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(e).text(t)},expandAll:function(){n.each(this.views,function(e){e.expand()})},collapseAll:function(){n.each(this.views,function(e){e.collapse()})},addItemView:function(e,t,i){var n=this,a=n._filterCollection().indexOf(e);if(-1!==a){var o=n._createItemView(e);return s(o).queue("fx",[function(e){n.$emptyMessage().is(":visible")?n.$emptyMessage().fadeOut(n.fxSpeed,e):e()},function(e){n._attachView(o,a),e()}]),o}},_attachView:function(e,t,i){i=!!n.isUndefined(i)||i,t=t||0;var s=this;return s.views.splice(t,0,e),s._insertIntoListAt(t,s._renderItemView$el(e).hide()),s.trigger("view:attached",e),i?e.$el.slideDown(s.fxSpeed,function(){s.trigger("view:attached:rendered")}):(e.$el.show(),s.trigger("view:attached:rendered")),e},_insertIntoListAt:function(e,t){var i=this.$list();return 0===e?i.prepend(t):i.children().eq(e-1).after(t),t},removeItemView:function(e,t,i){var a=this,o=n.find(a.views,function(t){return t.model===e});if(o)return a.views=n.without(a.views,o),a.trigger("view:removed",o),s({}).queue("fx",[function(e){o.$el.fadeOut(a.fxSpeed,e)},function(e){o.remove(),a.trigger("view:removed:rendered"),a.views.length?e():a._renderEmptyMessage().fadeIn(a.fxSpeed,e)}]),o},viewFromModelId:function(e){return n.find(this.views,function(t){return t.model.id===e})},viewFromModel:function(e){return e?this.viewFromModelId(e.id):void 0},viewsWhereModel:function(e){return this.views.filter(function(t){return n.isMatch(t.model.attributes,e)})},viewRange:function(e,t){if(e===t)return e?[e]:[];var i=this.views.indexOf(e),n=this.views.indexOf(t);return-1===i||-1===n?i===n?[]:-1===i?[t]:[e]:i .controls .search-query");return i.val()!==e&&i.val(e),this},clearSearch:function(e){return this.searchFor="",this.trigger("search:clear",this),this.$("> .controls .search-query").val(""),this.renderItems(),this},THROTTLE_SELECTOR_FX_AT:20,showSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!0,this.$(".list-actions").slideDown(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,n.each(this.views,function(t){t.showSelector(e)})},hideSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!1,this.$(".list-actions").slideUp(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,n.each(this.views,function(t){t.hideSelector(e)}),this.selected=[],this.lastSelected=null},toggleSelectors:function(){this.selecting?this.hideSelectors():this.showSelectors()},selectAll:function(e){n.each(this.views,function(t){t.select(e)})},deselectAll:function(e){this.lastSelected=null,n.each(this.views,function(t){t.deselect(e)})},selectRange:function(e,t){var i=this.viewRange(e,t);return n.each(i,function(e){e.select()}),i},getSelectedViews:function(){return n.filter(this.views,function(e){return e.selected})},getSelectedModels:function(){return new this.collection.constructor(n.map(this.getSelectedViews(),function(e){return e.model}))},_showLoadingIndicator:function(e,t,i){this.debug("_showLoadingIndicator",this.indicator,e,t,i),t=void 0!==t?t:this.fxSpeed,this.indicator||(this.indicator=new d.default(this.$el),this.debug("\t created",this.indicator)),this.$el.is(":visible")?(this.$el.fadeOut(t),this.indicator.show(e,t,i)):this.indicator.show(0,i)},_hideLoadingIndicator:function(e,t){this.debug("_hideLoadingIndicator",this.indicator,e,t),e=void 0!==e?e:this.fxSpeed,this.indicator&&this.indicator.hide(e,t)},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(e,t){return t=t||0,this.$scrollContainer().animate({scrollTop:e},t),this},scrollToTop:function(e){return this.scrollTo(0,e)},scrollToItem:function(e,t){return this},scrollToId:function(e,t){return this.scrollToItem(this.viewFromModelId(e),t)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});p.prototype.templates=function(){return{el:u.default.wrapTemplate(["
      ",'
      ','
      ','
      ',"
      "]),controls:u.default.wrapTemplate(['
      ','
      ','
      <%- view.title %>
      ',"
      ",'
      <%- view.subtitle %>
      ','
      ','
      ','",'
      ','
      ','",'","
      ",'
      ',"
      ","
      ","
      "])}}();var m=p.extend({modelCollectionKey:"contents",initialize:function(e){p.prototype.initialize.call(this,e),this.selecting=void 0!==e.selecting&&e.selecting,this.setModel(this.model,e)},setModel:function(e,t){if(t=t||{},this.debug(this+".setModel:",e,t),this.freeModel(),this.freeViews(),e){var i=this.model?this.model.get("id"):null;this.model=e,this.logger&&(this.model.logger=this.logger),this._setUpModelListeners(),this.stopListening(this.collection),this.collection=this.model[this.modelCollectionKey]||t.collection||this._createDefaultCollection(),this._setUpCollectionListeners(),i&&e.get("id")!==i&&this.trigger("new-model",this)}return this},freeModel:function(){return this.model&&this.stopListening(this.model),this},_setUpModelListeners:function(){return this.log(this+"._setUpModelListeners",this.model),this.listenTo(this.model,"error",function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("error"),this.trigger.apply(this,e)},this),this.logger&&this.listenTo(this.model,"all",function(e){this.info(this+"(model)",e,arguments)}),this},_renderControls:function(e){this.debug(this+"(ModelListPanel)._renderControls");var t=this.model?this.model.toJSON():{},i=s(this.templates.controls(t,this));return e.find(".controls").replaceWith(i),i},toString:function(){return"ModelListPanel("+this.model+")"}});m.prototype.templates=function(){var e=u.default.wrapTemplate(['
      ','
      ','
      <%- model.name %>
      ',"
      ",'
      <%- view.subtitle %>
      ','
      ','
      ','",'
      ','
      ','",'","
      ",'
      ',"
      ","
      ","
      "]);return n.extend(n.clone(p.prototype.templates),{controls:e})}(),t.default={ListPanel:p,ModelListPanel:m}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";function n(e,t){function i(e){o(this).parent().children("input").val("").trigger("searchInput.clear").blur(),t.onclear()}function n(e,n){if(!n)return i();o(this).trigger("search.search",n),"function"==typeof t.onfirstsearch&&u?(u=!1,t.onfirstsearch(n)):t.onsearch(n)}function s(){return['"].join("")}var r=27,d=13,c=o(e),u=!0,h={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(e){},minSearchLen:0,escWillClear:!0,oninit:function(){}};return"string"===a.default.type(t)?("toggle-loading"===t&&function(){c.find(".search-loading").toggle(),c.find(".search-clear").toggle()}(),c):("object"===a.default.type(t)&&(t=a.default.extend(!0,{},h,t)),c.addClass("search-input").prepend([function(){return o(s()).focus(function(e){o(this).select()}).keyup(function(e){if(e.preventDefault(),e.stopPropagation(),e.which===r&&t.escWillClear)i.call(this,e);else{var s=o(this).val();(e.which===d||t.minSearchLen&&s.length>=t.minSearchLen)&&n.call(this,e,s)}}).val(t.initialVal)}(),function(){return o([''].join("")).tooltip({placement:"bottom"}).click(function(e){i.call(this,e)})}(),function(){return o([''].join("")).hide().tooltip({placement:"bottom"})}()]))}var s=i(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=a.default,l=window._l||function(e){return e};a.default.fn.extend({searchInput:function(e){return this.each(function(){return n(this,e)})}})},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(42),a=n(s),o=i(5),l=n(o),r=i(4),d=n(r),c=a.default.DatasetListItemView,u=c.extend({className:c.prototype.className+" history-content",initialize:function(e,t){c.prototype.initialize.call(this,e,t)},toString:function(){return"HDAListItemView("+(this.model?""+this.model:"(no model)")+")"}});u.prototype.templates=function(){var t=l.default.wrapTemplate(['
      ','','
      ','<%- dataset.hid %> ','<%- dataset.name %>',"
      ","
      ",'',"<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>","","
      "],"dataset"),i=e.extend({},c.prototype.templates.warnings,{hidden:l.default.wrapTemplate(["<% if( !dataset.visible ){ %>",'
      ',(0,d.default)("This dataset has been hidden"),"
      ","<% } %>"],"dataset")});return e.extend({},c.prototype.templates,{titleBar:t,warnings:i})}(),t.default={HDAListItemView:u}}).call(t,i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(11),a=n(s),o=i(43),l=n(o),r=i(86),d=n(r),c=i(5),u=n(c),h=i(4),f=n(h),p=l.default.DCListItemView,m=p.extend({className:p.prototype.className+" history-content",_setUpListeners:function(){p.prototype._setUpListeners.call(this),this.listenTo(this.model,{"change:tags change:populated change:visible":function(e,t){this.render()}})},_getFoldoutPanelClass:function(){switch(this.model.get("collection_type")){case"list":return d.default.ListCollectionView;case"paired":return d.default.PairCollectionView;case"list:paired":return d.default.ListOfPairsCollectionView;case"list:list":return d.default.ListOfListsCollectionView}throw new TypeError("Uknown collection_type: "+this.model.get("collection_type"))},_swapNewRender:function(e){p.prototype._swapNewRender.call(this,e);var t=this.model.get("populated")?a.default.OK:a.default.RUNNING;return this.$el.addClass("state-"+t),this.$el},toString:function(){return"HDCAListItemView("+(this.model?""+this.model:"(no model)")+")"}});m.prototype.templates=function(){var t=e.extend({},p.prototype.templates.warnings,{hidden:u.default.wrapTemplate(["<% if( !collection.visible ){ %>",'
      ',(0,f.default)("This collection has been hidden"),"
      ","<% } %>"],"collection")}),i=u.default.wrapTemplate(['
      ','','
      ','<%- collection.hid %> ','<%- collection.name %>',"
      ",'
      ','',"<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>","","
      "],"collection");return e.extend({},p.prototype.templates,{warnings:t,titleBar:i})}(),t.default={HDCAListItemView:m}}).call(t,i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(82),a=n(s),o=i(37),l=(n(o),i(43)),r=n(l),d=i(5),c=n(d),u=i(4),h=n(u),f=a.default.ModelListPanel,p=f.extend({_logNamespace:"collections",className:f.prototype.className+" dataset-collection-panel",DatasetDCEViewClass:r.default.DatasetDCEListItemView,NestedDCDCEViewClass:r.default.NestedDCDCEListItemView,modelCollectionKey:"elements",initialize:function(e){f.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,this.panelStack=[],this.parentName=e.parentName,this.foldoutStyle=e.foldoutStyle||"foldout",this.downloadUrl=Galaxy.root+"api/dataset_collections/"+this.model.attributes.id+"/download",console.log(this)},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;i.log("_queueNewRender:",e,t),i._swapNewRender(e),i.trigger("rendered",i)},_filterCollection:function(){return this.model.getVisibleContents()},_getItemViewClass:function(e){switch(e.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.NestedDCDCEViewClass}throw new TypeError("Unknown element type:",e.get("element_type"))},_getItemViewOptions:function(t){var i=f.prototype._getItemViewOptions.call(this,t);return e.extend(i,{linkTarget:this.linkTarget,hasUser:this.hasUser,foldoutStyle:this.foldoutStyle})},_setUpItemViewListeners:function(e){var t=this;return f.prototype._setUpItemViewListeners.call(t,e),t.listenTo(e,{"expanded:drilldown":function(e,t){this._expandDrilldownPanel(t)},"collapsed:drilldown":function(e,t){this._collapseDrilldownPanel(t)}}),this},_expandDrilldownPanel:function(e){this.panelStack.push(e),this.$("> .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.remove(),this.trigger("close")},toString:function(){return"CollectionView("+(this.model?this.model.get("name"):"")+")"}});p.prototype.templates=function(){var t=c.default.wrapTemplate(['
      ','",'
      ','
      <%- collection.name || collection.element_identifier %>
      ','
      ','<% if( collection.collection_type === "list" ){ %>',(0,h.default)("a list of datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',(0,h.default)("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',(0,h.default)("a list of paired datasets"),'<% } else if( collection.collection_type === "list:list" ){ %>',(0,h.default)("a list of dataset lists"),"<% } %>","
      ","
      ",'
      ','
      ','','',"","
      ","
      "],"collection");return e.extend(e.clone(f.prototype.templates),{controls:t})}();var m=p.extend({DatasetDCEViewClass:r.default.DatasetDCEListItemView,toString:function(){return"ListCollectionView("+(this.model?this.model.get("name"):"")+")"}}),g=m.extend({toString:function(){return"PairCollectionView("+(this.model?this.model.get("name"):"")+")"}}),_=p.extend({NestedDCDCEViewClass:r.default.NestedDCDCEListItemView.extend({foldoutPanelClass:g}),toString:function(){return"ListOfPairsCollectionView("+(this.model?this.model.get("name"):"")+")"}}),v=p.extend({NestedDCDCEViewClass:r.default.NestedDCDCEListItemView.extend({foldoutPanelClass:g}),toString:function(){return"ListOfListsCollectionView("+(this.model?this.model.get("name"):"")+")"}});t.default={CollectionView:p,ListCollectionView:m,PairCollectionView:g,ListOfPairsCollectionView:_,ListOfListsCollectionView:v}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(11),o=s(a),l=i(42),r=s(l),d=i(22),c=s(d),u=i(88),h=s(u),f=i(14),p=s(f),m=i(5),g=s(m),_=i(4),v=s(_),w=r.default.DatasetListItemView,y=w.extend({initialize:function(e){w.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var e=w.prototype._renderPrimaryActions.call(this);return this.model.get("state")===o.default.NOT_VIEWABLE?e:w.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){var t=this;if(this.model.get("state")===o.default.DISCARDED||!this.model.get("accessible"))return null;var i=this.model.get("purged"),n=this.model.get("deleted"),s={title:(0,v.default)("Edit attributes"),href:Galaxy.root+"datasets/edit?dataset_id="+this.model.attributes.id,faIcon:"fa-pencil",classes:"edit-btn",onclick:function(e){Galaxy.router&&(e.preventDefault(),Galaxy.router.push("datasets/edit",{dataset_id:t.model.attributes.id}))}};return n||i?(s.disabled=!0,i?s.title=(0,v.default)("Cannot edit attributes of datasets removed from disk"):n&&(s.title=(0,v.default)("Undelete dataset to edit attributes"))):e.contains([o.default.UPLOAD,o.default.NEW],this.model.get("state"))&&(s.disabled=!0,s.title=(0,v.default)("This dataset is not yet editable")),(0,p.default)(s)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return(0,p.default)({title:t?(0,v.default)("Dataset is already deleted"):(0,v.default)("Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model.delete()}})},_renderDetails:function(){var t=w.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&e.contains([o.default.OK,o.default.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderToolHelpButton:function(){var e=this.model.attributes.dataset_id,t=this.model.attributes.creating_job,i=this,s=function(t){var s='
      ';t.name&&t.help?(s+="Tool help for "+t.name+"
      ",s+=t.help):s+="Tool help is unavailable for this dataset.
      ",s+="
      ",i.$el.find(".details").append(n.parseHTML(s))},a=function(e){n.ajax({url:Galaxy.root+"api/tools/"+e.tool_id+"/build"}).done(function(e){s(e)}).fail(function(){s({})})};return null===Galaxy.user.id?null:(0,p.default)({title:(0,v.default)("Tool Help"),classes:"icon-btn",href:"#",faIcon:"fa-question",onclick:function(){i.$el.find(".toolhelp").length>0?i.$el.find(".toolhelp").toggle():n.ajax({url:Galaxy.root+"api/jobs/"+t}).done(function(e){a(e)}).fail(function(){console.log('Failed at recovering job information from the Galaxy API for job id "'+t+'".')})}})},_renderSecondaryActions:function(){var e=w.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case o.default.UPLOAD:case o.default.NOT_VIEWABLE:return e;case o.default.ERROR:return e.unshift(this._renderErrButton()),e.concat([this._renderRerunButton(),this._renderToolHelpButton()]);case o.default.OK:case o.default.FAILED_METADATA:return e.concat([this._renderRerunButton(),this._renderVisualizationsButton(),this._renderToolHelpButton()])}return e.concat([this._renderRerunButton(),this._renderToolHelpButton()])},_renderErrButton:function(){var e=this;return(0,p.default)({title:(0,v.default)("View or report this error"),href:Galaxy.root+"datasets/error?dataset_id="+this.model.attributes.id,classes:"report-error-btn",faIcon:"fa-bug",onclick:function(t){Galaxy.router&&(t.preventDefault(),Galaxy.router.push("datasets/error",{dataset_id:e.model.attributes.id}))}})},_renderRerunButton:function(){var e=this.model.get("creating_job");if(this.model.get("rerunnable"))return(0,p.default)({title:(0,v.default)("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh",onclick:function(t){Galaxy.router&&(t.preventDefault(),Galaxy.router.push("/",{job_id:e}))}})},_renderVisualizationsButton:function(){var t=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||e.isEmpty(t))return null;if(!e.isObject(t[0]))return this.warn("Visualizations have been switched off"),null;var i=n(this.templates.visualizations(t,this));return i.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(i.find(".visualization-link").addBack(".visualization-link")),i},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Visualization",url:n(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new c.default.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:(0,p.default)({title:(0,v.default)("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new h.default.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:(0,p.default)({title:(0,v.default)("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=n('?').attr("href",this.model.urls.edit).attr("target","_top");e.find(".dbkey .value").replaceWith(t)}},events:e.extend(e.clone(w.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return confirm((0,v.default)("This will permanently remove the data in your dataset. Are you sure?"))&&this.model.purge(),!1},toString:function(){return"HDAEditView("+(this.model?""+this.model:"(no model)")+")"}});y.prototype.templates=function(){var t=e.extend({},w.prototype.templates.warnings,{failed_metadata:g.default.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:g.default.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
      ',(0,v.default)("This dataset has been deleted"),'
      ',(0,v.default)("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
      ',(0,v.default)("Permanently remove it from disk"),"","<% } %>","
      ","<% } %>"],"dataset")}),i=g.default.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return e.extend({},w.prototype.templates,{warnings:t,visualizations:i})}(),t.default={DatasetListItemEdit:y}}).call(t,i(1),i(0))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(5),o=s(a),l=i(4),r=s(l);i(15);var d=e.View.extend(o.default.LoggableMixin).extend(o.default.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
      ',n.escape(e),"
      "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),e.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",""+this.model,")"].join("")}});t.default={AnnotationEditor:d}}).call(t,i(2),i(1))},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var n=i(0),s=t(n),a=i(24),o=t(a),l=i(30),r=t(l),d=i(138),c=t(d),u=i(149),h=t(u),f=i(25),p=t(f),m=i(65),g=t(m),_=i(44),v=t(_),w=i(163),y=t(w),b=i(164),x=t(b),C=i(57),$=t(C),k=i(12),S=t(k),T=i(165),D=t(T),E=i(166),P=t(E),A=i(168),M=t(A),I=i(77),L=t(I),O=i(8),V=t(O),N=i(3),H=t(N),j=i(6),G=t(j),F=i(169),U=t(F),z=i(170),R=t(z),B=s.default;window.app=function(t,i){window.Galaxy=new o.default.GalaxyApp(t,i),Galaxy.debug("analysis app");var n=r.default.extend({routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours","(/)user(/)":"show_user","(/)user(/)(:form_id)":"show_user_form","(/)workflow(/)":"show_workflows","(/)workflow/run(/)":"show_run","(/)pages(/)create(/)":"show_pages_create","(/)pages(/)edit(/)":"show_pages_edit","(/)pages(/)(:action_id)":"show_pages","(/)visualizations(/)edit(/)":"show_visualizations_edit","(/)visualizations/(:action_id)":"show_visualizations","(/)workflows/list_published(/)":"show_workflows_published","(/)histories(/)rename(/)":"show_histories_rename","(/)histories(/)permissions(/)":"show_histories_permissions","(/)histories(/)(:action_id)":"show_histories","(/)datasets(/)list(/)":"show_datasets","(/)workflow/import_workflow":"show_import_workflow","(/)custom_builds":"show_custom_builds","(/)datasets/edit":"show_dataset_edit_attributes","(/)datasets/error":"show_dataset_error"},require_login:["show_user","show_user_form","show_workflows"],authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id||-1==this.require_login.indexOf(t)},show_tours:function(e){e?$.default.giveTour(e):this.page.display(new $.default.ToursView)},show_user:function(){this.page.display(new y.default.View)},show_user_form:function(e){var t=new y.default.Model({user_id:Galaxy.params.id});this.page.display(new v.default.View(t.get(e)))},show_visualizations:function(e){this.page.display(new D.default.View({action_id:e,plural:"Visualizations",item:"visualization"}))},show_visualizations_edit:function(){this.page.display(new v.default.View({url:"visualization/edit?id="+V.default.get("id"),redirect:"visualizations/list"}))},show_workflows_published:function(){this.page.display(new S.default({url_base:Galaxy.root+"workflow/list_published",dict_format:!0}))},show_histories:function(e){this.page.display(new M.default.View({action_id:e}))},show_histories_rename:function(){this.page.display(new v.default.View({url:"history/rename?id="+V.default.get("id"),redirect:"histories/list"}))},show_histories_permissions:function(){this.page.display(new v.default.View({url:"history/permissions?id="+V.default.get("id"),redirect:"histories/list"}))},show_datasets:function(){this.page.display(new S.default({url_base:Galaxy.root+"dataset/list",dict_format:!0}))},show_pages:function(e){this.page.display(new D.default.View({action_id:e,plural:"Pages",item:"page"}))},show_pages_create:function(){this.page.display(new v.default.View({url:"page/create",redirect:"pages/list"}))},show_pages_edit:function(){this.page.display(new v.default.View({url:"page/edit?id="+V.default.get("id"),redirect:"pages/list"}))},show_workflows:function(){this.page.display(new P.default.View)},show_run:function(){this._loadWorkflow()},show_import_workflow:function(){this.page.display(new P.default.ImportWorkflowView)},show_custom_builds:function(){var e=this,t=this.page.historyPanel.historyView;if(!t||!t.model||!t.model.id)return void window.setTimeout(function(){e.show_custom_builds()},500);this.page.display(new x.default.View)},show_dataset_edit_attributes:function(){this.page.display(new R.default.View)},show_dataset_error:function(){this.page.display(new U.default.View)},home:function(e){e.tool_id||e.job_id?"upload1"===e.tool_id?(this.page.toolPanel.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(e):e.workflow_id?this._loadWorkflow():e.m_c?this._loadCenterIframe(e.m_c+"/"+e.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(e){e.id=decodeURIComponent(e.tool_id),this.page.display(new g.default.View(e))},_loadCenterIframe:function(e,t){t=t||Galaxy.root,e=t+e,this.page.$("#galaxy_main").prop("src",e)},_loadWorkflow:function(){var e=this;H.default.get({url:Galaxy.root+"api/workflows/"+H.default.getQueryString("id")+"/download?style=run",success:function(t){e.page.display(new L.default.View(t))},error:function(t){var i=t.err_msg||"Error occurred while loading the resource.",n={message:i,status:"danger",persistent:!0};e.page.display(new G.default.Message(n))}})}});B(function(){Galaxy.page=new p.default.View(e.extend(t,{Left:c.default,Right:h.default,Router:n}))})}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(64),o=s(a),l=i(139),r=s(l),d=i(4),c=s(d),u=i(77),h=(s(u),e.View.extend({initialize:function(t,i){var n=i.config;this.root=i.root,this.stored_workflow_menu_entries=n.stored_workflow_menu_entries||[];var s=new o.default.ToolSearch({hidden:!1}),a=new o.default.ToolCollection(n.toolbox);this.tool_panel=new o.default.ToolPanel({tool_search:s,tools:a,layout:n.toolbox_in_panel}),this.tool_panel_view=new o.default.ToolPanelView({model:this.tool_panel}),this.upload_button=new r.default({nginx_upload_path:n.nginx_upload_path,ftp_upload_site:n.ftp_upload_site,default_genome:n.default_genome,default_extension:n.default_extension}),Galaxy.upload=this.upload_button,this.model=new e.Model({title:(0,c.default)("Tools"),buttons:[this.upload_button]}),this.setElement(this._template())},render:function(){var e=this;this.tool_panel.get("layout").size()>0&&(this.$el.prepend(this.tool_panel_view.$el),this.tool_panel_view.render()),e.$("#internal-workflows").append(e._templateAllWorkflow({title:(0,c.default)("All workflows"),href:"workflow"})),n.each(this.stored_workflow_menu_entries,function(t){e.$("#internal-workflows").append(e._templateWorkflowLink({title:t.stored_workflow.name,href:"workflow/run?id="+t.encoded_stored_workflow_id}))})},_templateTool:function(e){return['"].join("")},_templateAllWorkflow:function(e){return['"].join("")},_templateWorkflowLink:function(e){return['"].join("")},_template:function(){return['
      ','",'
      ','
      ','
      ',"",(0,c.default)("Workflows"),"","
      ",'
      ','
      ',"
      ","
      "].join("")},toString:function(){return"toolPanel"}}));t.default=h}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(3),a=n(s),o=i(7),l=n(o),r=i(28),d=n(r),c=i(140),u=n(c),h=i(141),f=n(h),p=i(144),m=n(p),g=i(146),_=n(g);t.default=e.View.extend({options:{nginx_upload_path:"",ftp_upload_site:"n/a",default_genome:"?",default_extension:"auto",height:500,width:900,auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."}},list_extensions:[],list_genomes:[],initialize:function(e){var t=this;this.options=a.default.merge(e,this.options),this.ui_button=new u.default.View({onclick:function(e){e.preventDefault(),t.show()},onunload:function(){var e=t.ui_button.model.get("percentage",0);if(e>0&&e<100)return"Several uploads are queued."}}),this.setElement(this.ui_button.$el);var t=this;a.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(e){for(var i in e)t.list_extensions.push({id:e[i].extension,text:e[i].extension,description:e[i].description,description_url:e[i].description_url,composite_files:e[i].composite_files});t.list_extensions.sort(function(e,t){var i=e.text&&e.text.toLowerCase(),n=t.text&&t.text.toLowerCase();return i>n?1:ii.text?1:e.text0){var n={file_count:e.length,dbkey:e[0].get("genome","?"),file_type:e[0].get("extension","auto")};for(var s in e){var a=e[s];if(a.set("status","running"),!(a.get("file_size")>0)){i.error_message="Upload content incomplete.",a.set("status","error"),a.set("info",i.error_message);break}var o="files_"+s+"|";switch(n[o+"type"]="upload_dataset",n[o+"space_to_tab"]=a.get("space_to_tab")&&"Yes"||null,n[o+"to_posix_lines"]=a.get("to_posix_lines")&&"Yes"||null,n[o+"dbkey"]=a.get("genome",null),n[o+"file_type"]=a.get("extension",null),a.get("file_mode")){case"new":n[o+"url_paste"]=a.get("url_paste");break;case"ftp":n[o+"ftp_files"]=a.get("file_path");break;case"local":i.files.push({name:o+"file_data",file:a.get("file_data")})}}i.payload.inputs=JSON.stringify(n)}return i}})}).call(t,i(2))},function(e,t,i){"use strict";(function(e,i){Object.defineProperty(t,"__esModule",{value:!0});var n=e.View.extend({initialize:function(t){var n=this;this.model=t&&t.model||new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",percentage:0,status:"",onunload:function(){},onclick:function(){}}).set(t),this.setElement(this._template()),this.$progress=this.$(".progress-bar"),this.listenTo(this.model,"change",this.render,this),this.render(),i(window).on("beforeunload",function(){return n.model.get("onunload")()})},render:function(){var e=this.model.attributes;this.$el.off("click").on("click",function(t){e.onclick(t)}).tooltip({title:this.model.get("tooltip"),placement:"bottom"}),this.$progress.removeClass().addClass("progress-bar").addClass("progress-bar-notransition").addClass(""!=e.status&&"progress-bar-"+e.status).css({width:e.percentage+"%"})},_template:function(){return'
      '}});t.default={View:n}}).call(t,i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=(a(o),i(16)),r=a(l),d=i(142),c=a(d),u=i(32),h=a(u),f=i(33),p=a(f),m=i(10),g=a(m),_=i(13),v=a(_),w=i(6),y=a(w),b=i(143),x=a(b);i(34),t.default=e.View.extend({upload_size:0,collection:new r.default.Collection,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(e){var t=this;this.app=e,this.options=e.options,this.list_extensions=e.list_extensions,this.list_genomes=e.list_genomes,this.ui_button=e.ui_button,this.ftp_upload_site=e.currentFtp(),this.setElement(this._template()),this.$uploadbox=this.$(".upload-box"),this.$uploadtable=this.$(".upload-table"),this.btnLocal=new y.default.Button({id:"btn-local",title:"Choose local file",onclick:function(){t.uploadbox.select()},icon:"fa fa-laptop"}),this.btnFtp=new y.default.Button({id:"btn-ftp",title:"Choose FTP file",onclick:function(){t._eventFtp()},icon:"fa fa-folder-open-o"}),this.btnCreate=new y.default.Button({id:"btn-new",title:"Paste/Fetch data",onclick:function(){t._eventCreate()},icon:"fa fa-edit"}),this.btnStart=new y.default.Button({id:"btn-start",title:"Start",onclick:function(){t._eventStart()}}),this.btnStop=new y.default.Button({id:"btn-stop",title:"Pause",onclick:function(){t._eventStop()}}),this.btnReset=new y.default.Button({id:"btn-reset",title:"Reset",onclick:function(){t._eventReset()}}),this.btnClose=new y.default.Button({id:"btn-close",title:"Close",onclick:function(){t.app.modal.hide()}}),n.each([this.btnLocal,this.btnFtp,this.btnCreate,this.btnStop,this.btnReset,this.btnStart,this.btnClose],function(e){t.$(".upload-buttons").prepend(e.$el)}),this.uploadbox=this.$uploadbox.uploadbox({url:this.app.options.nginx_upload_path,announce:function(e,i){t._eventAnnounce(e,i)},initialize:function(e){return t.app.toData([t.collection.get(e)],t.history_id)},progress:function(e,i){t._eventProgress(e,i)},success:function(e,i){t._eventSuccess(e,i)},error:function(e,i){t._eventError(e,i)},complete:function(){t._eventComplete()},ondragover:function(){t.$uploadbox.addClass("highlight")},ondragleave:function(){t.$uploadbox.removeClass("highlight")}}),this.ftp=new g.default.View({title:"FTP files",container:this.btnFtp.$el}),this.select_extension=new v.default.View({css:"upload-footer-selection",container:this.$(".upload-footer-extension"),data:n.filter(this.list_extensions,function(e){return!e.composite_files}),value:this.options.default_extension,onchange:function(e){t._changeExtension(e)}}),this.$(".upload-footer-extension-info").on("click",function(e){new p.default({$el:s(e.target),title:t.select_extension.text(),extension:t.select_extension.value(),list:t.list_extensions,placement:"top"})}).on("mousedown",function(e){e.preventDefault()}),this.select_genome=new v.default.View({css:"upload-footer-selection",container:this.$(".upload-footer-genome"),data:this.list_genomes,value:this.options.default_genome,onchange:function(e){t._changeGenome(e)}}),this.loader=new x.default({$container:this.$uploadbox,collection:this.collection,new_content:function(e){var i=new c.default(t,{model:e});return t.$uploadtable.find("> tbody:first").append(i.$el),i.render(),i}}),this.collection.on("remove",function(e){t._eventRemove(e)}),this.render()},render:function(){var e="";e=0==this.counter.announce?this.uploadbox.compatible()?" ":"Browser does not support Drag & Drop. Try Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":0==this.counter.running?"You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":"Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",this.$(".upload-top-info").html(e);var t=0==this.counter.running&&this.counter.announce+this.counter.success+this.counter.error>0,i=0==this.counter.running&&this.counter.announce>0,n=0==this.counter.running,s=this.counter.announce+this.counter.success+this.counter.error>0;this.btnReset[t?"enable":"disable"](),this.btnStart[i?"enable":"disable"](),this.btnStart.$el[i?"addClass":"removeClass"]("btn-primary"),this.btnStop[this.counter.running>0?"enable":"disable"](),this.btnLocal[n?"enable":"disable"](),this.btnFtp[n?"enable":"disable"](),this.btnCreate[n?"enable":"disable"](),this.btnFtp.$el[this.ftp_upload_site?"show":"hide"](),this.$(".upload-table")[s?"show":"hide"](),this.$(".upload-helper")[s?"hide":"show"]()},_eventAnnounce:function(e,t){this.counter.announce++;var i=new r.default.Model({id:e,file_name:t.name,file_size:t.size,file_mode:t.mode||"local",file_path:t.path,file_data:t});this.render(),this.collection.add(i)},_eventProgress:function(e,t){var i=this.collection.get(e);i.set("percentage",t),this.ui_button.model.set("percentage",this._uploadPercentage(t,i.get("file_size")))},_eventSuccess:function(e,t){var i=this.collection.get(e);i.set({percentage:100,status:"success"}),this.ui_button.model.set("percentage",this._uploadPercentage(100,i.get("file_size"))),this.upload_completed+=100*i.get("file_size"),this.counter.announce--,this.counter.success++,this.render(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t){var i=this.collection.get(e);i.set({percentage:100,status:"error",info:t}),this.ui_button.model.set({percentage:this._uploadPercentage(100,i.get("file_size")),status:"danger"}),this.upload_completed+=100*i.get("file_size"),this.counter.announce--,this.counter.error++,this.render()},_eventComplete:function(){this.collection.each(function(e){"queued"==e.get("status")&&e.set("status","init")}),this.counter.running=0,this.render()},_eventRemove:function(e){var t=e.get("status");"success"==t?this.counter.success--:"error"==t?this.counter.error--:this.counter.announce--,this.uploadbox.remove(e.id),this.render()},_eventFtp:function(){if(this.ftp.visible)this.ftp.hide();else{this.ftp.empty();var e=this;this.ftp.append(new h.default({collection:this.collection,ftp_upload_site:this.ftp_upload_site,onadd:function(t){return e.uploadbox.add([{mode:"ftp",name:t.path,size:t.size,path:t.path}])},onremove:function(t){e.collection.remove(t)}}).$el),this.ftp.show()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(0!=this.counter.announce&&0==this.counter.running){var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){"init"==t.get("status")&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.model.set({percentage:0,status:"success"}),this.counter.running=this.counter.announce,this.history_id=this.app.currentHistory(),this._uploadFtp(),this.uploadbox.start(),this.render()}},_eventStop:function(){this.counter.running>0&&(this.ui_button.model.set("status","info"),s(".upload-top-info").html("Queue will pause after completing the current file..."),this.uploadbox.stop())},_eventReset:function(){if(0==this.counter.running){this.collection.reset(),this.counter.reset(),this.uploadbox.reset(),this.select_extension.value(this.options.default_extension),this.select_genome.value(this.options.default_genome),this.ui_button.model.set("percentage",0),this.render()}},_changeExtension:function(e,t){var i=this;this.collection.each(function(n){"init"!=n.get("status")||n.get("extension")!=i.options.default_extension&&t||n.set("extension",e)})},_changeGenome:function(e,t){var i=this;this.collection.each(function(n){"init"!=n.get("status")||n.get("genome")!=i.options.default_genome&&t||n.set("genome",e)})},_uploadFtp:function(){var e=this,t=[];this.collection.each(function(i){"queued"==i.get("status")&&"ftp"==i.get("file_mode")&&(e.uploadbox.remove(i.id),t.push(i))}),t.length>0&&s.uploadpost({data:this.app.toData(t),url:this.app.options.nginx_upload_path,success:function(i){n.each(t,function(t){e._eventSuccess(t.id)})},error:function(i){n.each(t,function(t){e._eventError(t.id,i)})}})},_uploadPercentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(){return'
      Drop files here
      '}})}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=a(o),r=i(16),d=(a(r),i(31)),c=a(d),u=i(10),h=a(u),f=i(13),p=a(f);t.default=e.View.extend({status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},initialize:function(e,t){var i=this;this.app=e,this.model=t.model,this.setElement(this._template(t.model)),this.$mode=this.$(".upload-mode"),this.$title=this.$(".upload-title"),this.$text=this.$(".upload-text"),this.$size=this.$(".upload-size"),this.$info_text=this.$(".upload-info-text"),this.$info_progress=this.$(".upload-info-progress"),this.$text_content=this.$(".upload-text-content"),this.$settings=this.$(".upload-settings"),this.$symbol=this.$(".upload-symbol"),this.$progress_bar=this.$(".upload-progress-bar"),this.$percentage=this.$(".upload-percentage"),this.settings=new h.default.View({title:"Upload configuration",container:this.$(".upload-settings"),placement:"bottom"});var s=this.app.select_genome.value(),a=this.app.select_extension.value();this.select_genome=new p.default.View({css:"upload-genome",data:i.app.list_genomes,container:this.$(".upload-genome"),value:s,onchange:function(e){i.model.set("genome",e)}}),this.select_extension=new p.default.View({css:"upload-extension",data:i.app.list_extensions,container:this.$(".upload-extension"),value:a,onchange:function(e){i.model.set("extension",e)}}),this.model.set({genome:s,extension:a}),this.$symbol.on("click",function(){i._removeRow()}),this.$(".upload-extension-info").on("click",function(e){i.app.showExtensionInfo({$el:n(e.target),title:i.select_extension.text(),extension:i.select_extension.value()})}).on("mousedown",function(e){e.preventDefault()}),this.$settings.on("click",function(e){i._showSettings()}).on("mousedown",function(e){e.preventDefault()}),this.$text_content.on("change input",function(e){i.model.set({url_paste:n(e.target).val(),file_size:n(e.target).val().length})}),this.listenTo(this.model,"change:percentage",function(){i._refreshPercentage()}),this.listenTo(this.model,"change:status",function(){i._refreshStatus()}),this.listenTo(this.model,"change:info",function(){i._refreshInfo()}),this.listenTo(this.model,"change:genome",function(){i._refreshGenome()}),this.listenTo(this.model,"change:extension",function(){i._refreshExtension()}),this.listenTo(this.model,"change:file_size",function(){i._refreshFileSize()})},render:function(){this._refreshType(),this._refreshPercentage(),this._refreshStatus(),this._refreshInfo(),this._refreshGenome(),this._refreshExtension(),this._refreshFileSize()},remove:function(){this.select_genome.remove(),this.select_extension.remove(),e.View.prototype.remove.apply(this)},_refreshType:function(){var e=this.model.attributes;this.$title.html(s.escape(e.file_name)),this.$size.html(l.default.bytesToString(e.file_size)),this.$mode.removeClass().addClass("upload-mode").addClass("text-primary"),"new"==e.file_mode?(this.$text.css({width:this.$el.width()-16+"px",top:this.$el.height()-8+"px"}).show(),this.$el.height(this.$el.height()-8+this.$text.height()+16),this.$mode.addClass("fa fa-edit")):"local"==e.file_mode?this.$mode.addClass("fa fa-laptop"):"ftp"==e.file_mode&&this.$mode.addClass("fa fa-folder-open-o")},_refreshExtension:function(){this.select_extension.value(this.model.get("extension"))},_refreshGenome:function(){this.select_genome.value(this.model.get("genome"))},_refreshInfo:function(){var e=this.model.get("info");e?this.$info_text.html("Failed: "+e).show():this.$info_text.hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$progress_bar.css({width:e+"%"}),this.$percentage.html(100!=e?e+"%":"Adding to history...")},_refreshStatus:function(){var e=this.model.get("status");this.$symbol.removeClass().addClass("upload-symbol").addClass(this.status_classes[e]),this.model.set("enabled","init"==e);var t=this.model.get("enabled");this.$text_content.attr("disabled",!t),t?(this.select_genome.enable(),this.select_extension.enable()):(this.select_genome.disable(),this.select_extension.disable()),"success"==e&&(this.$el.addClass("success"),this.$percentage.html("100%")),"error"==e&&(this.$el.addClass("danger"),this.$info_progress.hide())},_refreshFileSize:function(){this.$size.html(l.default.bytesToString(this.model.get("file_size")))},_removeRow:function(){-1!==["init","success","error"].indexOf(this.model.get("status"))&&this.app.collection.remove(this.model)},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append(new c.default(this).$el),this.settings.show())},_template:function(e){return'
      You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
      ",rt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Ht=/^key/,qt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ft=/^([^.]*)(?:\.(.+)|)/;lt.event={global:{},add:function(t,e,i,n,a){var s,o,r,l,h,c,u,d,f,p,g,m=Et.get(t);if(m)for(i.handler&&(s=i,i=s.handler,a=s.selector),i.guid||(i.guid=lt.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(e){return void 0!==lt&<.event.triggered!==e.type?lt.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(kt)||[""],h=e.length;h--;)r=Ft.exec(e[h])||[],f=g=r[1],p=(r[2]||"").split(".").sort(),f&&(u=lt.event.special[f]||{},f=(a?u.delegateType:u.bindType)||f,u=lt.event.special[f]||{},c=lt.extend({type:f,origType:g,data:n,handler:i,guid:i.guid,selector:a,needsContext:a&<.expr.match.needsContext.test(a),namespace:p.join(".")},s),(d=l[f])||(d=l[f]=[],d.delegateCount=0,u.setup&&!1!==u.setup.call(t,n,p,o)||t.addEventListener&&t.addEventListener(f,o)),u.add&&(u.add.call(t,c),c.handler.guid||(c.handler.guid=i.guid)),a?d.splice(d.delegateCount++,0,c):d.push(c),lt.event.global[f]=!0)},remove:function(t,e,i,n,a){var s,o,r,l,h,c,u,d,f,p,g,m=Et.hasData(t)&&Et.get(t);if(m&&(l=m.events)){for(e=(e||"").match(kt)||[""],h=e.length;h--;)if(r=Ft.exec(e[h])||[],f=g=r[1],p=(r[2]||"").split(".").sort(),f){for(u=lt.event.special[f]||{},f=(n?u.delegateType:u.bindType)||f,d=l[f]||[],r=r[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=d.length;s--;)c=d[s],!a&&g!==c.origType||i&&i.guid!==c.guid||r&&!r.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(d.splice(s,1),c.selector&&d.delegateCount--,u.remove&&u.remove.call(t,c));o&&!d.length&&(u.teardown&&!1!==u.teardown.call(t,p,m.handle)||lt.removeEvent(t,f,m.handle),delete l[f])}else for(f in l)lt.event.remove(t,f+e[h],i,n,!0);lt.isEmptyObject(l)&&Et.remove(t,"handle events")}},dispatch:function(t){t=lt.event.fix(t);var e,i,n,a,s,o=[],r=tt.call(arguments),l=(Et.get(this,"events")||{})[t.type]||[],h=lt.event.special[t.type]||{};if(r[0]=t,t.delegateTarget=this,!h.preDispatch||!1!==h.preDispatch.call(this,t)){for(o=lt.event.handlers.call(this,t,l),e=0;(a=o[e++])&&!t.isPropagationStopped();)for(t.currentTarget=a.elem,i=0;(s=a.handlers[i++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(s.namespace)||(t.handleObj=s,t.data=s.data,void 0!==(n=((lt.event.special[s.origType]||{}).handle||s.handler).apply(a.elem,r))&&!1===(t.result=n)&&(t.preventDefault(),t.stopPropagation()));return h.postDispatch&&h.postDispatch.call(this,t),t.result}},handlers:function(t,e){var i,n,a,s,o=[],r=e.delegateCount,l=t.target;if(r&&l.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==t.type)){for(n=[],i=0;i-1:lt.find(a,this,null,[l]).length),n[a]&&n.push(s);n.length&&o.push({elem:l,handlers:n})}return r]*)\/>/gi,Bt=/\s*$/g;lt.extend({htmlPrefilter:function(t){return t.replace(Vt,"<$1>")},clone:function(t,e,i){var n,a,s,o,r=t.cloneNode(!0),l=lt.contains(t.ownerDocument,t);if(!(rt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||lt.isXMLDoc(t)))for(o=p(r),s=p(t),n=0,a=s.length;n0&&g(o,!l&&p(t,"script")),r},cleanData:function(t){for(var e,i,n,a=lt.event.special,s=0;void 0!==(i=t[s]);s++)if(Tt(i)){if(e=i[Et.expando]){if(e.events)for(n in e.events)a[n]?lt.event.remove(i,n):lt.removeEvent(i,n,e.handle);i[Et.expando]=void 0}i[At.expando]&&(i[At.expando]=void 0)}}}),lt.fn.extend({domManip:T,detach:function(t){return E(this,t,!0)},remove:function(t){return E(this,t)},text:function(t){return St(this,function(t){return void 0===t?lt.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return T(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){w(this,t).appendChild(t)}})},prepend:function(){return T(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=w(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return T(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return T(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(lt.cleanData(p(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return lt.clone(this,t,e)})},html:function(t){return St(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Bt.test(t)&&!Lt[(It.exec(t)||["",""])[1].toLowerCase()]){t=lt.htmlPrefilter(t);try{for(;i1)},show:function(){return I(this,!0)},hide:function(){return I(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Pt(this)?lt(this).show():lt(this).hide()})}}),lt.Tween=N,N.prototype={constructor:N,init:function(t,e,i,n,a,s){this.elem=t,this.prop=i,this.easing=a||lt.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(lt.cssNumber[i]?"":"px")},cur:function(){var t=N.propHooks[this.prop];return t&&t.get?t.get(this):N.propHooks._default.get(this)},run:function(t){var e,i=N.propHooks[this.prop];return this.options.duration?this.pos=e=lt.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):N.propHooks._default.set(this),this}},N.prototype.init.prototype=N.prototype,N.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=lt.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){lt.fx.step[t.prop]?lt.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[lt.cssProps[t.prop]]&&!lt.cssHooks[t.prop]?t.elem[t.prop]=t.now:lt.style(t.elem,t.prop,t.now+t.unit)}}},N.propHooks.scrollTop=N.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},lt.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},lt.fx=N.prototype.init,lt.fx.step={};var oe,re,le=/^(?:toggle|show|hide)$/,he=/queueHooks$/;lt.Animation=lt.extend(V,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return f(i.elem,t,$t.exec(e),i),i}]},tweener:function(t,e){lt.isFunction(t)?(e=t,t=["*"]):t=t.match(kt);for(var i,n=0,a=t.length;n1)},removeAttr:function(t){return this.each(function(){lt.removeAttr(this,t)})}}),lt.extend({attr:function(t,e,i){var n,a,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?lt.prop(t,e,i):(1===s&<.isXMLDoc(t)||(e=e.toLowerCase(),a=lt.attrHooks[e]||(lt.expr.match.bool.test(e)?ce:void 0)),void 0!==i?null===i?void lt.removeAttr(t,e):a&&"set"in a&&void 0!==(n=a.set(t,i,e))?n:(t.setAttribute(e,i+""),i):a&&"get"in a&&null!==(n=a.get(t,e))?n:(n=lt.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!rt.radioValue&&"radio"===e&<.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n,a=0,s=e&&e.match(kt);if(s&&1===t.nodeType)for(;i=s[a++];)n=lt.propFix[i]||i,lt.expr.match.bool.test(i)&&(t[n]=!1),t.removeAttribute(i)}}),ce={set:function(t,e,i){return!1===e?lt.removeAttr(t,i):t.setAttribute(i,i),i}},lt.each(lt.expr.match.bool.source.match(/\w+/g),function(t,e){var i=ue[e]||lt.find.attr;ue[e]=function(t,e,n){var a,s;return n||(s=ue[e],ue[e]=a,a=null!=i(t,e,n)?e.toLowerCase():null,ue[e]=s),a}});var de=/^(?:input|select|textarea|button)$/i,fe=/^(?:a|area)$/i;lt.fn.extend({prop:function(t,e){return St(this,lt.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[lt.propFix[t]||t]})}}),lt.extend({prop:function(t,e,i){var n,a,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&<.isXMLDoc(t)||(e=lt.propFix[e]||e,a=lt.propHooks[e]),void 0!==i?a&&"set"in a&&void 0!==(n=a.set(t,i,e))?n:t[e]=i:a&&"get"in a&&null!==(n=a.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=lt.find.attr(t,"tabindex");return e?parseInt(e,10):de.test(t.nodeName)||fe.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),rt.optSelected||(lt.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),lt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){lt.propFix[this.toLowerCase()]=this});var pe=/[\t\r\n\f]/g;lt.fn.extend({addClass:function(t){var e,i,n,a,s,o,r,l=0;if(lt.isFunction(t))return this.each(function(e){lt(this).addClass(t.call(this,e,B(this)))});if("string"==typeof t&&t)for(e=t.match(kt)||[];i=this[l++];)if(a=B(i),n=1===i.nodeType&&(" "+a+" ").replace(pe," ")){for(o=0;s=e[o++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");r=lt.trim(n),a!==r&&i.setAttribute("class",r)}return this},removeClass:function(t){var e,i,n,a,s,o,r,l=0;if(lt.isFunction(t))return this.each(function(e){lt(this).removeClass(t.call(this,e,B(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(kt)||[];i=this[l++];)if(a=B(i),n=1===i.nodeType&&(" "+a+" ").replace(pe," ")){for(o=0;s=e[o++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");r=lt.trim(n),a!==r&&i.setAttribute("class",r)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):lt.isFunction(t)?this.each(function(i){lt(this).toggleClass(t.call(this,i,B(this),e),e)}):this.each(function(){var e,n,a,s;if("string"===i)for(n=0,a=lt(this),s=t.match(kt)||[];e=s[n++];)a.hasClass(e)?a.removeClass(e):a.addClass(e);else void 0!==t&&"boolean"!==i||(e=B(this),e&&Et.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Et.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+B(i)+" ").replace(pe," ").indexOf(e)>-1)return!0;return!1}});var ge=/\r/g,me=/[\x20\t\r\n\f]+/g;lt.fn.extend({val:function(t){var e,i,n,a=this[0];{if(arguments.length)return n=lt.isFunction(t),this.each(function(i){var a;1===this.nodeType&&(a=n?t.call(this,i,lt(this).val()):t,null==a?a="":"number"==typeof a?a+="":lt.isArray(a)&&(a=lt.map(a,function(t){return null==t?"":t+""})),(e=lt.valHooks[this.type]||lt.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,a,"value")||(this.value=a))});if(a)return(e=lt.valHooks[a.type]||lt.valHooks[a.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(a,"value"))?i:(i=a.value,"string"==typeof i?i.replace(ge,""):null==i?"":i)}}}),lt.extend({valHooks:{option:{get:function(t){var e=lt.find.attr(t,"value");return null!=e?e:lt.trim(lt.text(t)).replace(me," ")}},select:{get:function(t){for(var e,i,n=t.options,a=t.selectedIndex,s="select-one"===t.type||a<0,o=s?null:[],r=s?a+1:n.length,l=a<0?r:s?a:0;l-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),lt.each(["radio","checkbox"],function(){lt.valHooks[this]={set:function(t,e){if(lt.isArray(e))return t.checked=lt.inArray(lt(t).val(),e)>-1}},rt.checkOn||(lt.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var ve=/^(?:focusinfocus|focusoutblur)$/;lt.extend(lt.event,{trigger:function(t,e,n,a){var s,o,r,l,h,c,u,d=[n||Z],f=ot.call(t,"type")?t.type:t,p=ot.call(t,"namespace")?t.namespace.split("."):[];if(o=r=n=n||Z,3!==n.nodeType&&8!==n.nodeType&&!ve.test(f+lt.event.triggered)&&(f.indexOf(".")>-1&&(p=f.split("."),f=p.shift(),p.sort()),h=f.indexOf(":")<0&&"on"+f,t=t[lt.expando]?t:new lt.Event(f,"object"==typeof t&&t),t.isTrigger=a?2:3,t.namespace=p.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),e=null==e?[t]:lt.makeArray(e,[t]),u=lt.event.special[f]||{},a||!u.trigger||!1!==u.trigger.apply(n,e))){if(!a&&!u.noBubble&&!lt.isWindow(n)){for(l=u.delegateType||f,ve.test(l+f)||(o=o.parentNode);o;o=o.parentNode)d.push(o),r=o;r===(n.ownerDocument||Z)&&d.push(r.defaultView||r.parentWindow||i)}for(s=0;(o=d[s++])&&!t.isPropagationStopped();)t.type=s>1?l:u.bindType||f,c=(Et.get(o,"events")||{})[t.type]&&Et.get(o,"handle"),c&&c.apply(o,e),(c=h&&o[h])&&c.apply&&Tt(o)&&(t.result=c.apply(o,e),!1===t.result&&t.preventDefault());return t.type=f,a||t.isDefaultPrevented()||u._default&&!1!==u._default.apply(d.pop(),e)||!Tt(n)||h&<.isFunction(n[f])&&!lt.isWindow(n)&&(r=n[h],r&&(n[h]=null),lt.event.triggered=f,n[f](),lt.event.triggered=void 0,r&&(n[h]=r)),t.result}},simulate:function(t,e,i){var n=lt.extend(new lt.Event,i,{type:t,isSimulated:!0});lt.event.trigger(n,null,e)}}),lt.fn.extend({trigger:function(t,e){return this.each(function(){lt.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return lt.event.trigger(t,e,i,!0)}}),lt.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){lt.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),lt.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),rt.focusin="onfocusin"in i,rt.focusin||lt.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){lt.event.simulate(e,t.target,lt.event.fix(t))};lt.event.special[e]={setup:function(){var n=this.ownerDocument||this,a=Et.access(n,e);a||n.addEventListener(t,i,!0),Et.access(n,e,(a||0)+1)},teardown:function(){var n=this.ownerDocument||this,a=Et.access(n,e)-1;a?Et.access(n,e,a):(n.removeEventListener(t,i,!0),Et.remove(n,e))}}});var _e=i.location,be=lt.now(),ye=/\?/;lt.parseJSON=function(t){return JSON.parse(t+"")},lt.parseXML=function(t){var e;if(!t||"string"!=typeof t)return null;try{e=(new i.DOMParser).parseFromString(t,"text/xml")}catch(t){e=void 0}return e&&!e.getElementsByTagName("parsererror").length||lt.error("Invalid XML: "+t),e};var we=/#.*$/,xe=/([?&])_=[^&]*/,ke=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ce=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Se=/^(?:GET|HEAD)$/,Te=/^\/\//,Ee={},Ae={},Me="*/".concat("*"),Oe=Z.createElement("a");Oe.href=_e.href,lt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:_e.href,type:"GET",isLocal:Ce.test(_e.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Me,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":lt.parseJSON,"text xml":lt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?U(U(t,lt.ajaxSettings),e):U(lt.ajaxSettings,t)},ajaxPrefilter:G(Ee),ajaxTransport:G(Ae),ajax:function(t,e){function n(t,e,n,r){var h,u,_,b,w,k=e;2!==y&&(y=2,l&&i.clearTimeout(l),a=void 0,o=r||"",x.readyState=t>0?4:0,h=t>=200&&t<300||304===t,n&&(b=Y(d,x,n)),b=X(d,b,x,h),h?(d.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(lt.lastModified[s]=w),(w=x.getResponseHeader("etag"))&&(lt.etag[s]=w)),204===t||"HEAD"===d.type?k="nocontent":304===t?k="notmodified":(k=b.state,u=b.data,_=b.error,h=!_)):(_=k,!t&&k||(k="error",t<0&&(t=0))),x.status=t,x.statusText=(e||k)+"",h?g.resolveWith(f,[u,k,x]):g.rejectWith(f,[x,k,_]),x.statusCode(v),v=void 0,c&&p.trigger(h?"ajaxSuccess":"ajaxError",[x,d,h?u:_]),m.fireWith(f,[x,k]),c&&(p.trigger("ajaxComplete",[x,d]),--lt.active||lt.event.trigger("ajaxStop")))}"object"==typeof t&&(e=t,t=void 0),e=e||{};var a,s,o,r,l,h,c,u,d=lt.ajaxSetup({},e),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?lt(f):lt.event,g=lt.Deferred(),m=lt.Callbacks("once memory"),v=d.statusCode||{},_={},b={},y=0,w="canceled",x={readyState:0,getResponseHeader:function(t){var e;if(2===y){if(!r)for(r={};e=ke.exec(o);)r[e[1].toLowerCase()]=e[2];e=r[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===y?o:null},setRequestHeader:function(t,e){var i=t.toLowerCase();return y||(t=b[i]=b[i]||t,_[t]=e),this},overrideMimeType:function(t){return y||(d.mimeType=t),this},statusCode:function(t){var e;if(t)if(y<2)for(e in t)v[e]=[v[e],t[e]];else x.always(t[x.status]);return this},abort:function(t){var e=t||w;return a&&a.abort(e),n(0,e),this}};if(g.promise(x).complete=m.add,x.success=x.done,x.error=x.fail,d.url=((t||d.url||_e.href)+"").replace(we,"").replace(Te,_e.protocol+"//"),d.type=e.method||e.type||d.method||d.type,d.dataTypes=lt.trim(d.dataType||"*").toLowerCase().match(kt)||[""],null==d.crossDomain){h=Z.createElement("a");try{h.href=d.url,h.href=h.href,d.crossDomain=Oe.protocol+"//"+Oe.host!=h.protocol+"//"+h.host}catch(t){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=lt.param(d.data,d.traditional)),W(Ee,d,e,x),2===y)return x;c=lt.event&&d.global,c&&0==lt.active++&<.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Se.test(d.type),s=d.url,d.hasContent||(d.data&&(s=d.url+=(ye.test(s)?"&":"?")+d.data,delete d.data),!1===d.cache&&(d.url=xe.test(s)?s.replace(xe,"$1_="+be++):s+(ye.test(s)?"&":"?")+"_="+be++)),d.ifModified&&(lt.lastModified[s]&&x.setRequestHeader("If-Modified-Since",lt.lastModified[s]),lt.etag[s]&&x.setRequestHeader("If-None-Match",lt.etag[s])),(d.data&&d.hasContent&&!1!==d.contentType||e.contentType)&&x.setRequestHeader("Content-Type",d.contentType),x.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Me+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)x.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(!1===d.beforeSend.call(f,x,d)||2===y))return x.abort();w="abort";for(u in{success:1,error:1,complete:1})x[u](d[u]);if(a=W(Ae,d,e,x)){if(x.readyState=1,c&&p.trigger("ajaxSend",[x,d]),2===y)return x;d.async&&d.timeout>0&&(l=i.setTimeout(function(){x.abort("timeout")},d.timeout));try{y=1,a.send(_,n)}catch(t){if(!(y<2))throw t;n(-1,t)}}else n(-1,"No Transport");return x},getJSON:function(t,e,i){return lt.get(t,e,i,"json")},getScript:function(t,e){return lt.get(t,void 0,e,"script")}}),lt.each(["get","post"],function(t,e){lt[e]=function(t,i,n,a){return lt.isFunction(i)&&(a=a||n,n=i,i=void 0),lt.ajax(lt.extend({url:t,type:e,dataType:a,data:i,success:n},lt.isPlainObject(t)&&t))}}),lt._evalUrl=function(t){return lt.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},lt.fn.extend({wrapAll:function(t){var e;return lt.isFunction(t)?this.each(function(e){lt(this).wrapAll(t.call(this,e))}):(this[0]&&(e=lt(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return lt.isFunction(t)?this.each(function(e){lt(this).wrapInner(t.call(this,e))}):this.each(function(){var e=lt(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=lt.isFunction(t);return this.each(function(i){lt(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){lt.nodeName(this,"body")||lt(this).replaceWith(this.childNodes)}).end()}}),lt.expr.filters.hidden=function(t){return!lt.expr.filters.visible(t)},lt.expr.filters.visible=function(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0};var Re=/%20/g,$e=/\[\]$/,De=/\r?\n/g,Pe=/^(?:submit|button|image|reset|file)$/i,je=/^(?:input|select|textarea|keygen)/i;lt.param=function(t,e){var i,n=[],a=function(t,e){e=lt.isFunction(e)?e():null==e?"":e,n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=lt.ajaxSettings&<.ajaxSettings.traditional),lt.isArray(t)||t.jquery&&!lt.isPlainObject(t))lt.each(t,function(){a(this.name,this.value)});else for(i in t)K(i,t[i],e,a);return n.join("&").replace(Re,"+")},lt.fn.extend({serialize:function(){return lt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=lt.prop(this,"elements");return t?lt.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!lt(this).is(":disabled")&&je.test(this.nodeName)&&!Pe.test(t)&&(this.checked||!jt.test(t))}).map(function(t,e){var i=lt(this).val();return null==i?null:lt.isArray(i)?lt.map(i,function(t){return{name:e.name,value:t.replace(De,"\r\n")}}):{name:e.name,value:i.replace(De,"\r\n")}}).get()}}),lt.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(t){}};var Ie={0:200,1223:204},Ne=lt.ajaxSettings.xhr();rt.cors=!!Ne&&"withCredentials"in Ne,rt.ajax=Ne=!!Ne,lt.ajaxTransport(function(t){var e,n;if(rt.cors||Ne&&!t.crossDomain)return{send:function(a,s){var o,r=t.xhr();if(r.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)r[o]=t.xhrFields[o];t.mimeType&&r.overrideMimeType&&r.overrideMimeType(t.mimeType),t.crossDomain||a["X-Requested-With"]||(a["X-Requested-With"]="XMLHttpRequest");for(o in a)r.setRequestHeader(o,a[o]);e=function(t){return function(){e&&(e=n=r.onload=r.onerror=r.onabort=r.onreadystatechange=null,"abort"===t?r.abort():"error"===t?"number"!=typeof r.status?s(0,"error"):s(r.status,r.statusText):s(Ie[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=e(),n=r.onerror=e("error"),void 0!==r.onabort?r.onabort=n:r.onreadystatechange=function(){4===r.readyState&&i.setTimeout(function(){e&&n()})},e=e("abort");try{r.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}}),lt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return lt.globalEval(t),t}}}),lt.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),lt.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,a){e=lt("