##
## Render the dataset `$data`, using `$hid` as the displayed id
##
## separate so it's only called once
#def render_script( $data )
#end def
## FIXME: This function is duplicated in history.tmpl!
## This copy is used for rendering datasets when the client's javascript
## is enabled.
#def render_dataset( $data, $hid )
#if $data.state in ["no state","",None]:
#set $data_state = "queued"
#else
#set $data_state = $data.state
#end if
##
## Header row for history items (name, state, action buttons)
##
|
#if $data_state == 'running'
#elif $data_state == 'ok'
#pass
#else
#set $src = $h.url_for( "/static/style/data_%s.png" % $data_state )
#end if
|
|
##
## Body for history items, extra info and actions, data "peek"
##
#if $data_state == "queued"
Job is waiting to run
#elif $data_state == "running"
Job is currently running
#elif $data_state == "error"
#elif $data_state == "empty"
No data: $data.display_info
#else
$data.blurb,
format:
$data.ext,
database:
#if $data.dbkey == '?'
$data.dbkey
#else
$data.dbkey
#end if
Info: $data.display_info
#if $data.has_data:
save
#for $display_app in $data.datatype.get_display_types():
#set $display_links = $data.datatype.get_display_links($data, $display_app, $app, $request.base)
#if $len($display_links) > 0:
| $data.datatype.get_display_label($display_app)
#for $display_name, $display_link in display_links:
$display_name
#end for
#end if
#end for
#end if
#if $data.peek != "no peek"
#end if
#end if
##
## Child datasets
##
#if $len( $data.children ) > 0:
#set $children = []
#for $child_assoc in $data.children:
#if $child_assoc.child.visible:
$children.append($child_assoc.child)
#end if
#end for
#if $len( $children ) > 0:
There are ${len( $children )} secondary datasets.
#for $idx, $child in $enumerate($children)
$render_dataset( $child, $idx + 1 )
#end for
#end if
#end if
#end def
## this is necessary because this dataset remains in history.active_datasets
## after deletion, until the history is reloaded
## FIXME: still necessary now that we don't re-pull finished datasets? test.
#if $data.deleted is not True
$render_dataset( $data, $hid )
$render_script( $data )
#end if