galaxy-dist commit 6e19bc97f2b8: - Fix dbkey migrate script for downgrade and rare case when config is empty
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Kanwei Li <kanwei@gmail.com> # Date 1280868063 14400 # Node ID 6e19bc97f2b8ba816ab20fc53a88f3504c992e00 # Parent 0366c4a4765631188f1515fbd77fddbbf1532d4f - Fix dbkey migrate script for downgrade and rare case when config is empty - Fix grid sorting in "Visualize in Trackster" modal box - Refactor out sort_order in grids, fixing a bug with sort arrow not showing --- a/templates/tracks/add_to_viz.mako +++ b/templates/tracks/add_to_viz.mako @@ -6,8 +6,3 @@ ${render_grid_header( grid, False )} ${render_grid_table( grid, show_item_checkboxes=True )} -## Initialize the grid. -<script type="text/javascript"> - init_grid_elements(); - init_grid_controls(); -</script> --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -136,7 +136,6 @@ class Grid( object ): extra_url_args[ "f-" + column.key ] = column_filter.encode("utf-8") # Process sort arguments. sort_key = None - sort_order = None if 'sort' in kwargs: sort_key = kwargs['sort'] elif base_sort_key: @@ -144,11 +143,9 @@ class Grid( object ): encoded_sort_key = sort_key if sort_key: if sort_key.startswith( "-" ): - sort_order = 'desc' # Can't use lower() on timestamp or integer objects, so func.lower() is not used here... query = query.order_by( self.model_class.table.c.get( sort_key[1:] ).desc() ) else: - sort_order = 'asc' # See reason for not using lower() to do case-insensitive search. query = query.order_by( self.model_class.table.c.get( sort_key ).asc() ) extra_url_args['sort'] = encoded_sort_key @@ -226,7 +223,6 @@ class Grid( object ): cur_filter_dict=cur_filter_dict, sort_key=sort_key, encoded_sort_key=encoded_sort_key, - sort_order=sort_order, current_item=current_item, ids = kwargs.get( 'id', [] ), url = url, --- a/templates/grid_base.mako +++ b/templates/grid_base.mako @@ -739,8 +739,8 @@ href = "" extra = "" if column.sortable: - if sort_key == column.key: - if sort_order == "asc": + if sort_key.endswith(column.key): + if not sort_key.startswith("-"): href = url( sort=( "-" + column.key ) ) extra = "↓" else: --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -205,7 +205,7 @@ class UsesVisualization( SharableItemSec # Set dbkey. try: - dbkey = latest_revision.config['dbkey'] + dbkey = latest_revision.dbkey except KeyError: dbkey = None --- a/lib/galaxy/model/migrate/versions/0054_visualization_dbkey.py +++ b/lib/galaxy/model/migrate/versions/0054_visualization_dbkey.py @@ -14,13 +14,13 @@ log = logging.getLogger( __name__ ) metadata = MetaData( migrate_engine ) db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) -Visualization_table = Table( "visualization", metadata, autoload=True ) -Visualization_revision_table = Table( "visualization_revision", metadata, autoload=True ) - def upgrade(): print __doc__ metadata.reflect() + + Visualization_table = Table( "visualization", metadata, autoload=True ) + Visualization_revision_table = Table( "visualization_revision", metadata, autoload=True ) # Create dbkey columns. x = Column( "dbkey", TEXT, index=True ) @@ -47,12 +47,16 @@ def upgrade(): for viz in all_viz: viz_id = viz['viz_id'] viz_rev_id = viz['viz_rev_id'] - dbkey = from_json_string(viz[Visualization_revision_table.c.config]).get('dbkey', "").replace("'", "\\'") - db_session.execute("UPDATE visualization_revision SET dbkey='%s' WHERE id=%s" % (dbkey, viz_rev_id)) - db_session.execute("UPDATE visualization SET dbkey='%s' WHERE id=%s" % (dbkey, viz_id)) + if viz[Visualization_revision_table.c.config]: + dbkey = from_json_string(viz[Visualization_revision_table.c.config]).get('dbkey', "").replace("'", "\\'") + db_session.execute("UPDATE visualization_revision SET dbkey='%s' WHERE id=%s" % (dbkey, viz_rev_id)) + db_session.execute("UPDATE visualization SET dbkey='%s' WHERE id=%s" % (dbkey, viz_id)) def downgrade(): metadata.reflect() + + Visualization_table = Table( "visualization", metadata, autoload=True ) + Visualization_revision_table = Table( "visualization_revision", metadata, autoload=True ) Visualization_table.c.dbkey.drop() Visualization_revision_table.c.dbkey.drop()
participants (1)
-
commits-noreply@bitbucket.org