commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9e531f5ffaee/ Changeset: 9e531f5ffaee Branch: next-stable User: greg Date: 2013-05-30 21:32:25 Summary: Add the ability for a user to reset metadata on a selected list of repositories in the tool shed for those repositories for which they are authorized to change. Affected #: 6 files diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b lib/galaxy/webapps/tool_shed/controllers/admin.py --- a/lib/galaxy/webapps/tool_shed/controllers/admin.py +++ b/lib/galaxy/webapps/tool_shed/controllers/admin.py @@ -307,7 +307,7 @@ message = util.restore_text( kwd.get( 'message', '' ) ) status = kwd.get( 'status', 'done' ) repositories_select_field = suc.build_repository_ids_select_field( trans ) - return trans.fill_template( '/webapps/tool_shed/admin/reset_metadata_on_selected_repositories.mako', + return trans.fill_template( '/webapps/tool_shed/common/reset_metadata_on_selected_repositories.mako', repositories_select_field=repositories_select_field, message=message, status=status ) diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -2392,6 +2392,19 @@ message=message, status=status ) ) + @web.expose + def reset_metadata_on_my_writable_repositories_in_tool_shed( self, trans, **kwd ): + if 'reset_metadata_on_selected_repositories_button' in kwd: + message, status = metadata_util.reset_metadata_on_selected_repositories( trans, **kwd ) + else: + message = util.restore_text( kwd.get( 'message', '' ) ) + status = kwd.get( 'status', 'done' ) + repositories_select_field = suc.build_repository_ids_select_field( trans, my_writable=True ) + return trans.fill_template( '/webapps/tool_shed/common/reset_metadata_on_selected_repositories.mako', + repositories_select_field=repositories_select_field, + message=message, + status=status ) + def __search_ids_names( self, tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_names ): for i, tool_id in enumerate( tool_ids ): tool_name = tool_names[ i ] diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -12,6 +12,7 @@ from galaxy.web.form_builder import SelectField from galaxy.datatypes import checkers from galaxy.model.orm import and_ +from galaxy.model.orm import or_ import sqlalchemy.orm.exc from tool_shed.util import common_util from tool_shed.util import xml_util @@ -88,19 +89,39 @@ '${host}' """ -def build_repository_ids_select_field( trans, name='repository_ids', multiple=True, display='checkboxes' ): +def build_repository_ids_select_field( trans, name='repository_ids', multiple=True, display='checkboxes', my_writable=False ): """Method called from both Galaxy and the Tool Shed to generate the current list of repositories for resetting metadata.""" repositories_select_field = SelectField( name=name, multiple=multiple, display=display ) if trans.webapp.name == 'tool_shed': # We're in the tool shed. - 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, - trans.model.Repository.table.c.user_id ): - owner = repository.user.username - option_label = '%s (%s)' % ( repository.name, owner ) - option_value = '%s' % trans.security.encode_id( repository.id ) - repositories_select_field.add_option( option_label, option_value ) + if my_writable: + username = trans.user.username + clause_list = [] + for repository in trans.sa_session.query( trans.model.Repository ) \ + .filter( trans.model.Repository.table.c.deleted == False ): + allow_push = repository.allow_push( trans.app ) + if allow_push: + allow_push_usernames = allow_push.split( ',' ) + if username in allow_push_usernames: + clause_list.append( trans.model.Repository.table.c.id == repository.id ) + if clause_list: + for repository in trans.sa_session.query( trans.model.Repository ) \ + .filter( or_( *clause_list ) ) \ + .order_by( trans.model.Repository.table.c.name, + trans.model.Repository.table.c.user_id ): + owner = repository.user.username + option_label = '%s (%s)' % ( repository.name, owner ) + option_value = '%s' % trans.security.encode_id( repository.id ) + repositories_select_field.add_option( option_label, option_value ) + else: + 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, + trans.model.Repository.table.c.user_id ): + owner = repository.user.username + option_label = '%s (%s)' % ( repository.name, owner ) + option_value = '%s' % trans.security.encode_id( repository.id ) + repositories_select_field.add_option( option_label, option_value ) else: # We're in Galaxy. for repository in trans.sa_session.query( trans.model.ToolShedRepository ) \ diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b templates/webapps/tool_shed/admin/reset_metadata_on_selected_repositories.mako --- a/templates/webapps/tool_shed/admin/reset_metadata_on_selected_repositories.mako +++ /dev/null @@ -1,40 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> -<%namespace file="/webapps/tool_shed/common/common.mako" import="common_misc_javascripts" /> - -<%def name="javascripts()"> - ${parent.javascripts()} - ${common_misc_javascripts()} -</%def> - -%if message: - ${render_msg( message, status )} -%endif - -<div class="warningmessage"> - Resetting metadata may take a while because this process clones each change set in each selected repository's change log to a temporary location on disk. - Wait until this page redirects after clicking the <b>Reset metadata on selected repositories</b> button, as doing anything else will not be helpful. Watch - the tool shed paster log to pass the time if necessary. -</div> - -<div class="toolForm"> - <div class="toolFormTitle">Reset all metadata on each selected repository</div> - <form name="reset_metadata_on_selected_repositories" id="reset_metadata_on_selected_repositories" action="${h.url_for( controller='admin', action='reset_metadata_on_selected_repositories_in_tool_shed' )}" method="post" > - <div class="form-row"> - Check each repository for which you want to reset metadata. Repository names are followed by owners in parentheses. - </div> - <div style="clear: both"></div> - <div class="form-row"> - <input type="checkbox" id="checkAll" name="select_all_repositories_checkbox" value="true" onclick="checkAllFields('repository_ids');"/><input type="hidden" name="select_all_repositories_checkbox" value="true"/><b>Select/unselect all repositories</b> - </div> - <div style="clear: both"></div> - <div class="form-row"> - ${repositories_select_field.get_html()} - </div> - <div style="clear: both"></div> - <div class="form-row"> - <input type="submit" name="reset_metadata_on_selected_repositories_button" value="Reset metadata on selected repositories"/> - </div> - </form> - </div> -</div> diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b templates/webapps/tool_shed/common/reset_metadata_on_selected_repositories.mako --- /dev/null +++ b/templates/webapps/tool_shed/common/reset_metadata_on_selected_repositories.mako @@ -0,0 +1,40 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/webapps/tool_shed/common/common.mako" import="common_misc_javascripts" /> + +<%def name="javascripts()"> + ${parent.javascripts()} + ${common_misc_javascripts()} +</%def> + +%if message: + ${render_msg( message, status )} +%endif + +<div class="warningmessage"> + Resetting metadata may take a while because this process clones each change set in each selected repository's change log to a temporary location on disk. + Wait until this page redirects after clicking the <b>Reset metadata on selected repositories</b> button, as doing anything else will not be helpful. Watch + the tool shed paster log to pass the time if necessary. +</div> + +<div class="toolForm"> + <div class="toolFormTitle">Reset all metadata on each selected repository</div> + <form name="reset_metadata_on_selected_repositories" id="reset_metadata_on_selected_repositories" action="${h.url_for( controller='admin', action='reset_metadata_on_selected_repositories_in_tool_shed' )}" method="post" > + <div class="form-row"> + Check each repository for which you want to reset metadata. Repository names are followed by owners in parentheses. + </div> + <div style="clear: both"></div> + <div class="form-row"> + <input type="checkbox" id="checkAll" name="select_all_repositories_checkbox" value="true" onclick="checkAllFields('repository_ids');"/><input type="hidden" name="select_all_repositories_checkbox" value="true"/><b>Select/unselect all repositories</b> + </div> + <div style="clear: both"></div> + <div class="form-row"> + ${repositories_select_field.get_html()} + </div> + <div style="clear: both"></div> + <div class="form-row"> + <input type="submit" name="reset_metadata_on_selected_repositories_button" value="Reset metadata on selected repositories"/> + </div> + </form> + </div> +</div> diff -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 -r 9e531f5ffaeefedbfdcb71d3e9d4f1ca1a2aa85b templates/webapps/tool_shed/index.mako --- a/templates/webapps/tool_shed/index.mako +++ b/templates/webapps/tool_shed/index.mako @@ -101,7 +101,41 @@ </div> %if has_reviewed_repositories: <div class="toolTitle"> - <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='reviewed_repositories_i_own' )}">Reviewed repositories I own</a> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories_i_own' )}">Repositories I own</a> + </div> + %if has_reviewed_repositories: + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='reviewed_repositories_i_own' )}">Reviewed repositories I own</a> + </div> + %endif + %if has_deprecated_repositories: + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_deprecated_repositories_i_own' )}">Deprecated repositories I own</a> + </div> + %endif + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories' )}">My writable repositories</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='reset_metadata_on_my_writable_repositories_in_tool_shed' )}">Reset metadata on my repositories</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_missing_tool_test_components' )}">Latest revision: missing tool tests</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_with_install_errors' )}">Latest revision: installation errors</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_with_failing_tool_tests' )}">Latest revision: failing tool tests</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_with_skip_tool_test_checked' )}">Latest revision: skip tool tests</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_with_no_failing_tool_tests' )}">Latest revision: all tool tests pass</a> + </div> + <div class="toolTitle"> + <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_my_writable_repositories_with_invalid_tools' )}">Latest revision: invalid tools</a></div> %endif %if has_deprecated_repositories: https://bitbucket.org/galaxy/galaxy-central/commits/f8174b474884/ Changeset: f8174b474884 User: Dave Bouvier Date: 2013-05-30 21:36:28 Summary: Merge with next-stable. Affected #: 2 files 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)
-
commits-noreply@bitbucket.org