<% _=n_ %> ## Render the dataset `data` as history item, using `hid` as the displayed id <%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True )"> <% if data.state in ['no state','',None]: data_state = "queued" else: data_state = data.state current_user_roles = trans.get_current_user_roles() %> %if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
%else:
%endif %if data.deleted:
This dataset has been deleted. Click here to undelete.
%endif %if data.visible is False:
This dataset has been hidden. Click here to unhide.
%endif ## Header row for history items (name, state, action buttons)
%if data_state == "upload": ## TODO: Make these CSS, just adding a "disabled" class to the normal ## links should be enough. However the number of datasets being uploaded ## at a time is usually small so the impact of these images is also small. %if for_editing: %endif %else: <% dataset_id = trans.security.encode_id( data.id ) if for_editing: display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' ) else: # Get URL for display only. if data.history.user and data.history.user.username: display_url = h.url_for( controller='dataset', action='display_by_username_and_slug', username=data.history.user.username, slug=dataset_id ) else: # HACK: revert to for_editing display URL when there is no user/username. This should only happen when # there's no user/username because dataset is being displayed by history/view after error reported. # There are no security concerns here because both dataset/display and dataset/display_by_username_and_slug # check user permissions (to the same degree) before displaying. display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' ) %> %if for_editing: %endif %endif %if for_editing: %endif
${hid}: ${data.display_name()}
## Body for history items, extra info and actions, data "peek"
%if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
You do not have permission to view this dataset.
%elif data_state == "upload":
Dataset is uploading
%elif data_state == "queued":
${_('Job is waiting to run')}
%elif data_state == "running":
${_('Job is currently running')}
%elif data_state == "error":
An error occurred running this job: ${data.display_info().strip()}
%elif data_state == "discarded":
The job creating this dataset was cancelled before completion.
%elif data_state == 'setting_metadata':
${_('Metadata is being Auto-Detected.')}
%elif data_state == "empty":
${_('No data: ')}${data.display_info()}
%elif data_state in [ "ok", "failed_metadata" ]: %if data_state == "failed_metadata":
An error occurred setting the metadata for this dataset. You may be able to set it manually or retry auto-detection.
%endif
${data.blurb}, format: ${data.ext}, database: %if data.dbkey == '?': ${_(data.dbkey)} %else: ${_(data.dbkey)} %endif
${_('Info: ')}${data.display_info()}
<% dataset_id=trans.security.encode_id( data.id ) %> %if data.has_data(): %if for_editing: %if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks(): %endif %if trans.user:
%endif %else: ## When displaying datasets for viewing, this is often needed to prevent peek from overlapping ## icons.
%endif
%for display_app in data.datatype.get_display_types(): <% target_frame, 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)} %endfor %endif %endfor %for display_app in data.get_display_applications( trans ).itervalues(): | ${display_app.name} %for link_app in display_app.links.itervalues(): ${_(link_app.name)} %endfor %endfor %elif for_editing: %endif
%if data.peek != "no peek":
${_(data.display_peek())}
%endif %else:
${_('Error: unknown dataset state "%s".') % data_state}
%endif ## Recurse for child datasets %if len( data.children ) > 0: ## FIXME: This should not be in the template, there should ## be a 'visible_children' method on dataset. <% children = [] for child in data.children: if child.visible: children.append( child ) %> %if len( children ) > 0:
There are ${len( children )} secondary datasets. %for idx, child in enumerate(children): ${render_dataset( child, idx + 1, show_deleted_on_refresh = show_deleted_on_refresh )} %endfor
%endif %endif