lists.galaxyproject.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
List overview
Download
galaxy-commits
March 2013
----- 2024 -----
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
galaxy-commits@lists.galaxyproject.org
1 participants
183 discussions
Start a n
N
ew thread
commit/galaxy-central: greg: Add links for set_environment tool dependency type in the Tool dependency definitions Galaxy Utilities grid.
by commits-noreply@bitbucket.org
05 Mar '13
05 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/b9af8161548a/
changeset: b9af8161548a user: greg date: 2013-03-05 01:47:23 summary: Add links for set_environment tool dependency type in the Tool dependency definitions Galaxy Utilities grid. affected #: 1 file diff -r 26315fa894cefb9192a38ee596f3cb93d8c33e3f -r b9af8161548a17653704304a72d392d2a328cc4b lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -843,12 +843,14 @@ # Example: "set_environment": [{"name": "JAVA_JAR_FILE", "type": "set_environment"}] env_dicts = tds_dict[ 'set_environment' ] num_env_dicts = len( env_dicts ) - td_str += '<b>environment:</b> ' - for index, env_dict in enumerate( env_dicts ): - td_str += '%s' % escape_html( env_dict[ 'name' ] ) - if index < num_env_dicts - 1: - td_str += ', ' - td_str += '<br/>' + if num_env_dicts > 0: + td_str += '<a href="browse_datatypes?operation=view_or_manage_repository&id=%s">' % trans.security.encode_id( repository_metadata.id ) + td_str += '<b>environment:</b> ' + for index, env_dict in enumerate( env_dicts ): + td_str += '%s' % escape_html( env_dict[ 'name' ] ) + if index < num_env_dicts - 1: + td_str += ', ' + td_str += '</a><br/>' for index, key in enumerate( sorted_keys ): if key == 'set_environment': continue 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.
1
0
0
0
commit/galaxy-central: greg: Better aggangement of Galaxy utility grid columns in the tool shed, and fix for the Repository Dependency link in the Valid repository dependency definitions Galaxy Utilities grid.
by commits-noreply@bitbucket.org
05 Mar '13
05 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/26315fa894ce/
changeset: 26315fa894ce user: greg date: 2013-03-05 01:39:23 summary: Better aggangement of Galaxy utility grid columns in the tool shed, and fix for the Repository Dependency link in the Valid repository dependency definitions Galaxy Utilities grid. affected #: 1 file diff -r 3254331483381a1f9d4be24a81cc4d88a703f8bb -r 26315fa894cefb9192a38ee596f3cb93d8c33e3f lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -9,6 +9,8 @@ from galaxy import eggs eggs.require('markupsafe') from markupsafe import escape as escape_html +eggs.require('mercurial') +from mercurial import hg, ui, patch, commands log = logging.getLogger( __name__ ) @@ -774,7 +776,14 @@ required_repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) if required_repository: required_repository_id = trans.security.encode_id( required_repository.id ) - rd_str += '<a href="browse_repository_dependencies?operation=view_or_manage_repository&id=%s&changeset_revision=%s">' % ( required_repository_id, changeset_revision ) + required_repository_metadata = suc.get_repository_metadata_by_repository_id_changeset_revision( trans, required_repository_id, changeset_revision ) + if not required_repository_metadata: + repo_dir = required_repository.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + updated_changeset_revision = suc.get_next_downloadable_changeset_revision( required_repository, repo, changeset_revision ) + required_repository_metadata = suc.get_repository_metadata_by_repository_id_changeset_revision( trans, required_repository_id, updated_changeset_revision ) + required_repository_metadata_id = trans.security.encode_id( required_repository_metadata.id ) + rd_str += '<a href="browse_repository_dependencies?operation=view_or_manage_repository&id=%s">' % ( required_repository_metadata_id ) rd_str += 'Repository <b>%s</b> revision <b>%s</b> owned by <b>%s</b>' % ( escape_html( rd_tup[ 1 ] ), escape_html( rd_tup[ 3 ] ), escape_html( rd_tup[ 2 ] ) ) if required_repository: rd_str += '</a>' @@ -785,6 +794,8 @@ title = "Valid repository dependency definitions in this tool shed" default_sort_key = "Repository.name" columns = [ + RequiredRepositoryColumn( "Repository dependency", + attach_popup=False ), RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), @@ -795,12 +806,10 @@ attach_popup=False, key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", - attach_popup=False ), - RequiredRepositoryColumn( "Repository dependency", - attach_popup=False ) + attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", - cols_to_filter=[ columns[0], columns[1] ], + cols_to_filter=[ columns[1], columns[2] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -848,7 +857,9 @@ name = td_dict[ 'name' ] type = td_dict[ 'type' ] version = td_dict[ 'version' ] + td_str += '<a href="browse_datatypes?operation=view_or_manage_repository&id=%s">' % trans.security.encode_id( repository_metadata.id ) td_str += '<b>%s</b> version <b>%s</b>' % ( escape_html( name ), escape_html( version ) ) + td_str += '</a>' if index < num_keys - 1: td_str += '<br/>' return td_str @@ -856,6 +867,8 @@ title = "Tool dependency definitions in this tool shed" default_sort_key = "Repository.name" columns = [ + ToolDependencyColumn( "Tool dependency", + attach_popup=False ), RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), @@ -866,12 +879,10 @@ attach_popup=False, key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", - attach_popup=False ), - ToolDependencyColumn( "Tool dependency", - attach_popup=False ) + attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", - cols_to_filter=[ columns[0], columns[1] ], + cols_to_filter=[ columns[1], columns[2] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -910,7 +921,9 @@ for index, tool_tup in enumerate( sorted_tool_tups ): tool_id = tool_tup[ 0 ] version = tool_tup[ 1 ] + tool_str += '<a href="browse_datatypes?operation=view_or_manage_repository&id=%s">' % trans.security.encode_id( repository_metadata.id ) tool_str += '<b>%s:</b> %s' % ( escape_html( tool_id ), escape_html( version ) ) + tool_str += '</a>' if index < num_tool_tups - 1: tool_str += '<br/>' return tool_str @@ -918,6 +931,8 @@ title = "Valid tools in this tool shed" default_sort_key = "Repository.name" columns = [ + ToolsColumn( "Tool id and version", + attach_popup=False ), RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), @@ -928,12 +943,10 @@ attach_popup=False, key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", - attach_popup=False ), - ToolsColumn( "Tool id and version", - attach_popup=False ) + attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", - cols_to_filter=[ columns[0], columns[1] ], + cols_to_filter=[ columns[1], columns[2] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -975,7 +988,9 @@ for index, datatype_tup in enumerate( sorted_datatype_tups ): extension = datatype_tup[ 0 ] dtype = datatype_tup[ 1 ] + datatype_str += '<a href="browse_datatypes?operation=view_or_manage_repository&id=%s">' % trans.security.encode_id( repository_metadata.id ) datatype_str += '<b>%s:</b> %s' % ( escape_html( extension ), escape_html( dtype ) ) + datatype_str += '</a>' if index < num_datatype_tups - 1: datatype_str += '<br/>' return datatype_str @@ -983,6 +998,8 @@ title = "Custom datatypes in this tool shed" default_sort_key = "Repository.name" columns = [ + DatatypesColumn( "Datatype extension and class", + attach_popup=False ), RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), @@ -993,12 +1010,10 @@ attach_popup=False, key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", - attach_popup=False ), - DatatypesColumn( "Datatype extension and class", - attach_popup=False ) + attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", - cols_to_filter=[ columns[0], columns[1] ], + cols_to_filter=[ columns[1], columns[2] ], key="free-text-search", visible=False, filterable="standard" ) ) 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.
1
0
0
0
commit/galaxy-central: greg: Speed up the searches for tools and workflows contained in repositories in the tool shed.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/325433148338/
changeset: 325433148338 user: greg date: 2013-03-04 23:21:46 summary: Speed up the searches for tools and workflows contained in repositories in the tool shed. affected #: 1 file diff -r 5705e0578adfb202d1bba0c4b12a9f6344fdd6b7 -r 3254331483381a1f9d4be24a81cc4d88a703f8bb 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 @@ -1927,73 +1927,80 @@ 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 ): - metadata = repository_metadata.metadata - if tool_ids or tool_names or tool_versions: - if 'tools' in metadata: - tools = metadata[ 'tools' ] - else: - tools = [] - for tool_dict in tools: - if tool_ids and not tool_names and not tool_versions: - for tool_id in tool_ids: - if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_id=tool_id ): - match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) - elif tool_names and not tool_ids and not tool_versions: - for tool_name in tool_names: - if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_name=tool_name ): - match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) - elif tool_versions and not tool_ids and not tool_names: - for tool_version in tool_versions: - if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_version=tool_version ): - match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) - elif tool_ids and tool_names and not tool_versions: - if len( tool_ids ) == len( tool_names ): - match_tuples = self.__search_ids_names( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_names ) - elif len( tool_ids ) == 1 or len( tool_names ) == 1: - tool_ids, tool_names = self.__make_same_length( tool_ids, tool_names ) - match_tuples = self.__search_ids_names( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_names ) - else: - ok = False - elif tool_ids and tool_versions and not tool_names: - if len( tool_ids ) == len( tool_versions ): - match_tuples = self.__search_ids_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_versions ) - elif len( tool_ids ) == 1 or len( tool_versions ) == 1: - tool_ids, tool_versions = self.__make_same_length( tool_ids, tool_versions ) - match_tuples = self.__search_ids_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_versions ) - else: - ok = False - elif tool_versions and tool_names and not tool_ids: - if len( tool_versions ) == len( tool_names ): - match_tuples = self.__search_names_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_names, tool_versions ) - elif len( tool_versions ) == 1 or len( tool_names ) == 1: - tool_versions, tool_names = self.__make_same_length( tool_versions, tool_names ) - match_tuples = self.__search_names_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_names, tool_versions ) - else: - ok = False - elif tool_versions and tool_names and tool_ids: - if len( tool_versions ) == len( tool_names ) and len( tool_names ) == len( tool_ids ): - for i, tool_version in enumerate( tool_versions ): - tool_name = tool_names[ i ] - tool_id = tool_ids[ i ] - if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_id=tool_id, tool_name=tool_name, tool_version=tool_version ): + if tool_ids or tool_names or tool_versions: + for repository_metadata in trans.sa_session.query( trans.model.RepositoryMetadata ) \ + .filter( trans.model.RepositoryMetadata.table.c.includes_tools == True ) \ + .join( trans.model.Repository ) \ + .filter( and_( trans.model.Repository.table.c.deleted == False, + trans.model.Repository.table.c.deprecated == False ) ): + metadata = repository_metadata.metadata + if metadata: + tools = metadata.get( 'tools', [] ) + for tool_dict in tools: + if tool_ids and not tool_names and not tool_versions: + for tool_id in tool_ids: + if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_id=tool_id ): match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) - else: - ok = False - elif workflow_names: - if 'workflows' in metadata: + elif tool_names and not tool_ids and not tool_versions: + for tool_name in tool_names: + if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_name=tool_name ): + match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) + elif tool_versions and not tool_ids and not tool_names: + for tool_version in tool_versions: + if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_version=tool_version ): + match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) + elif tool_ids and tool_names and not tool_versions: + if len( tool_ids ) == len( tool_names ): + match_tuples = self.__search_ids_names( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_names ) + elif len( tool_ids ) == 1 or len( tool_names ) == 1: + tool_ids, tool_names = self.__make_same_length( tool_ids, tool_names ) + match_tuples = self.__search_ids_names( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_names ) + else: + ok = False + elif tool_ids and tool_versions and not tool_names: + if len( tool_ids ) == len( tool_versions ): + match_tuples = self.__search_ids_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_versions ) + elif len( tool_ids ) == 1 or len( tool_versions ) == 1: + tool_ids, tool_versions = self.__make_same_length( tool_ids, tool_versions ) + match_tuples = self.__search_ids_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_ids, tool_versions ) + else: + ok = False + elif tool_versions and tool_names and not tool_ids: + if len( tool_versions ) == len( tool_names ): + match_tuples = self.__search_names_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_names, tool_versions ) + elif len( tool_versions ) == 1 or len( tool_names ) == 1: + tool_versions, tool_names = self.__make_same_length( tool_versions, tool_names ) + match_tuples = self.__search_names_versions( tool_dict, exact_matches_checked, match_tuples, repository_metadata, tool_names, tool_versions ) + else: + ok = False + elif tool_versions and tool_names and tool_ids: + if len( tool_versions ) == len( tool_names ) and len( tool_names ) == len( tool_ids ): + for i, tool_version in enumerate( tool_versions ): + tool_name = tool_names[ i ] + tool_id = tool_ids[ i ] + if self.__in_tool_dict( tool_dict, exact_matches_checked, tool_id=tool_id, tool_name=tool_name, tool_version=tool_version ): + match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) + else: + ok = False + elif workflow_names or all_workflows: + for repository_metadata in trans.sa_session.query( trans.model.RepositoryMetadata ) \ + .filter( trans.model.RepositoryMetadata.table.c.includes_workflows == True ) \ + .join( trans.model.Repository ) \ + .filter( and_( trans.model.Repository.table.c.deleted == False, + trans.model.Repository.table.c.deprecated == False ) ): + metadata = repository_metadata.metadata + if metadata: # metadata[ 'workflows' ] is a list of tuples where each contained tuple is # [ <relative path to the .ga file in the repository>, <exported workflow dict> ] - workflow_tups = metadata[ 'workflows' ] - workflows = [ workflow_tup[1] for workflow_tup in workflow_tups ] - else: - workflows = [] - for workflow_dict in workflows: - 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 ) ) + if workflow_names: + workflow_tups = metadata.get( 'workflows', [] ) + workflows = [ workflow_tup[1] for workflow_tup in workflow_tups ] + for workflow_dict in workflows: + 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: + match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) return ok, match_tuples @web.expose 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.
1
0
0
0
commit/galaxy-central: dannon: Update migrate_tools to the correct path.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5705e0578adf/
changeset: 5705e0578adf user: dannon date: 2013-03-04 20:43:41 summary: Update migrate_tools to the correct path. affected #: 1 file diff -r 7010204f7ccda05f806cfe7f30a6a3bc03a5e2d7 -r 5705e0578adfb202d1bba0c4b12a9f6344fdd6b7 lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py --- /dev/null +++ b/lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py @@ -0,0 +1,44 @@ +""" +Migration script to update the migrate_tools.repository_path column to point to the new location lib/tool_shed/galaxy_install/migrate. +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * + +import datetime +now = datetime.datetime.utcnow +# Need our custom types, but don't import anything else from model +from galaxy.model.custom_types import * + +import sys, logging +log = logging.getLogger( __name__ ) +log.setLevel(logging.DEBUG) +handler = logging.StreamHandler( sys.stdout ) +format = "%(name)s %(levelname)s %(asctime)s %(message)s" +formatter = logging.Formatter( format ) +handler.setFormatter( formatter ) +log.addHandler( handler ) + +metadata = MetaData( migrate_engine ) +db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + +def upgrade(): + print __doc__ + metadata.reflect() + # Create the table. + try: + cmd = "UPDATE migrate_tools set repository_path='lib/tool_shed/galaxy_install/migrate';" + db_session.execute( cmd ) + except Exception, e: + log.debug( "Updating migrate_tools.repository_path column to point to the new location lib/tool_shed/galaxy_install/migrate failed: %s" % str( e ) ) + +def downgrade(): + metadata.reflect() + try: + cmd = "UPDATE migrate_tools set repository_path='lib/galaxy/tool_shed/migrate';" + db_session.execute( cmd ) + except Exception, e: + log.debug( "Updating migrate_tools.repository_path column to point to the old location lib/galaxy/tool_shed/migrate failed: %s" % str( e ) ) + 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.
1
0
0
0
commit/galaxy-central: greg: Fix links in the tool shed's Galaxy utilities grids.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7010204f7ccd/
changeset: 7010204f7ccd user: greg date: 2013-03-04 20:29:23 summary: Fix links in the tool shed's Galaxy utilities grids. affected #: 2 files diff -r 93f0c6867e3427d582f6fba6ca2877ecf472b6d5 -r 7010204f7ccda05f806cfe7f30a6a3bc03a5e2d7 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 @@ -82,10 +82,17 @@ def browse_datatypes( self, trans, **kwd ): if 'operation' in kwd: operation = kwd[ 'operation' ].lower() + # The received id is a RepositoryMetadata id. + repository_metadata_id = kwd[ 'id' ] + repository_metadata = suc.get_repository_metadata_by_id( trans, repository_metadata_id ) + repository_id = trans.security.encode_id( repository_metadata.repository_id ) + changeset_revision = repository_metadata.changeset_revision + new_kwd = dict( id=repository_id, + changeset_revision=changeset_revision ) if operation == "view_or_manage_repository": return trans.response.send_redirect( web.url_for( controller='repository', action='view_or_manage_repository', - **kwd ) ) + **new_kwd ) ) return self.datatypes_grid( trans, **kwd ) @web.expose @@ -256,34 +263,55 @@ def browse_repository_dependencies( self, trans, **kwd ): if 'operation' in kwd: operation = kwd[ 'operation' ].lower() + # The received id is a RepositoryMetadata id. + repository_metadata_id = kwd[ 'id' ] + repository_metadata = suc.get_repository_metadata_by_id( trans, repository_metadata_id ) + repository_id = trans.security.encode_id( repository_metadata.repository_id ) + changeset_revision = repository_metadata.changeset_revision + new_kwd = dict( id=repository_id, + changeset_revision=changeset_revision ) if operation == "browse_repository": return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repository', - **kwd ) ) + **new_kwd ) ) if operation == "view_or_manage_repository": return trans.response.send_redirect( web.url_for( controller='repository', action='view_or_manage_repository', - **kwd ) ) + **new_kwd ) ) return self.repository_dependencies_grid( trans, **kwd ) @web.expose def browse_tools( self, trans, **kwd ): if 'operation' in kwd: operation = kwd[ 'operation' ].lower() + # The received id is a RepositoryMetadata id. + repository_metadata_id = kwd['id' ] + repository_metadata = suc.get_repository_metadata_by_id( trans, repository_metadata_id ) + repository_id = trans.security.encode_id( repository_metadata.repository_id ) + changeset_revision = repository_metadata.changeset_revision + new_kwd = dict( id=repository_id, + changeset_revision=changeset_revision ) if operation == "view_or_manage_repository": return trans.response.send_redirect( web.url_for( controller='repository', action='view_or_manage_repository', - **kwd ) ) + **new_kwd ) ) return self.tools_grid( trans, **kwd ) @web.expose def browse_tool_dependencies( self, trans, **kwd ): if 'operation' in kwd: operation = kwd[ 'operation' ].lower() + # The received id is a RepositoryMetadata id. + repository_metadata_id = kwd[ 'id' ] + repository_metadata = suc.get_repository_metadata_by_id( trans, repository_metadata_id ) + repository_id = trans.security.encode_id( repository_metadata.repository_id ) + changeset_revision = repository_metadata.changeset_revision + new_kwd = dict( id=repository_id, + changeset_revision=changeset_revision ) if operation == "view_or_manage_repository": return trans.response.send_redirect( web.url_for( controller='repository', action='view_or_manage_repository', - **kwd ) ) + **new_kwd ) ) return self.tool_dependencies_grid( trans, **kwd ) @web.expose diff -r 93f0c6867e3427d582f6fba6ca2877ecf472b6d5 -r 7010204f7ccda05f806cfe7f30a6a3bc03a5e2d7 lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -787,7 +787,7 @@ columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -858,7 +858,7 @@ columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -920,7 +920,7 @@ columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -985,7 +985,7 @@ columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", 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.
1
0
0
0
commit/galaxy-central: carlfeberhard: call_hook: Fix to handle exception.args more gracefully when modifying
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/93f0c6867e34/
changeset: 93f0c6867e34 user: carlfeberhard date: 2013-03-04 19:51:52 summary: call_hook: Fix to handle exception.args more gracefully when modifying affected #: 1 file diff -r 141c99107f8d2a11a1b91c80ad0ce8e264ee806c -r 93f0c6867e3427d582f6fba6ca2877ecf472b6d5 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2715,7 +2715,10 @@ if code: return code( *args, **kwargs ) except Exception, e: - e.args = ( "Error in '%s' hook '%s', original message: %s" % ( self.name, hook_name, e.args[0] ), ) + original_message = '' + if len( e.args ): + original_message = e.args[0] + e.args = ( "Error in '%s' hook '%s', original message: %s" % ( self.name, hook_name, original_message ), ) raise def exec_before_job( self, app, inp_data, out_data, param_dict={} ): pass 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.
1
0
0
0
commit/galaxy-central: greg: Clean up recently introduced tool shed repository Galaxy utilities grids.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/141c99107f8d/
changeset: 141c99107f8d user: greg date: 2013-03-04 19:01:33 summary: Clean up recently introduced tool shed repository Galaxy utilities grids. affected #: 2 files diff -r 8236c09e92011aa2c8c4d4bcd63f0b91de773488 -r 141c99107f8d2a11a1b91c80ad0ce8e264ee806c 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 @@ -280,9 +280,9 @@ def browse_tool_dependencies( self, trans, **kwd ): if 'operation' in kwd: operation = kwd[ 'operation' ].lower() - if operation == "browse_repository": + if operation == "view_or_manage_repository": return trans.response.send_redirect( web.url_for( controller='repository', - action='browse_repository', + action='view_or_manage_repository', **kwd ) ) return self.tool_dependencies_grid( trans, **kwd ) diff -r 8236c09e92011aa2c8c4d4bcd63f0b91de773488 -r 141c99107f8d2a11a1b91c80ad0ce8e264ee806c lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -643,7 +643,10 @@ class ChangesetRevisionColumn( grids.TextColumn ): def get_value( self, trans, grid, repository_metadata ): - return escape_html( repository_metadata.changeset_revision ) + repository = repository_metadata.repository + changeset_revision = repository_metadata.changeset_revision + changeset_revision_label = suc.get_revision_label( trans, repository, changeset_revision ) + return escape_html( changeset_revision_label ) class MaliciousColumn( grids.BooleanColumn ): @@ -719,6 +722,7 @@ default_sort_key = "Repository.name" columns = [ RepositoryNameColumn( "Repository name", + key="Repository.name", link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), attach_popup=False ), RepositoryOwnerColumn( "Owner", @@ -743,8 +747,7 @@ .join( model.Repository ) \ .filter( and_( model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ - .join( model.User.table ) \ - .order_by( model.Repository.name ) + .join( model.User.table ) class RepositoryDependenciesGrid( RepositoryMetadataGrid ): @@ -767,22 +770,24 @@ for index, rd_tup in enumerate( sorted_rd_tups ): name = rd_tup[ 1 ] owner = rd_tup[ 2 ] + changeset_revision = rd_tup[ 3 ] required_repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) if required_repository: required_repository_id = trans.security.encode_id( required_repository.id ) - rd_str += '<a href="browse_repository_dependencies?operation=browse_repository&id=%s">' % required_repository_id - rd_str += '<b>name:</b> %s | <b>owner:</b> %s | <b>revision:</b> %s' % ( escape_html( rd_tup[ 1 ] ), escape_html( rd_tup[ 2 ] ), escape_html( rd_tup[ 3 ] ) ) + rd_str += '<a href="browse_repository_dependencies?operation=view_or_manage_repository&id=%s&changeset_revision=%s">' % ( required_repository_id, changeset_revision ) + rd_str += 'Repository <b>%s</b> revision <b>%s</b> owned by <b>%s</b>' % ( escape_html( rd_tup[ 1 ] ), escape_html( rd_tup[ 3 ] ), escape_html( rd_tup[ 2 ] ) ) if required_repository: rd_str += '</a>' if index < num_tups - 1: rd_str += '<br/>' return rd_str - title = "Repository dependency definitions in this tool shed" + title = "Valid repository dependency definitions in this tool shed" + default_sort_key = "Repository.name" columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="browse_repository", id=item.repository.id ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -806,8 +811,7 @@ .filter( and_( model.RepositoryMetadata.table.c.has_repository_dependencies == True, model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ - .join( model.User.table ) \ - .order_by( model.Repository.name ) + .join( model.User.table ) class ToolDependenciesGrid( RepositoryMetadataGrid ): @@ -850,10 +854,11 @@ return td_str title = "Tool dependency definitions in this tool shed" + default_sort_key = "Repository.name" columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="browse_repository", id=item.repository.id ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -877,8 +882,7 @@ .filter( and_( model.RepositoryMetadata.table.c.includes_tool_dependencies == True, model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ - .join( model.User.table ) \ - .order_by( model.Repository.name ) + .join( model.User.table ) class ToolsGrid( RepositoryMetadataGrid ): @@ -893,21 +897,30 @@ if metadata: tool_dicts = metadata.get( 'tools', [] ) if tool_dicts: - num_tool_dicts = len( tool_dicts ) - for index, tool_dict in enumerate( tool_dicts ): - tool_id = tool_dict[ 'id' ] - name = tool_dict[ 'name' ] - version = tool_dict[ 'version' ] - tool_str += '<b>%s</b> | %s | %s' % ( escape_html( tool_id ), escape_html( name ), escape_html( version ) ) - if index < num_tool_dicts - 1: + # Create tuples of the attributes we want so we can sort them by extension. + tool_tups = [] + for tool_dict in tool_dicts: + tool_id = tool_dict.get( 'id', '' ) + version = tool_dict.get( 'version', '' ) + # For now we'll just display tool id and version. + if tool_id and version: + tool_tups.append( ( tool_id, version ) ) + sorted_tool_tups = sorted( tool_tups, key=lambda tool_tup: tool_tup[ 0 ] ) + num_tool_tups = len( sorted_tool_tups ) + for index, tool_tup in enumerate( sorted_tool_tups ): + tool_id = tool_tup[ 0 ] + version = tool_tup[ 1 ] + tool_str += '<b>%s:</b> %s' % ( escape_html( tool_id ), escape_html( version ) ) + if index < num_tool_tups - 1: tool_str += '<br/>' return tool_str title = "Valid tools in this tool shed" + default_sort_key = "Repository.name" columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -916,7 +929,7 @@ key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", attach_popup=False ), - ToolsColumn( "Tool id | name | version", + ToolsColumn( "Tool id and version", attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", @@ -931,8 +944,7 @@ .filter( and_( model.RepositoryMetadata.table.c.includes_tools == True, model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ - .join( model.User.table ) \ - .order_by( model.Repository.name ) + .join( model.User.table ) class DatatypesGrid( RepositoryMetadataGrid ): @@ -947,23 +959,33 @@ if metadata: datatype_dicts = metadata.get( 'datatypes', [] ) if datatype_dicts: - num_datatype_dicts = len( datatype_dicts ) - for index, datatype_dict in enumerate( datatype_dicts ): + # Create tuples of the attributes we want so we can sort them by extension. + datatype_tups = [] + for datatype_dict in datatype_dicts: # Example: {"display_in_upload": "true", "dtype": "galaxy.datatypes.blast:BlastXml", "extension": "blastxml", "mimetype": "application/xml"} extension = datatype_dict.get( 'extension', '' ) dtype = datatype_dict.get( 'dtype', '' ) mimetype = datatype_dict.get( 'mimetype', '' ) display_in_upload = datatype_dict.get( 'display_in_upload', False ) - datatype_str += '<b>%s</b> | %s | %s' % ( escape_html( extension ), escape_html( dtype ), escape_html( mimetype ) ) - if index < num_datatype_dicts - 1: + # For now we'll just display extension and dtype. + if extension and dtype: + datatype_tups.append( ( extension, dtype ) ) + sorted_datatype_tups = sorted( datatype_tups, key=lambda datatype_tup: datatype_tup[ 0 ] ) + num_datatype_tups = len( sorted_datatype_tups ) + for index, datatype_tup in enumerate( sorted_datatype_tups ): + extension = datatype_tup[ 0 ] + dtype = datatype_tup[ 1 ] + datatype_str += '<b>%s:</b> %s' % ( escape_html( extension ), escape_html( dtype ) ) + if index < num_datatype_tups - 1: datatype_str += '<br/>' return datatype_str title = "Custom datatypes in this tool shed" + default_sort_key = "Repository.name" columns = [ RepositoryMetadataGrid.RepositoryNameColumn( "Repository name", model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id ) ), + link=( lambda item: dict( operation="view_or_manage_repository", id=item.repository.id, changeset_revision=item.changeset_revision ) ), attach_popup=False, key="Repository.name" ), RepositoryMetadataGrid.RepositoryOwnerColumn( "Owner", @@ -972,7 +994,7 @@ key="User.username" ), RepositoryMetadataGrid.ChangesetRevisionColumn( "Revision", attach_popup=False ), - DatatypesColumn( "Datatype extension | Type | Mimetype", + DatatypesColumn( "Datatype extension and class", attach_popup=False ) ] columns.append( grids.MulticolFilterColumn( "Search repository name, owner", @@ -987,5 +1009,4 @@ .filter( and_( model.RepositoryMetadata.table.c.includes_datatypes == True, model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ - .join( model.User.table ) \ - .order_by( model.Repository.name ) + .join( model.User.table ) 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.
1
0
0
0
commit/galaxy-central: 5 new changesets
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
5 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/32c6537bef27/
changeset: 32c6537bef27 user: jmchilton date: 2013-02-26 06:09:22 summary: Implement equivalent of dataset display through the API. affected #: 4 files diff -r 993c232d34cda550a5605f87d7416467d4e2c33f -r 32c6537bef27b7d481aed08a7189f11c5161a3ee lib/galaxy/web/__init__.py --- a/lib/galaxy/web/__init__.py +++ b/lib/galaxy/web/__init__.py @@ -2,6 +2,6 @@ The Galaxy web application framework """ -from framework import expose, json, json_pretty, require_login, require_admin, url_for, error, form, FormBuilder, expose_api +from framework import expose, json, json_pretty, require_login, require_admin, url_for, error, form, FormBuilder, expose_api, expose_api_raw from framework.base import httpexceptions diff -r 993c232d34cda550a5605f87d7416467d4e2c33f -r 32c6537bef27b7d481aed08a7189f11c5161a3ee lib/galaxy/web/framework/__init__.py --- a/lib/galaxy/web/framework/__init__.py +++ b/lib/galaxy/web/framework/__init__.py @@ -99,7 +99,14 @@ return decorator return argcatcher -def expose_api( func ): +def expose_api_raw( func ): + """ + Expose this function via the API but don't dump the results + to JSON. + """ + return expose_api( func, to_json=False ) + +def expose_api( func, to_json=True ): @wraps(func) def decorator( self, trans, *args, **kwargs ): def error( environ, start_response ): @@ -183,10 +190,12 @@ trans.response.status = 400 return "That user does not exist." try: - if trans.debug: - return simplejson.dumps( func( self, trans, *args, **kwargs ), indent=4, sort_keys=True ) - else: - return simplejson.dumps( func( self, trans, *args, **kwargs ) ) + rval = func( self, trans, *args, **kwargs) + if to_json and trans.debug: + rval = simplejson.dumps( rval, indent=4, sort_keys=True ) + elif to_json: + rval = simplejson.dumps( rval ) + return rval except paste.httpexceptions.HTTPException: raise # handled except: diff -r 993c232d34cda550a5605f87d7416467d4e2c33f -r 32c6537bef27b7d481aed08a7189f11c5161a3ee lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -125,6 +125,33 @@ 'error' : str( exception ) } + @web.expose_api_raw + def display( self, trans, history_content_id, history_id, preview=False, filename=None, to_ext=None, chunk=None, **kwd ): + """ + GET /api/histories/{encoded_history_id}/contents/{encoded_content_id} + Displays history content (dataset). + """ + hda_dict = {} + try: + # for anon users: + #TODO: check login_required? + #TODO: this isn't actually most_recently_used (as defined in histories) + if( ( trans.user == None ) + and ( history_id == trans.security.encode_id( trans.history.id ) ) ): + history = trans.history + #TODO: dataset/hda by id (from history) OR check_ownership for anon user + hda = self.get_history_dataset_association( trans, history, history_content_id, + check_ownership=False, check_accessible=True ) + + else: + history = self.get_history( trans, history_id, + check_ownership=True, check_accessible=True, deleted=False ) + hda = self.get_history_dataset_association( trans, history, history_content_id, + check_ownership=True, check_accessible=True ) + except: + raise + return hda.datatype.display_data(trans, hda, preview, filename, to_ext, chunk, **kwd) + @web.expose_api def show( self, trans, id, history_id, **kwd ): """ diff -r 993c232d34cda550a5605f87d7416467d4e2c33f -r 32c6537bef27b7d481aed08a7189f11c5161a3ee lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -83,6 +83,11 @@ name_prefix='history_', path_prefix='/api/histories/:history_id', parent_resources=dict( member_name='history', collection_name='histories' ) ) + webapp.api_mapper.connect("history_contents_display", + "/api/histories/:history_id/contents/:history_content_id/display", + controller="history_contents", + action="display", + conditions=dict(method=["GET"])) webapp.api_mapper.resource( 'permission', 'permissions', path_prefix='/api/libraries/:library_id',
https://bitbucket.org/galaxy/galaxy-central/commits/3284b58ae9fd/
changeset: 3284b58ae9fd user: jmchilton date: 2013-02-26 16:56:15 summary: Update HDA API return value to reflect new API-based path for downloads. affected #: 1 file diff -r 32c6537bef27b7d481aed08a7189f11c5161a3ee -r 3284b58ae9fd65dd276d0faa2ed930f245c9df5d lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -155,7 +155,7 @@ @web.expose_api def show( self, trans, id, history_id, **kwd ): """ - GET /api/histories/{encoded_history_id}/contents/{encoded_content_id} + GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display Displays information about a history content (dataset). """ hda_dict = {} @@ -230,14 +230,7 @@ hda_dict[ 'file_name' ] = hda.file_name if not hda_dict[ 'deleted' ]: - # Problem: Method url_for cannot use the dataset controller - # Get the environment from DefaultWebTransaction - # and use default webapp mapper instead of webapp API mapper - web_url_for = routes.URLGenerator( trans.webapp.mapper, trans.environ ) - #
http://routes.groovie.org/generating.html
- # url_for is being phased out, so new applications should use url - hda_dict[ 'download_url' ] = web_url_for( controller='dataset', action='display', - dataset_id=trans.security.encode_id( hda.id ), to_ext=hda.ext ) + hda_dict[ 'download_url' ] = url_for( 'history_contents_display', history_id = trans.security.encode_id( history.id ), history_content_id = trans.security.encode_id( hda.id ) ) can_access_hda = trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset ) hda_dict[ 'accessible' ] = ( trans.user_is_admin() or can_access_hda )
https://bitbucket.org/galaxy/galaxy-central/commits/440cad876d23/
changeset: 440cad876d23 user: jmchilton date: 2013-02-26 16:59:40 summary: In previous commit, I modified documentation in the wrong place. affected #: 1 file diff -r 3284b58ae9fd65dd276d0faa2ed930f245c9df5d -r 440cad876d23f467bf4ad63ac26a9fe7c4c5eeed lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -128,7 +128,7 @@ @web.expose_api_raw def display( self, trans, history_content_id, history_id, preview=False, filename=None, to_ext=None, chunk=None, **kwd ): """ - GET /api/histories/{encoded_history_id}/contents/{encoded_content_id} + GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display Displays history content (dataset). """ hda_dict = {} @@ -155,7 +155,7 @@ @web.expose_api def show( self, trans, id, history_id, **kwd ): """ - GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display + GET /api/histories/{encoded_history_id}/contents/{encoded_content_id} Displays information about a history content (dataset). """ hda_dict = {}
https://bitbucket.org/galaxy/galaxy-central/commits/a2424331a3f9/
changeset: a2424331a3f9 user: jmchilton date: 2013-03-04 17:32:32 summary: Per Jeremy's request I have moved the API history contents dataset display functionality to the dataset controller -
https://bitbucket.org/galaxy/galaxy-central/pull-request/131/implement-equi…
. affected #: 3 files diff -r 440cad876d23f467bf4ad63ac26a9fe7c4c5eeed -r a2424331a3f929bfadafea1dedbab5fb4b651472 lib/galaxy/webapps/galaxy/api/datasets.py --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -4,12 +4,12 @@ import logging, os, string, shutil, urllib, re, socket from galaxy import util, datatypes, jobs, web, util from galaxy.visualization.data_providers.genome import FeatureLocationIndexDataProvider -from galaxy.web.base.controller import BaseAPIController, UsesVisualizationMixin +from galaxy.web.base.controller import BaseAPIController, UsesVisualizationMixin, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin from galaxy.web.framework.helpers import is_true log = logging.getLogger( __name__ ) -class DatasetsController( BaseAPIController, UsesVisualizationMixin ): +class DatasetsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMixin, UsesHistoryDatasetAssociationMixin ): @web.expose_api def index( self, trans, **kwd ): @@ -191,3 +191,31 @@ data = data_provider.get_data( **kwargs ) return data + + @web.expose_api_raw + def display( self, trans, history_content_id, history_id, preview=False, filename=None, to_ext=None, chunk=None, **kwd ): + """ + GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display + Displays history content (dataset). + """ + # Huge amount of code overlap with lib/galaxy/webapps/galaxy/api/history_content:show here. + hda_dict = {} + try: + # for anon users: + #TODO: check login_required? + #TODO: this isn't actually most_recently_used (as defined in histories) + if( ( trans.user == None ) + and ( history_id == trans.security.encode_id( trans.history.id ) ) ): + history = trans.history + #TODO: dataset/hda by id (from history) OR check_ownership for anon user + hda = self.get_history_dataset_association( trans, history, history_content_id, + check_ownership=False, check_accessible=True ) + + else: + history = self.get_history( trans, history_id, + check_ownership=True, check_accessible=True, deleted=False ) + hda = self.get_history_dataset_association( trans, history, history_content_id, + check_ownership=True, check_accessible=True ) + except: + raise + return hda.datatype.display_data(trans, hda, preview, filename, to_ext, chunk, **kwd) diff -r 440cad876d23f467bf4ad63ac26a9fe7c4c5eeed -r a2424331a3f929bfadafea1dedbab5fb4b651472 lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -125,33 +125,6 @@ 'error' : str( exception ) } - @web.expose_api_raw - def display( self, trans, history_content_id, history_id, preview=False, filename=None, to_ext=None, chunk=None, **kwd ): - """ - GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display - Displays history content (dataset). - """ - hda_dict = {} - try: - # for anon users: - #TODO: check login_required? - #TODO: this isn't actually most_recently_used (as defined in histories) - if( ( trans.user == None ) - and ( history_id == trans.security.encode_id( trans.history.id ) ) ): - history = trans.history - #TODO: dataset/hda by id (from history) OR check_ownership for anon user - hda = self.get_history_dataset_association( trans, history, history_content_id, - check_ownership=False, check_accessible=True ) - - else: - history = self.get_history( trans, history_id, - check_ownership=True, check_accessible=True, deleted=False ) - hda = self.get_history_dataset_association( trans, history, history_content_id, - check_ownership=True, check_accessible=True ) - except: - raise - return hda.datatype.display_data(trans, hda, preview, filename, to_ext, chunk, **kwd) - @web.expose_api def show( self, trans, id, history_id, **kwd ): """ diff -r 440cad876d23f467bf4ad63ac26a9fe7c4c5eeed -r a2424331a3f929bfadafea1dedbab5fb4b651472 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -85,7 +85,7 @@ parent_resources=dict( member_name='history', collection_name='histories' ) ) webapp.api_mapper.connect("history_contents_display", "/api/histories/:history_id/contents/:history_content_id/display", - controller="history_contents", + controller="datasets", action="display", conditions=dict(method=["GET"])) webapp.api_mapper.resource( 'permission',
https://bitbucket.org/galaxy/galaxy-central/commits/8236c09e9201/
changeset: 8236c09e9201 user: dannon date: 2013-03-04 18:06:15 summary: Merged in galaxyp/galaxy-central-parallelism-refactorings (pull request #131) Implement equivalent of dataset display through the API. affected #: 5 files Diff not available. 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.
1
0
0
0
commit/galaxy-central: greg: Move the tool shed's repository review grid classes out of the repository_review controller and into ~/tool_shed/grids.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/cd3270cefc61/
changeset: cd3270cefc61 user: greg date: 2013-03-04 16:07:31 summary: Move the tool shed's repository review grid classes out of the repository_review controller and into ~/tool_shed/grids. affected #: 2 files diff -r 6cd65073a397246e7b6fa8884d2c26760865ffad -r cd3270cefc612315602e43e1a41a17e0f92dec1d 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 @@ -2,15 +2,12 @@ from galaxy import web, util from galaxy.web.base.controller import BaseUIController from galaxy.web.form_builder import SelectField, CheckboxField -from galaxy.webapps.tool_shed import model -from galaxy.web.framework.helpers import grids -from galaxy.model.orm import and_ from sqlalchemy.sql.expression import func from galaxy.webapps.tool_shed.util import common_util from galaxy.webapps.tool_shed.util.container_util import STRSEP -from tool_shed.grids.repository_grids import RepositoryGrid import tool_shed.util.shed_util_common as suc from galaxy.util.odict import odict +import tool_shed.grids.repository_review_grids as repository_review_grids from galaxy import eggs eggs.require('mercurial') @@ -18,259 +15,15 @@ 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' - default_sort_key = "name" - columns = [ - NameColumn( "Name", - key="Component.name", - link=( lambda item: dict( operation="edit", id=item.id ) ), - attach_popup=False ), - DescriptionColumn( "Description", - key="Component.description", - attach_popup=False ) - ] - default_filter = {} - global_actions = [ - grids.GridAction( "Add new component", - dict( controller='repository_review', action='manage_components', operation='create' ) ) - ] - operations = [] - standard_filters = [] - num_rows_per_page = 50 - preserve_state = False - use_paging = True - -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. - if repository.reviews: - rval = '' - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - 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 ) - 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. - repository_metadata_revisions = suc.get_repository_metadata_revisions_for_review( repository, reviewed=False ) - if repository_metadata_revisions: - rval = '' - for repository_metadata in repository_metadata_revisions: - 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 ) - return rval - return '' - class ReviewersColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository ): - rval = '' - if repository.reviewers: - for user in repository.reviewers: - rval += '<a class="view-info" href="repository_reviews_by_user?id=%s">' % trans.security.encode_id( user.id ) - rval += '%s</a> | ' % user.username - rval = rval.rstrip( ' | ' ) - return rval - title = "All reviewed repositories" - model_class = model.Repository - template='/webapps/tool_shed/repository_review/grid.mako' - default_sort_key = "Repository.name" - columns = [ - RepositoryGrid.NameColumn( "Repository name", - key="name", - link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), - attach_popup=True ), - WithReviewsRevisionColumn( "Reviewed revisions" ), - WithoutReviewsRevisionColumn( "Revisions for review" ), - RepositoryGrid.UserColumn( "Owner", attach_popup=False ), - ReviewersColumn( "Reviewers", attach_popup=False ) - ] - columns.append( grids.MulticolFilterColumn( "Search repository name", - cols_to_filter=[ columns[0] ], - 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 ) ) \ - .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ - .join( ( model.User.table, model.User.table.c.id == model.Repository.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 ) ) - -class RepositoriesWithoutReviewsGrid( RepositoriesWithReviewsGrid ): - # This grid filters out repositories that have been marked as either deprecated or deleted. - title = "Repositories with no reviews" - columns = [ - RepositoriesWithReviewsGrid.NameColumn( "Repository name", - key="name", - link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), - attach_popup=True ), - RepositoriesWithReviewsGrid.DescriptionColumn( "Synopsis", - 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] ], - 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.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, - model.Repository.table.c.deprecated == False ) ) \ - .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ - .filter( model.RepositoryReview.table.c.user_id == trans.user.id ) \ - .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 ) ) - -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="' - if review.user == trans.user: - rval += 'edit_review' - else: - 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 ' - rval += 'name="star1-%s" ' % trans.security.encode_id( review.id ) - rval += 'type="radio" ' - rval += 'class="community_rating_star star" ' - rval += 'disabled="disabled" ' - rval += 'value="%s"' % str( review.rating ) - rval += '/>' - return rval - return '' - title = "Reviews by user" - model_class = model.RepositoryReview - template='/webapps/tool_shed/repository_review/grid.mako' - default_sort_key = 'repository_id' - columns = [ - RepositoryNameColumn( "Repository Name", - model_class=model.Repository, - key="Repository.name", - link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), - attach_popup=True ), - RepositoryDescriptionColumn( "Description", - model_class=model.Repository, - key="Repository.description", - attach_popup=False ), - RevisionColumn( "Revision", attach_popup=False ), - RatingColumn( "Rating", attach_popup=False ), - ] - # Override these - default_filter = {} - global_actions = [] - operations = [ - grids.GridOperation( "Inspect repository revisions", - allow_multiple=False, - condition=( lambda item: not item.deleted ), - async_compatible=False ) - ] - standard_filters = [] - 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 ) \ - .filter( and_( model.RepositoryReview.table.c.deleted == False, \ - model.RepositoryReview.table.c.user_id == user_id ) ) \ - .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 = [ - RepositoriesWithReviewsGrid.NameColumn( "Repository name", - key="name", - link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), - attach_popup=True ), - RepositoriesWithReviewsGrid.WithReviewsRevisionColumn( "Reviewed revisions" ), - RepositoriesWithReviewsGrid.WithoutReviewsRevisionColumn( "Revisions for review" ), - RepositoriesWithReviewsGrid.ReviewersColumn( "Reviewers", attach_popup=False ), - RepositoryGrid.DeprecatedColumn( "Deprecated" ) - ] - columns.append( grids.MulticolFilterColumn( "Search repository name", - cols_to_filter=[ columns[0] ], - 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 ) \ - .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ - .filter( model.Repository.table.c.user_id == trans.user.id ) \ - .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 ) ) class RepositoryReviewController( BaseUIController, common_util.ItemRatings ): - component_grid = ComponentGrid() - repositories_reviewed_by_me_grid = RepositoriesReviewedByMeGrid() - repositories_with_reviews_grid = RepositoriesWithReviewsGrid() - repositories_without_reviews_grid = RepositoriesWithoutReviewsGrid() - repository_reviews_by_user_grid = RepositoryReviewsByUserGrid() - reviewed_repositories_i_own_grid = ReviewedRepositoriesIOwnGrid() + component_grid = repository_review_grids.ComponentGrid() + 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() @web.expose @web.require_login( "approve repository review" ) diff -r 6cd65073a397246e7b6fa8884d2c26760865ffad -r cd3270cefc612315602e43e1a41a17e0f92dec1d lib/tool_shed/grids/repository_review_grids.py --- /dev/null +++ b/lib/tool_shed/grids/repository_review_grids.py @@ -0,0 +1,258 @@ +import os, logging +from galaxy.webapps.tool_shed import model +from galaxy.web.framework.helpers import grids +from galaxy.model.orm import and_ +from tool_shed.grids.repository_grids import RepositoryGrid +import tool_shed.util.shed_util_common as suc + +from galaxy import eggs +eggs.require('mercurial') +from mercurial import hg, ui, patch, commands + +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' + default_sort_key = "name" + columns = [ + NameColumn( "Name", + key="Component.name", + link=( lambda item: dict( operation="edit", id=item.id ) ), + attach_popup=False ), + DescriptionColumn( "Description", + key="Component.description", + attach_popup=False ) + ] + default_filter = {} + global_actions = [ + grids.GridAction( "Add new component", + dict( controller='repository_review', action='manage_components', operation='create' ) ) + ] + operations = [] + standard_filters = [] + num_rows_per_page = 50 + preserve_state = False + use_paging = True + +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. + if repository.reviews: + rval = '' + repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + 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 ) + 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. + repository_metadata_revisions = suc.get_repository_metadata_revisions_for_review( repository, reviewed=False ) + if repository_metadata_revisions: + rval = '' + for repository_metadata in repository_metadata_revisions: + 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 ) + return rval + return '' + class ReviewersColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository ): + rval = '' + if repository.reviewers: + for user in repository.reviewers: + rval += '<a class="view-info" href="repository_reviews_by_user?id=%s">' % trans.security.encode_id( user.id ) + rval += '%s</a> | ' % user.username + rval = rval.rstrip( ' | ' ) + return rval + title = "All reviewed repositories" + model_class = model.Repository + template='/webapps/tool_shed/repository_review/grid.mako' + default_sort_key = "Repository.name" + columns = [ + RepositoryGrid.NameColumn( "Repository name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + WithReviewsRevisionColumn( "Reviewed revisions" ), + WithoutReviewsRevisionColumn( "Revisions for review" ), + RepositoryGrid.UserColumn( "Owner", attach_popup=False ), + ReviewersColumn( "Reviewers", attach_popup=False ) + ] + columns.append( grids.MulticolFilterColumn( "Search repository name", + cols_to_filter=[ columns[0] ], + 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 ) ) \ + .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ + .join( ( model.User.table, model.User.table.c.id == model.Repository.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 ) ) + +class RepositoriesWithoutReviewsGrid( RepositoriesWithReviewsGrid ): + # This grid filters out repositories that have been marked as either deprecated or deleted. + title = "Repositories with no reviews" + columns = [ + RepositoriesWithReviewsGrid.NameColumn( "Repository name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoriesWithReviewsGrid.DescriptionColumn( "Synopsis", + 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] ], + 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.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, + model.Repository.table.c.deprecated == False ) ) \ + .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ + .filter( model.RepositoryReview.table.c.user_id == trans.user.id ) \ + .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 ) ) + +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="' + if review.user == trans.user: + rval += 'edit_review' + else: + 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 ' + rval += 'name="star1-%s" ' % trans.security.encode_id( review.id ) + rval += 'type="radio" ' + rval += 'class="community_rating_star star" ' + rval += 'disabled="disabled" ' + rval += 'value="%s"' % str( review.rating ) + rval += '/>' + return rval + return '' + title = "Reviews by user" + model_class = model.RepositoryReview + template='/webapps/tool_shed/repository_review/grid.mako' + default_sort_key = 'repository_id' + columns = [ + RepositoryNameColumn( "Repository Name", + model_class=model.Repository, + key="Repository.name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoryDescriptionColumn( "Description", + model_class=model.Repository, + key="Repository.description", + attach_popup=False ), + RevisionColumn( "Revision", attach_popup=False ), + RatingColumn( "Rating", attach_popup=False ), + ] + # Override these + default_filter = {} + global_actions = [] + operations = [ + grids.GridOperation( "Inspect repository revisions", + allow_multiple=False, + condition=( lambda item: not item.deleted ), + async_compatible=False ) + ] + standard_filters = [] + 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 ) \ + .filter( and_( model.RepositoryReview.table.c.deleted == False, \ + model.RepositoryReview.table.c.user_id == user_id ) ) \ + .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 = [ + RepositoriesWithReviewsGrid.NameColumn( "Repository name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoriesWithReviewsGrid.WithReviewsRevisionColumn( "Reviewed revisions" ), + RepositoriesWithReviewsGrid.WithoutReviewsRevisionColumn( "Revisions for review" ), + RepositoriesWithReviewsGrid.ReviewersColumn( "Reviewers", attach_popup=False ), + RepositoryGrid.DeprecatedColumn( "Deprecated" ) + ] + columns.append( grids.MulticolFilterColumn( "Search repository name", + cols_to_filter=[ columns[0] ], + 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 ) \ + .join( ( model.RepositoryReview.table, model.RepositoryReview.table.c.repository_id == model.Repository.table.c.id ) ) \ + .filter( model.Repository.table.c.user_id == trans.user.id ) \ + .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 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.
1
0
0
0
commit/galaxy-central: greg: Move the tool shed's administrative grids out of the admin controller and into ~/tool_shed/grids.
by commits-noreply@bitbucket.org
04 Mar '13
04 Mar '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6cd65073a397/
changeset: 6cd65073a397 user: greg date: 2013-03-04 15:47:37 summary: Move the tool shed's administrative grids out of the admin controller and into ~/tool_shed/grids. affected #: 3 files diff -r db8a3bd35841ce033aff283510a0f7fe3aec3ab0 -r 6cd65073a397246e7b6fa8884d2c26760865ffad 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 @@ -1,12 +1,9 @@ from galaxy.web.base.controller import BaseUIController from galaxy import web, util from galaxy.web.base.controllers.admin import Admin -from galaxy.webapps.tool_shed import model -from galaxy.model.orm import and_ -from galaxy.web.framework.helpers import time_ago, grids from galaxy.util import inflector import tool_shed.util.shed_util_common as suc -from tool_shed.grids.repository_grids import RepositoryGrid, CategoryGrid +import tool_shed.grids.admin_grids as admin_grids from galaxy import eggs eggs.require( 'mercurial' ) @@ -16,440 +13,15 @@ log = logging.getLogger( __name__ ) -class UserGrid( grids.Grid ): - # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. - class UserLoginColumn( grids.TextColumn ): - def get_value( self, trans, grid, user ): - return user.email - class UserNameColumn( grids.TextColumn ): - def get_value( self, trans, grid, user ): - if user.username: - return user.username - return 'not set' - class GroupsColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.groups: - return len( user.groups ) - return 0 - class RolesColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.roles: - return len( user.roles ) - return 0 - class ExternalColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.external: - return 'yes' - return 'no' - class LastLoginColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.galaxy_sessions: - return self.format( user.galaxy_sessions[ 0 ].update_time ) - return 'never' - class StatusColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.purged: - return "purged" - elif user.deleted: - return "deleted" - return "" - class EmailColumn( grids.GridColumn ): - def filter( self, trans, user, query, column_filter ): - if column_filter == 'All': - return query - return query.filter( and_( model.Tool.table.c.user_id == model.User.table.c.id, - model.User.table.c.email == column_filter ) ) - title = "Users" - model_class = model.User - template='/admin/user/grid.mako' - default_sort_key = "email" - columns = [ - UserLoginColumn( "Email", - key="email", - link=( lambda item: dict( operation="information", id=item.id ) ), - attach_popup=True, - filterable="advanced" ), - UserNameColumn( "User Name", - key="username", - attach_popup=False, - filterable="advanced" ), - GroupsColumn( "Groups", attach_popup=False ), - RolesColumn( "Roles", attach_popup=False ), - ExternalColumn( "External", attach_popup=False ), - LastLoginColumn( "Last Login", format=time_ago ), - StatusColumn( "Status", attach_popup=False ), - # Columns that are valid for filtering but are not visible. - EmailColumn( "Email", - key="email", - visible=False ) - ] - columns.append( grids.MulticolFilterColumn( "Search", - cols_to_filter=[ columns[0], columns[1] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) - global_actions = [ - grids.GridAction( "Create new user", - dict( controller='admin', action='users', operation='create' ) ) - ] - operations = [ - grids.GridOperation( "Manage Roles and Groups", - condition=( lambda item: not item.deleted ), - allow_multiple=False, - url_args=dict( action="manage_roles_and_groups_for_user" ) ), - grids.GridOperation( "Reset Password", - condition=( lambda item: not item.deleted ), - allow_multiple=True, - allow_popup=False, - url_args=dict( action="reset_user_password" ) ) - ] - standard_filters = [ - grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), - grids.GridColumnFilter( "Deleted", args=dict( deleted=True, purged=False ) ), - grids.GridColumnFilter( "Purged", args=dict( purged=True ) ), - grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) - ] - num_rows_per_page = 50 - preserve_state = False - use_paging = True - def get_current_item( self, trans, **kwargs ): - return trans.user - -class RoleGrid( grids.Grid ): - # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. - class NameColumn( grids.TextColumn ): - def get_value( self, trans, grid, role ): - return role.name - class DescriptionColumn( grids.TextColumn ): - def get_value( self, trans, grid, role ): - if role.description: - return role.description - return '' - class TypeColumn( grids.TextColumn ): - def get_value( self, trans, grid, role ): - return role.type - class StatusColumn( grids.GridColumn ): - def get_value( self, trans, grid, role ): - if role.deleted: - return "deleted" - return "" - class GroupsColumn( grids.GridColumn ): - def get_value( self, trans, grid, role ): - if role.groups: - return len( role.groups ) - return 0 - class UsersColumn( grids.GridColumn ): - def get_value( self, trans, grid, role ): - if role.users: - return len( role.users ) - return 0 - title = "Roles" - model_class = model.Role - template='/admin/dataset_security/role/grid.mako' - default_sort_key = "name" - columns = [ - NameColumn( "Name", - key="name", - link=( lambda item: dict( operation="Manage users and groups", id=item.id ) ), - attach_popup=True, - filterable="advanced" ), - DescriptionColumn( "Description", - key='description', - attach_popup=False, - filterable="advanced" ), - TypeColumn( "Type", - key='type', - attach_popup=False, - filterable="advanced" ), - GroupsColumn( "Groups", attach_popup=False ), - UsersColumn( "Users", attach_popup=False ), - StatusColumn( "Status", attach_popup=False ), - # Columns that are valid for filtering but are not visible. - grids.DeletedColumn( "Deleted", - key="deleted", - visible=False, - filterable="advanced" ) - ] - columns.append( grids.MulticolFilterColumn( "Search", - cols_to_filter=[ columns[0], columns[1], columns[2] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) - global_actions = [ - grids.GridAction( "Add new role", - dict( controller='admin', action='roles', operation='create' ) ) - ] - operations = [ grids.GridOperation( "Rename", - condition=( lambda item: not item.deleted ), - allow_multiple=False, - url_args=dict( action="rename_role" ) ), - grids.GridOperation( "Delete", - condition=( lambda item: not item.deleted ), - allow_multiple=True, - url_args=dict( action="mark_role_deleted" ) ), - grids.GridOperation( "Undelete", - condition=( lambda item: item.deleted ), - allow_multiple=True, - url_args=dict( action="undelete_role" ) ), - grids.GridOperation( "Purge", - condition=( lambda item: item.deleted ), - allow_multiple=True, - url_args=dict( action="purge_role" ) ) ] - standard_filters = [ - grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), - grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ), - grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) - ] - num_rows_per_page = 50 - preserve_state = False - use_paging = True - def apply_query_filter( self, trans, query, **kwd ): - return query.filter( model.Role.type != model.Role.types.PRIVATE ) - -class GroupGrid( grids.Grid ): - # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. - class NameColumn( grids.TextColumn ): - def get_value( self, trans, grid, group ): - return group.name - class StatusColumn( grids.GridColumn ): - def get_value( self, trans, grid, group ): - if group.deleted: - return "deleted" - return "" - class RolesColumn( grids.GridColumn ): - def get_value( self, trans, grid, group ): - if group.roles: - return len( group.roles ) - return 0 - class UsersColumn( grids.GridColumn ): - def get_value( self, trans, grid, group ): - if group.members: - return len( group.members ) - return 0 - title = "Groups" - model_class = model.Group - template='/admin/dataset_security/group/grid.mako' - default_sort_key = "name" - columns = [ - NameColumn( "Name", - link=( lambda item: dict( operation="Manage users and roles", id=item.id ) ), - attach_popup=True ), - UsersColumn( "Users", attach_popup=False ), - RolesColumn( "Roles", attach_popup=False ), - StatusColumn( "Status", attach_popup=False ), - # Columns that are valid for filtering but are not visible. - grids.DeletedColumn( "Deleted", - key="deleted", - visible=False, - filterable="advanced" ) - ] - columns.append( grids.MulticolFilterColumn( "Search", - cols_to_filter=[ columns[0], columns[1], columns[2] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) - global_actions = [ - grids.GridAction( "Add new group", - dict( controller='admin', action='groups', operation='create' ) ) - ] - operations = [ grids.GridOperation( "Rename", - condition=( lambda item: not item.deleted ), - allow_multiple=False, - url_args=dict( action="rename_group" ) ), - grids.GridOperation( "Delete", - condition=( lambda item: not item.deleted ), - allow_multiple=True, - url_args=dict( action="mark_group_deleted" ) ), - grids.GridOperation( "Undelete", - condition=( lambda item: item.deleted ), - allow_multiple=True, - url_args=dict( action="undelete_group" ) ), - grids.GridOperation( "Purge", - condition=( lambda item: item.deleted ), - allow_multiple=True, - url_args=dict( action="purge_group" ) ) ] - standard_filters = [ - grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), - grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ), - grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) - ] - num_rows_per_page = 50 - preserve_state = False - use_paging = True - -class ManageCategoryGrid( CategoryGrid ): - columns = [ col for col in CategoryGrid.columns ] - # Override the NameColumn to include an Edit link - columns[ 0 ] = CategoryGrid.NameColumn( "Name", - key="Category.name", - link=( lambda item: dict( operation="Edit", id=item.id ) ), - model_class=model.Category, - attach_popup=False ) - global_actions = [ - grids.GridAction( "Add new category", - dict( controller='admin', action='manage_categories', operation='create' ) ) - ] - -class AdminRepositoryGrid( RepositoryGrid ): - class DeletedColumn( grids.BooleanColumn ): - def get_value( self, trans, grid, repository ): - if repository.deleted: - return 'yes' - return '' - columns = [ RepositoryGrid.NameColumn( "Name", - key="name", - link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), - attach_popup=True ), - RepositoryGrid.UserColumn( "Owner", - model_class=model.User, - link=( lambda item: dict( operation="repositories_by_user", id=item.id ) ), - attach_popup=False, - key="User.username" ), - RepositoryGrid.DeprecatedColumn( "Deprecated", key="deprecated", attach_popup=False ), - # Columns that are valid for filtering but are not visible. - DeletedColumn( "Deleted", key="deleted", attach_popup=False ) ] - columns.append( grids.MulticolFilterColumn( "Search repository name", - cols_to_filter=[ columns[0] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) - operations = [ operation for operation in RepositoryGrid.operations ] - operations.append( grids.GridOperation( "Delete", - allow_multiple=False, - condition=( lambda item: not item.deleted ), - async_compatible=False ) ) - operations.append( grids.GridOperation( "Undelete", - allow_multiple=False, - condition=( lambda item: item.deleted ), - async_compatible=False ) ) - standard_filters = [] - default_filter = {} - def build_initial_query( self, trans, **kwd ): - return trans.sa_session.query( model.Repository ) \ - .join( model.User.table ) - -class RepositoryMetadataGrid( grids.Grid ): - class IdColumn( grids.IntegerColumn ): - def get_value( self, trans, grid, repository_metadata ): - return repository_metadata.id - class NameColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - return repository_metadata.repository.name - class OwnerColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - return repository_metadata.repository.user.username - class RevisionColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - repository = repository_metadata.repository - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - ctx = suc.get_changectx_for_changeset( repo, repository_metadata.changeset_revision ) - return "%s:%s" % ( str( ctx.rev() ), repository_metadata.changeset_revision ) - class ToolsColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - tools_str = '0' - if repository_metadata: - metadata = repository_metadata.metadata - if metadata: - if 'tools' in metadata: - # We used to display the following, but grid was too cluttered. - #for tool_metadata_dict in metadata[ 'tools' ]: - # tools_str += '%s <b>%s</b><br/>' % ( tool_metadata_dict[ 'id' ], tool_metadata_dict[ 'version' ] ) - return '%d' % len( metadata[ 'tools' ] ) - return tools_str - class DatatypesColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - datatypes_str = '0' - if repository_metadata: - metadata = repository_metadata.metadata - if metadata: - if 'datatypes' in metadata: - # We used to display the following, but grid was too cluttered. - #for datatype_metadata_dict in metadata[ 'datatypes' ]: - # datatypes_str += '%s<br/>' % datatype_metadata_dict[ 'extension' ] - return '%d' % len( metadata[ 'datatypes' ] ) - return datatypes_str - class WorkflowsColumn( grids.TextColumn ): - def get_value( self, trans, grid, repository_metadata ): - workflows_str = '0' - if repository_metadata: - metadata = repository_metadata.metadata - if metadata: - if 'workflows' in metadata: - # We used to display the following, but grid was too cluttered. - #workflows_str += '<b>Workflows:</b><br/>' - # metadata[ 'workflows' ] is a list of tuples where each contained tuple is - # [ <relative path to the .ga file in the repository>, <exported workflow dict> ] - #workflow_tups = metadata[ 'workflows' ] - #workflow_metadata_dicts = [ workflow_tup[1] for workflow_tup in workflow_tups ] - #for workflow_metadata_dict in workflow_metadata_dicts: - # workflows_str += '%s<br/>' % workflow_metadata_dict[ 'name' ] - return '%d' % len( metadata[ 'workflows' ] ) - return workflows_str - class DeletedColumn( grids.BooleanColumn ): - def get_value( self, trans, grid, repository_metadata ): - if repository_metadata.repository.deleted: - return 'yes' - return '' - class DeprecatedColumn( grids.BooleanColumn ): - def get_value( self, trans, grid, repository_metadata ): - if repository_metadata.repository.deprecated: - return 'yes' - return '' - class MaliciousColumn( grids.BooleanColumn ): - def get_value( self, trans, grid, repository_metadata ): - if repository_metadata.malicious: - return 'yes' - return '' - # Grid definition - title = "Repository Metadata" - model_class = model.RepositoryMetadata - template='/webapps/tool_shed/repository/grid.mako' - default_sort_key = "name" - columns = [ - IdColumn( "Id", - visible=False, - attach_popup=False ), - NameColumn( "Name", - key="name", - model_class=model.Repository, - link=( lambda item: dict( operation="view_or_manage_repository_revision", id=item.id ) ), - attach_popup=True ), - OwnerColumn( "Owner", attach_popup=False ), - RevisionColumn( "Revision", attach_popup=False ), - ToolsColumn( "Tools", attach_popup=False ), - DatatypesColumn( "Datatypes", attach_popup=False ), - WorkflowsColumn( "Workflows", attach_popup=False ), - DeletedColumn( "Deleted", attach_popup=False ), - DeprecatedColumn( "Deprecated", attach_popup=False ), - MaliciousColumn( "Malicious", attach_popup=False ) - ] - columns.append( grids.MulticolFilterColumn( "Search repository name", - cols_to_filter=[ columns[1] ], - key="free-text-search", - visible=False, - filterable="standard" ) ) - operations = [ grids.GridOperation( "Delete", - allow_multiple=False, - allow_popup=True, - async_compatible=False, - confirm="Repository metadata records cannot be recovered after they are deleted. Click OK to delete the selected items." ) ] - standard_filters = [] - default_filter = {} - num_rows_per_page = 50 - preserve_state = False - use_paging = True - def build_initial_query( self, trans, **kwd ): - return trans.sa_session.query( model.RepositoryMetadata ) \ - .join( model.Repository.table ) class AdminController( BaseUIController, Admin ): - user_list_grid = UserGrid() - role_list_grid = RoleGrid() - group_list_grid = GroupGrid() - manage_category_grid = ManageCategoryGrid() - repository_grid = AdminRepositoryGrid() - repository_metadata_grid = RepositoryMetadataGrid() + user_list_grid = admin_grids.UserGrid() + role_list_grid = admin_grids.RoleGrid() + group_list_grid = admin_grids.GroupGrid() + manage_category_grid = admin_grids.ManageCategoryGrid() + repository_grid = admin_grids.AdminRepositoryGrid() + repository_metadata_grid = admin_grids.RepositoryMetadataGrid() @web.expose @web.require_admin diff -r db8a3bd35841ce033aff283510a0f7fe3aec3ab0 -r 6cd65073a397246e7b6fa8884d2c26760865ffad lib/tool_shed/grids/admin_grids.py --- /dev/null +++ b/lib/tool_shed/grids/admin_grids.py @@ -0,0 +1,435 @@ +import os, logging +from galaxy.web.framework.helpers import time_ago, grids +from galaxy.webapps.tool_shed import model +from galaxy.model.orm import and_ +import tool_shed.util.shed_util_common as suc +from tool_shed.grids.repository_grids import RepositoryGrid, CategoryGrid + +log = logging.getLogger( __name__ ) + + +class UserGrid( grids.Grid ): + # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. + class UserLoginColumn( grids.TextColumn ): + def get_value( self, trans, grid, user ): + return user.email + class UserNameColumn( grids.TextColumn ): + def get_value( self, trans, grid, user ): + if user.username: + return user.username + return 'not set' + class GroupsColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.groups: + return len( user.groups ) + return 0 + class RolesColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.roles: + return len( user.roles ) + return 0 + class ExternalColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.external: + return 'yes' + return 'no' + class LastLoginColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.galaxy_sessions: + return self.format( user.galaxy_sessions[ 0 ].update_time ) + return 'never' + class StatusColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.purged: + return "purged" + elif user.deleted: + return "deleted" + return "" + class EmailColumn( grids.GridColumn ): + def filter( self, trans, user, query, column_filter ): + if column_filter == 'All': + return query + return query.filter( and_( model.Tool.table.c.user_id == model.User.table.c.id, + model.User.table.c.email == column_filter ) ) + title = "Users" + model_class = model.User + template='/admin/user/grid.mako' + default_sort_key = "email" + columns = [ + UserLoginColumn( "Email", + key="email", + link=( lambda item: dict( operation="information", id=item.id ) ), + attach_popup=True, + filterable="advanced" ), + UserNameColumn( "User Name", + key="username", + attach_popup=False, + filterable="advanced" ), + GroupsColumn( "Groups", attach_popup=False ), + RolesColumn( "Roles", attach_popup=False ), + ExternalColumn( "External", attach_popup=False ), + LastLoginColumn( "Last Login", format=time_ago ), + StatusColumn( "Status", attach_popup=False ), + # Columns that are valid for filtering but are not visible. + EmailColumn( "Email", + key="email", + visible=False ) + ] + columns.append( grids.MulticolFilterColumn( "Search", + cols_to_filter=[ columns[0], columns[1] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + global_actions = [ + grids.GridAction( "Create new user", + dict( controller='admin', action='users', operation='create' ) ) + ] + operations = [ + grids.GridOperation( "Manage Roles and Groups", + condition=( lambda item: not item.deleted ), + allow_multiple=False, + url_args=dict( action="manage_roles_and_groups_for_user" ) ), + grids.GridOperation( "Reset Password", + condition=( lambda item: not item.deleted ), + allow_multiple=True, + allow_popup=False, + url_args=dict( action="reset_user_password" ) ) + ] + standard_filters = [ + grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), + grids.GridColumnFilter( "Deleted", args=dict( deleted=True, purged=False ) ), + grids.GridColumnFilter( "Purged", args=dict( purged=True ) ), + grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) + ] + num_rows_per_page = 50 + preserve_state = False + use_paging = True + def get_current_item( self, trans, **kwargs ): + return trans.user + +class RoleGrid( grids.Grid ): + # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. + class NameColumn( grids.TextColumn ): + def get_value( self, trans, grid, role ): + return role.name + class DescriptionColumn( grids.TextColumn ): + def get_value( self, trans, grid, role ): + if role.description: + return role.description + return '' + class TypeColumn( grids.TextColumn ): + def get_value( self, trans, grid, role ): + return role.type + class StatusColumn( grids.GridColumn ): + def get_value( self, trans, grid, role ): + if role.deleted: + return "deleted" + return "" + class GroupsColumn( grids.GridColumn ): + def get_value( self, trans, grid, role ): + if role.groups: + return len( role.groups ) + return 0 + class UsersColumn( grids.GridColumn ): + def get_value( self, trans, grid, role ): + if role.users: + return len( role.users ) + return 0 + title = "Roles" + model_class = model.Role + template='/admin/dataset_security/role/grid.mako' + default_sort_key = "name" + columns = [ + NameColumn( "Name", + key="name", + link=( lambda item: dict( operation="Manage users and groups", id=item.id ) ), + attach_popup=True, + filterable="advanced" ), + DescriptionColumn( "Description", + key='description', + attach_popup=False, + filterable="advanced" ), + TypeColumn( "Type", + key='type', + attach_popup=False, + filterable="advanced" ), + GroupsColumn( "Groups", attach_popup=False ), + UsersColumn( "Users", attach_popup=False ), + StatusColumn( "Status", attach_popup=False ), + # Columns that are valid for filtering but are not visible. + grids.DeletedColumn( "Deleted", + key="deleted", + visible=False, + filterable="advanced" ) + ] + columns.append( grids.MulticolFilterColumn( "Search", + cols_to_filter=[ columns[0], columns[1], columns[2] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + global_actions = [ + grids.GridAction( "Add new role", + dict( controller='admin', action='roles', operation='create' ) ) + ] + operations = [ grids.GridOperation( "Rename", + condition=( lambda item: not item.deleted ), + allow_multiple=False, + url_args=dict( action="rename_role" ) ), + grids.GridOperation( "Delete", + condition=( lambda item: not item.deleted ), + allow_multiple=True, + url_args=dict( action="mark_role_deleted" ) ), + grids.GridOperation( "Undelete", + condition=( lambda item: item.deleted ), + allow_multiple=True, + url_args=dict( action="undelete_role" ) ), + grids.GridOperation( "Purge", + condition=( lambda item: item.deleted ), + allow_multiple=True, + url_args=dict( action="purge_role" ) ) ] + standard_filters = [ + grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), + grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ), + grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) + ] + num_rows_per_page = 50 + preserve_state = False + use_paging = True + def apply_query_filter( self, trans, query, **kwd ): + return query.filter( model.Role.type != model.Role.types.PRIVATE ) + +class GroupGrid( grids.Grid ): + # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp. + class NameColumn( grids.TextColumn ): + def get_value( self, trans, grid, group ): + return group.name + class StatusColumn( grids.GridColumn ): + def get_value( self, trans, grid, group ): + if group.deleted: + return "deleted" + return "" + class RolesColumn( grids.GridColumn ): + def get_value( self, trans, grid, group ): + if group.roles: + return len( group.roles ) + return 0 + class UsersColumn( grids.GridColumn ): + def get_value( self, trans, grid, group ): + if group.members: + return len( group.members ) + return 0 + title = "Groups" + model_class = model.Group + template='/admin/dataset_security/group/grid.mako' + default_sort_key = "name" + columns = [ + NameColumn( "Name", + link=( lambda item: dict( operation="Manage users and roles", id=item.id ) ), + attach_popup=True ), + UsersColumn( "Users", attach_popup=False ), + RolesColumn( "Roles", attach_popup=False ), + StatusColumn( "Status", attach_popup=False ), + # Columns that are valid for filtering but are not visible. + grids.DeletedColumn( "Deleted", + key="deleted", + visible=False, + filterable="advanced" ) + ] + columns.append( grids.MulticolFilterColumn( "Search", + cols_to_filter=[ columns[0], columns[1], columns[2] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + global_actions = [ + grids.GridAction( "Add new group", + dict( controller='admin', action='groups', operation='create' ) ) + ] + operations = [ grids.GridOperation( "Rename", + condition=( lambda item: not item.deleted ), + allow_multiple=False, + url_args=dict( action="rename_group" ) ), + grids.GridOperation( "Delete", + condition=( lambda item: not item.deleted ), + allow_multiple=True, + url_args=dict( action="mark_group_deleted" ) ), + grids.GridOperation( "Undelete", + condition=( lambda item: item.deleted ), + allow_multiple=True, + url_args=dict( action="undelete_group" ) ), + grids.GridOperation( "Purge", + condition=( lambda item: item.deleted ), + allow_multiple=True, + url_args=dict( action="purge_group" ) ) ] + standard_filters = [ + grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), + grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ), + grids.GridColumnFilter( "All", args=dict( deleted='All' ) ) + ] + num_rows_per_page = 50 + preserve_state = False + use_paging = True + +class ManageCategoryGrid( CategoryGrid ): + columns = [ col for col in CategoryGrid.columns ] + # Override the NameColumn to include an Edit link + columns[ 0 ] = CategoryGrid.NameColumn( "Name", + key="Category.name", + link=( lambda item: dict( operation="Edit", id=item.id ) ), + model_class=model.Category, + attach_popup=False ) + global_actions = [ + grids.GridAction( "Add new category", + dict( controller='admin', action='manage_categories', operation='create' ) ) + ] + +class AdminRepositoryGrid( RepositoryGrid ): + class DeletedColumn( grids.BooleanColumn ): + def get_value( self, trans, grid, repository ): + if repository.deleted: + return 'yes' + return '' + columns = [ RepositoryGrid.NameColumn( "Name", + key="name", + link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ), + attach_popup=True ), + RepositoryGrid.UserColumn( "Owner", + model_class=model.User, + link=( lambda item: dict( operation="repositories_by_user", id=item.id ) ), + attach_popup=False, + key="User.username" ), + RepositoryGrid.DeprecatedColumn( "Deprecated", key="deprecated", attach_popup=False ), + # Columns that are valid for filtering but are not visible. + DeletedColumn( "Deleted", key="deleted", attach_popup=False ) ] + columns.append( grids.MulticolFilterColumn( "Search repository name", + cols_to_filter=[ columns[0] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + operations = [ operation for operation in RepositoryGrid.operations ] + operations.append( grids.GridOperation( "Delete", + allow_multiple=False, + condition=( lambda item: not item.deleted ), + async_compatible=False ) ) + operations.append( grids.GridOperation( "Undelete", + allow_multiple=False, + condition=( lambda item: item.deleted ), + async_compatible=False ) ) + standard_filters = [] + default_filter = {} + def build_initial_query( self, trans, **kwd ): + return trans.sa_session.query( model.Repository ) \ + .join( model.User.table ) + +class RepositoryMetadataGrid( grids.Grid ): + class IdColumn( grids.IntegerColumn ): + def get_value( self, trans, grid, repository_metadata ): + return repository_metadata.id + class NameColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + return repository_metadata.repository.name + class OwnerColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + return repository_metadata.repository.user.username + class RevisionColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + repository = repository_metadata.repository + repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + ctx = suc.get_changectx_for_changeset( repo, repository_metadata.changeset_revision ) + return "%s:%s" % ( str( ctx.rev() ), repository_metadata.changeset_revision ) + class ToolsColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + tools_str = '0' + if repository_metadata: + metadata = repository_metadata.metadata + if metadata: + if 'tools' in metadata: + # We used to display the following, but grid was too cluttered. + #for tool_metadata_dict in metadata[ 'tools' ]: + # tools_str += '%s <b>%s</b><br/>' % ( tool_metadata_dict[ 'id' ], tool_metadata_dict[ 'version' ] ) + return '%d' % len( metadata[ 'tools' ] ) + return tools_str + class DatatypesColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + datatypes_str = '0' + if repository_metadata: + metadata = repository_metadata.metadata + if metadata: + if 'datatypes' in metadata: + # We used to display the following, but grid was too cluttered. + #for datatype_metadata_dict in metadata[ 'datatypes' ]: + # datatypes_str += '%s<br/>' % datatype_metadata_dict[ 'extension' ] + return '%d' % len( metadata[ 'datatypes' ] ) + return datatypes_str + class WorkflowsColumn( grids.TextColumn ): + def get_value( self, trans, grid, repository_metadata ): + workflows_str = '0' + if repository_metadata: + metadata = repository_metadata.metadata + if metadata: + if 'workflows' in metadata: + # We used to display the following, but grid was too cluttered. + #workflows_str += '<b>Workflows:</b><br/>' + # metadata[ 'workflows' ] is a list of tuples where each contained tuple is + # [ <relative path to the .ga file in the repository>, <exported workflow dict> ] + #workflow_tups = metadata[ 'workflows' ] + #workflow_metadata_dicts = [ workflow_tup[1] for workflow_tup in workflow_tups ] + #for workflow_metadata_dict in workflow_metadata_dicts: + # workflows_str += '%s<br/>' % workflow_metadata_dict[ 'name' ] + return '%d' % len( metadata[ 'workflows' ] ) + return workflows_str + class DeletedColumn( grids.BooleanColumn ): + def get_value( self, trans, grid, repository_metadata ): + if repository_metadata.repository.deleted: + return 'yes' + return '' + class DeprecatedColumn( grids.BooleanColumn ): + def get_value( self, trans, grid, repository_metadata ): + if repository_metadata.repository.deprecated: + return 'yes' + return '' + class MaliciousColumn( grids.BooleanColumn ): + def get_value( self, trans, grid, repository_metadata ): + if repository_metadata.malicious: + return 'yes' + return '' + # Grid definition + title = "Repository Metadata" + model_class = model.RepositoryMetadata + template='/webapps/tool_shed/repository/grid.mako' + default_sort_key = "name" + columns = [ + IdColumn( "Id", + visible=False, + attach_popup=False ), + NameColumn( "Name", + key="name", + model_class=model.Repository, + link=( lambda item: dict( operation="view_or_manage_repository_revision", id=item.id ) ), + attach_popup=True ), + OwnerColumn( "Owner", attach_popup=False ), + RevisionColumn( "Revision", attach_popup=False ), + ToolsColumn( "Tools", attach_popup=False ), + DatatypesColumn( "Datatypes", attach_popup=False ), + WorkflowsColumn( "Workflows", attach_popup=False ), + DeletedColumn( "Deleted", attach_popup=False ), + DeprecatedColumn( "Deprecated", attach_popup=False ), + MaliciousColumn( "Malicious", attach_popup=False ) + ] + columns.append( grids.MulticolFilterColumn( "Search repository name", + cols_to_filter=[ columns[1] ], + key="free-text-search", + visible=False, + filterable="standard" ) ) + operations = [ grids.GridOperation( "Delete", + allow_multiple=False, + allow_popup=True, + async_compatible=False, + confirm="Repository metadata records cannot be recovered after they are deleted. Click OK to delete the selected items." ) ] + standard_filters = [] + default_filter = {} + num_rows_per_page = 50 + preserve_state = False + use_paging = True + def build_initial_query( self, trans, **kwd ): + return trans.sa_session.query( model.RepositoryMetadata ) \ + .join( model.Repository.table ) diff -r db8a3bd35841ce033aff283510a0f7fe3aec3ab0 -r 6cd65073a397246e7b6fa8884d2c26760865ffad lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -10,6 +10,8 @@ eggs.require('markupsafe') from markupsafe import escape as escape_html +log = logging.getLogger( __name__ ) + class CategoryGrid( grids.Grid ): 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.
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200