2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/bc3f37e266b0/ Changeset: bc3f37e266b0 Branch: next-stable User: carlfeberhard Date: 2014-11-19 16:11:47+00:00 Summary: History, options menu: prevent AMD race conditions with Galaxy object by rendering options menu vars server-side Affected #: 4 files diff -r e131cfefca435532efffca4a1ce777216cda1933 -r bc3f37e266b062a23a38f016bd2f520549c826cf client/galaxy/scripts/mvc/history/options-menu.js --- a/client/galaxy/scripts/mvc/history/options-menu.js +++ b/client/galaxy/scripts/mvc/history/options-menu.js @@ -120,8 +120,7 @@ } ]; -function buildMenu( isAnon, purgeAllowed ){ - var urlRoot = Galaxy.options.root; +function buildMenu( isAnon, purgeAllowed, urlRoot ){ return _.clone( menu ).filter( function( menuOption ){ if( isAnon && !menuOption.anon ){ return false; @@ -150,11 +149,13 @@ options = options || {}; var isAnon = options.anonymous === undefined? true : options.anonymous, purgeAllowed = options.purgeAllowed || false, - menu = buildMenu( isAnon, purgeAllowed ); + root = options.root || ( ( Galaxy && Galaxy.options )? Galaxy.options.root: '/' ), + menu = buildMenu( isAnon, purgeAllowed, root ); //console.debug( 'menu:', menu ); return new PopupMenu( $button, menu ); }; + // ============================================================================ return create; }); diff -r e131cfefca435532efffca4a1ce777216cda1933 -r bc3f37e266b062a23a38f016bd2f520549c826cf static/scripts/mvc/history/options-menu.js --- a/static/scripts/mvc/history/options-menu.js +++ b/static/scripts/mvc/history/options-menu.js @@ -120,8 +120,7 @@ } ]; -function buildMenu( isAnon, purgeAllowed ){ - var urlRoot = Galaxy.options.root; +function buildMenu( isAnon, purgeAllowed, urlRoot ){ return _.clone( menu ).filter( function( menuOption ){ if( isAnon && !menuOption.anon ){ return false; @@ -150,11 +149,13 @@ options = options || {}; var isAnon = options.anonymous === undefined? true : options.anonymous, purgeAllowed = options.purgeAllowed || false, - menu = buildMenu( isAnon, purgeAllowed ); + root = options.root || ( ( Galaxy && Galaxy.options )? Galaxy.options.root: '/' ), + menu = buildMenu( isAnon, purgeAllowed, root ); //console.debug( 'menu:', menu ); return new PopupMenu( $button, menu ); }; + // ============================================================================ return create; }); diff -r e131cfefca435532efffca4a1ce777216cda1933 -r bc3f37e266b062a23a38f016bd2f520549c826cf static/scripts/packed/mvc/history/options-menu.js --- a/static/scripts/packed/mvc/history/options-menu.js +++ b/static/scripts/packed/mvc/history/options-menu.js @@ -1,1 +1,1 @@ -define(["mvc/base-mvc","utils/localization"],function(a,d){var e=[{html:d("History Lists"),header:true},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:true,anon:true},{html:d("Create New"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.createNewHistory()}}},{html:d("Copy History"),href:"history/copy"},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:true},{html:d("Collapse Expanded Datasets"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.collapseAll()}}},{html:d("Unhide Hidden Datasets"),confirm:d("Really unhide all hidden datasets?"),href:"history/unhide_datasets?current=True",anon:true},{html:d("Delete Hidden Datasets"),confirm:d("Really delete all hidden datasets?"),href:"history/delete_hidden_datasets",anon:true},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:true,anon:true},{html:d("Show Structure"),href:"history/display_structured",anon:true},{html:d("Export Citations"),href:"history/citations",anon:true},{html:d("Export to File"),href:"history/export_archive?preview=True",anon:true},{html:d("Delete"),confirm:d("Really delete the current history?"),href:"history/delete_current"},{html:d("Delete Permanently"),confirm:d("Really delete the current history permanently? This cannot be undone."),href:"history/delete_current?purge=True",purge:true,anon:true},{html:d("Other Actions"),header:true},{html:d("Import from File"),href:"history/import_archive"}];function c(h,g){var f=Galaxy.options.root;return _.clone(e).filter(function(i){if(h&&!i.anon){return false}if(!g&&i.purge){return false}if(i.href){i.href=f+i.href;i.target="galaxy_main"}if(i.confirm){i.func=function(){if(confirm(i.confirm)){galaxy_main.location=i.href}}}return true})}var b=function(h,f){f=f||{};var i=f.anonymous===undefined?true:f.anonymous,g=f.purgeAllowed||false,j=c(i,g);return new PopupMenu(h,j)};return b}); \ No newline at end of file +define(["mvc/base-mvc","utils/localization"],function(a,d){var e=[{html:d("History Lists"),header:true},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:true,anon:true},{html:d("Create New"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.createNewHistory()}}},{html:d("Copy History"),href:"history/copy"},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:true},{html:d("Collapse Expanded Datasets"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.collapseAll()}}},{html:d("Unhide Hidden Datasets"),confirm:d("Really unhide all hidden datasets?"),href:"history/unhide_datasets?current=True",anon:true},{html:d("Delete Hidden Datasets"),confirm:d("Really delete all hidden datasets?"),href:"history/delete_hidden_datasets",anon:true},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:true,anon:true},{html:d("Show Structure"),href:"history/display_structured",anon:true},{html:d("Export Citations"),href:"history/citations",anon:true},{html:d("Export to File"),href:"history/export_archive?preview=True",anon:true},{html:d("Delete"),confirm:d("Really delete the current history?"),href:"history/delete_current"},{html:d("Delete Permanently"),confirm:d("Really delete the current history permanently? This cannot be undone."),href:"history/delete_current?purge=True",purge:true,anon:true},{html:d("Other Actions"),header:true},{html:d("Import from File"),href:"history/import_archive"}];function c(h,g,f){return _.clone(e).filter(function(i){if(h&&!i.anon){return false}if(!g&&i.purge){return false}if(i.href){i.href=f+i.href;i.target="galaxy_main"}if(i.confirm){i.func=function(){if(confirm(i.confirm)){galaxy_main.location=i.href}}}return true})}var b=function(i,g){g=g||{};var j=g.anonymous===undefined?true:g.anonymous,h=g.purgeAllowed||false,f=g.root||((Galaxy&&Galaxy.options)?Galaxy.options.root:"/"),k=c(j,h,f);return new PopupMenu(i,k)};return b}); \ No newline at end of file diff -r e131cfefca435532efffca4a1ce777216cda1933 -r bc3f37e266b062a23a38f016bd2f520549c826cf templates/webapps/galaxy/root/index.mako --- a/templates/webapps/galaxy/root/index.mako +++ b/templates/webapps/galaxy/root/index.mako @@ -126,10 +126,12 @@ }); require([ 'mvc/history/options-menu' ], function( optionsMenu ){ $(function(){ + //##TODO: Galaxy is not reliably available here since index doesn't use app var popupmenu = optionsMenu( $( "#history-options-button" ), { - anonymous : Galaxy.currUser.isAnonymous(), - purgeAllowed : Galaxy.config.allow_user_dataset_purge - }); + anonymous : ${ 'true' if not trans.user else 'false' }, + purgeAllowed : ${ 'true' if trans.app.config.allow_user_dataset_purge else 'false' }, + root : '${ h.url_for( "/" ) }' + }); Galaxy.historyOptionsMenu = popupmenu; }); }); https://bitbucket.org/galaxy/galaxy-central/commits/c6cc1b485646/ Changeset: c6cc1b485646 User: carlfeberhard Date: 2014-11-19 16:12:08+00:00 Summary: Merge next-stable Affected #: 4 files diff -r 9aabb1c64eed61a0d9afd367eba6160670c9c8d3 -r c6cc1b48564682ac96ef7c5915c6f4982d8184fc client/galaxy/scripts/mvc/history/options-menu.js --- a/client/galaxy/scripts/mvc/history/options-menu.js +++ b/client/galaxy/scripts/mvc/history/options-menu.js @@ -120,8 +120,7 @@ } ]; -function buildMenu( isAnon, purgeAllowed ){ - var urlRoot = Galaxy.options.root; +function buildMenu( isAnon, purgeAllowed, urlRoot ){ return _.clone( menu ).filter( function( menuOption ){ if( isAnon && !menuOption.anon ){ return false; @@ -150,11 +149,13 @@ options = options || {}; var isAnon = options.anonymous === undefined? true : options.anonymous, purgeAllowed = options.purgeAllowed || false, - menu = buildMenu( isAnon, purgeAllowed ); + root = options.root || ( ( Galaxy && Galaxy.options )? Galaxy.options.root: '/' ), + menu = buildMenu( isAnon, purgeAllowed, root ); //console.debug( 'menu:', menu ); return new PopupMenu( $button, menu ); }; + // ============================================================================ return create; }); diff -r 9aabb1c64eed61a0d9afd367eba6160670c9c8d3 -r c6cc1b48564682ac96ef7c5915c6f4982d8184fc static/scripts/mvc/history/options-menu.js --- a/static/scripts/mvc/history/options-menu.js +++ b/static/scripts/mvc/history/options-menu.js @@ -120,8 +120,7 @@ } ]; -function buildMenu( isAnon, purgeAllowed ){ - var urlRoot = Galaxy.options.root; +function buildMenu( isAnon, purgeAllowed, urlRoot ){ return _.clone( menu ).filter( function( menuOption ){ if( isAnon && !menuOption.anon ){ return false; @@ -150,11 +149,13 @@ options = options || {}; var isAnon = options.anonymous === undefined? true : options.anonymous, purgeAllowed = options.purgeAllowed || false, - menu = buildMenu( isAnon, purgeAllowed ); + root = options.root || ( ( Galaxy && Galaxy.options )? Galaxy.options.root: '/' ), + menu = buildMenu( isAnon, purgeAllowed, root ); //console.debug( 'menu:', menu ); return new PopupMenu( $button, menu ); }; + // ============================================================================ return create; }); diff -r 9aabb1c64eed61a0d9afd367eba6160670c9c8d3 -r c6cc1b48564682ac96ef7c5915c6f4982d8184fc static/scripts/packed/mvc/history/options-menu.js --- a/static/scripts/packed/mvc/history/options-menu.js +++ b/static/scripts/packed/mvc/history/options-menu.js @@ -1,1 +1,1 @@ -define(["mvc/base-mvc","utils/localization"],function(a,d){var e=[{html:d("History Lists"),header:true},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:true,anon:true},{html:d("Create New"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.createNewHistory()}}},{html:d("Copy History"),href:"history/copy"},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:true},{html:d("Collapse Expanded Datasets"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.collapseAll()}}},{html:d("Unhide Hidden Datasets"),confirm:d("Really unhide all hidden datasets?"),href:"history/unhide_datasets?current=True",anon:true},{html:d("Delete Hidden Datasets"),confirm:d("Really delete all hidden datasets?"),href:"history/delete_hidden_datasets",anon:true},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:true,anon:true},{html:d("Show Structure"),href:"history/display_structured",anon:true},{html:d("Export Citations"),href:"history/citations",anon:true},{html:d("Export to File"),href:"history/export_archive?preview=True",anon:true},{html:d("Delete"),confirm:d("Really delete the current history?"),href:"history/delete_current"},{html:d("Delete Permanently"),confirm:d("Really delete the current history permanently? This cannot be undone."),href:"history/delete_current?purge=True",purge:true,anon:true},{html:d("Other Actions"),header:true},{html:d("Import from File"),href:"history/import_archive"}];function c(h,g){var f=Galaxy.options.root;return _.clone(e).filter(function(i){if(h&&!i.anon){return false}if(!g&&i.purge){return false}if(i.href){i.href=f+i.href;i.target="galaxy_main"}if(i.confirm){i.func=function(){if(confirm(i.confirm)){galaxy_main.location=i.href}}}return true})}var b=function(h,f){f=f||{};var i=f.anonymous===undefined?true:f.anonymous,g=f.purgeAllowed||false,j=c(i,g);return new PopupMenu(h,j)};return b}); \ No newline at end of file +define(["mvc/base-mvc","utils/localization"],function(a,d){var e=[{html:d("History Lists"),header:true},{html:d("Saved Histories"),href:"history/list"},{html:d("Histories Shared with Me"),href:"history/list_shared"},{html:d("Current History"),header:true,anon:true},{html:d("Create New"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.createNewHistory()}}},{html:d("Copy History"),href:"history/copy"},{html:d("Copy Datasets"),href:"dataset/copy_datasets"},{html:d("Share or Publish"),href:"history/sharing"},{html:d("Extract Workflow"),href:"workflow/build_from_current_history"},{html:d("Dataset Security"),href:"root/history_set_default_permissions"},{html:d("Resume Paused Jobs"),href:"history/resume_paused_jobs?current=True",anon:true},{html:d("Collapse Expanded Datasets"),func:function(){if(Galaxy&&Galaxy.currHistoryPanel){Galaxy.currHistoryPanel.collapseAll()}}},{html:d("Unhide Hidden Datasets"),confirm:d("Really unhide all hidden datasets?"),href:"history/unhide_datasets?current=True",anon:true},{html:d("Delete Hidden Datasets"),confirm:d("Really delete all hidden datasets?"),href:"history/delete_hidden_datasets",anon:true},{html:d("Purge Deleted Datasets"),confirm:d("Really delete all deleted datasets permanently? This cannot be undone."),href:"history/purge_deleted_datasets",purge:true,anon:true},{html:d("Show Structure"),href:"history/display_structured",anon:true},{html:d("Export Citations"),href:"history/citations",anon:true},{html:d("Export to File"),href:"history/export_archive?preview=True",anon:true},{html:d("Delete"),confirm:d("Really delete the current history?"),href:"history/delete_current"},{html:d("Delete Permanently"),confirm:d("Really delete the current history permanently? This cannot be undone."),href:"history/delete_current?purge=True",purge:true,anon:true},{html:d("Other Actions"),header:true},{html:d("Import from File"),href:"history/import_archive"}];function c(h,g,f){return _.clone(e).filter(function(i){if(h&&!i.anon){return false}if(!g&&i.purge){return false}if(i.href){i.href=f+i.href;i.target="galaxy_main"}if(i.confirm){i.func=function(){if(confirm(i.confirm)){galaxy_main.location=i.href}}}return true})}var b=function(i,g){g=g||{};var j=g.anonymous===undefined?true:g.anonymous,h=g.purgeAllowed||false,f=g.root||((Galaxy&&Galaxy.options)?Galaxy.options.root:"/"),k=c(j,h,f);return new PopupMenu(i,k)};return b}); \ No newline at end of file diff -r 9aabb1c64eed61a0d9afd367eba6160670c9c8d3 -r c6cc1b48564682ac96ef7c5915c6f4982d8184fc templates/webapps/galaxy/root/index.mako --- a/templates/webapps/galaxy/root/index.mako +++ b/templates/webapps/galaxy/root/index.mako @@ -126,10 +126,12 @@ }); require([ 'mvc/history/options-menu' ], function( optionsMenu ){ $(function(){ + //##TODO: Galaxy is not reliably available here since index doesn't use app var popupmenu = optionsMenu( $( "#history-options-button" ), { - anonymous : Galaxy.currUser.isAnonymous(), - purgeAllowed : Galaxy.config.allow_user_dataset_purge - }); + anonymous : ${ 'true' if not trans.user else 'false' }, + purgeAllowed : ${ 'true' if trans.app.config.allow_user_dataset_purge else 'false' }, + root : '${ h.url_for( "/" ) }' + }); Galaxy.historyOptionsMenu = popupmenu; }); }); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.