commit/galaxy-central: greg: Add the ability to browse invalid tools in the tool shed - current user is restricted to seeing only their invalid tools if not an admin. Also a bit of cleanup in tool shed statistics.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/a3ffda11a38b/ changeset: a3ffda11a38b user: greg date: 2012-04-04 19:36:37 summary: Add the ability to browse invalid tools in the tool shed - current user is restricted to seeing only their invalid tools if not an admin. Also a bit of cleanup in tool shed statistics. affected #: 8 files diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -50,9 +50,14 @@ for repository in self.sa_session.query( self.model.Repository ): self.repositories += 1 self.total_clones += repository.times_downloaded - if repository.deleted: + is_deleted = repository.deleted + is_new = repository.is_new + if is_deleted and is_new: self.deleted_repositories += 1 - elif repository.is_new: + self.new_repositories += 1 + elif is_deleted: + self.deleted_repositories += 1 + elif is_new: self.new_repositories += 1 else: processed_guids = [] diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 lib/galaxy/webapps/community/controllers/admin.py --- a/lib/galaxy/webapps/community/controllers/admin.py +++ b/lib/galaxy/webapps/community/controllers/admin.py @@ -461,21 +461,25 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - count = 0 - for repository in trans.sa_session.query( trans.model.Repository ) \ - .filter( trans.model.Repository.table.c.deleted == False ): - try: - reset_all_repository_metadata( trans, trans.security.encode_id( repository.id ) ) - log.debug( "Reset metadata on repository %s" % repository.name ) - count += 1 - except Exception, e: - log.debug( "Error attempting to reset metadata on repository %s: %s" % ( repository.name, str( e ) ) ) - message = "Reset metadata on %d repositories" % count - trans.response.send_redirect( web.url_for( controller='admin', - action='browse_repository_metadata', - webapp='community', - message=util.sanitize_text( message ), - status=status ) ) + if 'reset_all_repository_metadata_button' in kwd: + count = 0 + for repository in trans.sa_session.query( trans.model.Repository ) \ + .filter( trans.model.Repository.table.c.deleted == False ): + try: + reset_all_repository_metadata( trans, trans.security.encode_id( repository.id ) ) + log.debug( "Reset metadata on repository %s" % repository.name ) + count += 1 + except Exception, e: + log.debug( "Error attempting to reset metadata on repository %s: %s" % ( repository.name, str( e ) ) ) + message = "Reset metadata on %d repositories" % count + trans.response.send_redirect( web.url_for( controller='admin', + action='browse_repository_metadata', + webapp='community', + message=util.sanitize_text( message ), + status=status ) ) + return trans.fill_template( '/webapps/community/admin/reset_all_repository_metadata.mako', + message=message, + status=status ) @web.expose @web.require_admin def browse_repositories( self, trans, **kwd ): @@ -549,12 +553,15 @@ @web.expose @web.require_admin def regenerate_statistics( self, trans, **kwd ): + params = util.Params( kwd ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) if 'regenerate_statistics_button' in kwd: trans.app.shed_counter.generate_statistics() - message = "Successfully regenerated statistics" + message = "Successfully regenerated statistics" return trans.fill_template( '/webapps/community/admin/statistics.mako', message=message, - status='done' ) + status=status ) @web.expose @web.require_admin def delete_repository( self, trans, **kwd ): diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -400,6 +400,38 @@ # Render the list view return self.valid_repository_list_grid( trans, **kwd ) @web.expose + def browse_invalid_tools( self, trans, **kwd ): + params = util.Params( kwd ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) + webapp = params.get( 'webapp', 'community' ) + is_admin = trans.user_is_admin() + invalid_tools_dict = odict() + if is_admin: + for repository in trans.sa_session.query( trans.model.Repository ) \ + .filter( trans.model.Repository.table.c.deleted == False ) \ + .order_by( trans.model.Repository.table.c.name ): + for downloadable_revision in repository.downloadable_revisions: + metadata = downloadable_revision.metadata + invalid_tools = metadata.get( 'invalid_tools', [] ) + for invalid_tool_config in invalid_tools: + invalid_tools_dict[ invalid_tool_config ] = ( repository.id, repository.name, downloadable_revision.changeset_revision ) + else: + for repository in trans.sa_session.query( trans.model.Repository ) \ + .filter( and_( trans.model.Repository.table.c.deleted == False, + trans.model.Repository.table.c.user_id == trans.user.id ) ) \ + .order_by( trans.model.Repository.table.c.name ): + for downloadable_revision in repository.downloadable_revisions: + metadata = downloadable_revision.metadata + invalid_tools = metadata.get( 'invalid_tools', [] ) + for invalid_tool_config in invalid_tools: + invalid_tools_dict[ invalid_tool_config ] = ( repository.id, repository.name, downloadable_revision.changeset_revision ) + return trans.fill_template( '/webapps/community/repository/browse_invalid_tools.mako', + invalid_tools_dict=invalid_tools_dict, + webapp=webapp, + message=message, + status=status ) + @web.expose def find_workflows( self, trans, **kwd ): params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 templates/webapps/community/admin/index.mako --- a/templates/webapps/community/admin/index.mako +++ b/templates/webapps/community/admin/index.mako @@ -60,6 +60,9 @@ <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repository_metadata', webapp='community' )}">Browse metadata</a></div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', webapp='community' )}">Browse invalid tools</a> + </div></div></div><div class="toolSectionTitle"> diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 templates/webapps/community/admin/reset_all_repository_metadata.mako --- /dev/null +++ b/templates/webapps/community/admin/reset_all_repository_metadata.mako @@ -0,0 +1,19 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> + +%if message: + ${render_msg( message, status )} +%endif + +<div class="toolForm"> + <div class="toolFormTitle">Reset metadata on each change set of the repositories in this tool shed</div> + <form name="reset_all_repository_metadata" id="reset_all_repository_metadata" action="${h.url_for( controller='admin', action='reset_all_repository_metadata' )}" method="post" > + <div class="form-row"> + Click the button below to reset metadata on each change set of the repositories in this tool shed. + </div> + <div class="form-row"> + <input type="submit" name="reset_all_repository_metadata_button" value="Reset all repository metadata"/> + </div> + </form> + </div> +</div> diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 templates/webapps/community/admin/statistics.mako --- a/templates/webapps/community/admin/statistics.mako +++ b/templates/webapps/community/admin/statistics.mako @@ -19,7 +19,7 @@ <td>${trans.app.shed_counter.repositories}</td></tr><tr> - <td>New repositories</td> + <td>Empty repositories</td><td>${trans.app.shed_counter.new_repositories}</td></tr><tr> diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 templates/webapps/community/index.mako --- a/templates/webapps/community/index.mako +++ b/templates/webapps/community/index.mako @@ -71,6 +71,9 @@ <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='my_repositories', webapp='community' )}">Browse my repositories</a></div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', webapp='community' )}">Browse my invalid tools</a> + </div> %endif </div></div> diff -r 7aebce7e4aa1081643c69e23136765585b5097be -r a3ffda11a38b4a863dae03c0a53e2428ffbda1a4 templates/webapps/community/repository/browse_invalid_tools.mako --- /dev/null +++ b/templates/webapps/community/repository/browse_invalid_tools.mako @@ -0,0 +1,38 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> + +%if message: + ${render_msg( message, status )} +%endif + +<div class="toolForm"> + %if invalid_tools_dict: + <div class="toolFormTitle">Invalid tools<i> - click the tool config file name to see why the tool is invalid</i></div> + <div class="form-row"> + <table class="grid"> + <tr> + <th>Tool config</th> + <th>Repository name</th> + <th>Changeset revision</th> + </tr> + %for invalid_tool_config, repository_tup in invalid_tools_dict.items(): + <% repository_id, repository_name, changeset_revision = repository_tup %> + <tr> + <td> + <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( repository_id ), tool_config=invalid_tool_config, changeset_revision=changeset_revision, webapp=webapp )}"> + ${invalid_tool_config} + </a> + </td> + <td>${repository_name}</td> + <td>${changeset_revision}</td> + </tr> + %endfor + </table> + </div> + </div> + %else: + <div class="form-row"> + You do not own any repositories that contain invalid tools. + </div> + %endif +</div> 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