1 | <%inherit file="/base.mako"/> |
---|
2 | |
---|
3 | <% _=n_ %> |
---|
4 | |
---|
5 | <%def name="title()">Extract workflow from history</%def> |
---|
6 | |
---|
7 | <%def name="stylesheets()"> |
---|
8 | ${h.css( 'history', 'base' )} |
---|
9 | <style type="text/css"> |
---|
10 | div.toolForm{ |
---|
11 | margin-top: 10px; |
---|
12 | margin-bottom: 10px; |
---|
13 | } |
---|
14 | div.historyItem { |
---|
15 | margin-right: 0; |
---|
16 | } |
---|
17 | th { |
---|
18 | border-bottom: solid black 1px; |
---|
19 | } |
---|
20 | </style> |
---|
21 | </%def> |
---|
22 | |
---|
23 | <%def name="javascripts()"> |
---|
24 | ${parent.javascripts()} |
---|
25 | <script type="text/javascript"> |
---|
26 | $(function() { |
---|
27 | $("#checkall").click( function() { |
---|
28 | $("input[type=checkbox]").attr( 'checked', true ); |
---|
29 | return false; |
---|
30 | }).show(); |
---|
31 | $("#uncheckall").click( function() { |
---|
32 | $("input[type=checkbox]").attr( 'checked', false ); |
---|
33 | return false; |
---|
34 | }).show(); |
---|
35 | }); |
---|
36 | </script> |
---|
37 | </%def> |
---|
38 | |
---|
39 | <%def name="history_item( data, creator_disabled=False )"> |
---|
40 | %if data.state in [ "no state", "", None ]: |
---|
41 | <% data_state = "queued" %> |
---|
42 | %else: |
---|
43 | <% data_state = data.state %> |
---|
44 | %endif |
---|
45 | <div class="historyItemWrapper historyItem historyItem-${data_state}" id="historyItem-$data.id"> |
---|
46 | <table cellpadding="0" cellspacing="0" border="0" width="100%"> |
---|
47 | <tr> |
---|
48 | %if data_state != 'ok': |
---|
49 | <td style="width: 20px;"> |
---|
50 | <div style='padding-right: 5px;'><img src="${h.url_for( str( '/static/style/data_%s.png' % data_state ) )}" border="0" align="middle"></div> |
---|
51 | </td> |
---|
52 | %endif |
---|
53 | <td> |
---|
54 | <div style="overflow: hidden;"> |
---|
55 | <span class="historyItemTitle"><b>${data.hid}: ${data.display_name()}</b></span> |
---|
56 | </div> |
---|
57 | </td> |
---|
58 | </tr> |
---|
59 | </table> |
---|
60 | %if disabled: |
---|
61 | <hr> |
---|
62 | <div><input type="checkbox" name="dataset_ids" value="${data.hid}" checked="true" />${_('Treat as input dataset')}</div> |
---|
63 | %endif |
---|
64 | </div> |
---|
65 | </%def> |
---|
66 | |
---|
67 | <p>The following list contains each tool that was run to create the |
---|
68 | datasets in your current history. Please select those that you wish |
---|
69 | to include in the workflow.</p> |
---|
70 | |
---|
71 | <p>Tools which cannot be run interactively and thus cannot be incorporated |
---|
72 | into a workflow will be shown in gray.</p> |
---|
73 | |
---|
74 | %for warning in warnings: |
---|
75 | <div class="warningmark">${warning}</div> |
---|
76 | %endfor |
---|
77 | |
---|
78 | <form method="post" action="${h.url_for()}"> |
---|
79 | <div class='form-row'> |
---|
80 | <label>${_('Workflow name')}</label> |
---|
81 | <input name="workflow_name" type="text" value="Workflow constructed from history '${history.name}'" size="60"/> |
---|
82 | </div> |
---|
83 | <p> |
---|
84 | <input type="submit" value="${_('Create Workflow')}" /> |
---|
85 | <button id="checkall" style="display: none;">Check all</button> |
---|
86 | <button id="uncheckall" style="display: none;">Uncheck all</button> |
---|
87 | </p> |
---|
88 | |
---|
89 | <table border="0" cellspacing="0"> |
---|
90 | |
---|
91 | <tr> |
---|
92 | <th style="width: 47.5%">${_('Tool')}</th> |
---|
93 | <th style="width: 5%"></th> |
---|
94 | <th style="width: 47.5%">${_('History items created')}</th> |
---|
95 | </tr> |
---|
96 | |
---|
97 | %for job, datasets in jobs.iteritems(): |
---|
98 | |
---|
99 | <% |
---|
100 | cls = "toolForm" |
---|
101 | tool_name = "Unknown" |
---|
102 | if hasattr( job, 'is_fake' ) and job.is_fake: |
---|
103 | cls += " toolFormDisabled" |
---|
104 | disabled = True |
---|
105 | else: |
---|
106 | tool = app.toolbox.tools_by_id.get( job.tool_id, None ) |
---|
107 | if tool: |
---|
108 | tool_name = tool.name |
---|
109 | if tool is None or not( tool.is_workflow_compatible ): |
---|
110 | cls += " toolFormDisabled" |
---|
111 | disabled = True |
---|
112 | else: |
---|
113 | disabled = False |
---|
114 | %> |
---|
115 | |
---|
116 | <tr> |
---|
117 | <td> |
---|
118 | <div class="${cls}"> |
---|
119 | |
---|
120 | <div class="toolFormTitle">${tool_name}</div> |
---|
121 | <div class="toolFormBody"> |
---|
122 | %if disabled: |
---|
123 | <div style="font-style: italic; color: gray">This tool cannot be used in workflows</div> |
---|
124 | %else: |
---|
125 | <div><input type="checkbox" name="job_ids" value="${job.id}" checked="true" />Include "${tool_name}" in workflow</div> |
---|
126 | %endif |
---|
127 | </div> |
---|
128 | </div> |
---|
129 | </td> |
---|
130 | <td style="text-align: center;"> |
---|
131 | ▶ |
---|
132 | </td> |
---|
133 | <td> |
---|
134 | %for _, data in datasets: |
---|
135 | <div>${history_item( data, disabled )}</div> |
---|
136 | %endfor |
---|
137 | </td> |
---|
138 | </tr> |
---|
139 | |
---|
140 | %endfor |
---|
141 | |
---|
142 | </table> |
---|
143 | |
---|
144 | </form> |
---|