commit/galaxy-central: greg: Enhance the "find workflows" feature in the tool shed and installe dtool shed repositories to allow for finding all workflows if the search criteria is blank.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/d01699e14cb0/ changeset: d01699e14cb0 user: greg date: 2012-04-23 21:59:04 summary: Enhance the "find workflows" feature in the tool shed and installe dtool shed repositories to allow for finding all workflows if the search criteria is blank. affected #: 2 files diff -r 98f47fbe0a4f289e7078d5f0aab1c03caeeedf49 -r d01699e14cb0c8edcd4720db2fb6c4b4c284d7e6 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -475,13 +475,16 @@ # This can only occur when there is a multi-select grid with check boxes and an operation, # and the user clicked the operation button without checking any of the check boxes. return trans.show_error_message( "No items were selected." ) - workflow_names = [ item.lower() for item in util.listify( kwd.get( 'workflow_name', '' ) ) ] - exact_matches = params.get( 'exact_matches', '' ) - exact_matches_checked = CheckboxField.is_checked( exact_matches ) - match_tuples = [] - ok = True - if workflow_names: - ok, match_tuples = self.__search_repository_metadata( trans, exact_matches_checked, workflow_names=workflow_names ) + if 'find_workflows_button' in kwd: + workflow_names = [ item.lower() for item in util.listify( kwd.get( 'workflow_name', '' ) ) ] + exact_matches = params.get( 'exact_matches', '' ) + exact_matches_checked = CheckboxField.is_checked( exact_matches ) + match_tuples = [] + ok = True + if workflow_names: + ok, match_tuples = self.__search_repository_metadata( trans, exact_matches_checked, workflow_names=workflow_names ) + else: + ok, match_tuples = self.__search_repository_metadata( trans, exact_matches_checked, workflow_names=[], all_workflows=True ) if ok: kwd[ 'match_tuples' ] = match_tuples # Render the list view @@ -506,6 +509,9 @@ else: message = "No search performed - each field must contain the same number of comma-separated items." status = "error" + else: + exact_matches_checked = False + workflow_names = [] exact_matches_check_box = CheckboxField( 'exact_matches', checked=exact_matches_checked ) return trans.fill_template( '/webapps/community/repository/find_workflows.mako', webapp=webapp, @@ -593,7 +599,7 @@ exact_matches_check_box=exact_matches_check_box, message=message, status=status ) - def __search_repository_metadata( self, trans, exact_matches_checked, tool_ids='', tool_names='', tool_versions='', workflow_names='' ): + def __search_repository_metadata( self, trans, exact_matches_checked, tool_ids='', tool_names='', tool_versions='', workflow_names='', all_workflows=False ): match_tuples = [] ok = True for repository_metadata in trans.sa_session.query( model.RepositoryMetadata ): @@ -661,6 +667,8 @@ for workflow_name in workflow_names: if self.__in_workflow_dict( workflow_dict, exact_matches_checked, workflow_name ): match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) + elif all_workflows and 'workflows' in metadata: + match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) return ok, match_tuples def __in_workflow_dict( self, workflow_dict, exact_matches_checked, workflow_name ): workflow_dict_workflow_name = workflow_dict[ 'name' ].lower() diff -r 98f47fbe0a4f289e7078d5f0aab1c03caeeedf49 -r d01699e14cb0c8edcd4720db2fb6c4b4c284d7e6 templates/webapps/community/repository/find_workflows.mako --- a/templates/webapps/community/repository/find_workflows.mako +++ b/templates/webapps/community/repository/find_workflows.mako @@ -26,7 +26,7 @@ <div class="toolFormTitle">Search repositories for workflows</div><div class="toolFormBody"><div class="form-row"> - Enter a workflow name to find repositories that contain workflows matching the search criteria.<br/><br/> + Enter a workflow name to find repositories that contain workflows matching the search criteria, or leave blank to find all repositories that contain a workflow.<br/><br/> Comma-separated strings may be entered to expand search criteria. </div><div style="clear: both"></div> @@ -46,7 +46,7 @@ </div><div style="clear: both"></div><div class="form-row"> - <input type="submit" value="Search repositories"/> + <input type="submit" name="find_workflows_button" value="Search repositories"/></div></form></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