This commit is contained in:
Carl Eberhard
2015-02-17 09:54:52 -05:00
19 changed files with 194 additions and 110 deletions
@@ -25,7 +25,6 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
/** since history content is a mix, override model fn into a factory, creating based on history_content_type */
model : function( attrs, options ) {
//console.debug( 'HistoryContents.model:', attrs, options );
//TODO: can we move the type_id stuff here?
//attrs.type_id = typeIdStr( attrs );
@@ -185,16 +184,36 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
return deferred;
},
/** copy an existing, accessible hda into this collection */
copy : function( id, contentType ){
contentType = contentType || 'hda';
var type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' ),
collection = this;
isCopyable : function( contentsJSON ){
var copyableModelClasses = [
'HistoryDatasetAssociation',
'HistoryDatasetCollectionAssociation'
];
return ( ( _.isObject( contentsJSON ) && contentsJSON.id )
&& ( _.contains( copyableModelClasses, contentsJSON.model_class ) ) );
},
var xhr = jQuery.post( this.url(), {
type : type,
/** copy an existing, accessible hda into this collection */
copy : function( json ){
var id, type, contentType;
if( _.isString( json ) ){
id = json;
contentType = 'hda';
type = 'dataset';
} else {
id = json.id;
contentType = ({
'HistoryDatasetAssociation' : 'hda',
'LibraryDatasetDatasetAssociation' : 'ldda',
'HistoryDatasetCollectionAssociation' : 'hdca'
})[ json.model_class ] || 'hda';
type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' );
}
var collection = this,
xhr = jQuery.post( this.url(), {
content : id,
source : contentType,
content : id
type : type
})
.done( function( json ){
collection.add([ json ]);
@@ -69,8 +69,6 @@ var HistoryPanelEdit = _super.extend(
/** is the panel currently showing the dataset selection controls? */
this.annotationEditorShown = attributes.annotationEditorShown || false;
this.tagsEditorShown = attributes.tagsEditorShown || false;
this.multiselectActions = attributes.multiselectActions || this._getActions();
},
/** Override to handle history as drag-drop target */
@@ -210,11 +208,6 @@ var HistoryPanelEdit = _super.extend(
_super.prototype._setUpBehaviors.call( this, $where );
if( !this.model ){ return; }
// set up the pupup for actions available when multi selecting
if( this.multiselectActions.length ){
this.actionsPopup = new PopupMenu( $where.find( '.list-action-popup-btn' ), this.multiselectActions );
}
// anon users shouldn't have access to any of the following
if( ( !Galaxy.currUser || Galaxy.currUser.isAnonymous() )
|| ( Galaxy.currUser.id !== this.model.get( 'user_id' ) ) ){
@@ -245,7 +238,7 @@ var HistoryPanelEdit = _super.extend(
/** return a new popup menu for choosing a multi selection action
* ajax calls made for multiple datasets are queued
*/
_getActions : function(){
multiselectActions : function(){
var panel = this,
actions = [
{ html: _l( 'Hide datasets' ), func: function(){
@@ -7,6 +7,7 @@ define([
"mvc/collection/collection-panel",
"mvc/user/user-model",
"ui/fa-icon-button",
"mvc/ui/popup-menu",
"mvc/base-mvc",
"utils/localization",
"ui/search-input"
@@ -19,6 +20,7 @@ define([
COLLECTION_PANEL,
USER,
faIconButton,
PopupMenu,
BASE_MVC,
_l
){
@@ -302,7 +304,8 @@ var HistoryPanel = _super.extend(
/** In this override, add a btn to toggle the selectors */
_buildNewRender : function(){
var $newRender = _super.prototype._buildNewRender.call( this );
if( this.multiselectActions.length ){
//if( this.views.length && this.multiselectActions().length ){
if( this.multiselectActions().length ){
$newRender.find( '.controls .actions' ).prepend( this._renderSelectButton() );
}
return $newRender;
@@ -617,10 +620,18 @@ HistoryPanel.prototype.templates = (function(){
'<div class="actions"></div>',
'<div class="messages">',
'<% if( history.deleted ){ %>',
'<% if( history.deleted && history.purged ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been purged and deleted' ),
'</div>',
'<% } else if( history.deleted ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been deleted' ),
'</div>',
'<% } else if( history.purged ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been purged' ),
'</div>',
'<% } %>',
'<% if( history.message ){ %>',
@@ -646,8 +657,8 @@ HistoryPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
'<button class="list-action-popup-btn btn btn-default">',
_l( 'For all selected' ), '...</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
], 'history' );
@@ -353,8 +353,8 @@ var HistoryPanelColumn = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
'</a></li>',
'<% } %>',
'</ul>',
'<% } %>',
'</div>',
'</div>',
'<% } %>',
'</div>'
].join( '' ), { variable: 'data' }),
@@ -669,11 +669,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
/** set up listeners for a column and it's panel - handling: hda lazy-loading, drag and drop */
setUpColumnListeners : function setUpColumnListeners( column ){
var multipanel = this,
modelClassToSource = {
'HistoryDatasetAssociation' : 'hda',
'HistoryDatasetCollectionAssociation' : 'hdca'
};
var multipanel = this;
multipanel.listenTo( column, {
//'all': function(){ console.info( 'column ' + column + ':', arguments ) },
'in-view': multipanel.queueHdaFetch
@@ -691,20 +687,18 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
multipanel.currentColumnDropTargetOff();
},
'droptarget:drop': function( ev, data, panel ){
//note: this will bad copy sources fail silently
//note: bad copy sources fail silently
var toCopy = multipanel._dropData.filter( function( json ){
return ( ( _.isObject( json ) && json.id )
&& ( _.contains( _.keys( modelClassToSource ), json.model_class ) ) );
return panel.model.contents.isCopyable( json );
});
multipanel._dropData = null;
var queue = new ajaxQueue.NamedAjaxQueue();
toCopy.forEach( function( content ){
var contentType = modelClassToSource[ content.model_class ];
queue.add({
name : 'copy-' + content.id,
fn : function(){
return panel.model.contents.copy( content.id, contentType );
return panel.model.contents.copy( content );
}
});
});
@@ -714,7 +708,6 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
});
}
});
},
/** conv. fn to count the columns in columnMap */
+40 -14
View File
@@ -46,9 +46,6 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
/** string used for search placeholder */
searchPlaceholder : _l( 'search' ),
/** actions available for multiselected items */
multiselectActions : [],
// ......................................................................... SET UP
/** Set up the view, set up storage, bind listeners to HistoryContents events
* @param {Object} attributes optional settings for the list
@@ -103,11 +100,6 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
this.title = attributes.title || '';
this.subtitle = attributes.subtitle || '';
// allow override of multiselectActions through attributes
this.multiselectActions = attributes.multiselectActions || this.multiselectActions;
/** the popup displayed when 'for all selected...' is clicked */
this.actionsPopup = null;
this._setUpListeners();
},
@@ -288,9 +280,45 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
_setUpBehaviors : function( $where ){
$where = $where || this.$el;
$where.find( '.controls [title]' ).tooltip({ placement: 'bottom' });
// set up the pupup for actions available when multi selecting
this._renderMultiselectActionMenu( $where );
return this;
},
/** render a menu containing the actions available to sets of selected items */
_renderMultiselectActionMenu : function( $where ){
$where = $where || this.$el;
var $menu = $where.find( '.list-action-menu' ),
actions = this.multiselectActions();
if( !actions.length ){
return $menu.empty();
}
var $newMenu = $([
'<div class="list-action-menu btn-group">',
'<button class="list-action-menu-btn btn btn-default dropdown-toggle" data-toggle="dropdown">',
_l( 'For all selected' ), '...',
'</button>',
'<ul class="dropdown-menu pull-right" role="menu">', '</ul>',
'</div>'
].join(''));
var $actions = actions.map( function( action ){
var html = [ '<li><a href="javascript:void(0);">', action.html, '</a></li>' ].join( '' );
return $( html ).click( action.func );
});
$newMenu.find( 'ul' ).append( $actions );
$menu.replaceWith( $newMenu );
return $newMenu;
},
/** return a list of plain objects used to render multiselect actions menu. Each object should have:
* html: an html string used as the anchor contents
* func: a function called when the anchor is clicked (passed the click event)
*/
multiselectActions : function(){
return [];
},
// ------------------------------------------------------------------------ sub-$element shortcuts
/** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */
$scrollContainer : function(){
@@ -790,9 +818,8 @@ ListPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
//'<button class="list-action-popup-btn btn btn-default">',
// _l( 'For all selected' ), '...',
//'</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
]);
@@ -929,9 +956,8 @@ ModelListPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
//'<button class="list-action-popup-btn btn btn-default">',
// _l( 'For all selected' ), '...',
//'</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
]);
+28 -9
View File
@@ -25,7 +25,6 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
/** since history content is a mix, override model fn into a factory, creating based on history_content_type */
model : function( attrs, options ) {
//console.debug( 'HistoryContents.model:', attrs, options );
//TODO: can we move the type_id stuff here?
//attrs.type_id = typeIdStr( attrs );
@@ -185,16 +184,36 @@ var HistoryContents = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).exten
return deferred;
},
/** copy an existing, accessible hda into this collection */
copy : function( id, contentType ){
contentType = contentType || 'hda';
var type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' ),
collection = this;
isCopyable : function( contentsJSON ){
var copyableModelClasses = [
'HistoryDatasetAssociation',
'HistoryDatasetCollectionAssociation'
];
return ( ( _.isObject( contentsJSON ) && contentsJSON.id )
&& ( _.contains( copyableModelClasses, contentsJSON.model_class ) ) );
},
var xhr = jQuery.post( this.url(), {
type : type,
/** copy an existing, accessible hda into this collection */
copy : function( json ){
var id, type, contentType;
if( _.isString( json ) ){
id = json;
contentType = 'hda';
type = 'dataset';
} else {
id = json.id;
contentType = ({
'HistoryDatasetAssociation' : 'hda',
'LibraryDatasetDatasetAssociation' : 'ldda',
'HistoryDatasetCollectionAssociation' : 'hdca'
})[ json.model_class ] || 'hda';
type = ( contentType === 'hdca'? 'dataset_collection' : 'dataset' );
}
var collection = this,
xhr = jQuery.post( this.url(), {
content : id,
source : contentType,
content : id
type : type
})
.done( function( json ){
collection.add([ json ]);
@@ -69,8 +69,6 @@ var HistoryPanelEdit = _super.extend(
/** is the panel currently showing the dataset selection controls? */
this.annotationEditorShown = attributes.annotationEditorShown || false;
this.tagsEditorShown = attributes.tagsEditorShown || false;
this.multiselectActions = attributes.multiselectActions || this._getActions();
},
/** Override to handle history as drag-drop target */
@@ -210,11 +208,6 @@ var HistoryPanelEdit = _super.extend(
_super.prototype._setUpBehaviors.call( this, $where );
if( !this.model ){ return; }
// set up the pupup for actions available when multi selecting
if( this.multiselectActions.length ){
this.actionsPopup = new PopupMenu( $where.find( '.list-action-popup-btn' ), this.multiselectActions );
}
// anon users shouldn't have access to any of the following
if( ( !Galaxy.currUser || Galaxy.currUser.isAnonymous() )
|| ( Galaxy.currUser.id !== this.model.get( 'user_id' ) ) ){
@@ -245,7 +238,7 @@ var HistoryPanelEdit = _super.extend(
/** return a new popup menu for choosing a multi selection action
* ajax calls made for multiple datasets are queued
*/
_getActions : function(){
multiselectActions : function(){
var panel = this,
actions = [
{ html: _l( 'Hide datasets' ), func: function(){
+15 -4
View File
@@ -7,6 +7,7 @@ define([
"mvc/collection/collection-panel",
"mvc/user/user-model",
"ui/fa-icon-button",
"mvc/ui/popup-menu",
"mvc/base-mvc",
"utils/localization",
"ui/search-input"
@@ -19,6 +20,7 @@ define([
COLLECTION_PANEL,
USER,
faIconButton,
PopupMenu,
BASE_MVC,
_l
){
@@ -302,7 +304,8 @@ var HistoryPanel = _super.extend(
/** In this override, add a btn to toggle the selectors */
_buildNewRender : function(){
var $newRender = _super.prototype._buildNewRender.call( this );
if( this.multiselectActions.length ){
//if( this.views.length && this.multiselectActions().length ){
if( this.multiselectActions().length ){
$newRender.find( '.controls .actions' ).prepend( this._renderSelectButton() );
}
return $newRender;
@@ -617,10 +620,18 @@ HistoryPanel.prototype.templates = (function(){
'<div class="actions"></div>',
'<div class="messages">',
'<% if( history.deleted ){ %>',
'<% if( history.deleted && history.purged ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been purged and deleted' ),
'</div>',
'<% } else if( history.deleted ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been deleted' ),
'</div>',
'<% } else if( history.purged ){ %>',
'<div class="deleted-msg warningmessagesmall">',
_l( 'This history has been purged' ),
'</div>',
'<% } %>',
'<% if( history.message ){ %>',
@@ -646,8 +657,8 @@ HistoryPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
'<button class="list-action-popup-btn btn btn-default">',
_l( 'For all selected' ), '...</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
], 'history' );
+6 -13
View File
@@ -353,8 +353,8 @@ var HistoryPanelColumn = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
'</a></li>',
'<% } %>',
'</ul>',
'<% } %>',
'</div>',
'</div>',
'<% } %>',
'</div>'
].join( '' ), { variable: 'data' }),
@@ -669,11 +669,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
/** set up listeners for a column and it's panel - handling: hda lazy-loading, drag and drop */
setUpColumnListeners : function setUpColumnListeners( column ){
var multipanel = this,
modelClassToSource = {
'HistoryDatasetAssociation' : 'hda',
'HistoryDatasetCollectionAssociation' : 'hdca'
};
var multipanel = this;
multipanel.listenTo( column, {
//'all': function(){ console.info( 'column ' + column + ':', arguments ) },
'in-view': multipanel.queueHdaFetch
@@ -691,20 +687,18 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
multipanel.currentColumnDropTargetOff();
},
'droptarget:drop': function( ev, data, panel ){
//note: this will bad copy sources fail silently
//note: bad copy sources fail silently
var toCopy = multipanel._dropData.filter( function( json ){
return ( ( _.isObject( json ) && json.id )
&& ( _.contains( _.keys( modelClassToSource ), json.model_class ) ) );
return panel.model.contents.isCopyable( json );
});
multipanel._dropData = null;
var queue = new ajaxQueue.NamedAjaxQueue();
toCopy.forEach( function( content ){
var contentType = modelClassToSource[ content.model_class ];
queue.add({
name : 'copy-' + content.id,
fn : function(){
return panel.model.contents.copy( content.id, contentType );
return panel.model.contents.copy( content );
}
});
});
@@ -714,7 +708,6 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
});
}
});
},
/** conv. fn to count the columns in columnMap */
+40 -14
View File
@@ -46,9 +46,6 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
/** string used for search placeholder */
searchPlaceholder : _l( 'search' ),
/** actions available for multiselected items */
multiselectActions : [],
// ......................................................................... SET UP
/** Set up the view, set up storage, bind listeners to HistoryContents events
* @param {Object} attributes optional settings for the list
@@ -103,11 +100,6 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
this.title = attributes.title || '';
this.subtitle = attributes.subtitle || '';
// allow override of multiselectActions through attributes
this.multiselectActions = attributes.multiselectActions || this.multiselectActions;
/** the popup displayed when 'for all selected...' is clicked */
this.actionsPopup = null;
this._setUpListeners();
},
@@ -288,9 +280,45 @@ var ListPanel = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend(
_setUpBehaviors : function( $where ){
$where = $where || this.$el;
$where.find( '.controls [title]' ).tooltip({ placement: 'bottom' });
// set up the pupup for actions available when multi selecting
this._renderMultiselectActionMenu( $where );
return this;
},
/** render a menu containing the actions available to sets of selected items */
_renderMultiselectActionMenu : function( $where ){
$where = $where || this.$el;
var $menu = $where.find( '.list-action-menu' ),
actions = this.multiselectActions();
if( !actions.length ){
return $menu.empty();
}
var $newMenu = $([
'<div class="list-action-menu btn-group">',
'<button class="list-action-menu-btn btn btn-default dropdown-toggle" data-toggle="dropdown">',
_l( 'For all selected' ), '...',
'</button>',
'<ul class="dropdown-menu pull-right" role="menu">', '</ul>',
'</div>'
].join(''));
var $actions = actions.map( function( action ){
var html = [ '<li><a href="javascript:void(0);">', action.html, '</a></li>' ].join( '' );
return $( html ).click( action.func );
});
$newMenu.find( 'ul' ).append( $actions );
$menu.replaceWith( $newMenu );
return $newMenu;
},
/** return a list of plain objects used to render multiselect actions menu. Each object should have:
* html: an html string used as the anchor contents
* func: a function called when the anchor is clicked (passed the click event)
*/
multiselectActions : function(){
return [];
},
// ------------------------------------------------------------------------ sub-$element shortcuts
/** the scroll container for this panel - can be $el, $el.parent(), or grandparent depending on context */
$scrollContainer : function(){
@@ -790,9 +818,8 @@ ListPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
//'<button class="list-action-popup-btn btn btn-default">',
// _l( 'For all selected' ), '...',
//'</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
]);
@@ -929,9 +956,8 @@ ModelListPanel.prototype.templates = (function(){
'<button class="deselect-all btn btn-default"',
'data-mode="select">', _l( 'None' ), '</button>',
'</div>',
//'<button class="list-action-popup-btn btn btn-default">',
// _l( 'For all selected' ), '...',
//'</button>',
'<div class="list-action-menu btn-group">',
'</div>',
'</div>',
'</div>'
]);
@@ -1 +1 @@
define(["mvc/history/history-content-model","mvc/history/hda-model","mvc/history/hdca-model","mvc/base-mvc","utils/localization"],function(g,e,b,a,c){var f=Backbone.Collection.extend(a.LoggableMixin).extend({model:function(i,h){if(i.history_content_type==="dataset"){return new e.HistoryDatasetAssociation(i,h)}else{if(i.history_content_type==="dataset_collection"){switch(i.collection_type){case"list":return new b.HistoryListDatasetCollection(i,h);case"paired":return new b.HistoryPairDatasetCollection(i,h);case"list:paired":return new b.HistoryListPairedDatasetCollection(i,h)}throw new TypeError("Unknown collection_type: "+i.collection_type)}}throw new TypeError("Unknown history_content_type: "+i.history_content_type)},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(h){return h.get("id")})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(j){var i=!j.inReadyState();if(i){h.push(j.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,k,j){j=j||[];this.debug("checking isVisible");var i=new f(this.filter(function(l){return l.isVisible(h,k)}));_.each(j,function(l){if(!_.isFunction(l)){return}i=new f(i.filter(l))});return i},haveDetails:function(){return this.all(function(h){return h.hasDetails()})},fetchAllDetails:function(i){i=i||{};var h={details:"all"};i.data=(i.data)?(_.extend(i.data,h)):(h);return this.fetch(i)},ajaxQueue:function(m,j){var i=jQuery.Deferred(),h=this.length,l=[];if(!h){i.resolve([]);return i}var k=this.chain().reverse().map(function(o,n){return function(){var p=m.call(o,j);p.done(function(q){i.notify({curr:n,total:h,response:q,model:o})});p.always(function(q){l.push(q);if(k.length){k.shift()()}else{i.resolve(l)}})}}).value();k.shift()();return i},copy:function(l,k){k=k||"hda";var h=(k==="hdca"?"dataset_collection":"dataset"),j=this;var i=jQuery.post(this.url(),{type:h,source:k,content:l}).done(function(m){j.add([m])}).fail(function(n,m,o){j.trigger("error",j,i,{},"Error copying contents",{type:h,id:l,source:k})});return i},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){this.debug("set:",j);var i=this;j=_.map(j,function(m){var l=m.attributes||m,n=g.typeIdStr(l.history_content_type,l.id),o=i.get(n);if(!o){return m}var k=_.clone(o.attributes);_.extend(k,m);return k});Backbone.Collection.prototype.set.call(this,j,h)},promoteToHistoryDatasetCollection:function d(m,k,i){i=i||{};i.url=this.url();i.type="POST";var o=k;var l=[],h=null;if(k==="list"){this.chain().each(function(r){var p=r.attributes.name;var s=r.get("id");var q=r.attributes.history_content_type;if(q==="dataset"){if(o!=="list"){this.log("Invalid collection type")}l.push({name:p,src:"hda",id:s})}else{if(o==="list"){o="list:"+r.attributes.collection_type}else{if(o!=="list:"+r.attributes.collection_type){this.log("Invalid collection type")}}l.push({name:p,src:"hdca",id:s})}});h="New Dataset List"}else{if(k==="paired"){var j=this.ids();if(j.length!==2){}l.push({name:"forward",src:"hda",id:j[0]});l.push({name:"reverse",src:"hda",id:j[1]});h="New Dataset Pair"}}i.data={type:"dataset_collection",name:h,collection_type:o,element_identifiers:JSON.stringify(l)};var n=jQuery.ajax(i);n.done(function(r,p,q){m.refresh()});n.fail(function(r,p,q){if(r.responseJSON&&r.responseJSON.error){error=r.responseJSON.error}else{error=r.responseJSON}r.responseText=error});return n},clone:function(){var h=Backbone.Collection.prototype.clone.call(this);h.historyId=this.historyId;return h},print:function(){var h=this;h.each(function(i){h.debug(i);if(i.elements){h.debug("\t elements:",i.elements)}})},toString:function(){return(["HistoryContents(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryContents:f}});
define(["mvc/history/history-content-model","mvc/history/hda-model","mvc/history/hdca-model","mvc/base-mvc","utils/localization"],function(g,e,b,a,c){var f=Backbone.Collection.extend(a.LoggableMixin).extend({model:function(i,h){if(i.history_content_type==="dataset"){return new e.HistoryDatasetAssociation(i,h)}else{if(i.history_content_type==="dataset_collection"){switch(i.collection_type){case"list":return new b.HistoryListDatasetCollection(i,h);case"paired":return new b.HistoryPairDatasetCollection(i,h);case"list:paired":return new b.HistoryListPairedDatasetCollection(i,h)}throw new TypeError("Unknown collection_type: "+i.collection_type)}}throw new TypeError("Unknown history_content_type: "+i.history_content_type)},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(h){return h.get("id")})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(j){var i=!j.inReadyState();if(i){h.push(j.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,k,j){j=j||[];this.debug("checking isVisible");var i=new f(this.filter(function(l){return l.isVisible(h,k)}));_.each(j,function(l){if(!_.isFunction(l)){return}i=new f(i.filter(l))});return i},haveDetails:function(){return this.all(function(h){return h.hasDetails()})},fetchAllDetails:function(i){i=i||{};var h={details:"all"};i.data=(i.data)?(_.extend(i.data,h)):(h);return this.fetch(i)},ajaxQueue:function(m,j){var i=jQuery.Deferred(),h=this.length,l=[];if(!h){i.resolve([]);return i}var k=this.chain().reverse().map(function(o,n){return function(){var p=m.call(o,j);p.done(function(q){i.notify({curr:n,total:h,response:q,model:o})});p.always(function(q){l.push(q);if(k.length){k.shift()()}else{i.resolve(l)}})}}).value();k.shift()();return i},isCopyable:function(i){var h=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return((_.isObject(i)&&i.id)&&(_.contains(h,i.model_class)))},copy:function(h){var m,i,l;if(_.isString(h)){m=h;l="hda";i="dataset"}else{m=h.id;l=({HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"})[h.model_class]||"hda";i=(l==="hdca"?"dataset_collection":"dataset")}var k=this,j=jQuery.post(this.url(),{content:m,source:l,type:i}).done(function(n){k.add([n])}).fail(function(o,n,p){k.trigger("error",k,j,{},"Error copying contents",{type:i,id:m,source:l})});return j},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){this.debug("set:",j);var i=this;j=_.map(j,function(m){var l=m.attributes||m,n=g.typeIdStr(l.history_content_type,l.id),o=i.get(n);if(!o){return m}var k=_.clone(o.attributes);_.extend(k,m);return k});Backbone.Collection.prototype.set.call(this,j,h)},promoteToHistoryDatasetCollection:function d(m,k,i){i=i||{};i.url=this.url();i.type="POST";var o=k;var l=[],h=null;if(k==="list"){this.chain().each(function(r){var p=r.attributes.name;var s=r.get("id");var q=r.attributes.history_content_type;if(q==="dataset"){if(o!=="list"){this.log("Invalid collection type")}l.push({name:p,src:"hda",id:s})}else{if(o==="list"){o="list:"+r.attributes.collection_type}else{if(o!=="list:"+r.attributes.collection_type){this.log("Invalid collection type")}}l.push({name:p,src:"hdca",id:s})}});h="New Dataset List"}else{if(k==="paired"){var j=this.ids();if(j.length!==2){}l.push({name:"forward",src:"hda",id:j[0]});l.push({name:"reverse",src:"hda",id:j[1]});h="New Dataset Pair"}}i.data={type:"dataset_collection",name:h,collection_type:o,element_identifiers:JSON.stringify(l)};var n=jQuery.ajax(i);n.done(function(r,p,q){m.refresh()});n.fail(function(r,p,q){if(r.responseJSON&&r.responseJSON.error){error=r.responseJSON.error}else{error=r.responseJSON}r.responseText=error});return n},clone:function(){var h=Backbone.Collection.prototype.clone.call(this);h.historyId=this.historyId;return h},print:function(){var h=this;h.each(function(i){h.debug(i);if(i.elements){h.debug("\t elements:",i.elements)}})},toString:function(){return(["HistoryContents(",[this.historyId,this.length].join(),")"].join(""))}});return{HistoryContents:f}});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -2007,7 +2007,8 @@ div.permissionContainer{padding-left:20px}
.list-panel .controls .list-actions:after{clear:both}
.list-panel .controls .list-actions:before,.list-panel .controls .list-actions:after{content:" ";display:table;}
.list-panel .controls .list-actions:after{clear:both}
.list-panel .controls .list-actions .btn{padding-top:2px;padding-bottom:2px;font-size:90%}
.list-panel .controls .list-actions .btn{padding-top:2px;padding-bottom:2px;font-size:90%;z-index:inherit}
.list-panel .controls .list-actions .list-action-menu{float:right}.list-panel .controls .list-actions .list-action-menu .dropdown-menu{z-index:inherit}
.list-panel .list-items .list-item:not(:last-child){border-bottom-width:0px}
.list-panel .empty-message{display:none;margin:0px}
.list-item .details .list-panel{margin-top:8px;border-radius:3px;background:white;padding:4px}.list-item .details .list-panel .list-items{border:1px solid #bfbfbf;border-radius:3px}.list-item .details .list-panel .list-items .list-item:first-child{border-top-width:0px;border-radius:3px 3px 0px 0px}
@@ -2078,7 +2079,6 @@ div.permissionContainer{padding-left:20px}
.history-panel .controls .annotation-display .annotation{border-radius:3px;border:1px solid rgba(153,153,153,0.5);padding:4px;white-space:pre-wrap;overflow:auto}
.history-panel .controls .annotation-display .annotation:empty:after{position:relative;top:-4px;font-size:10px;font-style:italic;color:grey;content:'Click here to edit annotation'}
.history-panel .controls .annotation-display textarea{margin:0px 0px 2px 0px;border-radius:3px;width:100%}
.history-panel .controls .list-actions .list-action-popup-btn{float:right}
.history-panel .list-item.history-content{border-width:1px 0px 0px 0px}.history-panel .list-item.history-content:last-child{border-width:1px 0px 1px 0px}
.history-panel .empty-message{margin:0px 10px 0px 10px}
.history-panel .dataset-collection .subtitle{margin-top:2px}
-6
View File
@@ -449,12 +449,6 @@
width: 100%;
}
}
.list-actions {
.list-action-popup-btn {
float: right;
}
}
}
// display only a top border on all
+7
View File
@@ -167,6 +167,13 @@
padding-top: 2px;
padding-bottom: 2px;
font-size: 90%;
z-index: inherit;
}
.list-action-menu {
float: right;
.dropdown-menu {
z-index: inherit;
}
}
}
}
@@ -43,7 +43,6 @@ define( 'app', function(){
multipanel = new MULTI_PANEL.MultiPanelColumns({
el : $( '#center' ).get(0),
histories : histories,
//historiesJSON : historiesJSON,
order : bootstrapped.order,
currentHistoryId : '${current_history_id}'
}).render( 0 );