PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/show_params.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 164 lines | 151 code | 9 blank | 4 comment | 7 complexity | bca564fbc0185bfc5d20908cc726c228 MD5 | raw file
  1<%inherit file="/base.mako"/>
  2<%namespace file="/message.mako" import="render_msg" />
  3<% from galaxy.util import nice_size %>
  4
  5<style>
  6    .inherit {
  7        border: 1px solid #bbb;
  8        padding: 15px;
  9        text-align: center;
 10        background-color: #eee;
 11    }
 12</style>
 13
 14<%def name="inputs_recursive( input_params, param_values, depth=1, upgrade_messages=None )">
 15    <%
 16        if upgrade_messages is None:
 17            upgrade_messages = {}
 18    %>
 19    %for input_index, input in enumerate( input_params.itervalues() ):
 20        %if input.name in param_values:
 21            %if input.type == "repeat":
 22                %for i in range( len(param_values[input.name]) ):
 23                    ${ inputs_recursive(input.inputs, param_values[input.name][i], depth=depth+1) }
 24                %endfor
 25            %elif input.type == "conditional":
 26                <% 
 27                try:
 28                    current_case = param_values[input.name]['__current_case__']
 29                    is_valid = True
 30                except:
 31                    current_case = None
 32                    is_valid = False
 33                %>
 34                %if is_valid:
 35                    <tr>
 36                        ${ inputs_recursive_indent( text=input.test_param.label, depth=depth )}
 37                        ##<!-- Get the value of the current Conditional parameter -->
 38                        <td>${input.cases[current_case].value | h}</td>
 39                        <td></td>
 40                    </tr>
 41                    ${ inputs_recursive( input.cases[current_case].inputs, param_values[input.name], depth=depth+1, upgrade_messages=upgrade_messages.get( input.name ) ) }
 42                %else:
 43                    <tr>
 44                        ${ inputs_recursive_indent( text=input.name, depth=depth )}
 45                        <td><em>The previously used value is no longer valid</em></td>
 46                        <td></td>
 47                    </tr>
 48                %endif
 49            %elif input.type == "upload_dataset":
 50                    <tr>
 51                        ${inputs_recursive_indent( text=input.group_title( param_values ), depth=depth )}
 52                        <td>${ len( param_values[input.name] ) } uploaded datasets</td>
 53                        <td></td>
 54                    </tr>
 55            %elif input.visible:
 56                <% 
 57                if  hasattr( input, "label" ) and input.label:
 58                    label = input.label
 59                else:
 60                    #value for label not required, fallback to input name (same as tool panel)
 61                    label = input.name
 62                %>
 63                <tr>
 64                    ${inputs_recursive_indent( text=label, depth=depth )}
 65                    <td>${input.value_to_display_text( param_values[input.name], trans.app ) | h}</td>
 66                    <td>${ upgrade_messages.get( input.name, '' ) | h }</td>
 67                </tr>
 68            %endif
 69        %else:
 70            ## Parameter does not have a stored value.
 71            <tr>
 72                <%
 73                    # Get parameter label.  
 74                    if input.type == "conditional":
 75                        label = input.test_param.label
 76                    elif input.type == "repeat":
 77                        label = input.label()
 78                    else:
 79                        label = input.label or input.name
 80                %>
 81                ${inputs_recursive_indent( text=label, depth=depth )}
 82                <td><em>not used (parameter was added after this job was run)</em></td>
 83                <td></td>
 84            </tr>
 85        %endif
 86        
 87    %endfor
 88</%def>
 89
 90 ## function to add a indentation depending on the depth in a <tr>
 91<%def name="inputs_recursive_indent( text, depth )">
 92    <td style="padding-left: ${ ( depth - 1 ) * 10 }px">
 93        ${text | h}
 94    </td> 
 95</%def>
 96
 97<table class="tabletip">
 98    <thead>
 99        <tr><th colspan="2" style="font-size: 120%;">
100            % if tool:
101                Tool: ${tool.name | h}
102            % else:
103                Unknown Tool
104            % endif
105        </th></tr>
106    </thead>
107    <tbody>
108        <%
109        encoded_hda_id = trans.security.encode_id( hda.id )
110        %>
111        <tr><td>Name:</td><td>${hda.name | h}</td></tr>
112        <tr><td>Created:</td><td>${hda.create_time.strftime(trans.app.config.pretty_datetime_format)}</td></tr>
113        ##      <tr><td>Copied from another history?</td><td>${hda.source_library_dataset}</td></tr>
114        <tr><td>Filesize:</td><td>${nice_size(hda.dataset.file_size)}</td></tr>
115        <tr><td>Dbkey:</td><td>${hda.dbkey | h}</td></tr>
116        <tr><td>Format:</td><td>${hda.ext | h}</td></tr>
117        <tr><td>Galaxy Tool Version:</td><td>${job.tool_version | h}</td></tr>
118        <tr><td>Tool Version:</td><td>${hda.tool_version | h}</td></tr>
119        <tr><td>Tool Standard Output:</td><td><a href="${h.url_for( controller='dataset', action='stdout', dataset_id=encoded_hda_id )}">stdout</a></td></tr>
120        <tr><td>Tool Standard Error:</td><td><a href="${h.url_for( controller='dataset', action='stderr', dataset_id=encoded_hda_id )}">stderr</a></td></tr>
121        <tr><td>Tool Exit Code:</td><td>${job.exit_code | h}</td></tr>
122        <tr><td>API ID:</td><td>${encoded_hda_id}</td></tr>
123        %if trans.user_is_admin() or trans.app.config.expose_dataset_path:
124            <tr><td>Full Path:</td><td>${hda.file_name | h}</td></tr>
125        %endif
126        %if job and job.command_line and trans.user_is_admin():
127            <tr><td>Job Command-Line:</td><td>${ job.command_line | h }</td></tr>
128        %endif
129</table>
130<br />
131
132<table class="tabletip">
133    <thead>
134        <tr>
135            <th>Input Parameter</th>
136            <th>Value</th>
137            <th>Note for rerun</th>
138        </tr>
139    </thead>
140    <tbody>
141        % if params_objects and tool:
142            ${ inputs_recursive( tool.inputs, params_objects, depth=1, upgrade_messages=upgrade_messages ) }
143        %elif params_objects is None:
144            <tr><td colspan="3">Unable to load parameters.</td></tr>
145        % else:
146            <tr><td colspan="3">No parameters.</td></tr>
147        % endif
148    </tbody>
149</table>
150%if has_parameter_errors:
151    <br />
152    ${ render_msg( 'One or more of your original parameters may no longer be valid or displayed properly.', status='warning' ) }
153%endif
154
155    <h3>Inheritance Chain</h3>
156    <div class="inherit" style="background-color: #fff; font-weight:bold;">${hda.name | h}</div>
157
158    % for dep in inherit_chain:
159        <div style="font-size: 36px; text-align: center; position: relative; top: 3px">&uarr;</div>
160        <div class="inherit">
161            '${dep[0].name | h}' in ${dep[1]}<br/>
162        </div>
163    % endfor
164