Fix display_structure by using serializer; fix structure by removing extra decode_id

This commit is contained in:
Carl Eberhard
2015-02-27 10:03:47 -05:00
parent d4b6df5330
commit fe523237c6
2 changed files with 8 additions and 4 deletions
@@ -543,8 +543,10 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
def structure( self, trans, id=None, **kwargs ):
"""
"""
id = self.decode_id( id ) if id else trans.history.id
history_to_view = self.history_manager.get_accessible( trans, id, trans.user )
unencoded_history_id = trans.history.id
if id:
unencoded_history_id = self.decode_id( id )
history_to_view = self.history_manager.get_accessible( trans, unencoded_history_id, trans.user )
history_data = self.history_manager._get_history_data( trans, history_to_view )
history_dictionary = history_data[ 'history' ]
@@ -552,7 +554,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
jobs = ( trans.sa_session.query( trans.app.model.Job )
.filter( trans.app.model.Job.user == trans.user )
.filter( trans.app.model.Job.history_id == self.decode_id( id ) ) ).all()
.filter( trans.app.model.Job.history_id == unencoded_history_id ) ).all()
jobs = map( lambda j: self.encode_all_ids( trans, j.to_dict( 'element' ), True ), jobs )
tools = {}
@@ -128,13 +128,15 @@
## ----------------------------------------------------------------------------
<%def name="javascripts()">
<%
from galaxy.managers import hdas
hda_serializer = hdas.HDASerializer( trans.app )
self.js_app = 'display-structured'
controller = trans.webapp.controllers[ 'history' ]
hda_dicts = []
id_hda_dict_map = {}
for hda in history.active_datasets:
hda_dict = controller.get_hda_dict( trans, hda )
hda_dict = hda_serializer.serialize_to_view( trans, hda, 'detailed' )
id_hda_dict_map[ hda_dict[ 'id' ] ] = hda_dict
hda_dicts.append( hda_dict )
%>