1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/01e294adf7ac/ changeset: 01e294adf7ac user: greg date: 2013-03-12 19:29:19 summary: Add grids for tool shed repositories that are ready for review or have tools with invalid functional tests. affected #: 4 files diff -r f6bc826d0ec20da52746e0703774175e835aee94 -r 01e294adf7ac8715039d0baed1d44417e338c1a4 lib/galaxy/webapps/tool_shed/controllers/repository_review.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py @@ -20,11 +20,13 @@ class RepositoryReviewController( BaseUIController, common_util.ItemRatings ): component_grid = repository_review_grids.ComponentGrid() + repositories_ready_for_review_grid = repository_review_grids.RepositoriesReadyForReviewGrid() repositories_reviewed_by_me_grid = repository_review_grids.RepositoriesReviewedByMeGrid() repositories_with_reviews_grid = repository_review_grids.RepositoriesWithReviewsGrid() repositories_without_reviews_grid = repository_review_grids.RepositoriesWithoutReviewsGrid() repository_reviews_by_user_grid = repository_review_grids.RepositoryReviewsByUserGrid() reviewed_repositories_i_own_grid = repository_review_grids.ReviewedRepositoriesIOwnGrid() + repositories_with_invalid_tests_grid = repository_review_grids.RepositoriesWithInvalidTestsGrid() @web.expose @web.require_login( "approve repository review" ) @@ -368,6 +370,31 @@ return self.component_grid( trans, **kwd ) @web.expose + @web.require_login( "manage repositories ready for review" ) + def manage_repositories_ready_for_review( self, trans, **kwd ): + """ + A repository is ready to be reviewed if one of the following conditions is met: + 1) It contains no tools + 2) It contains tools the tools_functionally_correct flag is set to True. This implies that the repository metadata revision was installed and tested + by the Tool Shed's install and test framework. + """ + if 'operation' in kwd: + operation = kwd['operation'].lower() + if operation == "inspect repository revisions": + return trans.response.send_redirect( web.url_for( controller='repository_review', + action='create_review', + **kwd ) ) + if operation == "view_or_manage_repository": + return trans.response.send_redirect( web.url_for( controller='repository_review', + action='view_or_manage_repository', + **kwd ) ) + message = 'Any of these repositories that contain tools have been installed into Galaxy and proven to be functionally correct by executing the tests defined ' + message += 'for each tool. Repositories that do not contain tools have not been installed into Galaxy. ' + kwd[ 'message' ] = message + kwd[ 'status' ] = 'warning' + return self.repositories_ready_for_review_grid( trans, **kwd ) + + @web.expose @web.require_login( "manage repositories reviewed by me" ) def manage_repositories_reviewed_by_me( self, trans, **kwd ): # The value of the received id is the encoded repository id. @@ -383,6 +410,25 @@ return self.repositories_reviewed_by_me_grid( trans, **kwd ) @web.expose + @web.require_login( "manage repositories with invalid tests" ) + def manage_repositories_with_invalid_tests( self, trans, **kwd ): + """Display a list of repositories that contain tools, have not yet been reviewed, and have invalid functional tests.""" + if 'operation' in kwd: + operation = kwd['operation'].lower() + if operation == "inspect repository revisions": + return trans.response.send_redirect( web.url_for( controller='repository_review', + action='create_review', + **kwd ) ) + if operation == "view_or_manage_repository": + return trans.response.send_redirect( web.url_for( controller='repository_review', + action='view_or_manage_repository', + **kwd ) ) + message = 'These repositories contain tools with invalid functional tests (they have not yet been reviewed). ' + kwd[ 'message' ] = message + kwd[ 'status' ] = 'warning' + return self.repositories_with_invalid_tests_grid( trans, **kwd ) + + @web.expose @web.require_login( "manage repositories with reviews" ) def manage_repositories_with_reviews( self, trans, **kwd ): # The value of the received id is the encoded repository id. diff -r f6bc826d0ec20da52746e0703774175e835aee94 -r 01e294adf7ac8715039d0baed1d44417e338c1a4 lib/tool_shed/grids/repository_review_grids.py --- a/lib/tool_shed/grids/repository_review_grids.py +++ b/lib/tool_shed/grids/repository_review_grids.py @@ -1,7 +1,7 @@ import os, logging from galaxy.webapps.tool_shed import model from galaxy.web.framework.helpers import grids -from galaxy.model.orm import and_ +from galaxy.model.orm import and_, or_ from tool_shed.grids.repository_grids import RepositoryGrid import tool_shed.util.shed_util_common as suc @@ -11,13 +11,21 @@ log = logging.getLogger( __name__ ) + class ComponentGrid( grids.Grid ): + + class NameColumn( grids.TextColumn ): + def get_value( self, trans, grid, component ): return component.name + + class DescriptionColumn( grids.TextColumn ): + def get_value( self, trans, grid, component ): return component.description + title = "Repository review components" model_class = model.Component template='/webapps/tool_shed/repository_review/grid.mako' @@ -44,6 +52,8 @@ class RepositoriesWithReviewsGrid( RepositoryGrid ): # This grid filters out repositories that have been marked as either deprecated or deleted. + + class WithReviewsRevisionColumn( grids.GridColumn ): def get_value( self, trans, grid, repository ): # Restrict to revisions that have been reviewed. @@ -53,10 +63,12 @@ for review in repository.reviews: changeset_revision = review.changeset_revision rev, label = suc.get_rev_label_from_changeset_revision( repo, changeset_revision ) - rval += '<a href="manage_repository_reviews_of_revision' - rval += '?id=%s&changeset_revision=%s">%s</a><br/>' % ( trans.security.encode_id( repository.id ), changeset_revision, label ) + rval += '<a href="manage_repository_reviews_of_revision?id=%s&changeset_revision=%s">%s</a><br/>' % \ + ( trans.security.encode_id( repository.id ), changeset_revision, label ) return rval return '' + + class WithoutReviewsRevisionColumn( grids.GridColumn ): def get_value( self, trans, grid, repository ): # Restrict the options to revisions that have not yet been reviewed. @@ -67,11 +79,14 @@ rev, label, changeset_revision = suc.get_rev_label_changeset_revision_from_repository_metadata( trans, repository_metadata, repository=repository ) - rval += '<a href="manage_repository_reviews_of_revision' - rval += '?id=%s&changeset_revision=%s">%s</a><br/>' % ( trans.security.encode_id( repository.id ), changeset_revision, label ) + rval += '<a href="manage_repository_reviews_of_revision?id=%s&changeset_revision=%s">%s</a><br/>' % \ + ( trans.security.encode_id( repository.id ), changeset_revision, label ) return rval return '' + + class ReviewersColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository ): rval = '' if repository.reviewers: @@ -95,7 +110,7 @@ ReviewersColumn( "Reviewers", attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name", - cols_to_filter=[ columns[0] ], + cols_to_filter=[ columns[ 0 ] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -105,6 +120,7 @@ condition=( lambda item: not item.deleted ), async_compatible=False ) ] + def build_initial_query( self, trans, **kwd ): return trans.sa_session.query( model.Repository ) \ .filter( and_( model.Repository.table.c.deleted == False, @@ -114,6 +130,7 @@ .outerjoin( ( model.ComponentReview.table, model.ComponentReview.table.c.repository_review_id == model.RepositoryReview.table.c.id ) ) \ .outerjoin( ( model.Component.table, model.Component.table.c.id == model.ComponentReview.table.c.component_id ) ) + class RepositoriesWithoutReviewsGrid( RepositoriesWithReviewsGrid ): # This grid filters out repositories that have been marked as either deprecated or deleted. title = "Repositories with no reviews" @@ -123,14 +140,14 @@ link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=True ), RepositoriesWithReviewsGrid.DescriptionColumn( "Synopsis", - key="description", - attach_popup=False ), + key="description", + attach_popup=False ), RepositoriesWithReviewsGrid.WithoutReviewsRevisionColumn( "Revisions for review" ), RepositoriesWithReviewsGrid.UserColumn( "Owner", attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, description", - cols_to_filter=[ columns[0], columns[1] ], + cols_to_filter=[ columns[ 0 ], columns[ 1 ] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -138,6 +155,7 @@ allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ) ] + def build_initial_query( self, trans, **kwd ): return trans.sa_session.query( model.Repository ) \ .filter( and_( model.Repository.table.c.deleted == False, @@ -145,8 +163,51 @@ model.Repository.reviews == None ) ) \ .join( model.User.table ) + +class RepositoriesReadyForReviewGrid( RepositoriesWithoutReviewsGrid ): + # Repositories that are ready for human review are those that either: + # 1) Have no tools + # 2) Have tools that have been proven to be functionally correct within Galaxy. + # This grid filters out repositories that have been marked as either deprecated or deleted. + title = "Repositories ready for review" + columns = [ + RepositoriesWithoutReviewsGrid.NameColumn( "Repository name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoriesWithoutReviewsGrid.DescriptionColumn( "Synopsis", + key="description", + attach_popup=False ), + RepositoriesWithoutReviewsGrid.WithoutReviewsRevisionColumn( "Revisions for review" ), + RepositoriesWithoutReviewsGrid.UserColumn( "Owner", + attach_popup=False ) + ] + columns.append( grids.MulticolFilterColumn( "Search repository name, description", + cols_to_filter=[ columns[ 0 ], columns[ 1 ] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + operations = [ grids.GridOperation( "Inspect repository revisions", + allow_multiple=False, + condition=( lambda item: not item.deleted ), + async_compatible=False ) ] + + def build_initial_query( self, trans, **kwd ): + return trans.sa_session.query( model.Repository ) \ + .filter( and_( model.Repository.table.c.deleted == False, + model.Repository.table.c.deprecated == False, + model.Repository.reviews == None ) ) \ + .join( model.RepositoryMetadata.table ) \ + .filter( and_( model.RepositoryMetadata.table.c.downloadable == True, + or_( model.RepositoryMetadata.table.c.includes_tools == False, + and_( model.RepositoryMetadata.table.c.includes_tools == True, + model.RepositoryMetadata.table.c.tools_functionally_correct == True ) ) ) ) \ + .join( model.User.table ) + + class RepositoriesReviewedByMeGrid( RepositoriesWithReviewsGrid ): # This grid filters out repositories that have been marked as either deprecated or deleted. + def build_initial_query( self, trans, **kwd ): return trans.sa_session.query( model.Repository ) \ .filter( and_( model.Repository.table.c.deleted == False, @@ -157,15 +218,25 @@ .outerjoin( ( model.ComponentReview.table, model.ComponentReview.table.c.repository_review_id == model.RepositoryReview.table.c.id ) ) \ .outerjoin( ( model.Component.table, model.Component.table.c.id == model.ComponentReview.table.c.component_id ) ) + class RepositoryReviewsByUserGrid( grids.Grid ): # This grid filters out repositories that have been marked as deprecated. + + class RepositoryNameColumn( grids.TextColumn ): + def get_value( self, trans, grid, review ): return review.repository.name + + class RepositoryDescriptionColumn( grids.TextColumn ): + def get_value( self, trans, grid, review ): return review.repository.description + + class RevisionColumn( grids.TextColumn ): + def get_value( self, trans, grid, review ): encoded_review_id = trans.security.encode_id( review.id ) rval = '<a class="action-button" href="' @@ -175,7 +246,10 @@ rval +='browse_review' rval += '?id=%s">%s</a>' % ( encoded_review_id, suc.get_revision_label( trans, review.repository, review.changeset_revision ) ) return rval + + class RatingColumn( grids.TextColumn ): + def get_value( self, trans, grid, review ): if review.rating: rval = '<input ' @@ -187,6 +261,7 @@ rval += '/>' return rval return '' + title = "Reviews by user" model_class = model.RepositoryReview template='/webapps/tool_shed/repository_review/grid.mako' @@ -217,6 +292,7 @@ num_rows_per_page = 50 preserve_state = False use_paging = True + def build_initial_query( self, trans, **kwd ): user_id = trans.security.decode_id( kwd[ 'id' ] ) return trans.sa_session.query( model.RepositoryReview ) \ @@ -225,6 +301,7 @@ .join( ( model.Repository.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ .filter( model.Repository.table.c.deprecated == False ) + class ReviewedRepositoriesIOwnGrid( RepositoriesWithReviewsGrid ): title = "Reviewed repositories I own" columns = [ @@ -248,6 +325,7 @@ condition=( lambda item: not item.deleted ), async_compatible=False ) ] + def build_initial_query( self, trans, **kwd ): return trans.sa_session.query( model.Repository ) \ .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ @@ -255,4 +333,43 @@ .join( ( model.User.table, model.User.table.c.id == model.RepositoryReview.table.c.user_id ) ) \ .outerjoin( ( model.ComponentReview.table, model.ComponentReview.table.c.repository_review_id == model.RepositoryReview.table.c.id ) ) \ .outerjoin( ( model.Component.table, model.Component.table.c.id == model.ComponentReview.table.c.component_id ) ) - \ No newline at end of file + + +class RepositoriesWithInvalidTestsGrid( RepositoriesWithoutReviewsGrid ): + # Repositories that are ready for human review are those that either: + # 1) Have no tools + # 2) Have tools that have been proven to be functionally correct within Galaxy. + # This grid filters out repositories that have been marked as either deprecated or deleted. + title = "Repositories that contain tools with invalid functional tests" + columns = [ + RepositoriesWithoutReviewsGrid.NameColumn( "Repository name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoriesWithoutReviewsGrid.DescriptionColumn( "Synopsis", + key="description", + attach_popup=False ), + RepositoriesWithoutReviewsGrid.WithoutReviewsRevisionColumn( "Revisions for review" ), + RepositoriesWithoutReviewsGrid.UserColumn( "Owner", + attach_popup=False ) + ] + columns.append( grids.MulticolFilterColumn( "Search repository name, description", + cols_to_filter=[ columns[ 0 ], columns[ 1 ] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + operations = [ grids.GridOperation( "Inspect repository revisions", + allow_multiple=False, + condition=( lambda item: not item.deleted ), + async_compatible=False ) ] + + def build_initial_query( self, trans, **kwd ): + return trans.sa_session.query( model.Repository ) \ + .filter( and_( model.Repository.table.c.deleted == False, + model.Repository.table.c.deprecated == False, + model.Repository.reviews == None ) ) \ + .join( model.RepositoryMetadata.table ) \ + .filter( and_( model.RepositoryMetadata.table.c.downloadable == True, + model.RepositoryMetadata.table.c.includes_tools == True, + model.RepositoryMetadata.table.c.tools_functionally_correct == False ) ) \ + .join( model.User.table ) diff -r f6bc826d0ec20da52746e0703774175e835aee94 -r 01e294adf7ac8715039d0baed1d44417e338c1a4 templates/webapps/tool_shed/admin/index.mako --- a/templates/webapps/tool_shed/admin/index.mako +++ b/templates/webapps/tool_shed/admin/index.mako @@ -72,6 +72,15 @@ </div><div class="toolSectionBody"><div class="toolSectionBg"> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_ready_for_review' )}">Repositories ready for review</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_with_invalid_tests' )}">Repositories with invalid tests</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_without_reviews' )}">All repositories with no reviews</a> + </div> %if trans.user.repository_reviews: <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_reviewed_by_me' )}">Repositories reviewed by me</a> @@ -81,9 +90,6 @@ <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_with_reviews' )}">All reviewed repositories</a></div><div class="toolTitle"> - <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_without_reviews' )}">Repositories with no reviews</a> - </div> - <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_components' )}">Manage review components</a></div></div> diff -r f6bc826d0ec20da52746e0703774175e835aee94 -r 01e294adf7ac8715039d0baed1d44417e338c1a4 templates/webapps/tool_shed/index.mako --- a/templates/webapps/tool_shed/index.mako +++ b/templates/webapps/tool_shed/index.mako @@ -129,6 +129,15 @@ </div><div class="toolSectionBody"><div class="toolSectionBg"> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_ready_for_review' )}">Repositories ready for review</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_with_invalid_tests' )}">Repositories with invalid tests</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_without_reviews' )}">All repositories with no reviews</a> + </div> %if trans.user.repository_reviews: <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_reviewed_by_me' )}">Repositories reviewed by me</a> @@ -138,9 +147,6 @@ <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_with_reviews' )}">All reviewed repositories</a></div><div class="toolTitle"> - <a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_repositories_without_reviews' )}">Repositories with no reviews</a> - </div> - <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository_review', action='manage_components' )}">Manage review components</a></div></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.