1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/088e20b3d048/ Changeset: 088e20b3d048 User: carlfeberhard Date: 2014-11-14 17:17:48+00:00 Summary: History options: render history options menu based on anonymous user and allow_user_dataset_purge, remove 'include deleted/hidden' Affected #: 7 files diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c client/galaxy/scripts/mvc/history/history-panel-edit-current.js --- a/client/galaxy/scripts/mvc/history/history-panel-edit-current.js +++ b/client/galaxy/scripts/mvc/history/history-panel-edit-current.js @@ -396,25 +396,6 @@ if( !msg.is( ':hidden' ) ){ msg.slideUp( this.fxSpeed ); } }, -//TODO: move show_deleted/hidden into panel from opt menu and remove this - /** add listeners to an external options menu (templates/webapps/galaxy/root/index.mako) */ - connectToOptionsMenu : function( optionsMenu ){ - var panel = this; - if( !optionsMenu ){ - return panel; - } - // set a visible indication in the popupmenu for show_hidden/deleted based on the currHistoryPanel's settings - this.on( 'new-storage show-deleted show-hidden', function(){ -//TODO: global - var menu = ( Galaxy && Galaxy.historyOptionsMenu )? Galaxy.historyOptionsMenu : undefined; - if( menu ){ - menu.findItemByHtml( _l( 'Include Deleted Datasets' ) ).checked = panel.showDeleted; - menu.findItemByHtml( _l( 'Include Hidden Datasets' ) ).checked = panel.showHidden; - } - }); - return this; - }, - /** Return a string rep of the history */ toString : function(){ diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c client/galaxy/scripts/mvc/history/options-menu.js --- /dev/null +++ b/client/galaxy/scripts/mvc/history/options-menu.js @@ -0,0 +1,160 @@ +define([ + "mvc/base-mvc", + "utils/localization" +], function( BASE_MVC, _l ){ +// ============================================================================ +var menu = [ + { + html : _l( 'History Lists' ), + header : true + }, + { + html : _l( 'Saved Histories' ), + href : 'history/list' + }, + { + html : _l( 'Histories Shared with Me' ), + href : 'history/list_shared' + }, + + { + html : _l( 'Current History' ), + header : true, + anon : true + }, + { + html : _l( 'Create New' ), + func : function() { + if( Galaxy && Galaxy.currHistoryPanel ){ + Galaxy.currHistoryPanel.createNewHistory(); + } + } + }, + { + html : _l( 'Copy History' ), + href : 'history/copy' + }, + { + html : _l( 'Copy Datasets' ), + href : 'dataset/copy_datasets' + }, + { + html : _l( 'Share or Publish' ), + href : 'history/sharing' + }, + { + html : _l( 'Extract Workflow' ), + href : 'workflow/build_from_current_history' + }, + { + html : _l( 'Dataset Security' ), + href : 'root/history_set_default_permissions' + }, + { + html : _l( 'Resume Paused Jobs' ), + href : 'history/resume_paused_jobs?current=True', + anon : true + }, + { + html : _l( 'Collapse Expanded Datasets' ), + func : function() { + if( Galaxy && Galaxy.currHistoryPanel ){ + Galaxy.currHistoryPanel.collapseAll(); + } + } + }, + { + html : _l( 'Unhide Hidden Datasets' ), + confirm : _l( 'Really unhide all hidden datasets?' ), + href : 'history/unhide_datasets?current=True', + anon : true + }, + { + html : _l( 'Delete Hidden Datasets' ), + confirm : _l( 'Really delete all hidden datasets?' ), + href : 'history/delete_hidden_datasets', + anon : true + }, + { + html : _l( 'Purge Deleted Datasets' ), + confirm : _l( 'Really delete all deleted datasets permanently? This cannot be undone.' ), + href : 'history/purge_deleted_datasets', + purge : true, + anon : true + }, + { + html : _l( 'Show Structure' ), + href : 'history/display_structured', + anon : true + }, + { + html : _l( 'Export Citations' ), + href : 'history/citations', + anon : true + }, + { + html : _l( 'Export to File' ), + href : 'history/export_archive?preview=True', + anon : true + }, + { + html : _l( 'Delete' ), + confirm : _l( 'Really delete the current history?' ), + href : 'history/delete_current' + }, + { + html : _l( 'Delete Permanently' ), + confirm : _l( 'Really delete the current history permanently? This cannot be undone.' ), + href : 'history/delete_current?purge=True', + purge : true, + anon : true + }, + + { + html : _l( 'Other Actions' ), + header : true + }, + { + html : _l( 'Import from File' ), + href : 'history/import_archive' + } +]; + +function buildMenu( isAnon, purgeAllowed ){ + var urlRoot = Galaxy.options.root; + return _.clone( menu ).filter( function( menuOption ){ + if( isAnon && !menuOption.anon ){ + return false; + } + if( !purgeAllowed && menuOption.purge ){ + return false; + } + + //TODO:?? hard-coded galaxy_main + if( menuOption.href ){ + menuOption.href = urlRoot + menuOption.href; + menuOption.target = 'galaxy_main'; + } + if( menuOption.confirm ){ + menuOption.func = function(){ + if( confirm( menuOption.confirm ) ){ + galaxy_main.location = menuOption.href; + } + }; + } + return true; + }); +} + +var create = function( $button, options ){ + options = options || {}; + var isAnon = options.anonymous === undefined? true : options.anonymous, + purgeAllowed = options.purgeAllowed || false, + menu = buildMenu( isAnon, purgeAllowed ); + //console.debug( 'menu:', menu ); + return new PopupMenu( $button, menu ); +}; + +// ============================================================================ + return create; +}); diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c static/scripts/mvc/history/history-panel-edit-current.js --- a/static/scripts/mvc/history/history-panel-edit-current.js +++ b/static/scripts/mvc/history/history-panel-edit-current.js @@ -396,25 +396,6 @@ if( !msg.is( ':hidden' ) ){ msg.slideUp( this.fxSpeed ); } }, -//TODO: move show_deleted/hidden into panel from opt menu and remove this - /** add listeners to an external options menu (templates/webapps/galaxy/root/index.mako) */ - connectToOptionsMenu : function( optionsMenu ){ - var panel = this; - if( !optionsMenu ){ - return panel; - } - // set a visible indication in the popupmenu for show_hidden/deleted based on the currHistoryPanel's settings - this.on( 'new-storage show-deleted show-hidden', function(){ -//TODO: global - var menu = ( Galaxy && Galaxy.historyOptionsMenu )? Galaxy.historyOptionsMenu : undefined; - if( menu ){ - menu.findItemByHtml( _l( 'Include Deleted Datasets' ) ).checked = panel.showDeleted; - menu.findItemByHtml( _l( 'Include Hidden Datasets' ) ).checked = panel.showHidden; - } - }); - return this; - }, - /** Return a string rep of the history */ toString : function(){ diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c static/scripts/mvc/history/options-menu.js --- /dev/null +++ b/static/scripts/mvc/history/options-menu.js @@ -0,0 +1,160 @@ +define([ + "mvc/base-mvc", + "utils/localization" +], function( BASE_MVC, _l ){ +// ============================================================================ +var menu = [ + { + html : _l( 'History Lists' ), + header : true + }, + { + html : _l( 'Saved Histories' ), + href : 'history/list' + }, + { + html : _l( 'Histories Shared with Me' ), + href : 'history/list_shared' + }, + + { + html : _l( 'Current History' ), + header : true, + anon : true + }, + { + html : _l( 'Create New' ), + func : function() { + if( Galaxy && Galaxy.currHistoryPanel ){ + Galaxy.currHistoryPanel.createNewHistory(); + } + } + }, + { + html : _l( 'Copy History' ), + href : 'history/copy' + }, + { + html : _l( 'Copy Datasets' ), + href : 'dataset/copy_datasets' + }, + { + html : _l( 'Share or Publish' ), + href : 'history/sharing' + }, + { + html : _l( 'Extract Workflow' ), + href : 'workflow/build_from_current_history' + }, + { + html : _l( 'Dataset Security' ), + href : 'root/history_set_default_permissions' + }, + { + html : _l( 'Resume Paused Jobs' ), + href : 'history/resume_paused_jobs?current=True', + anon : true + }, + { + html : _l( 'Collapse Expanded Datasets' ), + func : function() { + if( Galaxy && Galaxy.currHistoryPanel ){ + Galaxy.currHistoryPanel.collapseAll(); + } + } + }, + { + html : _l( 'Unhide Hidden Datasets' ), + confirm : _l( 'Really unhide all hidden datasets?' ), + href : 'history/unhide_datasets?current=True', + anon : true + }, + { + html : _l( 'Delete Hidden Datasets' ), + confirm : _l( 'Really delete all hidden datasets?' ), + href : 'history/delete_hidden_datasets', + anon : true + }, + { + html : _l( 'Purge Deleted Datasets' ), + confirm : _l( 'Really delete all deleted datasets permanently? This cannot be undone.' ), + href : 'history/purge_deleted_datasets', + purge : true, + anon : true + }, + { + html : _l( 'Show Structure' ), + href : 'history/display_structured', + anon : true + }, + { + html : _l( 'Export Citations' ), + href : 'history/citations', + anon : true + }, + { + html : _l( 'Export to File' ), + href : 'history/export_archive?preview=True', + anon : true + }, + { + html : _l( 'Delete' ), + confirm : _l( 'Really delete the current history?' ), + href : 'history/delete_current' + }, + { + html : _l( 'Delete Permanently' ), + confirm : _l( 'Really delete the current history permanently? This cannot be undone.' ), + href : 'history/delete_current?purge=True', + purge : true, + anon : true + }, + + { + html : _l( 'Other Actions' ), + header : true + }, + { + html : _l( 'Import from File' ), + href : 'history/import_archive' + } +]; + +function buildMenu( isAnon, purgeAllowed ){ + var urlRoot = Galaxy.options.root; + return _.clone( menu ).filter( function( menuOption ){ + if( isAnon && !menuOption.anon ){ + return false; + } + if( !purgeAllowed && menuOption.purge ){ + return false; + } + + //TODO:?? hard-coded galaxy_main + if( menuOption.href ){ + menuOption.href = urlRoot + menuOption.href; + menuOption.target = 'galaxy_main'; + } + if( menuOption.confirm ){ + menuOption.func = function(){ + if( confirm( menuOption.confirm ) ){ + galaxy_main.location = menuOption.href; + } + }; + } + return true; + }); +} + +var create = function( $button, options ){ + options = options || {}; + var isAnon = options.anonymous === undefined? true : options.anonymous, + purgeAllowed = options.purgeAllowed || false, + menu = buildMenu( isAnon, purgeAllowed ); + //console.debug( 'menu:', menu ); + return new PopupMenu( $button, menu ); +}; + +// ============================================================================ + return create; +}); diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c static/scripts/packed/mvc/history/history-panel-edit-current.js --- a/static/scripts/packed/mvc/history/history-panel-edit-current.js +++ b/static/scripts/packed/mvc/history/history-panel-edit-current.js @@ -1,1 +1,1 @@ -define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/collection/collection-panel","mvc/base-mvc","utils/localization"],function(d,c,a,h,b){var e=h.SessionStorageModel.extend({defaults:{tagsEditorShown:false,annotationEditorShown:false,scrollPosition:0},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});e.storageKey=function f(){return("history-panel")};var g=c.HistoryPanelEdit;var i=g.extend({className:g.prototype.className+" current-history-panel",emptyMsg:b("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:b("No matching datasets found"),HDCAViewClass:g.prototype.HDCAViewClass.extend({foldoutStyle:"drilldown"}),initialize:function(j){j=j||{};this.preferences=new e(_.extend({id:e.storageKey()},_.pick(j,_.keys(e.prototype.defaults))));g.prototype.initialize.call(this,j);this.panelStack=[];this.currentContentId=j.currentContentId||null},_setUpListeners:function(){g.prototype._setUpListeners.call(this);var j=this;this.$scrollContainer().on("scroll",function(k){if(j.$el.is(":visible")){j.preferences.set("scrollPosition",$(this).scrollTop())}});this.on("new-model",function(){j.preferences.set("scrollPosition",0)})},loadCurrentHistory:function(k){this.debug(this+".loadCurrentHistory");var j=this;return this.loadHistoryWithDetails("current",k).then(function(m,l){j.trigger("current-history",j)})},switchToHistory:function(m,l){var j=this,k=function(){return jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+m)};return this.loadHistoryWithDetails(m,l,k).then(function(o,n){j.trigger("switched-history",j)})},createNewHistory:function(l){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",b("You must be logged in to create histories"));return $.when()}var j=this,k=function(){return jQuery.getJSON(galaxy_config.root+"history/create_new_current")};return this.loadHistory(undefined,l,k).then(function(n,m){j.trigger("new-history",j)})},setModel:function(k,j,l){g.prototype.setModel.call(this,k,j,l);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpCollectionListeners:function(){g.prototype._setUpCollectionListeners.call(this);this.collection.on("state:ready",function(k,l,j){if((!k.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeItemView(k)}},this)},_setUpModelListeners:function(){g.prototype._setUpModelListeners.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}},_buildNewRender:function(){if(!this.model){return $()}var j=g.prototype._buildNewRender.call(this);j.find(".search").prependTo(j.find(".controls"));this._renderQuotaMessage(j);return j},_renderQuotaMessage:function(j){j=j||this.$el;return $(this.templates.quotaMsg({},this)).prependTo(j.find(".messages"))},_renderEmptyMessage:function(l){var k=this,j=k.$emptyMessage(l),m=$(".toolMenuContainer");if((_.isEmpty(k.views)&&!k.searchFor)&&(Galaxy&&Galaxy.upload&&m.size())){j.empty();j.html([b("This history is empty"),". ",b("You can "),'<a class="uploader-link" href="javascript:void(0)">',b("load your own data"),"</a>",b(" or "),'<a class="get-data-link" href="javascript:void(0)">',b("get data from an external source"),"</a>"].join(""));j.find(".uploader-link").click(function(n){Galaxy.upload.show(n)});j.find(".get-data-link").click(function(n){m.parent().scrollTop(0);m.find('span:contains("Get Data")').click()});return j.show()}return g.prototype._renderEmptyMessage.call(this,l)},_renderTags:function(j){var k=this;g.prototype._renderTags.call(this,j);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(l){k.preferences.set("tagsEditorShown",l.hidden)})},_renderAnnotation:function(j){var k=this;g.prototype._renderAnnotation.call(this,j);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(l){k.preferences.set("annotationEditorShown",l.hidden)})},_swapNewRender:function(k){g.prototype._swapNewRender.call(this,k);var j=this;_.delay(function(){var l=j.preferences.get("scrollPosition");if(l){j.scrollTo(l)}},10);return this},_attachItems:function(k){g.prototype._attachItems.call(this,k);var j=this,l;if(j.currentContentId&&(l=j.viewFromModelId(j.currentContentId))){j.setCurrentContent(l)}return this},addItemView:function(l,m,k){var j=g.prototype.addItemView.call(this,l,m,k);if(!j){return j}if(this.panelStack.length){return this._collapseDrilldownPanel()}return j},_setUpItemViewListeners:function(k){var j=this;g.prototype._setUpItemViewListeners.call(j,k);k.on("expanded:drilldown",function(m,l){this._expandDrilldownPanel(l)},this);k.on("collapsed:drilldown",function(m,l){this._collapseDrilldownPanel(l)},this);k.on("display edit params rerun report-err visualize",function(l,m){this.setCurrentContent(l)},this);return this},setCurrentContent:function(j){this.$(".history-content.current-content").removeClass("current-content");if(j){j.$el.addClass("current-content");this.currentContentId=j.model.id}else{this.currentContentId=null}},_expandDrilldownPanel:function(j){this.panelStack.push(j);this.$("> .controls").add(this.$list()).hide();j.parentName=this.model.get("name");this.$el.append(j.render().$el)},_collapseDrilldownPanel:function(j){this.panelStack.pop();this.render()},connectToQuotaMeter:function(j){if(!j){return this}this.listenTo(j,"quota:over",this.showQuotaMessage);this.listenTo(j,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(j&&j.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var j=this.$el.find(".quota-message");if(j.is(":hidden")){j.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var j=this.$el.find(".quota-message");if(!j.is(":hidden")){j.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(j){var k=this;if(!j){return k}this.on("new-storage show-deleted show-hidden",function(){var l=(Galaxy&&Galaxy.historyOptionsMenu)?Galaxy.historyOptionsMenu:undefined;if(l){l.findItemByHtml(b("Include Deleted Datasets")).checked=k.showDeleted;l.findItemByHtml(b("Include Hidden Datasets")).checked=k.showHidden}});return this},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});i.prototype.templates=(function(){var j=h.wrapTemplate(['<div class="quota-message errormessage">',b("You are over your disk quota"),". ",b("Tool execution is on hold until your disk usage drops below your allocated quota"),".","</div>"],"history");return _.extend(_.clone(g.prototype.templates),{quotaMsg:j})}());return{CurrentHistoryPanel:i}}); \ No newline at end of file +define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/collection/collection-panel","mvc/base-mvc","utils/localization"],function(d,c,a,h,b){var e=h.SessionStorageModel.extend({defaults:{tagsEditorShown:false,annotationEditorShown:false,scrollPosition:0},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});e.storageKey=function f(){return("history-panel")};var g=c.HistoryPanelEdit;var i=g.extend({className:g.prototype.className+" current-history-panel",emptyMsg:b("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:b("No matching datasets found"),HDCAViewClass:g.prototype.HDCAViewClass.extend({foldoutStyle:"drilldown"}),initialize:function(j){j=j||{};this.preferences=new e(_.extend({id:e.storageKey()},_.pick(j,_.keys(e.prototype.defaults))));g.prototype.initialize.call(this,j);this.panelStack=[];this.currentContentId=j.currentContentId||null},_setUpListeners:function(){g.prototype._setUpListeners.call(this);var j=this;this.$scrollContainer().on("scroll",function(k){if(j.$el.is(":visible")){j.preferences.set("scrollPosition",$(this).scrollTop())}});this.on("new-model",function(){j.preferences.set("scrollPosition",0)})},loadCurrentHistory:function(k){this.debug(this+".loadCurrentHistory");var j=this;return this.loadHistoryWithDetails("current",k).then(function(m,l){j.trigger("current-history",j)})},switchToHistory:function(m,l){var j=this,k=function(){return jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+m)};return this.loadHistoryWithDetails(m,l,k).then(function(o,n){j.trigger("switched-history",j)})},createNewHistory:function(l){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",b("You must be logged in to create histories"));return $.when()}var j=this,k=function(){return jQuery.getJSON(galaxy_config.root+"history/create_new_current")};return this.loadHistory(undefined,l,k).then(function(n,m){j.trigger("new-history",j)})},setModel:function(k,j,l){g.prototype.setModel.call(this,k,j,l);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpCollectionListeners:function(){g.prototype._setUpCollectionListeners.call(this);this.collection.on("state:ready",function(k,l,j){if((!k.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeItemView(k)}},this)},_setUpModelListeners:function(){g.prototype._setUpModelListeners.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}},_buildNewRender:function(){if(!this.model){return $()}var j=g.prototype._buildNewRender.call(this);j.find(".search").prependTo(j.find(".controls"));this._renderQuotaMessage(j);return j},_renderQuotaMessage:function(j){j=j||this.$el;return $(this.templates.quotaMsg({},this)).prependTo(j.find(".messages"))},_renderEmptyMessage:function(l){var k=this,j=k.$emptyMessage(l),m=$(".toolMenuContainer");if((_.isEmpty(k.views)&&!k.searchFor)&&(Galaxy&&Galaxy.upload&&m.size())){j.empty();j.html([b("This history is empty"),". ",b("You can "),'<a class="uploader-link" href="javascript:void(0)">',b("load your own data"),"</a>",b(" or "),'<a class="get-data-link" href="javascript:void(0)">',b("get data from an external source"),"</a>"].join(""));j.find(".uploader-link").click(function(n){Galaxy.upload.show(n)});j.find(".get-data-link").click(function(n){m.parent().scrollTop(0);m.find('span:contains("Get Data")').click()});return j.show()}return g.prototype._renderEmptyMessage.call(this,l)},_renderTags:function(j){var k=this;g.prototype._renderTags.call(this,j);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(l){k.preferences.set("tagsEditorShown",l.hidden)})},_renderAnnotation:function(j){var k=this;g.prototype._renderAnnotation.call(this,j);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(l){k.preferences.set("annotationEditorShown",l.hidden)})},_swapNewRender:function(k){g.prototype._swapNewRender.call(this,k);var j=this;_.delay(function(){var l=j.preferences.get("scrollPosition");if(l){j.scrollTo(l)}},10);return this},_attachItems:function(k){g.prototype._attachItems.call(this,k);var j=this,l;if(j.currentContentId&&(l=j.viewFromModelId(j.currentContentId))){j.setCurrentContent(l)}return this},addItemView:function(l,m,k){var j=g.prototype.addItemView.call(this,l,m,k);if(!j){return j}if(this.panelStack.length){return this._collapseDrilldownPanel()}return j},_setUpItemViewListeners:function(k){var j=this;g.prototype._setUpItemViewListeners.call(j,k);k.on("expanded:drilldown",function(m,l){this._expandDrilldownPanel(l)},this);k.on("collapsed:drilldown",function(m,l){this._collapseDrilldownPanel(l)},this);k.on("display edit params rerun report-err visualize",function(l,m){this.setCurrentContent(l)},this);return this},setCurrentContent:function(j){this.$(".history-content.current-content").removeClass("current-content");if(j){j.$el.addClass("current-content");this.currentContentId=j.model.id}else{this.currentContentId=null}},_expandDrilldownPanel:function(j){this.panelStack.push(j);this.$("> .controls").add(this.$list()).hide();j.parentName=this.model.get("name");this.$el.append(j.render().$el)},_collapseDrilldownPanel:function(j){this.panelStack.pop();this.render()},connectToQuotaMeter:function(j){if(!j){return this}this.listenTo(j,"quota:over",this.showQuotaMessage);this.listenTo(j,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(j&&j.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var j=this.$el.find(".quota-message");if(j.is(":hidden")){j.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var j=this.$el.find(".quota-message");if(!j.is(":hidden")){j.slideUp(this.fxSpeed)}},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});i.prototype.templates=(function(){var j=h.wrapTemplate(['<div class="quota-message errormessage">',b("You are over your disk quota"),". ",b("Tool execution is on hold until your disk usage drops below your allocated quota"),".","</div>"],"history");return _.extend(_.clone(g.prototype.templates),{quotaMsg:j})}());return{CurrentHistoryPanel:i}}); \ No newline at end of file diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c static/scripts/packed/mvc/history/options-menu.js --- /dev/null +++ b/static/scripts/packed/mvc/history/options-menu.js @@ -0,0 +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 diff -r 94ed6755bdf39737cf3c5c2ad528c7703449861c -r 088e20b3d048624b0a736295e264b78bfdefd19c templates/webapps/galaxy/root/index.mako --- a/templates/webapps/galaxy/root/index.mako +++ b/templates/webapps/galaxy/root/index.mako @@ -28,102 +28,7 @@ galaxy_async.set_func_url( galaxy_async.set_user_pref, "${h.url_for( controller='user', action='set_user_pref_async' )}"); - // set up history options menu $(function(){ - // Init history options. - //$("#history-options-button").css( "position", "relative" ); - var popupmenu = PopupMenu.make_popupmenu( $("#history-options-button"), { - "${_("History Lists")}": null, - "${_("Saved Histories")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='list')}"; - }, - "${_("Histories Shared with Me")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='list_shared')}"; - }, - "${_("Current History")}": null, - "${_("Create New")}": function() { - if( Galaxy && Galaxy.currHistoryPanel ){ - Galaxy.currHistoryPanel.createNewHistory(); - } - }, - "${_("Copy History")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='copy')}"; - }, - "${_("Copy Datasets")}": function() { - galaxy_main.location = "${h.url_for( controller='dataset', action='copy_datasets' )}"; - }, - "${_("Share or Publish")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='sharing' )}"; - }, - "${_("Extract Workflow")}": function() { - galaxy_main.location = "${h.url_for( controller='workflow', action='build_from_current_history' )}"; - }, - "${_("Dataset Security")}": function() { - galaxy_main.location = "${h.url_for( controller='root', action='history_set_default_permissions' )}"; - }, - "${_("Resume Paused Jobs")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='resume_paused_jobs', current=True)}"; - }, - "${_("Collapse Expanded Datasets")}": function() { - if( Galaxy && Galaxy.currHistoryPanel ){ - Galaxy.currHistoryPanel.collapseAll(); - } - }, - "${_("Include Deleted Datasets")}": function( clickEvent, thisMenuOption ) { - if( Galaxy && Galaxy.currHistoryPanel ){ - thisMenuOption.checked = Galaxy.currHistoryPanel.toggleShowDeleted(); - } - }, - "${_("Include Hidden Datasets")}": function( clickEvent, thisMenuOption ) { - if( Galaxy && Galaxy.currHistoryPanel ){ - thisMenuOption.checked = Galaxy.currHistoryPanel.toggleShowHidden(); - } - }, - "${_("Unhide Hidden Datasets")}": function() { - if ( confirm( "Really unhide all hidden datasets?" ) ) { - galaxy_main.location = "${h.url_for( controller='history', action='unhide_datasets', current=True )}"; - } - }, - "${_("Delete Hidden Datasets")}": function() { - if ( confirm( "Really delete all hidden datasets?" ) ) { - galaxy_main.location = "${h.url_for( controller='history', action='delete_hidden_datasets')}"; - } - }, - "${_("Purge Deleted Datasets")}": function() { - if ( confirm( "Really delete all deleted datasets permanently? This cannot be undone." ) ) { - galaxy_main.location = "${h.url_for( controller='history', action='purge_deleted_datasets' )}"; - // update the user disk size when the purge page loads - $( '#galaxy_main' ).load( function(){ - Galaxy.user.fetch(); - }) - } - }, - "${_("Show Structure")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='display_structured' )}"; - }, - "${_("Export Citations")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='citations' )}"; - }, - "${_("Export to File")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='export_archive', preview=True )}"; - }, - "${_("Delete")}": function() { - if ( confirm( "Really delete the current history?" ) ) { - galaxy_main.location = "${h.url_for( controller='history', action='delete_current' )}"; - } - }, - "${_("Delete Permanently")}": function() { - if ( confirm( "Really delete the current history permanently? This cannot be undone." ) ) { - galaxy_main.location = "${h.url_for( controller='history', action='delete_current', purge=True )}"; - } - }, - "${_("Other Actions")}": null, - "${_("Import from File")}": function() { - galaxy_main.location = "${h.url_for( controller='history', action='import_archive' )}"; - } - }); - Galaxy.historyOptionsMenu = popupmenu; - // Fix iFrame scrolling on iOS if( navigator.userAgent.match( /(iPhone|iPod|iPad)/i ) ) { $("iframe").parent().css( { @@ -131,7 +36,6 @@ "-webkit-overflow-scrolling": "touch" }) } - }); </script></%def> @@ -203,27 +107,6 @@ </div><div class="panel-header-text">${_('History')}</div></div> - </div> - <div class="unified-panel-body"> - <div id="current-history-panel" class="history-panel"></div> - ## Don't bootstrap data here - confuses the browser history: load via API - <script type="text/javascript"> - require([ "mvc/history/history-panel-edit-current" ], function( historyPanel ){ - $(function(){ - var currPanel = new historyPanel.CurrentHistoryPanel({ - el : $( "#current-history-panel" ), - purgeAllowed : Galaxy.config.allow_user_dataset_purge, - linkTarget : 'galaxy_main', - $scrollContainer: function(){ return this.$el.parent(); } - }); - currPanel - .connectToQuotaMeter( Galaxy.quotaMeter ) - .connectToOptionsMenu( Galaxy.historyOptionsMenu ); - currPanel.loadCurrentHistory(); - Galaxy.currHistoryPanel = currPanel; - }); - }); - </script><script type="text/javascript"> $(function(){ $( '#history-refresh-button' ) @@ -234,6 +117,35 @@ } }); }); + require([ 'mvc/history/options-menu' ], function( optionsMenu ){ + $(function(){ + var popupmenu = optionsMenu( $( "#history-options-button" ), { + anonymous : Galaxy.currUser.isAnonymous(), + purgeAllowed : Galaxy.config.allow_user_dataset_purge + }); + Galaxy.historyOptionsMenu = popupmenu; + }); + }); + </script> + </div> + <div class="unified-panel-body"> + <div id="current-history-panel" class="history-panel"></div> + ## Don't bootstrap data here - confuses the browser history: load via API + <script type="text/javascript"> + require([ "mvc/history/history-panel-edit-current" ], function( historyPanel ){ + $(function(){ + var currPanel = new historyPanel.CurrentHistoryPanel({ + el : $( "#current-history-panel" ), + purgeAllowed : Galaxy.config.allow_user_dataset_purge, + linkTarget : 'galaxy_main', + $scrollContainer: function(){ return this.$el.parent(); } + }); + currPanel + .connectToQuotaMeter( Galaxy.quotaMeter ); + currPanel.loadCurrentHistory(); + Galaxy.currHistoryPanel = currPanel; + }); + }); </script></div></%def> 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.