Reimplement *old* method for unhide/delete-all-hidden using a temporary web controller endpoint.

This commit is contained in:
Dannon Baker
2017-02-20 13:53:40 -05:00
parent f155a9420a
commit ce264f9542
8 changed files with 36 additions and 28 deletions
@@ -110,17 +110,11 @@ var menu = [
html : _l( 'Unhide Hidden Datasets' ),
anon : true,
func : function() {
// TODO: Deprecate this functionality and replace with group dataset selector and action combination
if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really unhide all hidden datasets?' ) ) ){
var filtered = Galaxy.currHistoryPanel.model.contents.hidden();
//TODO: batch
filtered.ajaxQueue( Backbone.Model.prototype.save, { visible : true })
.done( function(){
Galaxy.currHistoryPanel.renderItems();
})
.fail( function(){
alert( 'There was an error unhiding the datasets' );
console.error( arguments );
});
$.post(Galaxy.root + "history/adjust_hidden",
{ 'user_action' : 'unhide' },
function(){Galaxy.currHistoryPanel.loadCurrentHistory();});
}
},
},
@@ -128,18 +122,11 @@ var menu = [
html : _l( 'Delete Hidden Datasets' ),
anon : true,
func : function() {
// TODO: Deprecate this functionality and replace with group dataset selector and action combination
if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete all hidden datasets?' ) ) ){
var filtered = Galaxy.currHistoryPanel.model.contents.hidden();
//TODO: batch
// both delete *and* unhide them
filtered.ajaxQueue( Backbone.Model.prototype.save, { deleted : true, visible: true })
.done( function(){
Galaxy.currHistoryPanel.renderItems();
})
.fail( function(){
alert( 'There was an error deleting the datasets' );
console.error( arguments );
});
$.post(Galaxy.root + "history/adjust_hidden",
{ 'user_action' : 'delete' },
function(){Galaxy.currHistoryPanel.loadCurrentHistory();});
}
},
},
+5
View File
@@ -78,6 +78,11 @@ def paste_app_factory( global_conf, **kwargs ):
# Force /history to go to view of current
webapp.add_route( '/history', controller='history', action='view' )
webapp.add_route( '/history/view/{id}', controller='history', action='view' )
# THIS IS A TEMPORARY ROUTE FOR THE 17.01 RELEASE
# This route supports the previous hide/delete-all-hidden functionality in a history.
# It will be removed after 17.01.
webapp.add_route( '/history/adjust_hidden', controller='history', action='adjust_hidden')
# Force /activate to go to the controller
webapp.add_route( '/activate', controller='user', action='activate' )
webapp.add_route( '/login', controller='root', action='login' )
@@ -826,6 +826,22 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
email=email,
send_to_err=send_to_err )
@web.expose
def adjust_hidden( self, trans, id=None, **kwd ):
""" THIS METHOD IS A TEMPORARY ADDITION. It'll allow us to fix the
regression in history-wide actions, and will be removed in the first
release after 17.01 """
action = kwd.get('user_action', None)
if action == 'delete':
for hda in trans.history.datasets:
if not hda.visible:
hda.mark_deleted()
print 'deleting hidden'
elif action == 'unhide':
trans.history.unhide_datasets()
print 'unhiding hidden'
trans.sa_session.flush()
@web.expose
@web.require_login( "share restricted histories with other users" )
def share_restricted( self, trans, id=None, email="", **kwd ):
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"options-menu.js","sources":["../../../src/mvc/history/options-menu.js"],"names":["define","PopupMenu","historyCopyDialog","BASE_MVC","_l","Webhooks","buildMenu","isAnon","purgeAllowed","urlRoot","_","clone","menu","filter","menuOption","anon","purge","href","target","confirm","func","galaxy_main","location","html","header","Galaxy","currHistoryPanel","createNewHistory","model","done","loadCurrentHistory","window","id","collapseAll","filtered","contents","hidden","ajaxQueue","Backbone","Model","prototype","save","visible","renderItems","fail","alert","console","error","arguments","deleted","add","url","async","callback","webhooks","webhooks_menu","$","each","models","index","webhook","toJSON","activate","push","config","title","length","unshift","merge","create","$button","options","undefined","anonymous","root"],"mappings":"AAAAA,QACI,oBACA,0BACA,eACA,qBACA,gBACD,SAAUC,EAAWC,EAAmBC,EAAUC,EAAIC,GAEzD,YAwMA,SAASC,GAAWC,EAAQC,EAAcC,GACtC,MAAOC,GAAEC,MAAOC,GAAOC,OAAQ,SAAUC,GACrC,MAAIP,KAAWO,EAAWC,MACf,GAENP,GAAgBM,EAAWE,OACrB,GAIPF,EAAWG,OACXH,EAAWG,KAAOR,EAAUK,EAAWG,KACvCH,EAAWI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IhE,GAA+BiE,SAAtBD,EAAQE,WAAyB,EAAOF,EAAQE,UACzDjE,EAAe+D,EAAQ/D,eAAgB,EACvCI,EAAON,EAAWC,EAAQC,EAAciB,OAAOiD,KAEnD,OAAO,IAAIzE,GAAWqE,EAAS1D,GAK/B,OAAOyD"}
{"version":3,"file":"options-menu.js","sources":["../../../src/mvc/history/options-menu.js"],"names":["define","PopupMenu","historyCopyDialog","BASE_MVC","_l","Webhooks","buildMenu","isAnon","purgeAllowed","urlRoot","_","clone","menu","filter","menuOption","anon","purge","href","target","confirm","func","galaxy_main","location","html","header","Galaxy","currHistoryPanel","createNewHistory","model","done","loadCurrentHistory","window","id","collapseAll","$","post","root","user_action","add","url","async","callback","webhooks","webhooks_menu","each","models","index","webhook","toJSON","activate","push","config","title","length","unshift","merge","create","$button","options","undefined","anonymous"],"mappings":"AAAAA,QACI,oBACA,0BACA,eACA,qBACA,gBACD,SAAUC,EAAWC,EAAmBC,EAAUC,EAAIC,GAEzD,YA2LA,SAASC,GAAWC,EAAQC,EAAcC,GACtC,MAAOC,GAAEC,MAAOC,GAAOC,OAAQ,SAAUC,GACrC,MAAIP,KAAWO,EAAWC,MACf,GAENP,GAAgBM,EAAWE,OACrB,GAIPF,EAAWG,OACXH,EAAWG,KAAOR,EAAUK,EAAWG,KACvCH,EAAWI,OAAS,eAGpBJ,EAAWK,UACXL,EAAWM,KAAO,WACVD,QAASL,EAAWK,WACpBE,YAAYC,SAAWR,EAAWG,SAIvC,KA9Mf,GAAIL,KAEIW,KAAUnB,EAAI,iBACdoB,QAAU,IAGVD,KAAUnB,EAAI,mBACda,KAAU,iBAGVM,KAAUnB,EAAI,4BACda,KAAU,wBAIVM,KAAUnB,EAAI,mBACdoB,QAAU,EACVT,MAAU,IAGVQ,KAAUnB,EAAI,cACdgB,KAAU,WACFK,QAAUA,OAAOC,kBACjBD,OAAOC,iBAAiBC,sBAKhCJ,KAAUnB,EAAI,gBACdgB,KAAU,WACNlB,EAAmBuB,OAAOC,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AAI,yBACda,KAAU,oBACVF,MAAU,IAGVQ,KAAUnB,EAAI,0BACda,KAAU,sCACVF,MAAU,IAIVQ,KAAUnB,EAAI,iBACdoB,QAAU,IAGVD,KAAUnB,EAAI,oBACda,KAAU,0BAKlBZ,GAASiC,KACLC,IAAK,gCACLC,OAAO,EACPC,SAAU,SAASC,GACf,GAAIC,KAEJT,GAAEU,KAAKF,EAASG,OAAQ,SAASC,EAAOlB,GACpC,GAAImB,GAAUnB,EAAMoB,QAChBD,GAAQE,UACRN,EAAcO,MACV3B,KAAOnB,EAAI2C,EAAQI,OAAOC,OAE1BrC,MAAO,MAKf4B,EAAcU,OAAS,IACvBV,EAAcW,SACV/B,KAASnB,EAAI,YACboB,QAAS,IAEbU,EAAEqB,MAAM3C,EAAM+B,MAgC1B,IAAIa,GAAS,SAAUC,EAASC,GAC5BA,EAAUA,KACV,IAAInD,GAA+BoD,SAAtBD,EAAQE,WAAyB,EAAOF,EAAQE,UACzDpD,EAAekD,EAAQlD,eAAgB,EACvCI,EAAON,EAAWC,EAAQC,EAAciB,OAAOW,KAEnD,OAAO,IAAInC,GAAWwD,EAAS7C,GAK/B,OAAO4C"}
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
+1 -1
View File
@@ -1,2 +1,2 @@
define(["mvc/ui/popup-menu","mvc/history/copy-dialog","mvc/base-mvc","utils/localization","mvc/webhooks"],function(a,b,c,d,e){"use strict";function f(a,b,c){return _.clone(g).filter(function(d){return a&&!d.anon?!1:!b&&d.purge?!1:(d.href&&(d.href=c+d.href,d.target="galaxy_main"),d.confirm&&(d.func=function(){confirm(d.confirm)&&(galaxy_main.location=d.href)}),!0)})}var g=[{html:d("History Lists"),header:!0},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:!0,anon:!0},{html:d("Create New"),func:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.createNewHistory()}},{html:d("Copy History"),func:function(){b(Galaxy.currHistoryPanel.model).done(function(){Galaxy.currHistoryPanel.loadCurrentHistory()})}},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Show Structure"),href:"history/display_structured",anon:!0},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Delete"),anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete the current history?"))&&(galaxy_main.window.location.href="history/delete?id="+Galaxy.currHistoryPanel.model.id)}},{html:d("Delete Permanently"),purge:!0,anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete the current history permanently? This cannot be undone."))&&(galaxy_main.window.location.href="history/delete?purge=True&id="+Galaxy.currHistoryPanel.model.id)}},{html:d("Dataset Actions"),header:!0,anon:!0},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:!0},{html:d("Collapse Expanded Datasets"),func:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.collapseAll()}},{html:d("Unhide Hidden Datasets"),anon:!0,func:function(){if(Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really unhide all hidden datasets?"))){var a=Galaxy.currHistoryPanel.model.contents.hidden();a.ajaxQueue(Backbone.Model.prototype.save,{visible:!0}).done(function(){Galaxy.currHistoryPanel.renderItems()}).fail(function(){alert("There was an error unhiding the datasets"),console.error(arguments)})}}},{html:d("Delete Hidden Datasets"),anon:!0,func:function(){if(Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete all hidden datasets?"))){var a=Galaxy.currHistoryPanel.model.contents.hidden();a.ajaxQueue(Backbone.Model.prototype.save,{deleted:!0,visible:!0}).done(function(){Galaxy.currHistoryPanel.renderItems()}).fail(function(){alert("There was an error deleting the datasets"),console.error(arguments)})}}},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:!0,anon:!0},{html:d("Downloads"),header:!0},{html:d("Export Tool Citations"),href:"history/citations",anon:!0},{html:d("Export History to File"),href:"history/export_archive?preview=True",anon:!0},{html:d("Other Actions"),header:!0},{html:d("Import from File"),href:"history/import_archive"}];e.add({url:"api/webhooks/history-menu/all",async:!1,callback:function(a){var b=[];$.each(a.models,function(a,c){var e=c.toJSON();e.activate&&b.push({html:d(e.config.title),anon:!0})}),b.length>0&&(b.unshift({html:d("Webhooks"),header:!0}),$.merge(g,b))}});var h=function(b,c){c=c||{};var d=void 0===c.anonymous?!0:c.anonymous,e=c.purgeAllowed||!1,g=f(d,e,Galaxy.root);return new a(b,g)};return h});
define(["mvc/ui/popup-menu","mvc/history/copy-dialog","mvc/base-mvc","utils/localization","mvc/webhooks"],function(a,b,c,d,e){"use strict";function f(a,b,c){return _.clone(g).filter(function(d){return a&&!d.anon?!1:!b&&d.purge?!1:(d.href&&(d.href=c+d.href,d.target="galaxy_main"),d.confirm&&(d.func=function(){confirm(d.confirm)&&(galaxy_main.location=d.href)}),!0)})}var g=[{html:d("History Lists"),header:!0},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:!0,anon:!0},{html:d("Create New"),func:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.createNewHistory()}},{html:d("Copy History"),func:function(){b(Galaxy.currHistoryPanel.model).done(function(){Galaxy.currHistoryPanel.loadCurrentHistory()})}},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Show Structure"),href:"history/display_structured",anon:!0},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Delete"),anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete the current history?"))&&(galaxy_main.window.location.href="history/delete?id="+Galaxy.currHistoryPanel.model.id)}},{html:d("Delete Permanently"),purge:!0,anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete the current history permanently? This cannot be undone."))&&(galaxy_main.window.location.href="history/delete?purge=True&id="+Galaxy.currHistoryPanel.model.id)}},{html:d("Dataset Actions"),header:!0,anon:!0},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:!0},{html:d("Collapse Expanded Datasets"),func:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.collapseAll()}},{html:d("Unhide Hidden Datasets"),anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really unhide all hidden datasets?"))&&$.post(Galaxy.root+"history/adjust_hidden",{user_action:"unhide"},function(){Galaxy.currHistoryPanel.loadCurrentHistory()})}},{html:d("Delete Hidden Datasets"),anon:!0,func:function(){Galaxy&&Galaxy.currHistoryPanel&&confirm(d("Really delete all hidden datasets?"))&&$.post(Galaxy.root+"history/adjust_hidden",{user_action:"delete"},function(){Galaxy.currHistoryPanel.loadCurrentHistory()})}},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:!0,anon:!0},{html:d("Downloads"),header:!0},{html:d("Export Tool Citations"),href:"history/citations",anon:!0},{html:d("Export History to File"),href:"history/export_archive?preview=True",anon:!0},{html:d("Other Actions"),header:!0},{html:d("Import from File"),href:"history/import_archive"}];e.add({url:"api/webhooks/history-menu/all",async:!1,callback:function(a){var b=[];$.each(a.models,function(a,c){var e=c.toJSON();e.activate&&b.push({html:d(e.config.title),anon:!0})}),b.length>0&&(b.unshift({html:d("Webhooks"),header:!0}),$.merge(g,b))}});var h=function(b,c){c=c||{};var d=void 0===c.anonymous?!0:c.anonymous,e=c.purgeAllowed||!1,g=f(d,e,Galaxy.root);return new a(b,g)};return h});
//# sourceMappingURL=../../../maps/mvc/history/options-menu.js.map