Skip to content

Commit

Permalink
Leave makos used by external service result handlers in for now
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 30, 2017
1 parent 3b4c124 commit 82f5a4c
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<%inherit file="/base.mako"/>
<%namespace file="json_common.mako" import="display_item" />

<%def name="title()">${param_dict['service_instance'].name}: ${action.label}</%def>

<%def name="display_json_grid_result( headers, rows )">
%for row in rows:
%for name in headers:
<div class="form-row">
<label>${name}</label>
${display_item( row.get( name ) )}
<div style="clear: both"></div>
</div>
%endfor
%endfor
</%def>

<%
#HACK!!!! need to use better method of displaying jqGrid here, needs to allow paging as optionally available.
if 'Rows' in result: #paged
records = result['Records']
total = result['Total']
rows = result['Rows']
page = result['Page']
else:
rows = result
records = None
total = None
page = None
headers = rows[0].keys()
%>

<div class="toolForm">
<div class="toolFormTitle">${action.label} of ${param_dict['service_instance'].name} (${param_dict['service'].name}) on ${param_dict['item'].name}</div>
<div class="toolFormBody">
%if records:
<div class="form-row">
<label>Records</label>
${records}
<div style="clear: both"></div>
</div>
%endif
%if total:
<div class="form-row">
<label>Total</label>
${total}
<div style="clear: both"></div>
</div>
%endif
%if page:
<div class="form-row">
<label>Page</label>
${page}
<div style="clear: both"></div>
</div>
%endif
${display_json_grid_result( headers, rows )}
</div>
</div>
11 changes: 11 additions & 0 deletions templates/webapps/galaxy/external_services/generic_json.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%inherit file="/base.mako"/>
<%namespace file="json_common.mako" import="display_item" />

<%def name="title()">${action.label} of ${param_dict['service_instance'].name} (${param_dict['service'].name}) on ${param_dict['item'].name}</%def>

<div class="toolForm">
<div class="toolFormTitle">${action.label} of ${param_dict['service_instance'].name} (${param_dict['service'].name}) on ${param_dict['item'].name}</i></div>
<div class="toolFormBody">
${display_item( result )}
</div>
</div>
28 changes: 28 additions & 0 deletions templates/webapps/galaxy/external_services/json_common.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

<%def name="display_dict( result_dict )">
%for key, value in result_dict.items():
<div class="form-row">
<label>${key}</label>
${display_item( value )}
<div style="clear: both"></div>
</div>
%endfor
</%def>

<%def name="display_list( items )">
<ul>
%for item in items:
<li>${display_item( item ) }</li>
%endfor
</ul>
</%def>

<%def name="display_item( item )">
%if isinstance( item, ( list, tuple ) ):
${display_list( item )}
%elif isinstance( item, dict ):
${display_dict( item )}
%else:
${item}
%endif
</%def>

0 comments on commit 82f5a4c

Please sign in to comment.