Files
galaxy/templates/dataset_code.tmpl
T

157 lines
7.4 KiB
Cheetah

##
## Render the dataset `$data`, using `$hid` as the displayed id
##
## separate so it's only called once
#def render_script( $data )
<script type="text/javascript">
q( document ).ready( function() {
initShowHide( q );
## This solves the problem of .hide() and .show() for the body div
## not executing until after it's already rendered.
q( "div.ajaxHistoryItem" ).show()
})
</script>
#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
<div class="historyItemWrapper historyItem historyItem-$data_state ajaxHistoryItem" id="historyItem-$data.id" style="display:none;">
##
## Header row for history items (name, state, action buttons)
##
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<div style='padding-right: 5px; display: none;' id="progress-$data.id">
<img src="$h.url_for('/static/style/data_running.gif')" border="0" align="middle" >
</div>
#if $data_state == 'running'
<div style='padding-right: 5px;'><img src="$h.url_for('/static/style/data_running.gif')" border="0" align="middle"></div>
#elif $data_state == 'ok'
#pass
#else
#set $src = $h.url_for( "/static/style/data_%s.png" % $data_state )
<div style='padding-right: 5px;'><img src="$src" border="0" align="middle"></div>
#end if
</td>
<td>
<div>
<div style="float: right;"><a href="$h.url_for( controller='dataset', dataset_id=$data.id, action='display', filename='index')" target="_top"><img src="$h.url_for('/static/images/eye_icon.png')" rollover="$h.url_for('/static/images/eye_icon_dark.png')" width='16' height='16' alt='display data' title='display data' class='displayButton' border='0'></a>
<a href="edit?id=$data.id" target="galaxy_main"><img src="$h.url_for('/static/images/pencil_icon.png')" rollover="$h.url_for('/static/images/pencil_icon_dark.png')" width='16' height='16' alt='edit attributes' title='edit attributes' class='editButton' border='0'></a>
<a href="delete?id=$data.id" class="historyItemDelete" id="historyItemDelter-${data.id}"><img src="$h.url_for('/static/images/delete_icon.png')" rollover="$h.url_for('/static/images/delete_icon_dark.png')" width='16' height='16' alt='delete' class='deleteButton' border='0'></a>
<!--
$h.link_to_remote( "<img src='%s' rollover='%s' width='16' height='16' alt='delete' class='deleteButton' border='0'>" % ( $h.url_for('/static/images/delete_icon.png'), $h.url_for('/static/images/delete_icon_dark.png') ),
dict( url=$h.url( action="delete_async", id=$data.id ),
before=( "$( 'progress-%s' ).show()" % $data.id ),
success=( "delete_item( 'historyItem-%s' )" % $data.id ),
failure="alert( 'delete failed' )" ),
href="delete?id=%d" % $data.id,
title='delete this item' ) -->
</div>
<span class="historyItemTitle"><b>$hid: $data.display_name</b></span>
</div>
</td>
</tr>
</table>
##
## Body for history items, extra info and actions, data "peek"
##
<div id="info$data.id" class="historyItemBody">
#if $data_state == "queued"
<div>Job is waiting to run</div>
#elif $data_state == "running"
<div>Job is currently running</div>
#elif $data_state == "error"
<div>
An error occurred running this job: <i>$data.display_info.strip()</i>,
<a href="${h.url_for( controller='dataset', action='errors', id=$data.id )}" target="galaxy_main">report this error</a>
</div>
#elif $data_state == "empty"
<div>No data: <i>$data.display_info</i></div>
#else
<div>
$data.blurb,
format: <span class="$data.ext">$data.ext</span>,
database:
#if $data.dbkey == '?'
<a href="edit?id=$data.id" target="galaxy_main"><span class="$data.dbkey">$data.dbkey</span></a>
#else
<span class="$data.dbkey">$data.dbkey</span>
#end if
</div>
<div class="info">Info: $data.display_info </div>
<div>
#if $data.has_data:
<a href="display?id=$data.id&tofile=yes&toext=$data.ext" target="_blank">save</a>
#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:
<a target="_blank" href="$display_link">$display_name</a>
#end for
#end if
#end for
#end if
</div>
#if $data.peek != "no peek"
<div><pre id="peek$data.id" class="peek">$data.display_peek</pre></div>
#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:
<div>
There are ${len( $children )} secondary datasets.
#for $idx, $child in $enumerate($children)
$render_dataset( $child, $idx + 1 )
#end for
</div>
#end if
#end if
</div>
</div>
<script type="text/javascript">
q( document ).ready( function() {
showHideLink( q, $data.id );
deleteLink( q );
})
</script>
#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