From c5ac90301eadd643b38215098adf0bc53534d522 Mon Sep 17 00:00:00 2001 From: Carl Eberhard Date: Thu, 1 May 2014 09:17:19 -0400 Subject: [PATCH] History: remove unused server templates history_common, history_item, and history_annotation_table; Pages: remove unused dialog for annotated histories --- lib/galaxy/webapps/galaxy/controllers/page.py | 10 - static/scripts/galaxy.pages.js | 71 +--- templates/webapps/galaxy/page/editor.mako | 1 - .../galaxy/page/history_annotation_table.mako | 61 ---- .../webapps/galaxy/root/history_common.mako | 337 ------------------ .../webapps/galaxy/root/history_item.mako | 3 - 6 files changed, 1 insertion(+), 482 deletions(-) delete mode 100644 templates/webapps/galaxy/page/history_annotation_table.mako delete mode 100644 templates/webapps/galaxy/root/history_common.mako delete mode 100644 templates/webapps/galaxy/root/history_item.mako diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index c9cb7dff52b..f369ac974be 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -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. """ diff --git a/static/scripts/galaxy.pages.js b/static/scripts/galaxy.pages.js index 1a7fbabf7df..b1328fcc4dc 100644 --- a/static/scripts/galaxy.pages.js +++ b/static/scripts/galaxy.pages.js @@ -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 "" ].join( '' ); // Insert embedded item into document. - //wym.insert(" "); // 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
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(){ diff --git a/templates/webapps/galaxy/page/editor.mako b/templates/webapps/galaxy/page/editor.mako index 86e7c668942..283b4158be4 100644 --- a/templates/webapps/galaxy/page/editor.mako +++ b/templates/webapps/galaxy/page/editor.mako @@ -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' )}"; diff --git a/templates/webapps/galaxy/page/history_annotation_table.mako b/templates/webapps/galaxy/page/history_annotation_table.mako deleted file mode 100644 index d4efe15e187..00000000000 --- a/templates/webapps/galaxy/page/history_annotation_table.mako +++ /dev/null @@ -1,61 +0,0 @@ -<%namespace file="../tagging_common.mako" import="render_tagging_element_html" /> -<%namespace file="../root/history_common.mako" import="render_dataset" /> - -
- - ## Table header. - - - - - ## Status messages and tags. - - - - - - - ## Table body. For each dataset, there is an area to annotate the dataset. - %if not datasets: - - - - %else: - ## Render requested datasets. - %for data in datasets: - %if data.visible: - - - ## - - - %endif - %endfor - %endif -
History '${history.get_display_name()}'
- %if history.deleted: -
- ${_('This is a deleted history.')} -
- %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 -
Description of History: -
    -
  1. What was the motivation for this history? -
  2. What is the outcome of this history? -
  3. What are unresolved questions from this history? -
  4. What new questions arise from this history? -
-
-
- ${_("Your history is empty. Click 'Get Data' on the left pane to start")} -
-
Describe this step: why was it done? what data did it produce?Describe this step: why was it done? what data does it produce? -
- ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = False )} -
-
-
\ No newline at end of file diff --git a/templates/webapps/galaxy/root/history_common.mako b/templates/webapps/galaxy/root/history_common.mako deleted file mode 100644 index 5565d45a09b..00000000000 --- a/templates/webapps/galaxy/root/history_common.mako +++ /dev/null @@ -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: -
- Download Dataset - Additional Files - %for file_type in meta_files: - Download ${file_type} - %endfor -
- - %endif - %endif - - -## 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 ): -
- %else: -
- %endif - - %if data.deleted or data.purged or data.dataset.purged: -
- %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 here to undelete - %if trans.app.config.allow_user_dataset_purge: - or here to immediately remove it from disk. - %else: - it. - %endif - %endif - %endif -
- %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: - <% - 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: - - %else: - - %endif - - ## edit attr button - %if for_editing: - %if data.deleted and not data.purged: - - %elif data.purged: - - %else: - - %endif - %endif - - %endif - - ## delete button - %if for_editing: - %if can_edit: - - %else: - - %endif - %endif -
- ## Hack, do it in css - %if data_state == "paused": - - %else: - - %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')}
-
- - %if for_editing: - - %endif -
- %elif data_state == "paused": -
- ${_('Job is currently paused:')} ${data.display_info().strip().rstrip('.')}. ${_('Use the history menu to resume.')}
-
- - %if for_editing: - - %endif -
- %elif data_state == "running": -
${_('Job is currently running')}
-
- - %if for_editing: - - %endif -
- %elif data_state == "error": - %if not data.purged: -
${data.get_size( nice_size=True )}
- %endif -
- An error occurred running this job: ${data.display_info().strip()} -
-
- %if for_editing: - - %endif - %if data.has_data(): - ${render_download_links( data, dataset_id )} - %endif - - %if for_editing: - - %endif -
- %elif data_state == "discarded": -
- The job creating this dataset was cancelled before completion. -
-
- - %if for_editing: - - %endif -
- %elif data_state == 'setting_metadata': -
${_('Metadata is being Auto-Detected.')}
- %elif data_state == "empty": -
${_('No data: ')}${data.display_info()}
-
- - %if for_editing: - - %endif -
- %elif data_state in [ "ok", "failed_metadata" ]: - %if data_state == "failed_metadata": -
- An error occurred setting the metadata for this dataset. - %if can_edit: - You may be able to set it manually or retry auto-detection. - %endif -
- %endif -
- ${data.blurb}
- ${_("format: ")} ${data.ext}, - ${_("database: ")} - %if data.dbkey == '?' and can_edit: - ${_(data.dbkey)} - %else: - ${_(data.dbkey)} - %endif -
- %if data.display_info(): -
${_('Info: ')}${data.display_info()}
- %endif -
- %if data.has_data(): - ${render_download_links( data, dataset_id )} - - - - %if for_editing: - - ## 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: - - %endif - %if trans.user: - %if not display_structured: -
- - -
- %endif -
- - - - %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": -
${_(h.to_unicode(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 - -
- -
- - -
- - diff --git a/templates/webapps/galaxy/root/history_item.mako b/templates/webapps/galaxy/root/history_item.mako deleted file mode 100644 index a6135050a9d..00000000000 --- a/templates/webapps/galaxy/root/history_item.mako +++ /dev/null @@ -1,3 +0,0 @@ -<%namespace file="history_common.mako" import="render_dataset" /> - -${render_dataset( data, hid )}