github.com/vlifesystems/rulehunter@v0.0.0-20180501090014-673078aa4a83/html/activity_tpl.go (about) 1 // Copyright (C) 2016-2017 vLife Systems Ltd <http://vlifesystems.com> 2 // Licensed under an MIT licence. Please see LICENSE.md for details. 3 4 package html 5 6 const activityTpl = ` 7 <!DOCTYPE html> 8 <html> 9 <head> 10 {{ index .Html "head" }} 11 <title>Activity</title> 12 </head> 13 14 <body> 15 {{ index .Html "nav" }} 16 17 <div id="content"> 18 <div class="container"> 19 <h1>Activity</h1> 20 21 <div id="reports-container"> 22 <ul class="reports-activity"> 23 {{range .Experiments}} 24 <li> 25 <table class="table table-bordered"> 26 <tr> 27 <th>Date</th> 28 <td>{{ .Stamp }}</td> 29 </tr> 30 {{if .Title}} 31 <tr><th>Title</th><td>{{ .Title }}</td></tr> 32 {{end}} 33 {{if .Category}} 34 <tr> 35 <th>Category</th> 36 <td><a href="{{ .CategoryURL }}">{{ .Category }}</a></td> 37 </tr> 38 {{end}} 39 {{if .Tags}} 40 <tr> 41 <th>Tags</th> 42 <td> 43 {{if eq .Status "success"}} 44 {{range $tag, $catLink := .Tags}} 45 <a href="{{ $catLink }}">{{ $tag }}</a> 46 {{end}} 47 {{else}} 48 {{range $tag, $catLink := .Tags}} 49 {{ $tag }} 50 {{end}} 51 {{end}} 52 </td> 53 </tr> 54 {{end}} 55 <tr><th>Experiment filename</th><td>{{ .Filename }}</td></tr> 56 <tr> 57 <th>Message</th> 58 {{if gt .Percent 0.0}} 59 <td> 60 {{ .Msg }}<br /> 61 <progress max="100" value="{{ .Percent }}"> 62 Progress: {{ .Percent }}% 63 </progress> 64 </td> 65 {{else}} 66 <td>{{ .Msg }}</td> 67 {{end}} 68 </tr> 69 <tr> 70 <th>Status</th> 71 <td class="status-{{ .Status }}">{{ .Status | ToTitle }}</td> 72 </tr> 73 </table> 74 </li> 75 {{end}} 76 </ul> 77 </div> 78 </div> 79 </div> 80 81 <div id="footer" class="container"> 82 {{ index .Html "footer" }} 83 </div> 84 85 {{ index .Html "bootstrapJS" }} 86 87 <script> 88 (function refreshWorker(){ 89 // Don't cache ajax or content won't fresh 90 $.ajaxSetup ({ 91 cache: false, 92 complete: function() { 93 // Schedule next request when current one is complete 94 setTimeout(refreshWorker, 10000); 95 } 96 }); 97 var ajaxLoad = "<img src='img/ring.gif' style='width:48px; height:48px' alt='loading...' />"; 98 var loadUrl = "activity #reports-container"; 99 $("#reports-container").html(ajaxLoad).load(loadUrl); 100 })(); 101 </script> 102 </body> 103 </html>`