History: remove unused server templates history_common, history_item, and history_annotation_table; Pages: remove unused dialog for annotated histories

This commit is contained in:
Carl Eberhard
2014-05-01 09:17:19 -04:00
parent 7270953658
commit c5ac90301e
6 changed files with 1 additions and 482 deletions
@@ -696,16 +696,6 @@ class PageController( BaseUIController, SharableMixin, UsesHistoryMixin,
# Render the list view
return self._datasets_selection_grid( trans, **kwargs )
@web.expose
@web.require_login("get annotation table for history")
def get_history_annotation_table( self, trans, id ):
""" Returns HTML for an annotation table for a history. """
history = self.get_history( trans, id, False, True )
if history:
datasets = self.get_history_datasets( trans, history )
return trans.fill_template( "page/history_annotation_table.mako", history=history, datasets=datasets, show_deleted=False )
@web.expose
def get_editor_iframe( self, trans ):
""" Returns the document for the page editor's iframe. """
+1 -70
View File
@@ -20,10 +20,7 @@ var Galaxy =
DIALOG_EMBED_DATASET : "embed_dataset",
DIALOG_EMBED_WORKFLOW : "embed_workflow",
DIALOG_EMBED_PAGE : "embed_page",
DIALOG_EMBED_VISUALIZATION : "embed_visualization",
// Annotation dialogs.
DIALOG_HISTORY_ANNOTATE : "history_annotate",
DIALOG_EMBED_VISUALIZATION : "embed_visualization"
};
// Initialize Galaxy elements.
@@ -464,25 +461,8 @@ WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHt
"</div>" ].join( '' );
// Insert embedded item into document.
//wym.insert("&nbsp;"); // Needed to prevent insertion from occurring in child element in webkit browsers.
wym.insert(item_embed_html);
// TODO: can we fix this?
// Due to oddities of wym.insert() [likely due to inserting a <div> and/or a complete paragraph], an
// empty paragraph (or two!) may be included either before an embedded item. Remove these paragraphs.
//$("#" + item_elt_id, wym._doc.body).each( function() {
// // Remove previous empty paragraphs.
// var removing = true;
// while (removing)
// {
// var prev_elt = $(this).prev();
// if ( prev_elt.length != 0 && jQuery.trim(prev_elt.text()) == "" )
// prev_elt.remove();
// else
// removing = false;
// }
//});
});
hide_modal();
},
@@ -495,55 +475,6 @@ WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHt
}
});
}
// ANNOTATE HISTORY DIALOG
if ( dialogType == Galaxy.DIALOG_ANNOTATE_HISTORY ) {
$.ajax(
{
url: list_histories_for_selection_url,
data: {},
error: function() { alert( "Grid refresh failed" ) },
success: function(table_html)
{
show_modal(
"Insert Link to History",
table_html,
{
"Annotate": function()
{
// Insert links to history for each checked item.
var item_ids = new Array();
$('input[name=id]:checked').each(function() {
var item_id = $(this).val();
// Get annotation table for history.
$.ajax(
{
url: get_history_annotation_table_url,
data: { id : item_id },
error: function() { alert( "Grid refresh failed" ) },
success: function(result)
{
// Insert into document.
wym.insert(result);
init_galaxy_elts(wym);
}
});
});
hide_modal();
},
"Cancel": function()
{
hide_modal();
}
}
);
}
});
}
};
$(function(){
@@ -19,7 +19,6 @@
set_accessible_url = "${h.url_for( controller='ITEM_CONTROLLER', action='set_accessible_async' )}",
get_name_and_link_url = "${h.url_for( controller='ITEM_CONTROLLER', action='get_name_and_link_async' )}?id=",
list_histories_for_selection_url = "${h.url_for(controller='page', action='list_histories_for_selection' )}",
get_history_annotation_table_url = "${h.url_for(controller='page', action='get_history_annotation_table' )}",
editor_base_path = "${h.url_for('/static/wymeditor')}/",
iframe_base_path = "${h.url_for('/static/wymeditor/iframe/galaxy')}/",
save_url = "${h.url_for(controller='page', action='save' )}";
@@ -1,61 +0,0 @@
<%namespace file="../tagging_common.mako" import="render_tagging_element_html" />
<%namespace file="../root/history_common.mako" import="render_dataset" />
<div class="annotated_item">
<table>
## Table header.
<tr>
<th colspan='2'>History '${history.get_display_name()}'</th>
</tr>
<tr>
## Status messages and tags.
<td colspan='2'>
%if history.deleted:
<div class="warningmessagesmall">
${_('This is a deleted history.')}
</div>
%endif
## Tags come for free with community tagging, so not sure if this is necessary.
##%if trans.get_user() is not None:
## Tags: ${render_tagging_element_html( tags=history.tags, editable=False, use_toggle_link=False )}
##%endif
</td>
</tr>
<tr>
<td colspan="2" class="annotation" item_class="History" item_id="${trans.security.encode_id( history.id )}">Description of History:
<ol>
<li>What was the motivation for this history?
<li>What is the outcome of this history?
<li>What are unresolved questions from this history?
<li>What new questions arise from this history?
</ol>
</td>
</tr>
## Table body. For each dataset, there is an area to annotate the dataset.
%if not datasets:
<tr>
<td>
<div class="infomessagesmall" id="emptyHistoryMessage">
${_("Your history is empty. Click 'Get Data' on the left pane to start")}
</div>
</td>
</tr>
%else:
## Render requested datasets.
%for data in datasets:
%if data.visible:
<tr>
<td valign="top" class="annotation" item_class="HistoryDatasetAssociation" item_id="${trans.security.encode_id( data.id )}">Describe this step: why was it done? what data did it produce?</td>
##<td valign="top" class="annotation">Describe this step: why was it done? what data does it produce?</td>
<td>
<div class="historyItemContainer" id="historyItemContainer-${data.id}">
${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = False )}
</div>
</td>
</tr>
%endif
%endfor
%endif
</table>
</div>
@@ -1,337 +0,0 @@
<% _=n_ %>
<%def name="render_download_links( data, dataset_id )">
<%
from galaxy.datatypes.metadata import FileParameter
%>
%if not data.purged:
## Check for downloadable metadata files
<% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
%if meta_files:
<div popupmenu="dataset-${dataset_id}-popup">
<a class="action-button" href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, \
to_ext=data.ext )}">Download Dataset</a>
<a>Additional Files</a>
%for file_type in meta_files:
<a class="action-button" href="${h.url_for( controller='/dataset', action='get_metadata_file', \
hda_id=dataset_id, metadata_name=file_type )}">Download ${file_type}</a>
%endfor
</div>
<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
%endif
<a href="${h.url_for( controller='/dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title='${_("Download")}' class="icon-button disk"></a>
%if meta_files:
</div>
%endif
%endif
</%def>
## 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, display_structured = False )">
<%
dataset_id = trans.security.encode_id( data.id )
if data.state in ['no state','',None]:
data_state = "queued"
else:
data_state = data.state
current_user_roles = trans.get_current_user_roles()
can_edit = not ( data.deleted or data.purged )
%>
%if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
<div class="historyItemWrapper historyItem historyItem-${data_state} historyItem-noPermission" id="historyItem-${dataset_id}">
%else:
<div class="historyItemWrapper historyItem historyItem-${data_state}" id="historyItem-${dataset_id}">
%endif
%if data.deleted or data.purged or data.dataset.purged:
<div class="warningmessagesmall"><strong>
%if data.dataset.purged or data.purged:
This dataset has been deleted and removed from disk.
%else:
This dataset has been deleted.
%if for_editing:
Click <a href="${h.url_for( controller='dataset', action='undelete', dataset_id=dataset_id )}" class="historyItemUndelete" id="historyItemUndeleter-${dataset_id}" target="galaxy_history">here</a> to undelete
%if trans.app.config.allow_user_dataset_purge:
or <a href="${h.url_for( controller='dataset', action='purge', dataset_id=dataset_id )}" class="historyItemPurge" id="historyItemPurger-${dataset_id}" target="galaxy_history">here</a> to immediately remove it from disk.
%else:
it.
%endif
%endif
%endif
</strong></div>
%endif
%if data.visible is False:
<div class="warningmessagesmall">
<strong>This dataset has been hidden. Click <a href="${h.url_for( controller='dataset', action='unhide', dataset_id=dataset_id )}" class="historyItemUnhide" id="historyItemUnhider-${dataset_id}" target="galaxy_history">here</a> to unhide.</strong>
</div>
%endif
## Header row for history items (name, state, action buttons)
<div style="overflow: hidden;" class="historyItemTitleBar">
<div class="historyItemButtons">
%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.
<span title='${_("Display Data")}' class='icon-button display_disabled'></span>
%if for_editing:
<span title='Edit Attributes' class='icon-button edit_disabled'></span>
%endif
%else:
<%
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, filename='' )
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 data.purged:
<span class="icon-button display_disabled" title="Cannot display datasets removed from disk"></span>
%else:
<a class="icon-button display" dataset_id="${dataset_id}" title='${_("View data")}' href="${display_url}"
%if for_editing:
target="galaxy_main"
%endif
></a>
%endif
## edit attr button
%if for_editing:
%if data.deleted and not data.purged:
<span title="Undelete dataset to edit attributes" class="icon-button edit_disabled"></span>
%elif data.purged:
<span title="Cannot edit attributes of datasets removed from disk" class="icon-button edit_disabled"></span>
%else:
<a class="icon-button edit" title='${_("Edit attributes")}' href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main"></a>
%endif
%endif
%endif
## delete button
%if for_editing:
%if can_edit:
<a class="icon-button delete" title='${_("Delete")}' href="${h.url_for( controller='dataset', action='delete', dataset_id=dataset_id, show_deleted_on_refresh=show_deleted_on_refresh )}" id="historyItemDeleter-${dataset_id}"></a>
%else:
<span title="Dataset is already deleted" class="icon-button delete_disabled"></span>
%endif
%endif
</div>
## Hack, do it in css
%if data_state == "paused":
<span class="fa fa-pause"></span>
%else:
<span class="state-icon"></span>
%endif
<span class="historyItemTitle">${hid}: ${data.display_name()}</span>
</div>
## Body for history items, extra info and actions, data "peek"
<div id="info${data.id}" class="historyItemBody">
%if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
<div>You do not have permission to view this dataset.</div>
%elif data_state == "upload":
<div>Dataset is uploading</div>
%elif data_state == "queued":
<div>${_('Job is waiting to run')}</div>
<div>
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state == "paused":
<div>
${_('Job is currently paused:')} <i>${data.display_info().strip().rstrip('.')}.</i> ${_('Use the history menu to resume.')}</div>
<div>
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state == "running":
<div>${_('Job is currently running')}</div>
<div>
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state == "error":
%if not data.purged:
<div>${data.get_size( nice_size=True )}</div>
%endif
<div>
An error occurred running this job: <i>${data.display_info().strip()}</i>
</div>
<div>
%if for_editing:
<a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug"></a>
%endif
%if data.has_data():
${render_download_links( data, dataset_id )}
%endif
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state == "discarded":
<div>
The job creating this dataset was cancelled before completion.
</div>
<div>
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state == 'setting_metadata':
<div>${_('Metadata is being Auto-Detected.')}</div>
%elif data_state == "empty":
<div>${_('No data: ')}<i>${data.display_info()}</i></div>
<div>
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%elif data_state in [ "ok", "failed_metadata" ]:
%if data_state == "failed_metadata":
<div class="warningmessagesmall" style="margin: 4px 0 4px 0">
An error occurred setting the metadata for this dataset.
%if can_edit:
You may be able to <a href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main">set it manually or retry auto-detection</a>.
%endif
</div>
%endif
<div>
${data.blurb}<br />
${_("format: ")} <span class="${data.ext}">${data.ext}</span>,
${_("database: ")}
%if data.dbkey == '?' and can_edit:
<a href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main">${_(data.dbkey)}</a>
%else:
<span class="${data.dbkey}">${_(data.dbkey)}</span>
%endif
</div>
%if data.display_info():
<div class="info">${_('Info: ')}${data.display_info()}</div>
%endif
<div>
%if data.has_data():
${render_download_links( data, dataset_id )}
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
## Visualization icon + visualizations. Using anchor attributes is a HACK to encode needed
## information--URL base, dataset id, dbkey, visualizations--in anchor.
<%
visualizations = data.get_visualizations()
%>
%if visualizations:
<a href="${h.url_for( controller='visualization' )}"
class="icon-button chart_curve visualize-icon"
title="Visualize"
dataset_id="${dataset_id}"
%if data.dbkey != '?':
dbkey="${data.dbkey}"
%endif
visualizations="${','.join(visualizations)}"></a>
%endif
%if trans.user:
%if not display_structured:
<div style="float: right">
<a href="${h.url_for( controller='tag', action='retag', item_class=data.__class__.__name__, item_id=dataset_id )}" target="galaxy_main" title="Edit dataset tags" class="icon-button tags"></a>
<a href="${h.url_for( controller='dataset', action='annotate', id=dataset_id )}" target="galaxy_main" title="Edit dataset annotation" class="icon-button annotate"></a>
</div>
%endif
<div style="clear: both"></div>
<div class="tag-area" style="display: none">
<strong>Tags:</strong>
<div class="tag-elt"></div>
</div>
<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">
<strong>Annotation:</strong>
<div id="${dataset_id}-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt editable-text" title="Edit dataset annotation"></div>
</div>
%endif
%else:
## When displaying datasets for viewing, this is often needed to prevent peek from overlapping
## icons.
<div style="clear: both"></div>
%endif
<div style="clear: both"></div>
%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:
<a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
%endfor
<br />
%endif
%endfor
%for display_app in data.get_display_applications( trans ).itervalues():
${display_app.name}
%for link_app in display_app.links.itervalues():
<a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a>
%endfor
<br />
%endfor
%elif for_editing:
<a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
%endif
</div>
%if data.peek != "no peek":
<div><pre id="peek${data.id}" class="peek">${_(h.to_unicode(data.display_peek()))}</pre></div>
%endif
%else:
<div>${_('Error: unknown dataset state "%s".') % data_state}</div>
%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:
<div>
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
</div>
%endif
%endif
<div style="clear: both;"></div>
</div>
</div>
</%def>
@@ -1,3 +0,0 @@
<%namespace file="history_common.mako" import="render_dataset" />
${render_dataset( data, hid )}