commit/galaxy-central: greg: Enhancements and fixes for working with versions of repository tools in the tool shed.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/4e3494acdb97/ changeset: 4e3494acdb97 user: greg date: 2011-08-18 19:51:02 summary: Enhancements and fixes for working with versions of repository tools in the tool shed. affected #: 13 files (6.6 KB) --- a/lib/galaxy/webapps/community/controllers/admin.py Thu Aug 18 13:13:35 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/admin.py Thu Aug 18 13:51:02 2011 -0400 @@ -347,7 +347,7 @@ title = "Repository Metadata" model_class = model.RepositoryMetadata template='/webapps/community/repository/grid.mako' - default_sort_key = "repository_id" + default_sort_key = "name" columns = [ IdColumn( "Id", visible=False, @@ -355,8 +355,8 @@ NameColumn( "Name", key="name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", - id=item.repository.id, + link=( lambda item: dict( operation="view_or_manage_repository_revision", + id=item.id, webapp="community" ) ), attach_popup=True ), RevisionColumn( "Revision", @@ -396,7 +396,15 @@ operation = kwd[ 'operation' ].lower() if operation == "delete": return self.delete_repository_metadata( trans, **kwd ) - if operation == "view_or_manage_repository": + if operation == "view_or_manage_repository_revision": + # The received id is a RepositoryMetadata object id, so we need to get the + # associated Repository and redirect to view_or_manage_repository with the + # changeset_revision. + repository_metadata = get_repository_metadata_by_id( trans, kwd[ 'id' ] ) + repository = repository_metadata.repository + kwd[ 'id' ] = trans.security.encode_id( repository.id ) + kwd[ 'changeset_revision' ] = repository_metadata.changeset_revision + kwd[ 'operation' ] = 'view_or_manage_repository' return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', **kwd ) ) --- a/lib/galaxy/webapps/community/controllers/common.py Thu Aug 18 13:13:35 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/common.py Thu Aug 18 13:51:02 2011 -0400 @@ -81,13 +81,24 @@ def get_repository_metadata_by_id( trans, id ): """Get repository metadata from the database""" return trans.sa_session.query( trans.model.RepositoryMetadata ).get( trans.security.decode_id( id ) ) +def get_revision_label( trans, repository, changeset_revision ): + """ + Return a string consisting of the human read-able + changeset rev and the changeset revision string. + """ + repo = hg.repository( get_configured_ui(), repository.repo_path ) + ctx = get_changectx_for_changeset( trans, repo, changeset_revision ) + if ctx: + return "%s:%s" % ( str( ctx.rev() ), changeset_revision ) + else: + return "-1:%s" % changeset_revision def get_latest_repository_metadata( trans, id ): """Get last metadata defined for a specified repository from the database""" return trans.sa_session.query( trans.model.RepositoryMetadata ) \ .filter( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ) ) \ .order_by( trans.model.RepositoryMetadata.table.c.update_time.desc() ) \ .first() -def generate_workflow_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict ): +def generate_workflow_metadata( trans, id, changeset_revision, exported_workflow_dict, metadata_dict ): """ Update the received metadata_dict with changes that have been applied to the received exported_workflow_dict. Store everything except the @@ -120,7 +131,7 @@ # The received metadata_dict includes no metadata for workflows, so a new repository_metadata table # record is not needed. return False -def generate_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict ): +def generate_tool_metadata( trans, id, changeset_revision, root, name, tool, metadata_dict ): """ Update the received metadata_dict with changes that have been applied to the received tool. @@ -163,15 +174,25 @@ if repository_metadata: metadata = repository_metadata.metadata if metadata and 'tools' in metadata: + saved_tool_ids = [] # The metadata for one or more tools was successfully generated in the past - # for this repository, so we compare the version string for each tool id + # for this repository, so we first compare the version string for each tool id # in metadata_dict with what was previously saved to see if we need to create # a new table record or if we can simply update the existing record. for new_tool_metadata_dict in metadata_dict[ 'tools' ]: for saved_tool_metadata_dict in metadata[ 'tools' ]: + if saved_tool_metadata_dict[ 'id' ] not in saved_tool_ids: + saved_tool_ids.append( saved_tool_metadata_dict[ 'id' ] ) if new_tool_metadata_dict[ 'id' ] == saved_tool_metadata_dict[ 'id' ]: if new_tool_metadata_dict[ 'version' ] != saved_tool_metadata_dict[ 'version' ]: return True + # So far, a new metadata record is not required, but we still have to check to see if + # any new tool ids exist in metadata_dict that are not in the saved metadata. We do + # this because if a new tarball was uploaded to a repository that included tools, it + # may have removed existing tool files if they were not included in the uploaded tarball. + for new_tool_metadata_dict in metadata_dict[ 'tools' ]: + if new_tool_metadata_dict[ 'id' ] not in saved_tool_ids: + return True else: # We have repository metadata that does not include metadata for any tools in the # repository, so we can update the existing repository metadata. @@ -183,7 +204,7 @@ # The received metadata_dict includes no metadata for tools, so a new repository_metadata table # record is not needed. return False -def set_repository_metadata( trans, id, change_set_revision, **kwd ): +def set_repository_metadata( trans, id, changeset_revision, **kwd ): """Set repository metadata""" message = '' status = 'done' @@ -191,7 +212,7 @@ repo_dir = repository.repo_path repo = hg.repository( get_configured_ui(), repo_dir ) invalid_files = [] - ctx = get_changectx_for_changeset( trans, repo, change_set_revision ) + ctx = get_changectx_for_changeset( trans, repo, changeset_revision ) if ctx is not None: metadata_dict = {} for root, dirs, files in os.walk( repo_dir ): @@ -211,7 +232,7 @@ tool = load_tool( trans, full_path ) if tool is not None: # Update the list metadata dictionaries for tools in metadata_dict. - metadata_dict = generate_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict ) + metadata_dict = generate_tool_metadata( trans, id, changeset_revision, root, name, tool, metadata_dict ) except Exception, e: invalid_files.append( ( name, str( e ) ) ) # Find all exported workflows @@ -224,27 +245,28 @@ fp.close() exported_workflow_dict = from_json_string( workflow_text ) # Update the list of metadata dictionaries for workflows in metadata_dict. - metadata_dict = generate_workflow_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict ) + metadata_dict = generate_workflow_metadata( trans, id, changeset_revision, exported_workflow_dict, metadata_dict ) except Exception, e: invalid_files.append( ( name, str( e ) ) ) if metadata_dict: if new_tool_metadata_required( trans, id, metadata_dict ) or new_workflow_metadata_required( trans, id, metadata_dict ): # Create a new repository_metadata table row. - repository_metadata = trans.model.RepositoryMetadata( repository.id, change_set_revision, metadata_dict ) + repository_metadata = trans.model.RepositoryMetadata( repository.id, changeset_revision, metadata_dict ) trans.sa_session.add( repository_metadata ) trans.sa_session.flush() else: - # Update the last saved repository_metadata table row. - repository_metadata = get_latest_repository_metadata( trans, id ) - repository_metadata.metadata = metadata_dict - trans.sa_session.add( repository_metadata ) - trans.sa_session.flush() + # Update the last saved repository_metadata table row. + repository_metadata = get_latest_repository_metadata( trans, id ) + repository_metadata.changeset_revision = changeset_revision + repository_metadata.metadata = metadata_dict + trans.sa_session.add( repository_metadata ) + trans.sa_session.flush() else: # change_set is None - message = "Repository does not include changeset revision '%s'." % str( change_set_revision ) + message = "Repository does not include changeset revision '%s'." % str( changeset_revision ) status = 'error' if invalid_files: - message = "Metadata cannot be defined for change set revision '%s'. Correct the following problems and reset metadata.<br/>" % str( change_set_revision ) + message = "Metadata cannot be defined for change set revision '%s'. Correct the following problems and reset metadata.<br/>" % str( changeset_revision ) for itc_tup in invalid_files: tool_file = itc_tup[0] exception_msg = itc_tup[1] @@ -284,16 +306,16 @@ def get_repository_by_name( trans, name ): """Get a repository from the database via name""" return trans.sa_session.query( app.model.Repository ).filter_by( name=name ).one() -def get_changectx_for_changeset( trans, repo, change_set_revision, **kwd ): +def get_changectx_for_changeset( trans, repo, changeset_revision, **kwd ): """Retrieve a specified changectx from a repository""" for changeset in repo.changelog: ctx = repo.changectx( changeset ) - if str( ctx ) == change_set_revision: + if str( ctx ) == changeset_revision: return ctx return None -def change_set_is_malicious( trans, id, change_set_revision, **kwd ): +def change_set_is_malicious( trans, id, changeset_revision, **kwd ): """Check the malicious flag in repository metadata for a specified change set""" - repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, change_set_revision ) + repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) if repository_metadata: return repository_metadata.malicious return False @@ -440,8 +462,7 @@ refresh_on_change_values = [] for repository_metadata in repository.downloadable_revisions: changeset_revision = repository_metadata.changeset_revision - ctx = get_changectx_for_changeset( trans, repo, changeset_revision ) - revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision ) + revision_label = get_revision_label( trans, repository, changeset_revision ) options.append( ( revision_label, changeset_revision ) ) refresh_on_change_values.append( changeset_revision ) if add_id_to_name: --- a/lib/galaxy/webapps/community/controllers/repository.py Thu Aug 18 13:13:35 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Aug 18 13:51:02 2011 -0400 @@ -83,7 +83,9 @@ strings of all downloadable_revisions of this repository. """ select_field = build_changeset_revision_select_field( trans, repository ) - return select_field.get_html() + if len( select_field.options ) > 1: + return select_field.get_html() + return repository.revision class DescriptionColumn( grids.TextColumn ): def get_value( self, trans, grid, repository ): return repository.description @@ -220,7 +222,7 @@ if 'operation' in kwd: operation = kwd['operation'].lower() if operation == "view_or_manage_repository": - repository_id = kwd.get( 'id', None ) + repository_id = kwd[ 'id' ] repository = get_repository( trans, repository_id ) is_admin = trans.user_is_admin() if is_admin or repository.user == trans.user: @@ -582,8 +584,7 @@ repository, selected_value=changeset_revision, add_id_to_name=False ) - ctx = get_changectx_for_changeset( trans, repo, changeset_revision ) - revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision ) + revision_label = get_revision_label( trans, repository, changeset_revision ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata @@ -721,8 +722,7 @@ repository, selected_value=changeset_revision, add_id_to_name=False ) - ctx = get_changectx_for_changeset( trans, repo, changeset_revision ) - revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision ) + revision_label = get_revision_label( trans, repository, changeset_revision ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata @@ -989,8 +989,6 @@ # Reload the tool_data_table_conf entries trans.app.tool_data_tables = galaxy.tools.data.ToolDataTableManager( trans.app.config.tool_data_table_config_path ) message = "The new entry has been added to the tool_data_table_conf.xml file, so click the <b>Reset metadata</b> button below." - # TODO: what if ~/tool-data/<loc_filename> doesn't exist? We need to figure out how to - # force the user to upload it's sample to the repository in order to generate metadata. return trans.response.send_redirect( web.url_for( controller='repository', action='manage_repository', id=repository_id, @@ -1025,29 +1023,56 @@ break return column_fields @web.expose - def display_tool( self, trans, repository_id, tool_config, **kwd ): + def display_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ): params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository( trans, repository_id ) + old_version_msg = "Your selected version of this tool does not exist in the repository tip, so it " + \ + "cannot be previewed, but you can inspect the tool version's metadata using it's pop-up menu and " + \ + "you can download your selected version of this tool from the <b>Repository Actions</b> menu." try: tool = load_tool( trans, os.path.abspath( tool_config ) ) - tool_state = self.__new_state( trans ) - is_malicious = change_set_is_malicious( trans, repository_id, repository.tip ) - return trans.fill_template( "/webapps/community/repository/tool_form.mako", - repository=repository, - tool=tool, - tool_state=tool_state, - is_malicious=is_malicious, - message=message, - status=status ) + can_preview = True + if changeset_revision != repository.tip: + # See if we are attempting to preview an old version of a tool. + # TODO: Previewing an old version of a tool is not currently supported because + # the received tool_config is a file on the file system. We need to implement + # an enhancement here to look at the repository manifest files if previewing an + # old version of a tool. + repo_changeset_repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) + repo_changeset_metadata = repo_changeset_repository_metadata.metadata + if 'tools' in repo_changeset_metadata: + for tool_metadata_dict in repo_changeset_metadata[ 'tools' ]: + if tool_metadata_dict[ 'id' ] == tool.id: + if tool_metadata_dict[ 'version' ] != tool.version: + can_preview = False + message = old_version_msg + if can_preview: + tool_state = self.__new_state( trans ) + is_malicious = change_set_is_malicious( trans, repository_id, repository.tip ) + return trans.fill_template( "/webapps/community/repository/tool_form.mako", + repository=repository, + tool=tool, + tool_state=tool_state, + is_malicious=is_malicious, + message=message, + status=status ) except Exception, e: - message = 'Error loading tool: %s. Click <b>Reset metadata</b> to correct this error.' % str( e ) - return trans.response.send_redirect( web.url_for( controller='repository', - action='manage_repository', - id=repository_id, - message=message, - status='error' ) ) + # TODO: enhance this to check the repository manifest for the files and + # display the tool using them. + exception_str = str( e ) + if exception_str.find( 'No such file or directory' ) >= 0: + message = old_version_msg + else: + message = "Error loading tool: %s. Click <b>Reset metadata</b> to correct this error." % exception_str + return trans.response.send_redirect( web.url_for( controller='repository', + action='browse_repositories', + operation='view_or_manage_repository', + id=repository_id, + changeset_revision=changeset_revision, + message=message, + status='error' ) ) def __new_state( self, trans, all_pages=False ): """ Create a new `DefaultToolState` for this tool. It will not be initialized @@ -1067,18 +1092,25 @@ repository = get_repository( trans, repository_id ) metadata = {} tool = None + revision_label = get_revision_label( trans, repository, changeset_revision ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ).metadata if 'tools' in repository_metadata: for tool_metadata_dict in repository_metadata[ 'tools' ]: if tool_metadata_dict[ 'id' ] == tool_id: metadata = tool_metadata_dict - tool = load_tool( trans, os.path.abspath( metadata[ 'tool_config' ] ) ) + try: + # We may be attempting to load a tool that no longer exists in the repository tip. + tool = load_tool( trans, os.path.abspath( metadata[ 'tool_config' ] ) ) + except: + tool = None break is_malicious = change_set_is_malicious( trans, repository_id, repository.tip ) return trans.fill_template( "/webapps/community/repository/view_tool_metadata.mako", repository=repository, tool=tool, metadata=metadata, + changeset_revision=changeset_revision, + revision_label=revision_label, is_malicious=is_malicious, message=message, status=status ) @@ -1147,6 +1179,7 @@ action='browse_repositories', operation="view_or_manage_repository", id=trans.security.encode_id( repository.id ), + changeset_revision=repository.tip, status=status, message=message ) ) return output.split() --- a/templates/webapps/community/repository/add_tool_data_table_entry.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/add_tool_data_table_entry.mako Thu Aug 18 13:51:02 2011 -0400 @@ -46,9 +46,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div> %endif --- a/templates/webapps/community/repository/browse_repository.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/browse_repository.mako Thu Aug 18 13:51:02 2011 -0400 @@ -68,9 +68,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> @@ -82,9 +82,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div> %endif --- a/templates/webapps/community/repository/manage_repository.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/manage_repository.mako Thu Aug 18 13:51:02 2011 -0400 @@ -97,26 +97,28 @@ ${render_msg( message, status )} %endif -<div class="toolForm"> - <div class="toolFormTitle">Revision</div> - <div class="toolFormBody"> - <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" > - <div class="form-row"> - <% - if changeset_revision == repository.tip: - tip_str = 'repository tip' - else: - tip_str = '' - %> - ${changeset_revision_select_field.get_html()} <i>${tip_str}</i> - <div class="toolParamHelp" style="clear: both;"> - Select a revision to preview download-able versions of tools from this repository. +%if len( changeset_revision_select_field.options ) > 1: + <div class="toolForm"> + <div class="toolFormTitle">Repository revision</div> + <div class="toolFormBody"> + <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" > + <div class="form-row"> + <% + if changeset_revision == repository.tip: + tip_str = 'repository tip' + else: + tip_str = '' + %> + ${changeset_revision_select_field.get_html()} <i>${tip_str}</i> + <div class="toolParamHelp" style="clear: both;"> + Select a revision to inspect and download versions of tools from this repository. + </div></div> - </div> - </form> + </form> + </div></div> -</div> -<p/> + <p/> +%endif <div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody"> @@ -181,7 +183,7 @@ %if can_set_metadata: <p/><div class="toolForm"> - <div class="toolFormTitle">Preview tools and inspect metadata</div> + <div class="toolFormTitle">Preview tools in repository tip and inspect metadata by tool version</div><div class="toolFormBody"> %if metadata: %if 'tools' in metadata: @@ -205,12 +207,12 @@ <tr><td><div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"> - <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}"> + <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision )}"> ${tool_dict[ 'name' ]} </a></div><div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View tool metadata</a></div></td><td>${tool_dict[ 'description' ]}</td> @@ -269,16 +271,20 @@ <div style="clear: both"></div> %endif %endif - <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post"> - <div class="form-row"> - <div style="float: left; width: 250px; margin-right: 10px;"> - <input type="submit" name="set_metadata_button" value="Reset metadata"/> + %if repository.tip == changeset_revision: + ## TODO: when we support previewing older versions of tools, we + ## should allow resetting metadata on the older versions as well. + <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post"> + <div class="form-row"> + <div style="float: left; width: 250px; margin-right: 10px;"> + <input type="submit" name="set_metadata_button" value="Reset metadata"/> + </div> + <div class="toolParamHelp" style="clear: both;"> + Inspect the repository and reset the above attributes for the repository tip. + </div></div> - <div class="toolParamHelp" style="clear: both;"> - Inspect the repository and reset the above attributes for the repository tip. - </div> - </div> - </form> + </form> + %endif </div></div> %endif --- a/templates/webapps/community/repository/rate_repository.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/rate_repository.mako Thu Aug 18 13:51:02 2011 -0400 @@ -75,9 +75,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> @@ -89,9 +89,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div> %endif --- a/templates/webapps/community/repository/tool_form.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/tool_form.mako Thu Aug 18 13:51:02 2011 -0400 @@ -115,9 +115,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> @@ -132,9 +132,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div> %endif @@ -145,7 +145,7 @@ %endif <div class="toolForm" id="${tool.id}"> - <div class="toolFormTitle">${tool.name}</div> + <div class="toolFormTitle">${tool.name} ${tool.version}</div><div class="toolFormBody"><form id="tool_form" name="tool_form" action="" method="get"><input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}"> --- a/templates/webapps/community/repository/upload.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/upload.mako Thu Aug 18 13:51:02 2011 -0400 @@ -48,9 +48,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> --- a/templates/webapps/community/repository/view_changelog.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/view_changelog.mako Thu Aug 18 13:51:02 2011 -0400 @@ -46,9 +46,9 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> %endif %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_rate: <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> @@ -57,9 +57,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div></ul> --- a/templates/webapps/community/repository/view_changeset.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/view_changeset.mako Thu Aug 18 13:51:02 2011 -0400 @@ -47,9 +47,9 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> %endif %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -61,9 +61,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> %endif </div></ul> --- a/templates/webapps/community/repository/view_repository.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/view_repository.mako Thu Aug 18 13:51:02 2011 -0400 @@ -94,26 +94,28 @@ ${render_msg( message, status )} %endif -<div class="toolForm"> - <div class="toolFormTitle">Revision</div> - <div class="toolFormBody"> - <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" > - <div class="form-row"> - <% - if changeset_revision == repository.tip: - tip_str = 'repository tip' - else: - tip_str = '' - %> - ${changeset_revision_select_field.get_html()} <i>${tip_str}</i> - <div class="toolParamHelp" style="clear: both;"> - Select a revision to preview download-able versions of tools from this repository. +%if len( changeset_revision_select_field.options ) > 1: + <div class="toolForm"> + <div class="toolFormTitle">Repository revision</div> + <div class="toolFormBody"> + <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" > + <div class="form-row"> + <% + if changeset_revision == repository.tip: + tip_str = 'repository tip' + else: + tip_str = '' + %> + ${changeset_revision_select_field.get_html()} <i>${tip_str}</i> + <div class="toolParamHelp" style="clear: both;"> + Select a revision to inspect and download versions of tools from this repository. + </div></div> - </div> - </form> + </form> + </div></div> -</div> -<p/> + <p/> +%endif <div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody"> @@ -173,7 +175,7 @@ %if metadata: <p/><div class="toolForm"> - <div class="toolFormTitle">Preview tools and inspect metadata</div> + <div class="toolFormTitle">Preview tools in repository tip and inspect metadata by tool version</div><div class="toolFormBody"> %if 'tools' in metadata: <div class="form-row"> @@ -196,12 +198,12 @@ <tr><td><div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"> - <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}"> + <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision )}"> ${tool_dict[ 'name' ]} </a></div><div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View tool metadata</a></div></td><td>${tool_dict[ 'description' ]}</td> --- a/templates/webapps/community/repository/view_tool_metadata.mako Thu Aug 18 13:13:35 2011 -0400 +++ b/templates/webapps/community/repository/view_tool_metadata.mako Thu Aug 18 13:51:02 2011 -0400 @@ -38,9 +38,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a> @@ -52,9 +52,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> %endif </div> %endif @@ -64,6 +64,20 @@ ${render_msg( message, status )} %endif +<div class="toolForm"> + <div class="toolFormTitle">Repository revision</div> + <div class="toolFormBody"> + <div class="form-row"> + <label>Revision:</label> + %if can_view_change_log: + <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${revision_label}</a> + %else: + ${revision_label} + %endif + </div> + </div> +</div> +<p/> %if can_download: <div class="toolForm"><div class="toolFormTitle">${repository.name}</div> @@ -85,7 +99,7 @@ <div class="toolFormBody"><div class="form-row"><label>Name:</label> - <a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=metadata[ 'tool_config' ] )}">${metadata[ 'name' ]}</a> + <a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=metadata[ 'tool_config' ], changeset_revision=changeset_revision )}">${metadata[ 'name' ]}</a><div style="clear: both"></div></div> %if 'description' in metadata: @@ -116,31 +130,33 @@ <div style="clear: both"></div></div> %endif - <div class="form-row"> - <label>Command:</label> - <pre>${tool.command}</pre> - <div style="clear: both"></div> - </div> - <div class="form-row"> - <label>Interpreter:</label> - ${tool.interpreter} - <div style="clear: both"></div> - </div> - <div class="form-row"> - <label>Is multi-byte:</label> - ${tool.is_multi_byte} - <div style="clear: both"></div> - </div> - <div class="form-row"> - <label>Forces a history refresh:</label> - ${tool.force_history_refresh} - <div style="clear: both"></div> - </div> - <div class="form-row"> - <label>Parallelism:</label> - ${tool.parallelism} - <div style="clear: both"></div> - </div> + %if tool: + <div class="form-row"> + <label>Command:</label> + <pre>${tool.command}</pre> + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Interpreter:</label> + ${tool.interpreter} + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Is multi-byte:</label> + ${tool.is_multi_byte} + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Forces a history refresh:</label> + ${tool.force_history_refresh} + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Parallelism:</label> + ${tool.parallelism} + <div style="clear: both"></div> + </div> + %endif <% if 'requirements' in metadata: requirements = metadata[ 'requirements' ] 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