PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/library/common/ldda_info.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 288 lines | 281 code | 6 blank | 1 comment | 4 complexity | 574a4d8f0c0b33dc9b931497080ab623 MD5 | raw file
  1. <%inherit file="/base.mako"/>
  2. <%namespace file="/message.mako" import="render_msg" />
  3. <%namespace file="/common/template_common.mako" import="render_template_fields" />
  4. <%
  5. from galaxy import util
  6. from galaxy.web.controllers.library_common import branch_deleted, get_containing_library_from_library_dataset
  7. from galaxy.web.framework.helpers import time_ago
  8. if ldda == ldda.library_dataset.library_dataset_dataset_association:
  9. current_version = True
  10. else:
  11. current_version = False
  12. if ldda.user:
  13. uploaded_by = ldda.user.email
  14. else:
  15. uploaded_by = 'anonymous'
  16. if trans.user_is_admin() and cntrller == 'library_admin':
  17. can_modify = can_manage = True
  18. elif cntrller in [ 'library', 'requests' ]:
  19. can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, ldda.library_dataset )
  20. can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, ldda.library_dataset )
  21. else:
  22. can_modify = can_manage = False
  23. form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
  24. %>
  25. <%def name="javascripts()">
  26. ${parent.javascripts()}
  27. </%def>
  28. %if current_version:
  29. <b><i>This is the latest version of this library dataset</i></b>
  30. %else:
  31. <font color="red"><b><i>This is an expired version of this library dataset</i></b></font>
  32. %endif
  33. <p/>
  34. <ul class="manage-table-actions">
  35. <li>
  36. <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}"><span>Browse this data library</span></a>
  37. </li>
  38. </ul>
  39. %if message:
  40. ${render_msg( message, status )}
  41. %endif
  42. <div class="toolForm">
  43. <div class="toolFormTitle">
  44. Information about <div class="menubutton popup" id="dataset-${ldda.id}-popup">${ldda.name}</div>
  45. %if not library.deleted and not branch_deleted( ldda.library_dataset.folder ) and not ldda.library_dataset.deleted:
  46. <div popupmenu="dataset-${ldda.id}-popup">
  47. %if can_modify:
  48. <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
  49. %if not info_association:
  50. <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
  51. %else:
  52. <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
  53. <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
  54. %endif
  55. %endif
  56. %if can_manage:
  57. <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_permissions', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
  58. %endif
  59. %if current_version and can_modify:
  60. <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), replace_id=trans.security.encode_id( ldda.library_dataset.id ) )}">Upload a new version of this dataset</a>
  61. %endif
  62. %if ldda.has_data():
  63. <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), ldda_ids=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Import this dataset into selected histories</a>
  64. <a class="action-button" href="${h.url_for( controller='library_common', action='download_dataset_from_folder', cntrller=cntrller, id=trans.security.encode_id( ldda.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Download this dataset</a>
  65. %endif
  66. %if show_associated_hdas_and_lddas:
  67. <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), show_associated_hdas_and_lddas=False, use_panels=use_panels, show_deleted=show_deleted )}">Hide items using this dataset's disk file</a>
  68. %else:
  69. <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), show_associated_hdas_and_lddas=True, use_panels=use_panels, show_deleted=show_deleted )}">Show items using this dataset's disk file</a>
  70. %endif
  71. </div>
  72. %endif
  73. </div>
  74. <div class="toolFormBody">
  75. %if ldda.message:
  76. <div class="form-row">
  77. <label>Message:</label>
  78. <pre>${ldda.message}</pre>
  79. <div style="clear: both"></div>
  80. </div>
  81. %endif
  82. <div class="form-row">
  83. <label>Uploaded by:</label>
  84. ${uploaded_by}
  85. <div style="clear: both"></div>
  86. </div>
  87. <div class="form-row">
  88. <label>Date uploaded:</label>
  89. ${ldda.create_time.strftime( "%Y-%m-%d" )}
  90. <div style="clear: both"></div>
  91. </div>
  92. <div class="form-row">
  93. <label>File size:</label>
  94. ${ldda.get_size( nice_size=True )}
  95. <div style="clear: both"></div>
  96. </div>
  97. %if ldda.tool_version:
  98. <div class="form-row">
  99. <label>Tool version:</label>
  100. ${ldda.tool_version}
  101. <div style="clear: both"></div>
  102. </div>
  103. %endif
  104. <div class="form-row">
  105. <label>Data type:</label>
  106. ${ldda.ext}
  107. <div style="clear: both"></div>
  108. </div>
  109. <div class="form-row">
  110. <label>Build:</label>
  111. ${ldda.dbkey}
  112. <div style="clear: both"></div>
  113. </div>
  114. <div class="form-row">
  115. <label>Miscellaneous information:</label>
  116. ${ldda.info}
  117. <div style="clear: both"></div>
  118. </div>
  119. %if ldda.creating_job_associations:
  120. <% job = ldda.creating_job_associations[0].job %>
  121. %if job.stdout and job.stdout.strip() != '':
  122. <div class="form-row">
  123. <label>Job Standard Output</label>
  124. <pre>${job.stdout}</pre>
  125. <div style="clear: both"></div>
  126. </div>
  127. %endif
  128. %if job.stderr and job.stderr.strip() != '':
  129. <div class="form-row">
  130. <label>Job Standard Error</label>
  131. <pre>${job.stderr}</pre>
  132. <div style="clear: both"></div>
  133. </div>
  134. %endif
  135. %endif
  136. <div class="form-row">
  137. <div>${ldda.blurb}</div>
  138. </div>
  139. ## We want to display all metadata item here, whether marked visible or not since they are all pretty useful
  140. %for name, spec in ldda.metadata.spec.items():
  141. <div class="form-row">
  142. <label>${spec.desc.replace( ' (click box & select)', '' )}:</label>
  143. <%
  144. metadata_val = ldda.metadata.get( name )
  145. if isinstance( metadata_val, trans.model.MetadataFile ):
  146. metadata_val = metadata_val.file_name
  147. elif isinstance( metadata_val, list ):
  148. # Make sure list items are strings
  149. metadata_val = [ str( item ) for item in metadata_val ]
  150. metadata_val = ', '.join( metadata_val )
  151. %>
  152. ${metadata_val}
  153. <div style="clear: both"></div>
  154. </div>
  155. %endfor
  156. %if ldda.peek != "no peek":
  157. <div class="form-row">
  158. <div id="info${ldda.id}" class="historyItemBody">
  159. <label>Peek:</label>
  160. <div><pre id="peek${ldda.id}" class="peek">${ldda.display_peek()}</pre></div>
  161. </div>
  162. </div>
  163. %endif
  164. %if trans.user_is_admin() and cntrller == 'library_admin':
  165. <div class="form-row">
  166. <label>Disk file:</label>
  167. ${ldda.file_name}
  168. <div style="clear: both"></div>
  169. </div>
  170. %endif
  171. </div>
  172. </div>
  173. %if widgets:
  174. ${render_template_fields( cntrller=cntrller, item_type='ldda', widgets=widgets, widget_fields_have_contents=widget_fields_have_contents, library_id=library_id, folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), info_association=info_association, inherited=inherited, editable=False )}
  175. %endif
  176. %if show_associated_hdas_and_lddas:
  177. %if associated_hdas:
  178. <p/>
  179. <b>Active (undeleted) history items that use this library dataset's disk file</b>
  180. <div class="toolForm">
  181. <table class="grid">
  182. <thead>
  183. <tr>
  184. <th>History</th>
  185. <th>History Item</th>
  186. <th>Last Updated</th>
  187. <th>User</th>
  188. </tr>
  189. </thead>
  190. %for hda in associated_hdas:
  191. <tr>
  192. <td>
  193. %if hda.history:
  194. <a target="_blank" href="${h.url_for( controller='history', action='view', id=trans.security.encode_id( hda.history_id ) )}">${hda.history.get_display_name()}</a>
  195. %else:
  196. no history
  197. %endif
  198. </td>
  199. <td>${hda.get_display_name()}</td>
  200. <td>${time_ago( hda.update_time )}</td>
  201. <td>
  202. %if hda.history and hda.history.user:
  203. ${hda.history.user.email}
  204. %else:
  205. anonymous
  206. %endif
  207. </td>
  208. </tr>
  209. %endfor
  210. </table>
  211. </div>
  212. <p/>
  213. %endif
  214. %if associated_lddas:
  215. <p/>
  216. <b>Other active (undeleted) library datasets that use this library dataset's disk file</b>
  217. <div class="toolForm">
  218. <table class="grid">
  219. <thead>
  220. <tr>
  221. <th>Library</th>
  222. <th>Library Folder</th>
  223. <th>Library Dataset</th>
  224. <th>Last Updated</th>
  225. <th>User</th>
  226. </tr>
  227. </thead>
  228. %for copied_ldda in associated_lddas:
  229. <% containing_library = get_containing_library_from_library_dataset( trans, copied_ldda.library_dataset ) %>
  230. <tr>
  231. <td>
  232. <%
  233. if containing_library:
  234. library_display_name = containing_library.get_display_name()
  235. else:
  236. library_display_name = 'no library'
  237. %>
  238. %if containing_library:
  239. <a href="${h.url_for( controller='library_common', action='browse_library', id=trans.security.encode_id( containing_library.id ), cntrller=cntrller, use_panels=use_panels )}">${library_display_name}</a>
  240. %else:
  241. ${library_display_name}
  242. %endif
  243. </td>
  244. <td>
  245. <%
  246. library_dataset = copied_ldda.library_dataset
  247. folder = library_dataset.folder
  248. folder_display_name = folder.get_display_name()
  249. if folder_display_name == library_display_name:
  250. folder_display_name = 'library root'
  251. %>
  252. ${folder_display_name}
  253. ${copied_ldda.library_dataset.folder.get_display_name()}
  254. </td>
  255. <td>${copied_ldda.get_display_name()}</td>
  256. <td>${time_ago( copied_ldda.update_time )}</td>
  257. <td>
  258. %if copied_ldda.user:
  259. ${copied_ldda.user.email}
  260. %else:
  261. anonymous
  262. %endif
  263. </td>
  264. </tr>
  265. %endfor
  266. </table>
  267. </div>
  268. <p/>
  269. %endif
  270. %endif
  271. %if current_version:
  272. <% expired_lddas = [ e_ldda for e_ldda in ldda.library_dataset.expired_datasets ] %>
  273. %if expired_lddas:
  274. <br/>
  275. <div class="toolFormTitle">Expired versions of ${ldda.name}</div>
  276. %for expired_ldda in expired_lddas:
  277. <div class="form-row">
  278. <a href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( expired_ldda.library_dataset.folder.id ), id=trans.security.encode_id( expired_ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">${expired_ldda.name}</a>
  279. </div>
  280. %endfor
  281. %endif
  282. %endif