[Treepkg-commits] r438 - trunk/contrib/sawmill/web/templates

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 16 22:24:55 CEST 2010


Author: teichmann
Date: 2010-09-16 22:24:54 +0200 (Thu, 16 Sep 2010)
New Revision: 438

Modified:
   trunk/contrib/sawmill/web/templates/details.html
   trunk/contrib/sawmill/web/templates/overview.html
Log:
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.


Modified: trunk/contrib/sawmill/web/templates/details.html
===================================================================
--- trunk/contrib/sawmill/web/templates/details.html	2010-09-14 11:02:37 UTC (rev 437)
+++ trunk/contrib/sawmill/web/templates/details.html	2010-09-16 20:24:54 UTC (rev 438)
@@ -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&auml;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 "&lt;unknown&gt;"
     return t.strftime(format)
 
+def pretty_timedelta(a, b):
+    if a is None or b is None: return "&lt;unknown&gt;"
+    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">

Modified: trunk/contrib/sawmill/web/templates/overview.html
===================================================================
--- trunk/contrib/sawmill/web/templates/overview.html	2010-09-14 11:02:37 UTC (rev 437)
+++ trunk/contrib/sawmill/web/templates/overview.html	2010-09-16 20:24:54 UTC (rev 438)
@@ -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&auml;gewerk - Free Software forestry</title>
  </head>



More information about the Treepkg-commits mailing list