Mercurial > treepkg
comparison contrib/sawmill/web/templates/details.html @ 478:7504ed4437e1
sawmill: short start and stop to %H:%M:%S because
the date is already printed in the date row. Introduced
a column with the duration to create the package.
author | Sascha Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 16 Sep 2010 20:24:54 +0000 |
parents | 43bb1cc38fba |
children | fa8a5205698c |
comparison
equal
deleted
inserted
replaced
477:43bb1cc38fba | 478:7504ed4437e1 |
---|---|
7 from datetime import date, datetime | 7 from datetime import date, datetime |
8 %> | 8 %> |
9 <html> | 9 <html> |
10 <head> | 10 <head> |
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
12 <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> | 12 <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> |
13 <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" /> | 13 <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" /> |
14 <title>Sägewerk - <%= escape(description) %></title> | 14 <title>Sägewerk - <%= escape(description) %></title> |
15 </head> | 15 </head> |
16 | 16 |
17 <body> | 17 <body> |
77 <th class="statustablehead">Status</th> | 77 <th class="statustablehead">Status</th> |
78 <th class="statustablehead">Package</th> | 78 <th class="statustablehead">Package</th> |
79 <th class="statustablehead">Revision</th> | 79 <th class="statustablehead">Revision</th> |
80 <th class="statustablehead">Start</th> | 80 <th class="statustablehead">Start</th> |
81 <th class="statustablehead">Stop</th> | 81 <th class="statustablehead">Stop</th> |
82 <th class="statustablehead">Duration</th> | |
82 <th class="statustablehead">Notes</th> | 83 <th class="statustablehead">Notes</th> |
83 </tr> | 84 </tr> |
84 <% | 85 <% |
85 | 86 |
86 def nn(s, d=""): | 87 def nn(s, d=""): |
87 if not s: return d | 88 if not s: return d |
88 return escape(s) | 89 return escape(s) |
89 | 90 |
90 def pretty_time(t, format="%Y-%m-%d %H:%M:%S"): | 91 def pretty_time(t, format="%H:%M:%S"): |
91 if not t: return "<unknown>" | 92 if not t: return "<unknown>" |
92 return t.strftime(format) | 93 return t.strftime(format) |
93 | 94 |
95 def pretty_timedelta(a, b): | |
96 if a is None or b is None: return "<unknown>" | |
97 td = a - b | |
98 secs = td.days * 24*3600 + td.seconds | |
99 out = [] | |
100 if secs > 3600: | |
101 hs = secs // 3600 | |
102 out.append("%dh" % hs) | |
103 secs %= 3600 | |
104 if secs > 60: | |
105 ms = secs // 60 | |
106 out.append("%dm" % ms) | |
107 secs %= 60 | |
108 if secs > 0 or not out: | |
109 out.append("%ds" % secs) | |
110 return " ".join(out) | |
94 | 111 |
95 def date_from_datetime(x): | 112 def date_from_datetime(x): |
96 if not x: return None | 113 if not x: return None |
97 return date(x.year, x.month, x.day) | 114 return date(x.year, x.month, x.day) |
98 | 115 |
136 <tr class="date_row"><td colspan="6"><%= pretty_time(last_date, "%Y-%m-%d") %></td></tr> | 153 <tr class="date_row"><td colspan="6"><%= pretty_time(last_date, "%Y-%m-%d") %></td></tr> |
137 <% | 154 <% |
138 # date changed | 155 # date changed |
139 %> | 156 %> |
140 <tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>"> | 157 <tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>"> |
141 <td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td> | 158 <td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td> |
142 <td style="font-weight:bold;"><%= nn(track_item.track) %></td> | 159 <td style="font-weight:bold;"><%= nn(track_item.track) %></td> |
143 <td align="right"> | 160 <td align="right"> |
144 <% | 161 <% |
145 tags = track_item.build_tags | 162 tags = track_item.build_tags |
146 if tags: | 163 if tags: |
147 # a tag | 164 # a tag |
148 %> | 165 %> |
149 <a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a> | 166 <a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a> |
150 <% | 167 <% |
151 else: | 168 else: |
152 # not a tag | 169 # not a tag |
153 %> | 170 %> |
154 <%= nn(track_item.revision) %> | 171 <%= nn(track_item.revision) %> |
155 <% | 172 <% |
156 # end if tags | 173 # end if tags |
157 %> | 174 %> |
158 </td> | 175 </td> |
159 <td><%= pretty_time(track_item.build_start) %></td> | 176 <td align="right"><%= pretty_time(track_item.build_start) %></td> |
160 <td><%= pretty_time(track_item.build_stop) %></td> | 177 <td align="right"><%= pretty_time(track_item.build_stop) %></td> |
161 <td> | 178 <td align="right"><%= pretty_timedelta(track_item.stop, track_item.build_start) %></td> |
179 <td> | |
162 <% | 180 <% |
163 for log_desc, log_path in track_item.build_logs: | 181 for log_desc, log_path in track_item.build_logs: |
164 # for all logs | 182 # for all logs |
165 %> | 183 %> |
166 [<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>] | 184 [<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>] |
167 | |
168 <% | 185 <% |
169 # for all logs | 186 # for all logs |
170 %> | 187 %> |
171 </td> | 188 </td> |
172 </tr> | 189 </tr> |
173 | |
174 <% | 190 <% |
175 # for all track itemes | 191 # for all track itemes |
176 %> | 192 %> |
177 | 193 |
178 </table> | 194 </table> |
179 <hr> | 195 <hr> |
180 report generated at <%= pretty_time(datetime.now()) %>, powered | 196 report generated at <%= pretty_time(datetime.now(), "%Y-%m-%d %H:%M:%S") %>, powered |
181 by <a href="http://treepkg.wald.intevation.org">Tree Packager</a> | 197 by <a href="http://treepkg.wald.intevation.org">Tree Packager</a> |
198 | |
182 | 199 |
183 <!-- end main body row --> | 200 <!-- end main body row --> |
184 </td> | 201 </td> |
185 <td width="10" bgcolor="#ffffff"> | 202 <td width="10" bgcolor="#ffffff"> |
186 <img src="img/clear.png" width="2" height="1" alt="" /> | 203 <img src="img/clear.png" width="2" height="1" alt="" /> |