commit/galaxy-central: carlfeberhard: fixes and improvements to (alt)history - now renders history controls; fix to popupmenu parent parameter; pack scripts
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/3164ba737fd4/ changeset: 3164ba737fd4 user: carlfeberhard date: 2012-10-02 00:25:35 summary: fixes and improvements to (alt)history - now renders history controls; fix to popupmenu parent parameter; pack scripts affected #: 19 files diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -173,11 +173,19 @@ states = states.split( "," ) for encoded_id, state in zip( ids, states ): try: + # assume encoded and decode to int id = int( trans.app.security.decode_id( encoded_id ) ) except: + # fallback to non-encoded id id = int( encoded_id ) + + # fetch new data for that id data = trans.sa_session.query( self.app.model.HistoryDatasetAssociation ).get( id ) + + # if the state has changed, if data.state != state: + + # find out if we need to force a refresh on this data job_hda = data while job_hda.copied_from_history_dataset_association: job_hda = job_hda.copied_from_history_dataset_association @@ -187,12 +195,15 @@ if tool: force_history_refresh = tool.force_history_refresh if not job_hda.visible: - force_history_refresh = True + force_history_refresh = True + + # add the new state html for the item, the refresh option and the new state, map to the id rval[encoded_id] = { "state": data.state, "html": unicode( trans.fill_template( "root/history_item.mako", data=data, hid=data.hid ), 'utf-8' ), "force_history_refresh": force_history_refresh } + return rval @web.json diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/galaxy.base.js --- a/static/scripts/galaxy.base.js +++ b/static/scripts/galaxy.base.js @@ -196,7 +196,7 @@ } }); // locate the element with the id corresponding to the menu's popupmenu attr - var box = $( "#" + menu.attr( 'popupmenu' ) ); + var box = $( parent ).find( "#" + menu.attr( 'popupmenu' ) ); // For menus with clickable link text, make clicking on the link go through instead // of activating the popup menu diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/mvc/base-mvc.js --- a/static/scripts/mvc/base-mvc.js +++ b/static/scripts/mvc/base-mvc.js @@ -69,6 +69,72 @@ } }; +// ============================================================================= +/** Global string localization object (and global short form alias) + * set with either: + * GalaxyLocalization.setLocalizedString( original, localized ) + * GalaxyLocalization.setLocalizedString({ original1 : localized1, original2 : localized2 }) + * get with either: + * _l( original ) + */ +//TODO: move to Galaxy.Localization (maybe galaxy.base.js) +var GalaxyLocalization = jQuery.extend({}, { + aliasName : '_l', + localizedStrings : {}, + + setLocalizedString : function( str_or_obj, localizedString ){ + // pass in either two strings (english, translated) or an obj (map) of english : translated attributes + //console.debug( this + '.setLocalizedString:', str_or_obj, localizedString ); + var self = this; + + // DRY non-duplicate assignment function + var setStringIfNotDuplicate = function( original, localized ){ + // do not set if identical - strcmp expensive but should only happen once per page per word + if( original !== localized ){ + self.localizedStrings[ original ] = localized; + } + }; + + if( jQuery.type( str_or_obj ) === "string" ){ + setStringIfNotDuplicate( str_or_obj, localizedString ); + + } else if( jQuery.type( str_or_obj ) === "object" ){ + jQuery.each( str_or_obj, function( key, val ){ + //console.debug( 'key=>val', key, '=>', val ); + // could recurse here but no reason + setStringIfNotDuplicate( key, val ); + }); + + } else { + throw( 'Localization.setLocalizedString needs either a string or object as the first argument,' + + ' given: ' + str_or_obj ); + } + }, + + localize : function( strToLocalize ){ + //console.debug( this + '.localize:', strToLocalize ); + // return the localized version if it's there, the strToLocalize if not + var retStr = strToLocalize; + if( _.has( this.localizedStrings, strToLocalize ) ){ + //console.debug( 'found' ); + retStr = this.localizedStrings[ strToLocalize ]; + } + //console.debug( 'returning:', retStr ); + return retStr; + }, + + toString : function(){ return 'GalaxyLocalization'; } +}); + +// global localization alias +window[ GalaxyLocalization.aliasName ] = function( str ){ return GalaxyLocalization.localize( str ); }; + +//TEST: setLocalizedString( string, string ), _l( string ) +//TEST: setLocalizedString( hash ), _l( string ) +//TEST: setLocalizedString( string === string ), _l( string ) +//TEST: _l( non assigned string ) + + //============================================================================== /** diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/mvc/history.js --- a/static/scripts/mvc/history.js +++ b/static/scripts/mvc/history.js @@ -6,71 +6,47 @@ Backbone.js implementation of history panel TODO: - replicate then refactor (could be the wrong order) + meta: + require.js + convert function comments to jsDoc style, complete comments + move inline styles into base.less + watch the magic strings + watch your globals - fix: - tags - annotations - _render_displayApps - _render_downloadButton - widget building (popupmenu, etc.) - history.mako js: updater, etc. - have info bodies prev. opened, redisplay on refresh + all: + add classes, ids on empty divs + incorporate relations? + events (local/ui and otherwise) + have info bodies prev. opened, redisplay on refresh + transfer history.mako js: + updater, etc. + create viz icon + trackster + scatterplot + phylo-viz + on ready: + delete function + check_transfer_status (running->ok) + quota meter update + + historyItemView: + poly HistoryItemView (and HistoryView?) on: for_editing, display_structured, trans.user + don't draw body until it's first unhide event + HIview state transitions (eg. upload -> ok), curr: build new, delete old, place new (in render) + move visualizations menu + include phyloviz - don't draw body until it's first unhide event - all history.mako js -> this - HIview state transitions (eg. upload -> ok), curr: build new, delete old, place new (in render) - History (meta controls : collapse all, rename, annotate, etc. - see history.js.120823.bak) - events (local/ui and otherwise) - HistoryCollection: (collection of History: 'Saved Histories') + History: + renaming broken + tags rendering broken (url?) + annotation (url?) + meta controls : collapse all, rename, annotate, etc. + + collection: + show_deleted, show_hidden (thru js - no refresh) + - ?move IconButtonViews -> templates? - - convert function comments to jsDoc style, complete comments - collection -> show_deleted, show_hidden - poly HistoryItemView on: for_editing, display_structured, trans.user - incorporate relations? - localization - template helper {{#local}} calls _l() - - move inline styles into base.less - add classes, ids on empty divs - watch the magic strings ============================================================================= */ - -//============================================================================== -// jq plugin? -//?? into template? I dunno: need to handle variadic keys, remove empty attrs (href="") -//TODO: not happy with this (a 4th rendering/templating system!?) or it being global -function linkHTMLTemplate( config, tag ){ - // Create an anchor (or any tag) using any config params passed in - //NOTE!: send class attr as 'classes' to avoid res. keyword collision (jsLint) - if( !config ){ return '<a></a>'; } - tag = tag || 'a'; - - var template = [ '<' + tag ]; - for( key in config ){ - var val = config[ key ]; - if( val === '' ){ continue; } - switch( key ){ - case 'text': continue; - case 'classes': - // handle keyword class which is also an HTML attr name - key = 'class'; - val = ( config.classes.join )?( config.classes.join( ' ' ) ):( config.classes ); - //note: lack of break (fall through) - default: - template.push( [ ' ', key, '="', val, '"' ].join( '' ) ); - } - } - template.push( '>' ); - if( 'text' in config ){ template.push( config.text ); } - template.push( '</' + tag + '>' ); - - return template.join( '' ); -} - -//============================================================================== //TODO: use initialize (or validate) to check purged AND deleted -> purged XOR deleted var HistoryItem = BaseModel.extend( LoggableMixin ).extend({ // a single HDA model @@ -292,7 +268,6 @@ var deleteBtnData = { title : 'Delete', href : this.model.get( 'delete_url' ), - target : 'galaxy_main', id : 'historyItemDeleter-' + this.model.get( 'id' ), icon_class : 'delete' }; @@ -329,8 +304,7 @@ var primaryActionButtons = $( '<div/>' ).attr( 'id', 'primary-actions-' + this.model.get( 'id' ) ), view = this; _.each( buttonRenderingFuncs, function( fn ){ - var render_return = fn.call( view ); - primaryActionButtons.append( render_return ); + primaryActionButtons.append( fn.call( view ) ); }); return primaryActionButtons; }, @@ -342,8 +316,7 @@ // return either: a single download icon-button (if there are no meta files) // or a popupmenu with links to download assoc. meta files (if there are meta files) var downloadLinkHTML = HistoryItemView.templates.downloadLinks( this.model.toJSON() ); - this.log( '_render_downloadButton, downloadLinkHTML:', downloadLinkHTML ); - + //this.log( this + '_render_downloadButton, downloadLinkHTML:', downloadLinkHTML ); return $( downloadLinkHTML ); }, @@ -447,7 +420,7 @@ // ................................................................................ other elements _render_tagArea : function(){ - if( this.model.get( 'retag_url' ) ){ return null; } + if( !this.model.get( 'retag_url' ) ){ return null; } //TODO: move to mvc/tags.js return $( HistoryItemView.templates.tagArea( this.model.toJSON() ) ); }, @@ -464,14 +437,14 @@ var displayAppsDiv = $( '<div/>' ).addClass( 'display-apps' ); if( !_.isEmpty( this.model.get( 'display_types' ) ) ){ - this.log( this + 'display_types:', this.model.get( 'display_types' ) ); + //this.log( this + 'display_types:', this.model.get( 'display_types' ) ); //TODO:?? does this ever get used? displayAppsDiv.append( HistoryItemView.templates.displayApps({ displayApps : this.model.toJSON().display_types }) ); } if( !_.isEmpty( this.model.get( 'display_apps' ) ) ){ - this.log( this + 'display_apps:', this.model.get( 'display_apps' ) ); + //this.log( this + 'display_apps:', this.model.get( 'display_apps' ) ); displayAppsDiv.append( HistoryItemView.templates.displayApps({ displayApps : this.model.toJSON().display_apps }) ); @@ -655,9 +628,10 @@ // Show or hide tag area; if showing tag area and it's empty, fill it. if( tagArea.is( ":hidden" ) ){ - if( !tagElt.html() ){ + if( !jQuery.trim( tagElt.html() ) ){ // Need to fill tag element. $.ajax({ + //TODO: the html from this breaks a couple of times url: this.model.get( 'ajax_get_tag_url' ), error: function() { alert( "Tagging failed" ); }, success: function(tag_elt_html) { @@ -688,7 +662,7 @@ // Show or hide annotation area; if showing annotation area and it's empty, fill it. if ( annotationArea.is( ":hidden" ) ){ - if( !annotationElem.html() ){ + if( !jQuery.trim( annotationElem.html() ) ){ // Need to fill annotation element. $.ajax({ url: this.model.get( 'ajax_get_annotation_url' ), @@ -762,6 +736,7 @@ //============================================================================== var History = BaseModel.extend( LoggableMixin ).extend({ + //TODO: bind change events from items and collection to this (itemLengths, states) // uncomment this out see log messages //logger : console, @@ -770,7 +745,8 @@ defaults : { id : '', name : '', - state : '', + state : '', + //TODO:?? change these to a list of encoded ids? state_details : { discarded : 0, empty : 0, @@ -781,15 +757,51 @@ running : 0, setting_metadata: 0, upload : 0 - } + }, + + // maybe security issues... + userIsAdmin : false, + userRoles : [], + //TODO: hardcoded + + //TODO: wire this to items + itemsLength : 0, + showDeleted : false, + showHidden : false, + + diskSize : 0, + deleted : false, + + // tagging_common.mako: render_individual_tagging_element(user=trans.get_user(), + // tagged_item=history, elt_context="history.mako", use_toggle_link=False, input_size="20") + tags : [], + annotation : null, + message : null, + quotaMsg : false, + + baseURL : null, + hideDeletedURL : null, + hideHiddenURL : null, + tagURL : null, + annotateURL : null }, initialize : function( data, history_datasets ){ - this.log( this + '.initialize', data, history_datasets ); + //this.log( this + '.initialize', data, history_datasets ); this.items = new HistoryCollection(); }, + toJSON : function(){ + // unfortunately, bb doesn't call 'get' to form the JSON meaning computed vals from get aren't used, so... + // a simple example of override and super call + var json = Backbone.Model.prototype.toJSON.call( this ); + json.itemsLength = this.items.length; + //this.log( this + '.json:', json ); + return json; + }, + loadDatasetsAsHistoryItems : function( datasets ){ + //TODO: add via ajax - multiple datasets at once // adds the given dataset/Item data to historyItems // and updates this.state based on their states //pre: datasets is a list of objs @@ -799,12 +811,12 @@ stateDetails = this.get( 'state_details' ); _.each( datasets, function( dataset, index ){ - self.log( 'loading dataset: ', dataset, index ); + //self.log( 'loading dataset: ', dataset, index ); // create an item sending along the history_id as well var historyItem = new HistoryItem( _.extend( dataset, { history_id: selfID } ) ); - self.log( 'as History:', historyItem ); + //self.log( 'as History:', historyItem ); self.items.add( historyItem ); // add item's state to running totals in stateDetails @@ -864,28 +876,42 @@ // direct attachment to existing element el : 'body.historyPage', - initialize : function(){ - this.log( this + '.initialize' ); + initialize : function(){ + this.log( this + '.initialize:', this ); this.itemViews = []; var parent = this; this.model.items.each( function( item ){ var itemView = new HistoryItemView({ model: item }); parent.itemViews.push( itemView ); }); - //itemViews.reverse(); }, - render : function(){ - this.log( this + '.render' ); + render : function(){ + this.$el.append( HistoryView.templates.historyPanel( this.model.toJSON() ) ); + this.log( this + ' rendered from template:', this.$el ); - // render to temp, move all at once, remove temp holder + // set up aliases + this.itemsDiv = this.$el.find( '#' + this.model.get( 'id' ) + '-datasets' ); + + //TODO: set up widgets, tooltips, etc. + + if( this.model.items.length ){ + // render to temp, move all at once, remove temp holder + var tempDiv = this._render_items(); + this.itemsDiv.append( tempDiv.children() ); + tempDiv.remove(); + } + }, + + _render_items : function(){ + var div = $( '<div/>' ), + view = this; //NOTE!: render in reverse (newest on top) via prepend (instead of append) - var tempDiv = $( '<div/>' ); - _.each( this.itemViews, function( view ){ - tempDiv.prepend( view.render() ); + _.each( this.itemViews, function( itemView ){ + view.log( view + '.render_items:', itemView ); + div.prepend( itemView.render() ); }); - this.$el.append( tempDiv.children() ); - tempDiv.remove(); + return div; }, toString : function(){ @@ -893,6 +919,13 @@ return 'HistoryView(' + nameString + ')'; } }); +//HistoryItemView.templates = InDomTemplateLoader.getTemplates({ +HistoryView.templates = CompiledTemplateLoader.getTemplates({ + 'history-templates.html' : { + historyPanel : 'template-history-historyPanel' + } +}); + //============================================================================== diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/mvc/ui.js --- a/static/scripts/mvc/ui.js +++ b/static/scripts/mvc/ui.js @@ -157,79 +157,10 @@ } }); -// ============================================================================= -/** Global string localization object (and global short form alias) - * set with either: - * GalaxyLocalization.setLocalizedString( original, localized ) - * GalaxyLocalization.setLocalizedString({ original1 : localized1, original2 : localized2 }) - * get with either: - * _l( original ) - */ -//TODO: move to Galaxy.Localization -var GalaxyLocalization = jQuery.extend({}, { - aliasName : '_l', - localizedStrings : {}, - - setLocalizedString : function( str_or_obj, localizedString ){ - // pass in either two strings (english, translated) or an obj (map) of english : translated attributes - //console.debug( this + '.setLocalizedString:', str_or_obj, localizedString ); - var self = this; - - // DRY non-duplicate assignment function - var setStringIfNotDuplicate = function( original, localized ){ - // do not set if identical - strcmp expensive but should only happen once per page per word - if( original !== localized ){ - self.localizedStrings[ original ] = localized; - } - }; - - if( jQuery.type( str_or_obj ) === "string" ){ - setStringIfNotDuplicate( str_or_obj, localizedString ); - - } else if( jQuery.type( str_or_obj ) === "object" ){ - jQuery.each( str_or_obj, function( key, val ){ - //console.debug( 'key=>val', key, '=>', val ); - // could recurse here but no reason - setStringIfNotDuplicate( key, val ); - }); - - } else { - throw( 'Localization.setLocalizedString needs either a string or object as the first argument,' + - ' given: ' + str_or_obj ); - } - }, - - localize : function( strToLocalize ){ - //console.debug( this + '.localize:', strToLocalize ); - // return the localized version if it's there, the strToLocalize if not - // try/catch cheaper than if in - try { - //var localized = this.localizedStrings[ strToLocalize ]; - //return localized; - return this.localizedStrings[ strToLocalize ]; - } catch( err ){ - //TODO??: potentially problematic catch all - //console.error( err ); - return strToLocalize; - } - }, - - toString : function(){ return 'GalaxyLocalization'; } -}); -// global localization alias -window[ GalaxyLocalization.aliasName ] = function( str ){ return GalaxyLocalization.localize( str ); }; -//TEST: setLocalizedString( string, string ), _l( string ) -//TEST: setLocalizedString( hash ), _l( string ) -//TEST: setLocalizedString( string === string ), _l( string ) -//TEST: _l( non assigned string ) -// ============================================================================= -/** UI icon-button (Backbone.View only - no model) - * - */ @@ -239,8 +170,3 @@ - - - - - diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/galaxy.base.js --- a/static/scripts/packed/galaxy.base.js +++ b/static/scripts/packed/galaxy.base.js @@ -1,1 +1,1 @@ -(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){g.append($("<li></li>").append($("<a href='#'></a>").html(j).click(i)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]=function(){if(!e||confirm(e)){var j;if(h=="_parent"){window.parent.location=f}else{if(h=="_top"){window.top.location=f}else{if(h=="demo"){if(j===undefined||j.closed){j=window.open(f,h);j.creator=self}}else{window.location=f}}}}}}});var c=$("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,c,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(c===undefined){c=3000}var b=b||$("select");b.each(function(){var e=$(this);var h=e.find("option").length;if((h<a)||(h>c)){return}if(e.attr("multiple")==="multiple"){return}if(e.hasClass("no-autocomplete")){return}var n=e.attr("value");var d=$("<input type='text' class='text-and-autocomplete-select'></input>");d.attr("size",40);d.attr("name",e.attr("name"));d.attr("id",e.attr("id"));d.click(function(){var o=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(o);$(this).select()});var f=[];var j={};e.children("option").each(function(){var p=$(this).text();var o=$(this).attr("value");f.push(p);j[p]=o;j[o]=o;if(o==n){d.attr("value",p)}});if(n===""||n==="?"){d.attr("value","Click to Search or Select")}if(e.attr("name")=="dbkey"){f=f.sort(naturalSort)}var g={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:c,minChars:0,hideForLessThanMinChars:false};d.autocomplete(f,g);e.replaceWith(d);var l=function(){var p=d.attr("value");var o=j[p];if(o!==null&&o!==undefined){d.attr("value",o)}else{if(n!==""){d.attr("value",n)}else{d.attr("value","?")}}};d.parents("form").submit(function(){l()});$(document).bind("convert_to_values",function(){l()});if(e.attr("refresh_on_change")=="true"){var i=e.attr("refresh_on_change_values"),m=e.attr("last_selected_value");if(i!==undefined){i=i.split(",")}var k=function(){var o=j[d.attr("value")];if(m!==o&&o!==null&&o!==undefined){if(i!==undefined&&$.inArray(o,i)===-1&&$.inArray(m,i)===-1){return}d.attr("value",o);$(window).trigger("refresh_on_change");d.parents("form").submit()}};d.bind("result",k);d.keyup(function(o){if(o.keyCode===13){k()}});d.keydown(function(o){if(o.keyCode===13){return false}})}})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=a.text(),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStorage.get("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStorage.deleteKey("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStorage.get("history_expand_state");if(k){delete k[j];$.jStorage.set("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStorage.get("history_expand_state");if(!k){k={}}k[j]=true;$.jStorage.set("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStorage.get("history_expand_state");if(!h){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStorage.set("history_expand_state",h)}).show()};b()}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tooltip){$(".tooltip").tooltip({placement:"top"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})}); \ No newline at end of file +(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){g.append($("<li></li>").append($("<a href='#'></a>").html(j).click(i)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]=function(){if(!e||confirm(e)){var j;if(h=="_parent"){window.parent.location=f}else{if(h=="_top"){window.top.location=f}else{if(h=="demo"){if(j===undefined||j.closed){j=window.open(f,h);j.creator=self}}else{window.location=f}}}}}}});var c=$(a).find("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,c,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(c===undefined){c=3000}var b=b||$("select");b.each(function(){var e=$(this);var h=e.find("option").length;if((h<a)||(h>c)){return}if(e.attr("multiple")==="multiple"){return}if(e.hasClass("no-autocomplete")){return}var n=e.attr("value");var d=$("<input type='text' class='text-and-autocomplete-select'></input>");d.attr("size",40);d.attr("name",e.attr("name"));d.attr("id",e.attr("id"));d.click(function(){var o=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(o);$(this).select()});var f=[];var j={};e.children("option").each(function(){var p=$(this).text();var o=$(this).attr("value");f.push(p);j[p]=o;j[o]=o;if(o==n){d.attr("value",p)}});if(n===""||n==="?"){d.attr("value","Click to Search or Select")}if(e.attr("name")=="dbkey"){f=f.sort(naturalSort)}var g={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:c,minChars:0,hideForLessThanMinChars:false};d.autocomplete(f,g);e.replaceWith(d);var l=function(){var p=d.attr("value");var o=j[p];if(o!==null&&o!==undefined){d.attr("value",o)}else{if(n!==""){d.attr("value",n)}else{d.attr("value","?")}}};d.parents("form").submit(function(){l()});$(document).bind("convert_to_values",function(){l()});if(e.attr("refresh_on_change")=="true"){var i=e.attr("refresh_on_change_values"),m=e.attr("last_selected_value");if(i!==undefined){i=i.split(",")}var k=function(){var o=j[d.attr("value")];if(m!==o&&o!==null&&o!==undefined){if(i!==undefined&&$.inArray(o,i)===-1&&$.inArray(m,i)===-1){return}d.attr("value",o);$(window).trigger("refresh_on_change");d.parents("form").submit()}};d.bind("result",k);d.keyup(function(o){if(o.keyCode===13){k()}});d.keydown(function(o){if(o.keyCode===13){return false}})}})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=a.text(),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStorage.get("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStorage.deleteKey("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStorage.get("history_expand_state");if(k){delete k[j];$.jStorage.set("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStorage.get("history_expand_state");if(!k){k={}}k[j]=true;$.jStorage.set("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStorage.get("history_expand_state");if(!h){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStorage.set("history_expand_state",h)}).show()};b()}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tooltip){$(".tooltip").tooltip({placement:"top"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})}); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/mvc/base-mvc.js --- a/static/scripts/packed/mvc/base-mvc.js +++ b/static/scripts/packed/mvc/base-mvc.js @@ -1,1 +1,1 @@ -var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){if(this.model.attributes.hidden){this.$el.hide()}else{this.$el.show()}}});var LoggableMixin={logger:null,log:function(){return(this.logger)?(this.logger.log.apply(this,arguments)):(undefined)}};var TemplateLoader=_.extend({},LoggableMixin,{getTemplateLoadFn:function(){throw ("There is no templateLoadFn. Make sure you're using a subclass of TemplateLoader")},getTemplates:function(d,e){e=e||false;this.log(this,"getTemplates:",d,", forceReload:",e);var c={},a=this,b=this.getTemplateLoadFn();if(!d){return c}jQuery.each(d,function(f,g){jQuery.each(g,function(h,i){a.log(a+", templateFile:",f,"templateName:",h,", templateID:",i);c[h]=b.call(a,f,h,i)})});return c}});var CompiledTemplateLoader=_.extend({},TemplateLoader,{getTemplateLoadFn:function(){return this.loadCompiledHandlebarsTemplate},loadCompiledHandlebarsTemplate:function(b,a,c){this.log("getInDomTemplates, templateFile:",b,"templateName:",a,", templateID:",c);if(!Handlebars.templates||!Handlebars.templates[c]){throw ("Template not found: Handlebars."+c+". Check your h.templates() call in the mako file that rendered this page")}this.log("found template function:",c);return Handlebars.templates[c]}});var InDomTemplateLoader=_.extend({},TemplateLoader,{compileTemplate:function(a){if(!Handlebars||!Handlebars.compile){throw ("No Handlebars.compile found. You may only have Handlebars.runtime loaded.Include handlebars.full for this to work")}this.log("compiling template:",a);return Handlebars.compile(a)},findTemplateInDom:function(b,a,c){return $("script#"+c).last()},getTemplateLoadFn:function(){return this.loadInDomTemplate},loadInDomTemplate:function(b,a,c){this.log("getInDomTemplate, templateFile:",b,"templateName:",a,", templateID:",c);var d=this.findTemplateInDom(b,a,c);if(!d||!d.length){throw ("Template not found within the DOM: "+c+". Check that this template has been included in the page")}this.log("found template in dom:",d.html());return this.compileTemplate(d.html())}});var RemoteTemplateLoader=_.extend({},InDomTemplateLoader,{templateBaseURL:"static/scripts/templates/",getTemplateLoadFn:function(){return this.loadViaHttpGet},loadViaHttpGet:function(d,c,f){var b="static/scripts/templates/";this.log("loadViaHttpGet, templateFile:",d,"templateName:",c,", templateID:",f,"templateBaseURL:",this.templateBaseURL);var h=null;try{h=this.loadInDomTemplate(d,c,f)}catch(g){this.log("getInDomTemplate exception:"+g);if(!Handlebars.compile){throw (g)}this.log("Couldn't locate template in DOM: "+f);var a=this;var e=b+d;jQuery.ajax(e,{method:"GET",async:false,success:function(i){a.log(d+" loaded via GET. Attempting compile...");$("body").append(i);h=a.loadInDomTemplate(d,c,f)},error:function(j,i,k){throw ("Failed to fetch "+e+":"+i)}})}if(!h){throw ("Couldn't load or fetch template: "+f)}return h}}); \ No newline at end of file +var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){if(this.model.attributes.hidden){this.$el.hide()}else{this.$el.show()}}});var LoggableMixin={logger:null,log:function(){return(this.logger)?(this.logger.log.apply(this,arguments)):(undefined)}};var GalaxyLocalization=jQuery.extend({},{aliasName:"_l",localizedStrings:{},setLocalizedString:function(b,a){var c=this;var d=function(f,e){if(f!==e){c.localizedStrings[f]=e}};if(jQuery.type(b)==="string"){d(b,a)}else{if(jQuery.type(b)==="object"){jQuery.each(b,function(e,f){d(e,f)})}else{throw ("Localization.setLocalizedString needs either a string or object as the first argument, given: "+b)}}},localize:function(b){var a=b;if(_.has(this.localizedStrings,b)){a=this.localizedStrings[b]}return a},toString:function(){return"GalaxyLocalization"}});window[GalaxyLocalization.aliasName]=function(a){return GalaxyLocalization.localize(a)};var TemplateLoader=_.extend({},LoggableMixin,{getTemplateLoadFn:function(){throw ("There is no templateLoadFn. Make sure you're using a subclass of TemplateLoader")},getTemplates:function(d,e){e=e||false;this.log(this,"getTemplates:",d,", forceReload:",e);var c={},a=this,b=this.getTemplateLoadFn();if(!d){return c}jQuery.each(d,function(f,g){jQuery.each(g,function(h,i){a.log(a+", templateFile:",f,"templateName:",h,", templateID:",i);c[h]=b.call(a,f,h,i)})});return c}});var CompiledTemplateLoader=_.extend({},TemplateLoader,{getTemplateLoadFn:function(){return this.loadCompiledHandlebarsTemplate},loadCompiledHandlebarsTemplate:function(b,a,c){this.log("getInDomTemplates, templateFile:",b,"templateName:",a,", templateID:",c);if(!Handlebars.templates||!Handlebars.templates[c]){throw ("Template not found: Handlebars."+c+". Check your h.templates() call in the mako file that rendered this page")}this.log("found template function:",c);return Handlebars.templates[c]}});var InDomTemplateLoader=_.extend({},TemplateLoader,{compileTemplate:function(a){if(!Handlebars||!Handlebars.compile){throw ("No Handlebars.compile found. You may only have Handlebars.runtime loaded.Include handlebars.full for this to work")}this.log("compiling template:",a);return Handlebars.compile(a)},findTemplateInDom:function(b,a,c){return $("script#"+c).last()},getTemplateLoadFn:function(){return this.loadInDomTemplate},loadInDomTemplate:function(b,a,c){this.log("getInDomTemplate, templateFile:",b,"templateName:",a,", templateID:",c);var d=this.findTemplateInDom(b,a,c);if(!d||!d.length){throw ("Template not found within the DOM: "+c+". Check that this template has been included in the page")}this.log("found template in dom:",d.html());return this.compileTemplate(d.html())}});var RemoteTemplateLoader=_.extend({},InDomTemplateLoader,{templateBaseURL:"static/scripts/templates/",getTemplateLoadFn:function(){return this.loadViaHttpGet},loadViaHttpGet:function(d,c,f){var b="static/scripts/templates/";this.log("loadViaHttpGet, templateFile:",d,"templateName:",c,", templateID:",f,"templateBaseURL:",this.templateBaseURL);var h=null;try{h=this.loadInDomTemplate(d,c,f)}catch(g){this.log("getInDomTemplate exception:"+g);if(!Handlebars.compile){throw (g)}this.log("Couldn't locate template in DOM: "+f);var a=this;var e=b+d;jQuery.ajax(e,{method:"GET",async:false,success:function(i){a.log(d+" loaded via GET. Attempting compile...");$("body").append(i);h=a.loadInDomTemplate(d,c,f)},error:function(j,i,k){throw ("Failed to fetch "+e+":"+i)}})}if(!h){throw ("Couldn't load or fetch template: "+f)}return h}}); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/mvc/history.js --- a/static/scripts/packed/mvc/history.js +++ b/static/scripts/packed/mvc/history.js @@ -1,1 +1,1 @@ -function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",HistoryItem.STATES.NOT_VIEWABLE)}},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NOT_VIEWABLE:"not_viewable",NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){var c=this.model.get("id"),b=this.model.get("state");this.clearReferences();this.$el.attr("id","historyItemContainer-"+c);var a=$("<div/>").attr("id","historyItem-"+c).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+b);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});make_popup_menus(a);this.$el.children().remove();return this.$el.append(a)},clearReferences:function(){this.displayButton=null;this.editButton=null;this.deleteButton=null;this.errButton=null},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());a.append(this._render_editButton());a.append(this._render_deleteButton());return a},_render_displayButton:function(){if(this.model.get("state")===HistoryItem.STATES.UPLOAD){return null}displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",enabled:false,icon_class:"display"}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display"});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){if((this.model.get("state")===HistoryItem.STATES.UPLOAD)||(!this.model.get("for_editing"))){return null}var c=this.model.get("purged"),a=this.model.get("deleted"),b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b.enabled=false}if(a){b.title="Undelete dataset to edit attributes"}else{if(c){b.title="Cannot edit attributes of datasets removed from disk"}}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a={title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"};if((this.model.get("deleted")||this.model.get("purged"))&&(!this.model.get("delete_url"))){a={title:"Dataset is already deleted",icon_class:"delete",enabled:false}}this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(HistoryItemView.templates.titleLink(this.model.toJSON())))},_render_hdaSummary:function(){var a=this.model.toJSON();if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){_.extend(a,{dbkey_unknown_and_editable:true})}return HistoryItemView.templates.hdaSummary(a)},_render_primaryActionButtons:function(c){var b=$("<div/>").attr("id","primary-actions-"+this.model.get("id")),a=this;_.each(c,function(d){var e=d.call(a);b.append(e)});return b},_render_downloadButton:function(){if(this.model.get("purged")){return null}var a=HistoryItemView.templates.downloadLinks(this.model.toJSON());this.log("_render_downloadButton, downloadLinkHTML:",a);return $(a)},_render_errButton:function(){if((this.model.get("state")!==HistoryItem.STATES.ERROR)||(!this.model.get("for_editing"))){return null}this.errButton=new IconButtonView({model:new IconButton({title:"View or report this error",href:this.model.get("report_error_url"),target:"galaxy_main",icon_class:"bug"})});return this.errButton.render().$el},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_rerunButton:function(){if(!this.model.get("for_editing")){return null}this.rerunButton=new IconButtonView({model:new IconButton({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",icon_class:"arrow-circle"})});return this.rerunButton.render().$el},_render_tracksterButton:function(){var a=this.model.get("trackster_urls");if(!(this.model.hasData())||!(this.model.get("for_editing"))||!(a)){return null}this.tracksterButton=new IconButtonView({model:new IconButton({title:"View in Trackster",icon_class:"chart_curve"})});this.errButton.render();this.errButton.$el.addClass("trackster-add").attr({"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]});return this.errButton.$el},_render_secondaryActionButtons:function(b){var c=$("<div/>"),a=this;c.attr("style","float: right;").attr("id","secondary-actions-"+this.model.get("id"));_.each(b,function(d){c.append(d.call(a))});return c},_render_tagButton:function(){if(!(this.model.hasData())||!(this.model.get("for_editing"))||(!this.model.get("retag_url"))){return null}this.tagButton=new IconButtonView({model:new IconButton({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),icon_class:"tags"})});return this.tagButton.render().$el},_render_annotateButton:function(){if(!(this.model.hasData())||!(this.model.get("for_editing"))||(!this.model.get("annotate_url"))){return null}this.annotateButton=new IconButtonView({model:new IconButton({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotate_url"),icon_class:"annotate"})});return this.annotateButton.render().$el},_render_tagArea:function(){if(this.model.get("retag_url")){return null}return $(HistoryItemView.templates.tagArea(this.model.toJSON()))},_render_annotationArea:function(){if(!this.model.get("annotate_url")){return null}return $(HistoryItemView.templates.annotationArea(this.model.toJSON()))},_render_displayApps:function(){if(!this.model.hasData()){return null}var a=$("<div/>").addClass("display-apps");if(!_.isEmpty(this.model.get("display_types"))){this.log(this+"display_types:",this.model.get("display_types"));a.append(HistoryItemView.templates.displayApps({displayApps:this.model.toJSON().display_types}))}if(!_.isEmpty(this.model.get("display_apps"))){this.log(this+"display_apps:",this.model.get("display_apps"));a.append(HistoryItemView.templates.displayApps({displayApps:this.model.toJSON().display_apps}))}return a},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_errButton,this._render_showParamsButton,this._render_rerunButton]))},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_failed_metadata:function(a){a.append($(HistoryItemView.templates.failedMetadata(this.model.toJSON())));this._render_body_ok(a)},_render_body_ok:function(a){a.append(this._render_hdaSummary());a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_errButton,this._render_showParamsButton,this._render_rerunButton]));a.append(this._render_secondaryActionButtons([this._render_tagButton,this._render_annotateButton]));a.append('<div class="clear"/>');a.append(this._render_tagArea());a.append(this._render_annotationArea());a.append(this._render_displayApps());a.append(this._render_peek())},_render_body:function(){var b=this.model.get("state");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this+".loadAndDisplayTags",b);var c=this.$el.find(".tag-area"),a=c.find(".tag-elt");if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this+".loadAndDisplayAnnotation",b);var d=this.$el.find(".annotation-area"),c=d.find(".annotation-elt"),a=this.model.get("ajax_set_annotation_url");if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"common-templates.html":{warningMsg:"template-warningmessagesmall"},"history-templates.html":{messages:"template-history-warning-messages",titleLink:"template-history-titleLink",hdaSummary:"template-history-hdaSummary",downloadLinks:"template-history-downloadLinks",failedMetadata:"template-history-failedMetaData",tagArea:"template-history-tagArea",annotationArea:"template-history-annotationArea",displayApps:"template-history-displayApps"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}}); \ No newline at end of file +var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",HistoryItem.STATES.NOT_VIEWABLE)}},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NOT_VIEWABLE:"not_viewable",NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){var c=this.model.get("id"),b=this.model.get("state");this.clearReferences();this.$el.attr("id","historyItemContainer-"+c);var a=$("<div/>").attr("id","historyItem-"+c).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+b);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});make_popup_menus(a);this.$el.children().remove();return this.$el.append(a)},clearReferences:function(){this.displayButton=null;this.editButton=null;this.deleteButton=null;this.errButton=null},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());a.append(this._render_editButton());a.append(this._render_deleteButton());return a},_render_displayButton:function(){if(this.model.get("state")===HistoryItem.STATES.UPLOAD){return null}displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",enabled:false,icon_class:"display"}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display"});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){if((this.model.get("state")===HistoryItem.STATES.UPLOAD)||(!this.model.get("for_editing"))){return null}var c=this.model.get("purged"),a=this.model.get("deleted"),b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b.enabled=false}if(a){b.title="Undelete dataset to edit attributes"}else{if(c){b.title="Cannot edit attributes of datasets removed from disk"}}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a={title:"Delete",href:this.model.get("delete_url"),id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"};if((this.model.get("deleted")||this.model.get("purged"))&&(!this.model.get("delete_url"))){a={title:"Dataset is already deleted",icon_class:"delete",enabled:false}}this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(HistoryItemView.templates.titleLink(this.model.toJSON())))},_render_hdaSummary:function(){var a=this.model.toJSON();if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){_.extend(a,{dbkey_unknown_and_editable:true})}return HistoryItemView.templates.hdaSummary(a)},_render_primaryActionButtons:function(c){var b=$("<div/>").attr("id","primary-actions-"+this.model.get("id")),a=this;_.each(c,function(d){b.append(d.call(a))});return b},_render_downloadButton:function(){if(this.model.get("purged")){return null}var a=HistoryItemView.templates.downloadLinks(this.model.toJSON());return $(a)},_render_errButton:function(){if((this.model.get("state")!==HistoryItem.STATES.ERROR)||(!this.model.get("for_editing"))){return null}this.errButton=new IconButtonView({model:new IconButton({title:"View or report this error",href:this.model.get("report_error_url"),target:"galaxy_main",icon_class:"bug"})});return this.errButton.render().$el},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_rerunButton:function(){if(!this.model.get("for_editing")){return null}this.rerunButton=new IconButtonView({model:new IconButton({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",icon_class:"arrow-circle"})});return this.rerunButton.render().$el},_render_tracksterButton:function(){var a=this.model.get("trackster_urls");if(!(this.model.hasData())||!(this.model.get("for_editing"))||!(a)){return null}this.tracksterButton=new IconButtonView({model:new IconButton({title:"View in Trackster",icon_class:"chart_curve"})});this.errButton.render();this.errButton.$el.addClass("trackster-add").attr({"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]});return this.errButton.$el},_render_secondaryActionButtons:function(b){var c=$("<div/>"),a=this;c.attr("style","float: right;").attr("id","secondary-actions-"+this.model.get("id"));_.each(b,function(d){c.append(d.call(a))});return c},_render_tagButton:function(){if(!(this.model.hasData())||!(this.model.get("for_editing"))||(!this.model.get("retag_url"))){return null}this.tagButton=new IconButtonView({model:new IconButton({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),icon_class:"tags"})});return this.tagButton.render().$el},_render_annotateButton:function(){if(!(this.model.hasData())||!(this.model.get("for_editing"))||(!this.model.get("annotate_url"))){return null}this.annotateButton=new IconButtonView({model:new IconButton({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotate_url"),icon_class:"annotate"})});return this.annotateButton.render().$el},_render_tagArea:function(){if(!this.model.get("retag_url")){return null}return $(HistoryItemView.templates.tagArea(this.model.toJSON()))},_render_annotationArea:function(){if(!this.model.get("annotate_url")){return null}return $(HistoryItemView.templates.annotationArea(this.model.toJSON()))},_render_displayApps:function(){if(!this.model.hasData()){return null}var a=$("<div/>").addClass("display-apps");if(!_.isEmpty(this.model.get("display_types"))){a.append(HistoryItemView.templates.displayApps({displayApps:this.model.toJSON().display_types}))}if(!_.isEmpty(this.model.get("display_apps"))){a.append(HistoryItemView.templates.displayApps({displayApps:this.model.toJSON().display_apps}))}return a},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_errButton,this._render_showParamsButton,this._render_rerunButton]))},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_primaryActionButtons([this._render_showParamsButton,this._render_rerunButton]))},_render_body_failed_metadata:function(a){a.append($(HistoryItemView.templates.failedMetadata(this.model.toJSON())));this._render_body_ok(a)},_render_body_ok:function(a){a.append(this._render_hdaSummary());a.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_errButton,this._render_showParamsButton,this._render_rerunButton]));a.append(this._render_secondaryActionButtons([this._render_tagButton,this._render_annotateButton]));a.append('<div class="clear"/>');a.append(this._render_tagArea());a.append(this._render_annotationArea());a.append(this._render_displayApps());a.append(this._render_peek())},_render_body:function(){var b=this.model.get("state");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this+".loadAndDisplayTags",b);var c=this.$el.find(".tag-area"),a=c.find(".tag-elt");if(c.is(":hidden")){if(!jQuery.trim(a.html())){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this+".loadAndDisplayAnnotation",b);var d=this.$el.find(".annotation-area"),c=d.find(".annotation-elt"),a=this.model.get("ajax_set_annotation_url");if(d.is(":hidden")){if(!jQuery.trim(c.html())){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"common-templates.html":{warningMsg:"template-warningmessagesmall"},"history-templates.html":{messages:"template-history-warning-messages",titleLink:"template-history-titleLink",hdaSummary:"template-history-hdaSummary",downloadLinks:"template-history-downloadLinks",failedMetadata:"template-history-failedMetaData",tagArea:"template-history-tagArea",annotationArea:"template-history-annotationArea",displayApps:"template-history-displayApps"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0},userIsAdmin:false,userRoles:[],itemsLength:0,showDeleted:false,showHidden:false,diskSize:0,deleted:false,tags:[],annotation:null,message:null,quotaMsg:false,baseURL:null,hideDeletedURL:null,hideHiddenURL:null,tagURL:null,annotateURL:null},initialize:function(b,a){this.items=new HistoryCollection()},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);a.itemsLength=this.items.length;return a},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){var h=new HistoryItem(_.extend(f,{history_id:b}));a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize:",this);this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.$el.append(HistoryView.templates.historyPanel(this.model.toJSON()));this.log(this+" rendered from template:",this.$el);this.itemsDiv=this.$el.find("#"+this.model.get("id")+"-datasets");if(this.model.items.length){var a=this._render_items();this.itemsDiv.append(a.children());a.remove()}},_render_items:function(){var b=$("<div/>"),a=this;_.each(this.itemViews,function(c){a.log(a+".render_items:",c);b.prepend(c.render())});return b},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});HistoryView.templates=CompiledTemplateLoader.getTemplates({"history-templates.html":{historyPanel:"template-history-historyPanel"}}); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/mvc/ui.js --- a/static/scripts/packed/mvc/ui.js +++ b/static/scripts/packed/mvc/ui.js @@ -1,1 +1,1 @@ -var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,tooltip_config:{},isMenuButton:true,id:null,href:null,target:null,enabled:true,visible:true}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=$(Handlebars.partials.iconButton(this.model.toJSON()));a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(this.model.attributes.on_click){this.model.attributes.on_click(a);return false}return true}});IconButtonView.templates={iconButton:Handlebars.partials.iconButton};var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(c){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",c.attributes.title).addClass("icon-button menu-button").addClass(c.attributes.icon_class).appendTo(a.$el).click(c.attributes.on_click);if(c.attributes.tooltip_config){b.tooltip(c.attributes.tooltip_config)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var GalaxyPaths=Backbone.Model.extend({defaults:{root_path:"",image_path:""}});var GalaxyLocalization=jQuery.extend({},{aliasName:"_l",localizedStrings:{},setLocalizedString:function(b,a){var c=this;var d=function(f,e){if(f!==e){c.localizedStrings[f]=e}};if(jQuery.type(b)==="string"){d(b,a)}else{if(jQuery.type(b)==="object"){jQuery.each(b,function(e,f){d(e,f)})}else{throw ("Localization.setLocalizedString needs either a string or object as the first argument, given: "+b)}}},localize:function(b){try{return this.localizedStrings[b]}catch(a){return b}},toString:function(){return"GalaxyLocalization"}});window[GalaxyLocalization.aliasName]=function(a){return GalaxyLocalization.localize(a)}; \ No newline at end of file +var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,tooltip_config:{},isMenuButton:true,id:null,href:null,target:null,enabled:true,visible:true}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=$(Handlebars.partials.iconButton(this.model.toJSON()));a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(this.model.attributes.on_click){this.model.attributes.on_click(a);return false}return true}});IconButtonView.templates={iconButton:Handlebars.partials.iconButton};var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(c){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",c.attributes.title).addClass("icon-button menu-button").addClass(c.attributes.icon_class).appendTo(a.$el).click(c.attributes.on_click);if(c.attributes.tooltip_config){b.tooltip(c.attributes.tooltip_config)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var GalaxyPaths=Backbone.Model.extend({defaults:{root_path:"",image_path:""}}); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/templates/compiled/helpers-common-templates.js --- a/static/scripts/packed/templates/compiled/helpers-common-templates.js +++ b/static/scripts/packed/templates/compiled/helpers-common-templates.js @@ -1,1 +1,1 @@ -Handlebars.registerPartial("clearFloatDiv",function(a){return'<div class="clear"></div>'});Handlebars.registerHelper("warningmessagesmall",function(a){return'<div class="warningmessagesmall"><strong>'+a.fn(this)+"</strong></div>"});Handlebars.registerPartial("iconButton",function(c,b){var a="";a+=(c.enabled)?("<a"):("<span");if(c.title){a+=' title="'+c.title+'"'}a+=' class="icon-button';if(c.isMenuButton){a+=" menu-button"}if(c.title){a+=" tooltip"}a+=" "+c.icon_class;if(!c.enabled){a+="_disabled"}a+='"';if(c.id){a+=' id="'+c.id+'"'}a+=' href="'+((c.href)?(c.href):("javascript:void(0);"))+'"';if(c.target){a+=' target="'+c.target+'"'}if(!c.visible){a+=' style="display: none;"'}a+=">"+((c.enabled)?("</a>"):("</span>"));return a}); \ No newline at end of file +Handlebars.registerPartial("clearFloatDiv",function(a){return'<div class="clear"></div>'});Handlebars.registerHelper("warningmessagesmall",function(a){return'<div class="warningmessagesmall"><strong>'+a.fn(this)+"</strong></div>"});Handlebars.registerHelper("local",function(a){return _l(a.fn(this))});Handlebars.registerPartial("iconButton",function(c,b){var a="";a+=(c.enabled)?("<a"):("<span");if(c.title){a+=' title="'+c.title+'"'}a+=' class="icon-button';if(c.isMenuButton){a+=" menu-button"}if(c.title){a+=" tooltip"}a+=" "+c.icon_class;if(!c.enabled){a+="_disabled"}a+='"';if(c.id){a+=' id="'+c.id+'"'}a+=' href="'+((c.href)?(c.href):("javascript:void(0);"))+'"';if(c.target){a+=' target="'+c.target+'"'}if(!c.visible){a+=' style="display: none;"'}a+=">"+((c.enabled)?("</a>"):("</span>"));return a}); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/templates/compiled/template-history-downloadLinks.js --- a/static/scripts/packed/templates/compiled/template-history-downloadLinks.js +++ b/static/scripts/packed/templates/compiled/template-history-downloadLinks.js @@ -1,1 +1,1 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-downloadLinks"]=b(function(g,l,f,k,j){f=f||g.helpers;var c,h="function",i=this.escapeExpression,m=this;function e(s,r){var p="",q,o;p+='\n<div popupmenu="dataset-';o=f.id;if(o){q=o.call(s,{hash:{}})}else{q=s.id;q=typeof q===h?q():q}p+=i(q)+'-popup">\n <a class="action-button" href="';o=f.download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.download_url;q=typeof q===h?q():q}p+=i(q)+'">Download Dataset</a>\n <a>Additional Files</a>\n ';q=s.meta_files;q=f.each.call(s,q,{hash:{},inverse:m.noop,fn:m.program(2,d,r)});if(q||q===0){p+=q}p+='\n</div>\n<div style="float:left;" class="menubutton split popup" id="dataset-';o=f.id;if(o){q=o.call(s,{hash:{}})}else{q=s.id;q=typeof q===h?q():q}p+=i(q)+'-popup">\n <a href="';o=f.download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.download_url;q=typeof q===h?q():q}p+=i(q)+'" title="Download" class="icon-button disk tooltip"></a>\n</div>\n';return p}function d(s,r){var p="",q,o;p+='\n <a class="action-button" href="';o=f.meta_download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.meta_download_url;q=typeof q===h?q():q}p+=i(q)+'">Download ';o=f.meta_file_type;if(o){q=o.call(s,{hash:{}})}else{q=s.meta_file_type;q=typeof q===h?q():q}p+=i(q)+"</a>\n ";return p}function n(p,o){return'\n<a href="" title="Download" class="icon-button disk tooltip"></a>\n'}c=l.meta_files;c=f["if"].call(l,c,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j)});if(c||c===0){return c}else{return""}})})(); \ No newline at end of file +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-downloadLinks"]=b(function(g,l,f,k,j){f=f||g.helpers;var c,h="function",i=this.escapeExpression,m=this;function e(s,r){var p="",q,o;p+='\n<div popupmenu="dataset-';o=f.id;if(o){q=o.call(s,{hash:{}})}else{q=s.id;q=typeof q===h?q():q}p+=i(q)+'-popup">\n <a class="action-button" href="';o=f.download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.download_url;q=typeof q===h?q():q}p+=i(q)+'">Download Dataset</a>\n <a>Additional Files</a>\n ';q=s.meta_files;q=f.each.call(s,q,{hash:{},inverse:m.noop,fn:m.program(2,d,r)});if(q||q===0){p+=q}p+='\n</div>\n<div style="float:left;" class="menubutton split popup" id="dataset-';o=f.id;if(o){q=o.call(s,{hash:{}})}else{q=s.id;q=typeof q===h?q():q}p+=i(q)+'-popup">\n <a href="';o=f.download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.download_url;q=typeof q===h?q():q}p+=i(q)+'" title="Download" class="icon-button disk tooltip"></a>\n</div>\n';return p}function d(s,r){var p="",q,o;p+='\n <a class="action-button" href="';o=f.meta_download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.meta_download_url;q=typeof q===h?q():q}p+=i(q)+'">Download ';o=f.meta_file_type;if(o){q=o.call(s,{hash:{}})}else{q=s.meta_file_type;q=typeof q===h?q():q}p+=i(q)+"</a>\n ";return p}function n(s,r){var p="",q,o;p+='\n<a href="';o=f.download_url;if(o){q=o.call(s,{hash:{}})}else{q=s.download_url;q=typeof q===h?q():q}p+=i(q)+'" title="Download" class="icon-button disk tooltip"></a>\n';return p}c=l.meta_files;c=f["if"].call(l,c,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j)});if(c||c===0){return c}else{return""}})})(); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/templates/compiled/template-history-historyPanel.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/template-history-historyPanel.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-historyPanel"]=b(function(k,C,A,s,J){A=A||k.helpers;var B="",o,n,y=this,f="function",c=A.blockHelperMissing,e=this.escapeExpression;function u(L,K){return"refresh"}function t(L,K){return"collapse all"}function r(O,N){var L="",M,K;L+='\n <div style="width: 40px; float: right; white-space: nowrap;">\n <a id="history-tag" title="';K=A.local;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(6,q,N)})}else{M=O.local;M=typeof M===f?M():M}if(!A.local){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(6,q,N)})}if(M||M===0){L+=M}L+='"\n class="icon-button tags tooltip" target="galaxy_main" href="';K=A.tagURL;if(K){M=K.call(O,{hash:{}})}else{M=O.tagURL;M=typeof M===f?M():M}L+=e(M)+'"></a>\n <a id="history-annotate" title="';K=A.local;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(8,m,N)})}else{M=O.local;M=typeof M===f?M():M}if(!A.local){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(8,m,N)})}if(M||M===0){L+=M}L+='"\n class="icon-button annotate tooltip" target="galaxy_main" href="';K=A.annotateURL;if(K){M=K.call(O,{hash:{}})}else{M=O.annotateURL;M=typeof M===f?M():M}L+=e(M)+'"></a>\n </div>\n ';return L}function q(L,K){return"Edit history tags"}function m(L,K){return"Edit history annotation"}function I(O,N){var L="",M,K;L+='\n<div class="historyLinks">\n <a href="';K=A.hideDeletedURL;if(K){M=K.call(O,{hash:{}})}else{M=O.hideDeletedURL;M=typeof M===f?M():M}L+=e(M)+'">';K=A.local;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(11,H,N)})}else{M=O.local;M=typeof M===f?M():M}if(!A.local){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(11,H,N)})}if(M||M===0){L+=M}L+="</a>\n</div>\n";return L}function H(L,K){return"hide deleted"}function G(O,N){var L="",M,K;L+='\n<div class="historyLinks">\n <a href="';K=A.hideHiddenURL;if(K){M=K.call(O,{hash:{}})}else{M=O.hideHiddenURL;M=typeof M===f?M():M}L+=e(M)+'">';K=A.local;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(14,F,N)})}else{M=O.local;M=typeof M===f?M():M}if(!A.local){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(14,F,N)})}if(M||M===0){L+=M}L+="</a>\n</div>\n";return L}function F(L,K){return"hide hidden"}function E(O,N){var L="",M,K;L+="\n ";L+='\n <div id="history-size" style="position: absolute; top: 3px; right: 0px;">';K=A.diskSize;if(K){M=K.call(O,{hash:{}})}else{M=O.diskSize;M=typeof M===f?M():M}L+=e(M)+'</div>\n <div id="history-name" style="margin-right: 50px;" class="tooltip editable-text" title="Click to rename history">';K=A.name;if(K){M=K.call(O,{hash:{}})}else{M=O.name;M=typeof M===f?M():M}L+=e(M)+"</div>\n \n ";return L}function D(O,N){var L="",M,K;L+='\n <div id="history-size">';K=A.diskSize;if(K){M=K.call(O,{hash:{}})}else{M=O.diskSize;M=typeof M===f?M():M}L+=e(M)+"</div>\n ";return L}function p(O,N){var L="",M,K;L+="\n";K=A.warningmessagesmall;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(21,l,N)})}else{M=O.warningmessagesmall;M=typeof M===f?M():M}if(!A.warningmessagesmall){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(21,l,N)})}if(M||M===0){L+=M}L+="\n";return L}function l(N,M){var L,K;K=A.local;if(K){L=K.call(N,{hash:{},inverse:y.noop,fn:y.program(22,j,M)})}else{L=N.local;L=typeof L===f?L():L}if(!A.local){L=c.call(N,L,{hash:{},inverse:y.noop,fn:y.program(22,j,M)})}if(L||L===0){return L}else{return""}}function j(L,K){return"You are currently viewing a deleted history!"}function i(N,M){var K="",L;K+="\n";K+='\n<div style="margin: 0px 5px 10px 5px">\n\n <div id="history-tag-area" style="display: none">\n <b>Tags:</b>\n ';K+="\n ";K+='\n </div>\n\n <div id="history-annotation-area" style="display: none">\n <strong>Annotation / Notes:</strong>\n <div id="history-annotation-container">\n <div id="history-annotation" class="tooltip editable-text" title="Click to edit annotation">\n ';L=N.annotation;L=A["if"].call(N,L,{hash:{},inverse:y.program(27,g,M),fn:y.program(25,h,M)});if(L||L===0){K+=L}K+="\n </div>\n </div>\n </div>\n</div>\n";return K}function h(O,N){var L="",M,K;L+="\n ";K=A.annotation;if(K){M=K.call(O,{hash:{}})}else{M=O.annotation;M=typeof M===f?M():M}L+=e(M)+"\n ";return L}function g(L,K){return"\n <em>Describe or add notes to history</em>\n "}function d(O,N){var L="",M,K;L+='\n<div id="message-container">\n <div class="';K=A.status;if(K){M=K.call(O,{hash:{}})}else{M=O.status;M=typeof M===f?M():M}L+=e(M)+'message">\n ';K=A.message;if(K){M=K.call(O,{hash:{}})}else{M=O.message;M=typeof M===f?M():M}L+=e(M)+"\n </div><br />\n</div>\n";return L}function z(L,K){return'\n <div id="quota-message" class="errormessage">\n You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota.\n </div>\n <br/>\n '}function x(O,N){var L="",M,K;L+='\n<div id="';K=A.id;if(K){M=K.call(O,{hash:{}})}else{M=O.id;M=typeof M===f?M():M}L+=e(M)+'-datasets" class="history-datasets-list">\n ';L+="\n</div>\n\n";return L}function w(O,N){var L="",M,K;L+='\n<div class="infomessagesmall" id="emptyHistoryMessage">\n';K=A.local;if(K){M=K.call(O,{hash:{},inverse:y.noop,fn:y.program(36,v,N)})}else{M=O.local;M=typeof M===f?M():M}if(!A.local){M=c.call(O,M,{hash:{},inverse:y.noop,fn:y.program(36,v,N)})}if(M||M===0){L+=M}L+="\n</div>\n";return L}function v(L,K){return"Your history is empty. Click 'Get Data' on the left pane to start"}B+='<div id="top-links" class="historyLinks">\n <a title="';n=A.local;if(n){o=n.call(C,{hash:{},inverse:y.noop,fn:y.program(1,u,J)})}else{o=C.local;o=typeof o===f?o():o}if(!A.local){o=c.call(C,o,{hash:{},inverse:y.noop,fn:y.program(1,u,J)})}if(o||o===0){B+=o}B+='" class="icon-button arrow-circle tooltip" href="';n=A.baseURL;if(n){o=n.call(C,{hash:{}})}else{o=C.baseURL;o=typeof o===f?o():o}B+=e(o)+"\"></a>\n <a title='";n=A.local;if(n){o=n.call(C,{hash:{},inverse:y.noop,fn:y.program(3,t,J)})}else{o=C.local;o=typeof o===f?o():o}if(!A.local){o=c.call(C,o,{hash:{},inverse:y.noop,fn:y.program(3,t,J)})}if(o||o===0){B+=o}B+="' class='icon-button toggle tooltip' href='#' style=\"display: none\"></a>\n ";o=C.userRoles;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(5,r,J)});if(o||o===0){B+=o}B+='\n</div>\n<div class="clear"></div>\n\n';B+="\n";o=C.showDeleted;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(10,I,J)});if(o||o===0){B+=o}B+="\n\n";o=C.showHidden;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(13,G,J)});if(o||o===0){B+=o}B+="\n\n";B+='\n<div id="history-name-area" class="historyLinks">\n <div id="history-name-container" style="position: relative;">\n ';o=C.userRoles;o=A["if"].call(C,o,{hash:{},inverse:y.program(18,D,J),fn:y.program(16,E,J)});if(o||o===0){B+=o}B+='\n </div> \n</div>\n<div style="clear: both;"></div>\n\n';o=C.deleted;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(20,p,J)});if(o||o===0){B+=o}B+="\n\n";B+="\n";B+="\n";o=C.userRoles;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(24,i,J)});if(o||o===0){B+=o}B+="\n\n";o=C.message;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(29,d,J)});if(o||o===0){B+=o}B+='\n\n<div id="quota-message-container">\n ';o=C.over_quota;o=A["if"].call(C,o,{hash:{},inverse:y.noop,fn:y.program(31,z,J)});if(o||o===0){B+=o}B+="\n</div>\n\n";o=C.itemsLength;o=A["if"].call(C,o,{hash:{},inverse:y.program(35,w,J),fn:y.program(33,x,J)});if(o||o===0){B+=o}return B})})(); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/packed/templates/compiled/tool_search.js --- a/static/scripts/packed/templates/compiled/tool_search.js +++ b/static/scripts/packed/templates/compiled/tool_search.js @@ -1,1 +1,1 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_search=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+='<input type="text" name="query" value="';g=d.search_hint_string;if(g){c=g.call(l,{hash:{}})}else{c=l.search_hint_string;c=typeof c===f?c():c}h+=i(c)+'" id="tool-search-query" autocomplete="off" class="search-query parent-width" />\n<a id="search-clear-btn" class="icon-button cross-circle tooltip" title="clear search (esc)"></a>\n<img src="';g=d.spinner_url;if(g){c=g.call(l,{hash:{}})}else{c=l.spinner_url;c=typeof c===f?c():c}h+=i(c)+'" id="search-spinner" class="search-spinner"/>';return h})})(); \ No newline at end of file +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_search=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+='<input type="text" name="query" value="';g=d.search_hint_string;if(g){c=g.call(l,{hash:{}})}else{c=l.search_hint_string;c=typeof c===f?c():c}h+=i(c)+'" id="tool-search-query" autocomplete="off" class="search-query parent-width" />\n<a id="search-clear-btn" class="tooltip" title="clear search (esc)"></a>\n<img src="';g=d.spinner_url;if(g){c=g.call(l,{hash:{}})}else{c=l.spinner_url;c=typeof c===f?c():c}h+=i(c)+'" id="search-spinner" class="search-spinner"/>';return h})})(); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/templates/common-templates.html --- a/static/scripts/templates/common-templates.html +++ b/static/scripts/templates/common-templates.html @@ -14,6 +14,15 @@ }); </script> +<script type="text/javascript" class="helper-common" id="helper-local"> +/** Calls _l (from base-mvc.js) to localize strings (if poosible) + * This helper is specifically for localization within templates + */ +Handlebars.registerHelper( 'local', function( options ){ + return _l( options.fn( this ) ); +}); +</script> + <script type="text/template" class="template-common" id="template-warningmessagesmall"> {{! renders a warning in a (mostly css) highlighted, iconned warning box }} <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div> diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/templates/compiled/helpers-common-templates.js --- a/static/scripts/templates/compiled/helpers-common-templates.js +++ b/static/scripts/templates/compiled/helpers-common-templates.js @@ -8,6 +8,12 @@ Handlebars.registerHelper( 'warningmessagesmall', function( options ){ return '<div class="warningmessagesmall"><strong>' + options.fn( this ) + '</strong></div>' }); +/** Calls _l (from base-mvc.js) to localize strings (if poosible) + * This helper is specifically for localization within templates + */ +Handlebars.registerHelper( 'local', function( options ){ + return _l( options.fn( this ) ); +}); /** Renders a glx style icon-button (see IconButton in mvc/ui.js) * can be used in either of the following ways: * within a template: {{> iconButton buttonData}} diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/templates/compiled/template-history-downloadLinks.js --- a/static/scripts/templates/compiled/template-history-downloadLinks.js +++ b/static/scripts/templates/compiled/template-history-downloadLinks.js @@ -45,8 +45,13 @@ function program4(depth0,data) { - - return "\n<a href=\"\" title=\"Download\" class=\"icon-button disk tooltip\"></a>\n";} + var buffer = "", stack1, foundHelper; + buffer += "\n<a href=\""; + foundHelper = helpers.download_url; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.download_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\" title=\"Download\" class=\"icon-button disk tooltip\"></a>\n"; + return buffer;} stack1 = depth0.meta_files; stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data)}); diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/templates/compiled/template-history-historyPanel.js --- /dev/null +++ b/static/scripts/templates/compiled/template-history-historyPanel.js @@ -0,0 +1,272 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['template-history-historyPanel'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, self=this, functionType="function", blockHelperMissing=helpers.blockHelperMissing, escapeExpression=this.escapeExpression; + +function program1(depth0,data) { + + + return "refresh";} + +function program3(depth0,data) { + + + return "collapse all";} + +function program5(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n <div style=\"width: 40px; float: right; white-space: nowrap;\">\n <a id=\"history-tag\" title=\""; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(6, program6, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(6, program6, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\"\n class=\"icon-button tags tooltip\" target=\"galaxy_main\" href=\""; + foundHelper = helpers.tagURL; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.tagURL; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\"></a>\n <a id=\"history-annotate\" title=\""; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\"\n class=\"icon-button annotate tooltip\" target=\"galaxy_main\" href=\""; + foundHelper = helpers.annotateURL; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.annotateURL; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\"></a>\n </div>\n "; + return buffer;} +function program6(depth0,data) { + + + return "Edit history tags";} + +function program8(depth0,data) { + + + return "Edit history annotation";} + +function program10(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n<div class=\"historyLinks\">\n <a href=\""; + foundHelper = helpers.hideDeletedURL; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.hideDeletedURL; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(11, program11, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(11, program11, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "</a>\n</div>\n"; + return buffer;} +function program11(depth0,data) { + + + return "hide deleted";} + +function program13(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n<div class=\"historyLinks\">\n <a href=\""; + foundHelper = helpers.hideHiddenURL; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.hideHiddenURL; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(14, program14, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(14, program14, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "</a>\n</div>\n"; + return buffer;} +function program14(depth0,data) { + + + return "hide hidden";} + +function program16(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n "; + buffer += "\n <div id=\"history-size\" style=\"position: absolute; top: 3px; right: 0px;\">"; + foundHelper = helpers.diskSize; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.diskSize; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</div>\n <div id=\"history-name\" style=\"margin-right: 50px;\" class=\"tooltip editable-text\" title=\"Click to rename history\">"; + foundHelper = helpers.name; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</div>\n \n "; + return buffer;} + +function program18(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n <div id=\"history-size\">"; + foundHelper = helpers.diskSize; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.diskSize; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</div>\n "; + return buffer;} + +function program20(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n"; + foundHelper = helpers.warningmessagesmall; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(21, program21, data)}); } + else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(21, program21, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n"; + return buffer;} +function program21(depth0,data) { + + var stack1, foundHelper; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(22, program22, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(22, program22, data)}); } + if(stack1 || stack1 === 0) { return stack1; } + else { return ''; }} +function program22(depth0,data) { + + + return "You are currently viewing a deleted history!";} + +function program24(depth0,data) { + + var buffer = "", stack1; + buffer += "\n"; + buffer += "\n<div style=\"margin: 0px 5px 10px 5px\">\n\n <div id=\"history-tag-area\" style=\"display: none\">\n <b>Tags:</b>\n "; + buffer += "\n "; + buffer += "\n </div>\n\n <div id=\"history-annotation-area\" style=\"display: none\">\n <strong>Annotation / Notes:</strong>\n <div id=\"history-annotation-container\">\n <div id=\"history-annotation\" class=\"tooltip editable-text\" title=\"Click to edit annotation\">\n "; + stack1 = depth0.annotation; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(27, program27, data),fn:self.program(25, program25, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div>\n </div>\n </div>\n</div>\n"; + return buffer;} +function program25(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n "; + foundHelper = helpers.annotation; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.annotation; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\n "; + return buffer;} + +function program27(depth0,data) { + + + return "\n <em>Describe or add notes to history</em>\n ";} + +function program29(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n<div id=\"message-container\">\n <div class=\""; + foundHelper = helpers.status; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.status; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "message\">\n "; + foundHelper = helpers.message; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\n </div><br />\n</div>\n"; + return buffer;} + +function program31(depth0,data) { + + + return "\n <div id=\"quota-message\" class=\"errormessage\">\n You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota.\n </div>\n <br/>\n ";} + +function program33(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n<div id=\""; + foundHelper = helpers.id; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "-datasets\" class=\"history-datasets-list\">\n "; + buffer += "\n</div>\n\n"; + return buffer;} + +function program35(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n<div class=\"infomessagesmall\" id=\"emptyHistoryMessage\">\n"; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(36, program36, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(36, program36, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n</div>\n"; + return buffer;} +function program36(depth0,data) { + + + return "Your history is empty. Click 'Get Data' on the left pane to start";} + + buffer += "<div id=\"top-links\" class=\"historyLinks\">\n <a title=\""; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\" class=\"icon-button arrow-circle tooltip\" href=\""; + foundHelper = helpers.baseURL; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.baseURL; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\"></a>\n <a title='"; + foundHelper = helpers.local; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); } + else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "' class='icon-button toggle tooltip' href='#' style=\"display: none\"></a>\n "; + stack1 = depth0.userRoles; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n</div>\n<div class=\"clear\"></div>\n\n"; + buffer += "\n"; + stack1 = depth0.showDeleted; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n\n"; + stack1 = depth0.showHidden; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(13, program13, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n\n"; + buffer += "\n<div id=\"history-name-area\" class=\"historyLinks\">\n <div id=\"history-name-container\" style=\"position: relative;\">\n "; + stack1 = depth0.userRoles; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(18, program18, data),fn:self.program(16, program16, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div> \n</div>\n<div style=\"clear: both;\"></div>\n\n"; + stack1 = depth0.deleted; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(20, program20, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n\n"; + buffer += "\n"; + buffer += "\n"; + stack1 = depth0.userRoles; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(24, program24, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n\n"; + stack1 = depth0.message; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(29, program29, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n\n<div id=\"quota-message-container\">\n "; + stack1 = depth0.over_quota; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(31, program31, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n</div>\n\n"; + stack1 = depth0.itemsLength; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(35, program35, data),fn:self.program(33, program33, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + return buffer;}); +})(); \ No newline at end of file diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 static/scripts/templates/history-templates.html --- a/static/scripts/templates/history-templates.html +++ b/static/scripts/templates/history-templates.html @@ -64,7 +64,7 @@ <a href="{{download_url}}" title="Download" class="icon-button disk tooltip"></a></div> {{else}} -<a href="" title="Download" class="icon-button disk tooltip"></a> +<a href="{{download_url}}" title="Download" class="icon-button disk tooltip"></a> {{/if}} </script> @@ -96,3 +96,112 @@ <br /> {{/each}} </script> + +<!-- +History panel/page - the main container for hdas (gen. on the left hand of the glx page) +--> +<script type="text/template" class="template-history" id="template-history-historyPanel"> +<div id="top-links" class="historyLinks"> + <a title="{{#local}}refresh{{/local}}" class="icon-button arrow-circle tooltip" href="{{baseURL}}"></a> + <a title='{{#local}}collapse all{{/local}}' class='icon-button toggle tooltip' href='#' style="display: none"></a> + {{#if userRoles}} + <div style="width: 40px; float: right; white-space: nowrap;"> + <a id="history-tag" title="{{#local}}Edit history tags{{/local}}" + class="icon-button tags tooltip" target="galaxy_main" href="{{tagURL}}"></a> + <a id="history-annotate" title="{{#local}}Edit history annotation{{/local}}" + class="icon-button annotate tooltip" target="galaxy_main" href="{{annotateURL}}"></a> + </div> + {{/if}} +</div> +<div class="clear"></div> + +{{! TODO: move to js with no reload - use each with historyLinks }} +{{#if showDeleted}} +<div class="historyLinks"> + <a href="{{hideDeletedURL}}">{{#local}}hide deleted{{/local}}</a> +</div> +{{/if}} + +{{#if showHidden}} +<div class="historyLinks"> + <a href="{{hideHiddenURL}}">{{#local}}hide hidden{{/local}}</a> +</div> +{{/if}} + +{{! history name (if any) }} +<div id="history-name-area" class="historyLinks"> + <div id="history-name-container" style="position: relative;"> + {{#if userRoles}} + {{! TODO: factor out conditional css }} + <div id="history-size" style="position: absolute; top: 3px; right: 0px;">{{diskSize}}</div> + <div id="history-name" style="margin-right: 50px;" class="tooltip editable-text" title="Click to rename history">{{name}}</div> + + {{else}} + <div id="history-size">{{diskSize}}</div> + {{/if}} + </div> +</div> +<div style="clear: both;"></div> + +{{#if deleted}} +{{#warningmessagesmall}}{{#local}}You are currently viewing a deleted history!{{/local}}{{/warningmessagesmall}} +{{/if}} + +{{! tags and annotations }} +{{! TODO: wire these to js events }} +{{#if userRoles}} +{{! TODO: move inline styles out }} +<div style="margin: 0px 5px 10px 5px"> + + <div id="history-tag-area" style="display: none"> + <b>Tags:</b> + {{! load via js render_individual_tagging_element }} + {{! render_individual_tagging_element(user=trans.get_user(), tagged_item=history, elt_context="history.mako", use_toggle_link=False, input_size="20") }} + </div> + + <div id="history-annotation-area" style="display: none"> + <strong>Annotation / Notes:</strong> + <div id="history-annotation-container"> + <div id="history-annotation" class="tooltip editable-text" title="Click to edit annotation"> + {{#if annotation}} + {{annotation}} + {{else}} + <em>Describe or add notes to history</em> + {{/if}} + </div> + </div> + </div> +</div> +{{/if}} + +{{#if message}} +<div id="message-container"> + <div class="{{status}}message"> + {{message}} + </div><br /> +</div> +{{/if}} + +<div id="quota-message-container"> + {{#if over_quota}} + <div id="quota-message" class="errormessage"> + You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota. + </div> + <br/> + {{/if}} +</div> + +{{#if itemsLength}} +<div id="{{id}}-datasets" class="history-datasets-list"> + {{! NOTE: HistoryItemViews will be appended here }} +</div> + +{{else}}{{! no history items }} +<div class="infomessagesmall" id="emptyHistoryMessage"> +{{#local}}Your history is empty. Click 'Get Data' on the left pane to start{{/local}} +</div> +{{/if}} +</script> + + + diff -r 78f37cb76a5f981febf36b8119278c59d2319e91 -r 3164ba737fd44f0ec842d6f2d743563d18d1dd74 templates/root/alternate_history.mako --- a/templates/root/alternate_history.mako +++ b/templates/root/alternate_history.mako @@ -97,15 +97,16 @@ # edit attr button if for_editing: if not( hda.deleted or hda.purged ): - edit_url = h.url_for( controller='dataset', action='edit', dataset_id=encoded_data_id ) + edit_url = h.url_for( controller='dataset', action='edit', + dataset_id=encoded_data_id ) add_to_data( edit_url=edit_url ) # delete button if for_editing and not ( deleted or dataset_purged or purged ): - add_to_data( delete_url=h.url_for( controller='dataset', action='delete', dataset_id=encoded_data_id, - ##TODO: loose end - show_deleted_on_refresh=show_deleted - )) + delete_url = h.url_for( controller='dataset', action='delete', + dataset_id=encoded_data_id, + show_deleted_on_refresh=show_deleted ) + add_to_data( delete_url=delete_url ) # ................................................................ primary actions (error, info, download) # download links (hda and associated meta files) @@ -127,7 +128,21 @@ # error report if for_editing: #NOTE: no state == 'error' check - add_to_data( report_error_url=h.url_for( h.url_for( controller='dataset', action='errors', id=encoded_data_id ) ) ) + ##TODO: has to have an _UN_ encoded id + #report_error_url = h.url_for( controller='dataset', action='errors', id=encoded_data_id ) + report_error_url = h.url_for( controller='dataset', action='errors', id=hda.id ) + add_to_data( report_error_url=report_error_url ) + + # info/params + show_params_url = h.url_for( controller='dataset', action='show_params', dataset_id=encoded_data_id ) + add_to_data( show_params_url=show_params_url ) + + # rerun + if for_editing: + ##TODO: has to have an _UN_ encoded id + #rerun_url = h.url_for( controller='tool_runner', action='rerun', id=encoded_data_id ) + rerun_url = h.url_for( controller='tool_runner', action='rerun', id=hda.id ) + add_to_data( rerun_url=rerun_url ) # visualizations if hda.ext in app.datatypes_registry.get_available_tracks(): @@ -265,39 +280,61 @@ %></%def> - +##TODO: remove after filling tags.js +<%namespace file="../tagging_common.mako" import="render_individual_tagging_element" /><%def name="context_to_js()"><% ##print 'context', context, dir( context ) ##print 'context.kwargs', context.kwargs ##print 'history:', history - user_is_admin = trans.user_is_admin() - user_roles = trans.get_current_user_roles() - prepped_hdas = [ - prep_hda( hda, True ) for hda in datasets ] + ##TODO: move to API + for_editing = True context_dict = { 'history' : { - 'id' : trans.security.encode_id( history.id ), - 'name' : history.name + 'id' : trans.security.encode_id( history.id ), + 'name' : history.name, + + 'status' : status, + 'showDeleted' : show_deleted, + 'showHidden' : show_hidden, + 'quotaMsg' : over_quota, + 'message' : message, ##'go outside' + + 'deleted' : history.deleted, + 'diskSize' : history.get_disk_size( nice_size=True ), + + ## maybe security issues... + 'userIsAdmin' : trans.user_is_admin(), + 'userRoles' : [ role.get_api_value() for role in trans.get_current_user_roles() ], + + ##tagging_common.mako: render_individual_tagging_element(user=trans.get_user(), + ## tagged_item=history, elt_context="history.mako", use_toggle_link=False, input_size="20") + 'tags' : [], + ##TODO: broken - of course + ##TODO: remove after filling tags.js + ##'tagHTML' : render_individual_tagging_element( + ## user=trans.get_user(), + ## tagged_item=history, + ## elt_context="history.mako", + ## use_toggle_link=False, + ## input_size="20"), + ##TODO:?? h.to_unicode( annotation ) | h + 'annotation' : h.to_unicode( annotation ), + + ##TODO: broken + 'baseURL' : h.url_for( 'history', show_deleted=show_deleted ), + 'hideDeletedURL' : h.url_for( 'history', show_deleted=False ), + 'hideHiddenURL' : h.url_for( 'history', show_hidden=False ), + 'tagURL' : h.url_for( controller='history', action='tag' ), + 'annotateURL' : h.url_for( controller='history', action='annotate' ) }, - 'annotation' : annotation, - 'hdas' : prepped_hdas, - 'hdaId' : hda_id, - 'showDeleted' : show_deleted, - 'showHidden' : show_hidden, - 'quotaMsg' : over_quota, - 'message' : message, - 'status' : status, + 'hdas' : [ prep_hda( hda, for_editing ) for hda in datasets ], # some of these may be unneeded when all is said and done... - 'forEditing' : True, - - ## maybe security issues... - 'userIsAdmin' : user_is_admin, - 'userRoles' : [ role.get_api_value() for role in user_roles ], - + 'hdaId' : hda_id, + 'forEditing' : for_editing, } %> ${ h.to_json_string( context_dict ) } @@ -307,9 +344,7 @@ ${parent.javascripts()} ${h.js( - "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", - ##"libs/handlebars.full", - "galaxy.autocom_tagging", + "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging", "mvc/base-mvc", "mvc/ui" )} @@ -324,15 +359,12 @@ "template-history-downloadLinks", "template-history-tagArea", "template-history-annotationArea", - "template-history-displayApps" + "template-history-displayApps", + + "template-history-historyPanel" )} - ## if using in-dom templates they need to go here (before the Backbone classes are defined) - ##NOTE: it's impossible(?) to include _ templates in this way bc they use identical delims as mako - ## (without altering Underscore.templateSettings) - ##<%include file="../../static/scripts/templates/common-templates.html" /> - ##<%include file="../../static/scripts/templates/history-templates.html" /> - + ##TODO: fix: curr hasta be _after_ h.templates - move somehow ${h.js( "mvc/history" ##"mvc/tags", "mvc/annotations" @@ -345,40 +377,34 @@ // Init. on document load. var pageData = ${context_to_js()}; - - //USE_MOCK_DATA = true; - USE_CURR_DATA = true; + if( console && console.debug ){ + window.pageData = pageData; + + ##_.each( pageData.hdas, function( hda ){ + ## console.debug( hda ); + ##}); + } // on ready + USE_CURR_DATA = true; $(function(){ if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); } - if( window.USE_MOCK_DATA ){ - if( console && console.debug ){ console.debug( '\t using mock data' ); } - createMockHistoryData(); - return; - - //TODO: handle empty history - } else if ( window.USE_CURR_DATA ){ - if( console && console.debug ){ console.debug( '\t using current history data' ); } + if ( window.USE_CURR_DATA ){ + // Navigate to a dataset. + if( pageData.hdaId ){ + self.location = "#" + pageData.hdaId; + } + glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas ); glx_history_view = new HistoryView({ model: glx_history }); glx_history_view.render(); return; + + } else { + // sandbox } - - // sandbox here - // testing iconButton - //ibm = new IconButton({ - // icon_class : 'information', - // on_click : function( event ){ console.debug( 'blerg' ); }, - //}); - //mockObj = { one : 1 }; - //ibv = new IconButtonView({ model : ibm }); - //new_click = function( event ){ console.debug( mockObj.one ); } - //$( 'body' ).append( ibv.render().$el ); - }); </script> @@ -387,7 +413,8 @@ <%def name="stylesheets()"> ${parent.stylesheets()} ${h.css("base", "history", "autocomplete_tagging" )} - <style>" + <style> + ## TODO: move to base.less .historyItemBody { display: none; } @@ -425,164 +452,4 @@ ${_('Galaxy History')} </%def> -<body class="historyPage"></body> - -<script type="text/javascript"> -function createMockHistoryData(){ - mockHistory = {}; - mockHistory.data = { - - template : { - id : 'a799d38679e985db', - name : 'template', - data_type : 'fastq', - file_size : 226297533, - genome_build : '?', - metadata_data_lines : 0, - metadata_dbkey : '?', - metadata_sequences : 0, - misc_blurb : '215.8 MB', - misc_info : 'uploaded fastq file (misc_info)', - model_class : 'HistoryDatasetAssociation', - download_url : '', - state : 'ok', - visible : true, - deleted : false, - purged : false, - - hid : 0, - //TODO: move to history - for_editing : true, - //for_editing : false, - - //?? not needed - //can_edit : true, - //can_edit : false, - - accessible : true, - - //TODO: move into model functions (build there (and cache?)) - //!! be careful with adding these accrd. to permissions - //!! IOW, don't send them via template/API if the user doesn't have perms to use - //!! (even if they don't show up) - undelete_url : '', - purge_url : '', - unhide_url : '', - - display_url : 'example.com/display', - edit_url : 'example.com/edit', - delete_url : 'example.com/delete', - - show_params_url : 'example.com/show_params', - rerun_url : 'example.com/rerun', - - retag_url : 'example.com/retag', - annotate_url : 'example.com/annotate', - - peek : [ - '<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>', - '<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>', - '<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>', - '<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>', - '<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>', - '<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>', - '<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>', - '</table>' - ].join( '' ) - } - - }; - _.extend( mockHistory.data, { - - notAccessible : - _.extend( _.clone( mockHistory.data.template ), - { accessible : false }), - - //deleted, purged, visible - deleted : - _.extend( _.clone( mockHistory.data.template ), - { deleted : true, - delete_url : '', - purge_url : 'example.com/purge', - undelete_url : 'example.com/undelete' }), - purgedNotDeleted : - _.extend( _.clone( mockHistory.data.template ), - { purged : true, - delete_url : '' }), - notvisible : - _.extend( _.clone( mockHistory.data.template ), - { visible : false, - unhide_url : 'example.com/unhide' }), - - hasDisplayApps : - _.extend( _.clone( mockHistory.data.template ), - { display_apps : { - 'display in IGB' : { - Web: "/display_application/63cd3858d057a6d1/igb_bam/Web", - Local: "/display_application/63cd3858d057a6d1/igb_bam/Local" - } - } - } - ), - canTrackster : - _.extend( _.clone( mockHistory.data.template ), - { trackster_urls : { - 'data-url' : "example.com/trackster-data", - 'action-url' : "example.com/trackster-action", - 'new-url' : "example.com/trackster-new" - } - } - ), - zeroSize : - _.extend( _.clone( mockHistory.data.template ), - { file_size : 0 }), - - hasMetafiles : - _.extend( _.clone( mockHistory.data.template ), { - download_meta_urls : { - 'bam_index' : "example.com/bam-index" - } - }), - - //states - upload : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.UPLOAD }), - queued : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.QUEUED }), - running : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.RUNNING }), - empty : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.EMPTY }), - error : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.ERROR, - report_error_url: 'example.com/report_err' }), - discarded : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.DISCARDED }), - setting_metadata : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.SETTING_METADATA }), - failed_metadata : - _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.FAILED_METADATA }) -/* -*/ - }); - - //mockHistory.views.deleted.logger = console; - mockHistory.items = {}; - mockHistory.views = {}; - for( key in mockHistory.data ){ - mockHistory.items[ key ] = new HistoryItem( mockHistory.data[ key ] ); - mockHistory.items[ key ].set( 'name', key ); - mockHistory.views[ key ] = new HistoryItemView({ model : mockHistory.items[ key ] }); - //console.debug( 'view: ', mockHistory.views[ key ] ); - $( 'body' ).append( mockHistory.views[ key ].render() ); - } -} -</script> \ No newline at end of file +<body class="historyPage"></body> \ No newline at end of file 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.
participants (1)
-
Bitbucket