Mercurial > treepkg
changeset 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 |
files | contrib/sawmill/web/templates/details.html contrib/sawmill/web/templates/overview.html |
diffstat | 2 files changed, 33 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/sawmill/web/templates/details.html Tue Sep 14 11:02:37 2010 +0000 +++ b/contrib/sawmill/web/templates/details.html Thu Sep 16 20:24:54 2010 +0000 @@ -9,7 +9,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> + <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" /> <title>Sägewerk - <%= escape(description) %></title> </head> @@ -79,6 +79,7 @@ <th class="statustablehead">Revision</th> <th class="statustablehead">Start</th> <th class="statustablehead">Stop</th> + <th class="statustablehead">Duration</th> <th class="statustablehead">Notes</th> </tr> <% @@ -87,10 +88,26 @@ if not s: return d return escape(s) -def pretty_time(t, format="%Y-%m-%d %H:%M:%S"): +def pretty_time(t, format="%H:%M:%S"): if not t: return "<unknown>" return t.strftime(format) +def pretty_timedelta(a, b): + if a is None or b is None: return "<unknown>" + td = a - b + secs = td.days * 24*3600 + td.seconds + out = [] + if secs > 3600: + hs = secs // 3600 + out.append("%dh" % hs) + secs %= 3600 + if secs > 60: + ms = secs // 60 + out.append("%dm" % ms) + secs %= 60 + if secs > 0 or not out: + out.append("%ds" % secs) + return " ".join(out) def date_from_datetime(x): if not x: return None @@ -138,48 +155,48 @@ # date changed %> <tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>"> - <td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td> - <td style="font-weight:bold;"><%= nn(track_item.track) %></td> - <td align="right"> +<td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td> +<td style="font-weight:bold;"><%= nn(track_item.track) %></td> +<td align="right"> <% tags = track_item.build_tags if tags: # a tag %> - <a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a> +<a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a> <% else: # not a tag %> - <%= nn(track_item.revision) %> +<%= nn(track_item.revision) %> <% # end if tags %> - </td> - <td><%= pretty_time(track_item.build_start) %></td> - <td><%= pretty_time(track_item.build_stop) %></td> - <td> +</td> +<td align="right"><%= pretty_time(track_item.build_start) %></td> +<td align="right"><%= pretty_time(track_item.build_stop) %></td> +<td align="right"><%= pretty_timedelta(track_item.stop, track_item.build_start) %></td> +<td> <% for log_desc, log_path in track_item.build_logs: # for all logs %> [<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>] - <% # for all logs %> - </td> +</td> </tr> - <% # for all track itemes %> </table> <hr> -report generated at <%= pretty_time(datetime.now()) %>, powered +report generated at <%= pretty_time(datetime.now(), "%Y-%m-%d %H:%M:%S") %>, powered by <a href="http://treepkg.wald.intevation.org">Tree Packager</a> + <!-- end main body row --> </td> <td width="10" bgcolor="#ffffff">
--- a/contrib/sawmill/web/templates/overview.html Tue Sep 14 11:02:37 2010 +0000 +++ b/contrib/sawmill/web/templates/overview.html Thu Sep 16 20:24:54 2010 +0000 @@ -7,7 +7,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> + <link rel="icon" href="img/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" /> <title>Sägewerk - Free Software forestry</title> </head>