commit/galaxy-central: greg: Change the Galaxy tool shed search feature on the Categories grid to search Repository names and descriptions rather than Category names and descriptions. The ability to search Category names and descriptions has been eliminated. Resolves issue # 480.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/3ed860e47dcf/ changeset: 3ed860e47dcf user: greg date: 2011-06-16 20:55:21 summary: Change the Galaxy tool shed search feature on the Categories grid to search Repository names and descriptions rather than Category names and descriptions. The ability to search Category names and descriptions has been eliminated. Resolves issue # 480. affected #: 5 files (2.9 KB) --- a/lib/galaxy/webapps/community/controllers/admin.py Thu Jun 16 12:27:57 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/admin.py Thu Jun 16 14:55:21 2011 -0400 @@ -323,7 +323,6 @@ group_list_grid = GroupListGrid() manage_category_list_grid = ManageCategoryListGrid() repository_list_grid = RepositoryListGrid() - category_list_grid = CategoryListGrid() @web.expose @web.require_admin @@ -368,21 +367,13 @@ return self.repository_list_grid( trans, **kwd ) @web.expose @web.require_admin - def browse_categories( self, trans, **kwd ): - if 'operation' in kwd: - operation = kwd[ 'operation' ].lower() - if operation in [ "repositories_by_category", "repositories_by_user" ]: - # Eliminate the current filters if any exist. - for k, v in kwd.items(): - if k.startswith( 'f-' ): - del kwd[ k ] - return trans.response.send_redirect( web.url_for( controller='admin', - action='browse_repositories', - **kwd ) ) - return self.category_list_grid( trans, **kwd ) - @web.expose - @web.require_admin def manage_categories( self, trans, **kwd ): + if 'f-free-text-search' in kwd: + # Trick to enable searching repository name, description from the CategoryListGrid. + # What we've done is rendered the search box for the RepositoryListGrid on the grid.mako + # template for the CategoryListGrid. See ~/templates/webapps/community/category/grid.mako. + # Since we are searching repositories and not categories, redirect to browse_repositories(). + return self.browse_repositories( trans, **kwd ) if 'operation' in kwd: operation = kwd['operation'].lower() if operation == "create": --- a/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 16 12:27:57 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 16 14:55:21 2011 -0400 @@ -25,7 +25,6 @@ VALID_REPOSITORYNAME_RE = re.compile( "^[a-z0-9\_]+$" ) class CategoryListGrid( grids.Grid ): - # TODO rename this class to be categoryListGrid when we eliminate all the tools stuff. class NameColumn( grids.TextColumn ): def get_value( self, trans, grid, category ): return category.name @@ -66,11 +65,6 @@ model_class=model.Repository, attach_popup=False ) ] - columns.append( grids.MulticolFilterColumn( "Search category name, description", - cols_to_filter=[ columns[0], columns[1] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) # Override these global_actions = [] @@ -185,6 +179,12 @@ return trans.fill_template( '/webapps/community/index.mako', message=message, status=status ) @web.expose def browse_categories( self, trans, **kwd ): + if 'f-free-text-search' in kwd: + # Trick to enable searching repository name, description from the CategoryListGrid. + # What we've done is rendered the search box for the RepositoryListGrid on the grid.mako + # template for the CategoryListGrid. See ~/templates/webapps/community/category/grid.mako. + # Since we are searching repositories and not categories, redirect to browse_repositories(). + return self.browse_repositories( trans, **kwd ) if 'operation' in kwd: operation = kwd['operation'].lower() if operation in [ "repositories_by_category", "repositories_by_user" ]: @@ -337,9 +337,9 @@ return "Repository names must contain only lower-case letters, numbers and underscore '_'." return '' def __add_hgweb_config_entry( self, trans, repository, repository_path ): - # Add an entry in the hgweb.config file for a new repository. This enables calls to repository.repo_path. - # An entry looks something like: repos/test/mira_assembler = database/community_files/000/repo_123. - # TODO: I believe this can be done via ui.updateconfig(), but I haven't confirmed this... + # Add an entry in the hgweb.config file for a new repository. + # An entry looks something like: + # repos/test/mira_assembler = database/community_files/000/repo_123. hgweb_config = "%s/hgweb.config" % trans.app.config.root entry = "repos/%s/%s = %s" % ( repository.user.username, repository.name, repository_path.lstrip( './' ) ) if os.path.exists( hgweb_config ): @@ -405,9 +405,9 @@ status = params.get( 'status', 'done' ) repository = get_repository( trans, id ) repo = hg.repository( ui.ui(), repository.repo_path ) - # TODO: Our current support for browsing a repository requires copies of the - # repository files to be in the repository root directory. We do the following - # to ensure the latest files are being browsed. + # Our current support for browsing a repository requires copies of the + # repository files to be in the repository root directory. We do the + # following to ensure the latest files are being browsed. current_working_dir = os.getcwd() repo_dir = repository.repo_path os.chdir( repo_dir ) @@ -627,10 +627,8 @@ return trans.response.send_redirect( download_url ) @web.json def open_folder( self, trans, repository_id, key ): - # TODO: The tool shed includes a repository source file browser, which currently depends upon - # copies of the hg repository file store in the repo_path for browsing. We need to figure - # out how to use the mercurial api to browse repository contents so we don't need these copied - # files ( not bad now, but hwen the tools shed includes data indexes, not good ). + # The tool shed includes a repository source file browser, which currently depends upon + # copies of the hg repository file store in the repo_path for browsing. # Avoid caching trans.response.headers['Pragma'] = 'no-cache' trans.response.headers['Expires'] = '0' --- a/lib/galaxy/webapps/community/controllers/upload.py Thu Jun 16 12:27:57 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/upload.py Thu Jun 16 14:55:21 2011 -0400 @@ -161,6 +161,8 @@ cloned_repo_dir = os.path.join( tmp_archive_dir, 'repo_%d' % repository.id ) return tmp_dir, cloned_repo_dir def __hg_push( self, trans, repository, file_data, commit_message, current_working_dir, cloned_repo_dir, repo_dir, tmp_dir ): + repo = hg.repository( ui.ui(), repo_dir ) + tip = repo.changectx( "tip" ) # We want these change sets to be associated with the owner of the repository, so we'll # set the HGUSER environment variable accordingly. os.environ[ 'HGUSER' ] = trans.user.username @@ -182,7 +184,10 @@ os.system( 'hg update > /dev/null 2>&1' ) os.chdir( current_working_dir ) shutil.rmtree( tmp_dir ) - message = "The file '%s' has been successfully uploaded to the repository." % file_data.filename + if tip != repo.changectx( "tip" ): + message = "The file '%s' has been successfully uploaded to the repository." % file_data.filename + else: + message = 'No changes in uploaded files.' trans.response.send_redirect( web.url_for( controller='repository', action='browse_repository', message=message, --- a/templates/webapps/community/admin/index.mako Thu Jun 16 12:27:57 2011 -0400 +++ b/templates/webapps/community/admin/index.mako Thu Jun 16 14:55:21 2011 -0400 @@ -43,7 +43,7 @@ <div class="page-container" style="padding: 10px;"><div class="toolMenu"><div class="toolSectionList"> - <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_categories', webapp='community' )}">Browse by category</a></div> + <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a></div><div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repositories', webapp='community' )}">Browse all repositories</a></div><div class="toolSectionTitle"> Categories --- a/templates/webapps/community/category/grid.mako Thu Jun 16 12:27:57 2011 -0400 +++ b/templates/webapps/community/category/grid.mako Thu Jun 16 14:55:21 2011 -0400 @@ -1,1 +1,63 @@ -<%inherit file="/grid_base.mako"/> +<%namespace file="/display_common.mako" import="render_message" /> +<%namespace file="/grid_base.mako" import="*" /> +<%namespace file="/grid_common.mako" import="*" /> +<%inherit file="/grid_base.mako" /> + +## Render grid header. +<%def name="render_grid_header( grid, repo_grid, render_title=True)"> + <div class="grid-header"> + %if render_title: + ${grid_title()} + %endif + %if grid.global_actions: + <ul class="manage-table-actions"> + %if len( grid.global_actions ) < 4: + %for action in grid.global_actions: + <li><a class="action-button" href="${h.url_for( **action.url_args )}">${action.label}</a></li> + %endfor + %else: + <li><a class="action-button" id="action-8675309-popup" class="menubutton">Actions</a></li> + <div popupmenu="action-8675309-popup"> + %for action in grid.global_actions: + <a class="action-button" href="${h.url_for( **action.url_args )}">${action.label}</a> + %endfor + </div> + %endif + </ul> + %endif + ${render_grid_filters( repo_grid )} + </div> +</%def> + +<%def name="make_grid( grid, repo_grid )"> + <div class="loading-elt-overlay"></div> + <table> + <tr> + <td width="75%">${self.render_grid_header( grid, repo_grid )}</td> + <td></td> + <td></td> + </tr> + <tr> + <td width="100%" id="grid-message" valign="top">${render_message( message, status )}</td> + <td></td> + <td></td> + </tr> + </table> + ${render_grid_table( grid, show_item_checkboxes )} +</%def> + +<%def name="grid_body( grid )"> + <% + from galaxy.webapps.community.controllers.repository import RepositoryListGrid + repo_grid = RepositoryListGrid() + %> + ${self.make_grid( grid, repo_grid )} +</%def> + +<%def name="center_panel()"> + <div style="overflow: auto; height: 100%"> + <div class="page-container" style="padding: 10px;"> + ${self.grid_body( grid )} + </div> + </div> +</%def> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket