commit/galaxy-central: greg: Miscellaneous code cleanup related to monitoring tool shed repository installation.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/b1cdad4c77fa/ changeset: b1cdad4c77fa user: greg date: 2012-07-03 15:55:51 summary: Miscellaneous code cleanup related to monitoring tool shed repository installation. affected #: 3 files diff -r 951ba799c0b020ae9d90f55435a30e19039f51fb -r b1cdad4c77fa52d939901b1afb56f910f0753088 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1557,20 +1557,7 @@ status = kwd.get( 'status', 'done' ) if webapp == 'galaxy': installed_repositories = trans.sa_session.query( trans.model.ToolShedRepository ).first() - installing_repository_ids = [] - new_status = trans.model.ToolShedRepository.installation_status.NEW - cloning_status = trans.model.ToolShedRepository.installation_status.CLONING - setting_tool_versions_status = trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS - installing_dependencies_status = trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES - loading_datatypes_status = trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES - for tool_shed_repository in trans.sa_session.query( trans.model.ToolShedRepository ) \ - .filter( or_( trans.model.ToolShedRepository.status == new_status, - trans.model.ToolShedRepository.status == cloning_status, - trans.model.ToolShedRepository.status == setting_tool_versions_status, - trans.model.ToolShedRepository.status == installing_dependencies_status, - trans.model.ToolShedRepository.status == loading_datatypes_status ) ): - installing_repository_ids.append( trans.security.encode_id( tool_shed_repository.id ) ) - installing_repository_ids = ','.join( installing_repository_ids ) + installing_repository_ids = get_ids_of_tool_shed_repositories_being_installed( trans, as_string=True ) return trans.fill_template( '/webapps/galaxy/admin/index.mako', webapp=webapp, installed_repositories=installed_repositories, @@ -2675,6 +2662,24 @@ ## ---- Utility methods ------------------------------------------------------- +def get_ids_of_tool_shed_repositories_being_installed( trans, as_string=False ): + installing_repository_ids = [] + new_status = trans.model.ToolShedRepository.installation_status.NEW + cloning_status = trans.model.ToolShedRepository.installation_status.CLONING + setting_tool_versions_status = trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS + installing_dependencies_status = trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES + loading_datatypes_status = trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES + for tool_shed_repository in trans.sa_session.query( trans.model.ToolShedRepository ) \ + .filter( or_( trans.model.ToolShedRepository.status == new_status, + trans.model.ToolShedRepository.status == cloning_status, + trans.model.ToolShedRepository.status == setting_tool_versions_status, + trans.model.ToolShedRepository.status == installing_dependencies_status, + trans.model.ToolShedRepository.status == loading_datatypes_status ) ): + installing_repository_ids.append( trans.security.encode_id( tool_shed_repository.id ) ) + if as_string: + return ','.join( installing_repository_ids ) + return installing_repository_ids + def get_user( trans, user_id ): """Get a User from the database by id.""" user = trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( user_id ) ) diff -r 951ba799c0b020ae9d90f55435a30e19039f51fb -r b1cdad4c77fa52d939901b1afb56f910f0753088 lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -140,8 +140,8 @@ bgcolor = trans.model.ToolShedRepository.states.OK else: bgcolor = trans.model.ToolShedRepository.states.ERROR - rval = '<div class="count-box state-color-%s" id="RepositoryStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_shed_repository.id ) ) - rval += '%s</div>' % tool_shed_repository.status + rval = '<div class="count-box state-color-%s" id="RepositoryStatus-%s">%s</div>' % \ + ( bgcolor, trans.security.encode_id( tool_shed_repository.id ), tool_shed_repository.status ) return rval webapp = "galaxy" @@ -170,7 +170,8 @@ RevisionColumn( "Revision", filterable="advanced" ), StatusColumn( "Installation Status", - filterable="advanced" ), + filterable="advanced", + label_id_prefix="RepositoryStatus-" ) ] operations = [] def build_initial_query( self, trans, **kwd ): @@ -1149,18 +1150,7 @@ if tsrid and tsrid not in tsridslist: tsridslist.append( tsrid ) if not tsridslist: - new_status = trans.model.ToolShedRepository.installation_status.NEW - cloning_status = trans.model.ToolShedRepository.installation_status.CLONING - setting_tool_versions_status = trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS - installing_dependencies_status = trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES - loading_datatypes_status = trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES - for tool_shed_repository in trans.sa_session.query( trans.model.ToolShedRepository ) \ - .filter( or_( trans.model.ToolShedRepository.status == new_status, - trans.model.ToolShedRepository.status == cloning_status, - trans.model.ToolShedRepository.status == setting_tool_versions_status, - trans.model.ToolShedRepository.status == installing_dependencies_status, - trans.model.ToolShedRepository.status == loading_datatypes_status ) ): - tsridslist.append( trans.security.encode_id( tool_shed_repository.id ) ) + tsridslist = get_ids_of_tool_shed_repositories_being_installed( trans, as_string=False ) kwd[ 'tool_shed_repository_ids' ] = tsridslist return self.repository_installation_grid( trans, **kwd ) @web.json diff -r 951ba799c0b020ae9d90f55435a30e19039f51fb -r b1cdad4c77fa52d939901b1afb56f910f0753088 templates/admin/tool_shed_repository/tool_dependency_installation_status.mako --- a/templates/admin/tool_shed_repository/tool_dependency_installation_status.mako +++ b/templates/admin/tool_shed_repository/tool_dependency_installation_status.mako @@ -9,8 +9,8 @@ bgcolor = trans.model.ToolDependency.states.ERROR elif tool_dependency.status in [ trans.model.ToolDependency.installation_status.INSTALLED ]: bgcolor = trans.model.ToolDependency.states.OK - rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">' % ( bgcolor, trans.security.encode_id( tool_dependency.id ) ) - rval += '%s</div>' % tool_dependency.status + rval = '<div class="count-box state-color-%s" id="ToolDependencyStatus-%s">%s</div>' % \ + ( bgcolor, trans.security.encode_id( tool_dependency.id, tool_dependency.status ) ) return rval %> ${rval} 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