Unverified Commit e7e348ab authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #19525 from mvdbeek/fix_extracting_workflow_from_purged_histories

[24.1] Fix extracting workflows from purged and deleted histories
parents 94456cb7 bd42a470
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3645,6 +3645,10 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
        """Return all active contents ordered by hid."""
        return self.contents_iter(types=["dataset", "dataset_collection"], deleted=False, visible=True)

    @property
    def visible_contents(self):
        return self.contents_iter(types=["dataset", "dataset_collection"], visible=True)

    def contents_iter(self, **kwds):
        """
        Fetch filtered list of contents of history.
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ class WorkflowSummary:
        # just grab the implicitly mapped jobs and handle in second pass. Second pass is
        # needed because cannot allow selection of individual datasets from an implicit
        # mapping during extraction - you get the collection or nothing.
        for content in self.history.active_contents:
        for content in self.history.visible_contents:
            self.__summarize_content(content)

    def __summarize_content(self, content):
+6 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ into a workflow will be shown in gray.</p>
    <div class="warningmark">${warning}</div>
%endfor

<form method="post" action="${h.url_for(controller='workflow', action='build_from_current_history')}">
<form method="post" action="${h.url_for(controller='workflow', action='build_from_current_history', history_id=trans.security.encode_id(history.id))}">
<div class='form-row'>
    <label>Workflow name</label>
    <input name="workflow_name" type="text" value="Workflow constructed from history '${ util.unicodify( history.name )}'" size="60"/>
@@ -112,6 +112,7 @@ into a workflow will be shown in gray.</p>
    <%
    cls = "toolForm"
    tool_name = "Unknown"
    checked_job = "checked" if any(True for d in datasets if not d[1].deleted) else ""
    if hasattr( job, 'is_fake' ) and job.is_fake:
        cls += " toolFormDisabled"
        disabled = True
@@ -142,7 +143,10 @@ into a workflow will be shown in gray.</p>
                    %if disabled:
                        <div style="font-style: italic; color: gray">${disabled_why}</div>
                    %else:
                        <div><input type="checkbox" name="job_ids" value="${job.id}" checked="true" />Include "${tool_name}" in workflow</div>
                        <div><input type="checkbox" name="job_ids" value="${job.id}" ${checked_job} />Include "${tool_name}" in workflow</div>
                        %if not checked_job:
                            ${ render_msg( "All job outputs have been deleted", status="info" ) }
                        %endif
                        %if tool_version_warning:
                            ${ render_msg( tool_version_warning, status="warning" ) }
                        %endif
+4 −0
Original line number Diff line number Diff line
@@ -121,6 +121,10 @@ class MockHistory:
    def active_contents(self):
        return self.active_datasets

    @property
    def visible_contents(self):
        return self.active_contents


class MockTrans:
    def __init__(self, history):