Add view/keys ability to history_contents.create

This allows the client to fetch the create_time for proper ordering
of history contents directly after a copy.
This commit is contained in:
carlfeberhard
2016-04-01 11:49:11 -04:00
parent 5dab37c155
commit ea921d2d7a
13 changed files with 54278 additions and 37 deletions
@@ -156,7 +156,6 @@ var DatasetAssociation = Backbone.Model
if( parsed.update_time ){
parsed.update_time = new Date( parsed.update_time );
}
console.log( 'dataset-model.parsed:', parsed );
return parsed;
},
@@ -349,7 +349,9 @@ var HistoryContents = _super.extend( BASE_MVC.LoggableMixin ).extend({
xhr = jQuery.post( this.url(), {
content : id,
source : contentType,
type : type
type : type,
view : 'detailed',
keys : 'create_time,update_time'
})
.done( function( response ){
collection.add([ response ], { parse: true });
@@ -334,6 +334,12 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
else:
message = "Invalid 'source' parameter in request %s" % source
raise exceptions.RequestParameterInvalidException(message)
# if the consumer specified keys or view, use the secondary serializer
if 'view' in kwd or 'keys' in kwd:
return self.hdca_serializer.serialize_to_view( dataset_collection_instance,
user=trans.user, trans=trans, **self._parse_serialization_params( kwd, 'detailed' ) )
return self.__collection_dict( trans, dataset_collection_instance, view="element" )
@expose_api_anonymous
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+56 -1
View File
@@ -1,2 +1,57 @@
webpackJsonp([4],[function(e,r,n){(function(e){var r=n(1),a=r,i=n(58).GalaxyApp,o=n(10),t=n(5),l=n(60);window.app=function(n,c){window.Galaxy=new i(n,c),Galaxy.debug("login app");var d=encodeURI(n.redirect);if(!n.show_welcome_with_login){var w=r.param({use_panels:"True",redirect:d});return void(window.location.href=Galaxy.root+"user/login?"+w)}var p=new l.PageLayoutView(e.extend(n,{el:"body",center:new o.CenterPanel({el:"#center"}),right:new o.RightPanel({title:t("Login required"),el:"#right"})}));a(function(){var e=r.param({redirect:d}),a=Galaxy.root+"user/login?"+e;p.render(),p.center.$("#galaxy_main").prop("src",n.welcome_url),p.right.$(".unified-panel-body").css("overflow","hidden").html('<iframe src="'+a+'" frameborder="0" style="width: 100%; height: 100%;"/>')})}}).call(r,n(3))}]);
webpackJsonp([5],[
/* 0 */
/*!**************************************!*\
!*** ./galaxy/scripts/apps/login.js ***!
\**************************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(_) {
var jQuery = __webpack_require__( /*! jquery */ 3 ),
$ = jQuery,
GalaxyApp = __webpack_require__( /*! galaxy */ 4 ).GalaxyApp,
PANEL = __webpack_require__( /*! layout/panel */ 12 ),
_l = __webpack_require__( /*! utils/localization */ 7 ),
PAGE = __webpack_require__( /*! layout/page */ 101 );
window.app = function app( options, bootstrapped ){
window.Galaxy = new GalaxyApp( options, bootstrapped );
Galaxy.debug( 'login app' );
var redirect = encodeURI( options.redirect );
// TODO: remove iframe for user login (at least) and render login page from here
// then remove this redirect
if( !options.show_welcome_with_login ){
var params = jQuery.param({ use_panels : 'True', redirect : redirect });
window.location.href = Galaxy.root + 'user/login?' + params;
return;
}
var loginPage = new PAGE.PageLayoutView( _.extend( options, {
el : 'body',
center : new PANEL.CenterPanel({ el : '#center' }),
right : new PANEL.RightPanel({
title : _l( 'Login required' ),
el : '#right'
}),
}));
$(function(){
// TODO: incorporate *actual* referrer/redirect info as the original page does
var params = jQuery.param({ redirect : redirect }),
loginUrl = Galaxy.root + 'user/login?' + params;
loginPage.render();
// welcome page (probably) needs to remain sandboxed
loginPage.center.$( '#galaxy_main' ).prop( 'src', options.welcome_url );
loginPage.right.$( '.unified-panel-body' )
.css( 'overflow', 'hidden' )
.html( '<iframe src="' + loginUrl + '" frameborder="0" style="width: 100%; height: 100%;"/>' );
});
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! underscore */ 1)))
/***/ }
]);
//# sourceMappingURL=login.bundled.js.map
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){"use strict";var d="dataset",e=b.SearchableModelMixin,f=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(e,{_logNamespace:d,defaults:{state:a.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(b,c){this.debug(this+"(Dataset).initialize",b,c),this.get("accessible")||this.set("state",a.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var a=this.get("id");if(!a)return{};var b={purge:"datasets/"+a+"/purge_async",display:"datasets/"+a+"/display/?preview=True",edit:"datasets/"+a+"/edit",download:"datasets/"+a+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+a,rerun:"tool_runner/rerun?id="+a,show_params:"datasets/"+a+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+a+"&metadata_name="};return _.each(b,function(a,c){b[c]=Galaxy.root+a}),this.urls=b,b},_setUpListeners:function(){this.on("change:state",function(a,b){this.log(this+" has changed state:",a,b),this.inReadyState()&&this.trigger("state:ready",a,b,this.previous("state"))}),this.on("change:id change:file_ext",function(){this._generateUrls()})},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);return _.extend(a,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var b=_.contains(a.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||b},hasDetails:function(){return this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(a){var b=this;return Backbone.Model.prototype.fetch.call(this,a).always(function(){b._generateUrls()})},parse:function(a,b){var c=Backbone.Model.prototype.parse.call(this,a,b);return c.create_time&&(c.create_time=new Date(c.create_time)),c.update_time&&(c.update_time=new Date(c.update_time)),console.log("dataset-model.parsed:",c),c},"delete":function(a){return this.get("deleted")?jQuery.when():this.save({deleted:!0},a)},undelete:function(a){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},a)},purge:function(a){if(this.get("purged"))return jQuery.when();a=a||{},a.url=this.urls.purge;var b=this,d=jQuery.ajax(a);return d.done(function(){b.set({deleted:!0,purged:!0})}),d.fail(function(d){var e=c("Unable to purge dataset"),f="Removal of datasets by users is not allowed in this Galaxy instance";d.responseJSON&&d.responseJSON.error?e=d.responseJSON.error:-1!==d.responseText.indexOf(f)&&(e=f),d.responseText=e,b.trigger("error",b,d,a,c(e),{error:e})}),d},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 a=this.get("id")||"";return this.get("name")&&(a='"'+this.get("name")+'",'+a),"Dataset("+a+")"}})),g=Backbone.Collection.extend(b.LoggableMixin).extend({_logNamespace:d,model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(a){return a.get("id")})},notReady:function(){return this.filter(function(a){return!a.inReadyState()})},haveDetails:function(){return this.all(function(a){return a.hasDetails()})},ajaxQueue:function(a,b){var c=jQuery.Deferred(),d=this.length,e=[];if(!d)return c.resolve([]),c;var f=this.chain().reverse().map(function(g,h){return function(){var i=a.call(g,b);i.done(function(a){c.notify({curr:h,total:d,response:a,model:g})}),i.always(function(a){e.push(a),f.length?f.shift()():c.resolve(e)})}}).value();return f.shift()(),c},matches:function(a){return this.filter(function(b){return b.matches(a)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:f,DatasetAssociationCollection:g}});
define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){"use strict";var d="dataset",e=b.SearchableModelMixin,f=Backbone.Model.extend(b.LoggableMixin).extend(b.mixin(e,{_logNamespace:d,defaults:{state:a.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(b,c){this.debug(this+"(Dataset).initialize",b,c),this.get("accessible")||this.set("state",a.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var a=this.get("id");if(!a)return{};var b={purge:"datasets/"+a+"/purge_async",display:"datasets/"+a+"/display/?preview=True",edit:"datasets/"+a+"/edit",download:"datasets/"+a+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+a,rerun:"tool_runner/rerun?id="+a,show_params:"datasets/"+a+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+a+"&metadata_name="};return _.each(b,function(a,c){b[c]=Galaxy.root+a}),this.urls=b,b},_setUpListeners:function(){this.on("change:state",function(a,b){this.log(this+" has changed state:",a,b),this.inReadyState()&&this.trigger("state:ready",a,b,this.previous("state"))}),this.on("change:id change:file_ext",function(){this._generateUrls()})},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);return _.extend(a,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var b=_.contains(a.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||b},hasDetails:function(){return this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(a){var b=this;return Backbone.Model.prototype.fetch.call(this,a).always(function(){b._generateUrls()})},parse:function(a,b){var c=Backbone.Model.prototype.parse.call(this,a,b);return c.create_time&&(c.create_time=new Date(c.create_time)),c.update_time&&(c.update_time=new Date(c.update_time)),c},"delete":function(a){return this.get("deleted")?jQuery.when():this.save({deleted:!0},a)},undelete:function(a){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},a)},purge:function(a){if(this.get("purged"))return jQuery.when();a=a||{},a.url=this.urls.purge;var b=this,d=jQuery.ajax(a);return d.done(function(){b.set({deleted:!0,purged:!0})}),d.fail(function(d){var e=c("Unable to purge dataset"),f="Removal of datasets by users is not allowed in this Galaxy instance";d.responseJSON&&d.responseJSON.error?e=d.responseJSON.error:-1!==d.responseText.indexOf(f)&&(e=f),d.responseText=e,b.trigger("error",b,d,a,c(e),{error:e})}),d},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 a=this.get("id")||"";return this.get("name")&&(a='"'+this.get("name")+'",'+a),"Dataset("+a+")"}})),g=Backbone.Collection.extend(b.LoggableMixin).extend({_logNamespace:d,model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(a){return a.get("id")})},notReady:function(){return this.filter(function(a){return!a.inReadyState()})},haveDetails:function(){return this.all(function(a){return a.hasDetails()})},ajaxQueue:function(a,b){var c=jQuery.Deferred(),d=this.length,e=[];if(!d)return c.resolve([]),c;var f=this.chain().reverse().map(function(g,h){return function(){var i=a.call(g,b);i.done(function(a){c.notify({curr:h,total:d,response:a,model:g})}),i.always(function(a){e.push(a),f.length?f.shift()():c.resolve(e)})}}).value();return f.shift()(),c},matches:function(a){return this.filter(function(b){return b.matches(a)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:f,DatasetAssociationCollection:g}});
//# sourceMappingURL=../../../maps/mvc/dataset/dataset-model.js.map
File diff suppressed because one or more lines are too long