add plc_nodeid and plc_siteid to history records so that the web templates can
[monitor.git] / web / MonitorWeb / monitorweb / templates / siteview.kid
index abbcfe2..bf24fe5 100644 (file)
@@ -2,6 +2,8 @@
 <?python
 layout_params['page_title'] = "Monitor Site View"
 from monitor.util import diff_time
+from time import mktime
+from links import *
 ?>
 <html py:layout="'sitemenu.kid'"
       xmlns:py="http://purl.org/kid/ns#"
@@ -13,24 +15,31 @@ from monitor.util import diff_time
                        <thead>
                                <tr>
                                        <th>Site name</th>
-                                       <th>Status</th>
                                        <th>Enabled</th>
-                                       <th>Slices (created / max)</th>
-                                       <th>Nodes (online / registered)</th>
+                                       <th>Penalty</th>
+                                       <th>Slices/Max</th>
+                                       <th>Nodes/Total</th>
+                                       <th>Status</th>
                                </tr>
                        </thead>
                        <tbody>
-                               <tr py:for="i,site in enumerate(sitequery)" class="${i%2 and 'odd' or 'even'}" >
-                                 <td nowrap="true"><a href="">${site.loginbase}</a></td>
-                                 <td id="site-${site.status}" py:content="site.last_changed"></td>
-                                 <td py:content="site.enabled"></td>
-                                 <td>${site.slices_used}/${site.slices_total}</td>
-                                 <td>${site.nodes_up} / ${site.nodes_total}</td>
+                               <tr py:for="i,site in enumerate(sitequery)">
+                                       <td nowrap="true"><a class="ext-link" href="${plc_site_uri_id(site.plc_siteid)}">
+                                                       <span class="icon">${site.loginbase}</span></a>
+                                       </td>
+                                       <td py:content="site.enabled"></td>
+                                       <td>n/a</td>
+                                       <td>${site.slices_used}/${site.slices_total}</td>
+                                       <td>${site.nodes_up} / ${site.nodes_total}</td>
+                                       <td id="site-${site.status}" py:content="diff_time(mktime(site.last_changed.timetuple()))"></td>
                                </tr>
                        </tbody>
                </table>
     <h3>Node List</h3>
-               <table id="sortable_table" class="datagrid" border="1" width="100%">
+               <p py:if="len(nodequery) == 0">
+                       There are no registered nodes for this PCU.
+               </p>
+               <table py:if="len(nodequery) > 0" id="sortable_table" class="datagrid" border="1" width="100%">
                        <thead>
                                <tr>
                                        <th mochi:format="int"></th>
@@ -43,11 +52,15 @@ from monitor.util import diff_time
                                </tr>
                        </thead>
                        <tbody>
-                               <tr py:for="i,node in enumerate(nodequery)" class="${i%2 and 'odd' or 'even'}" >
+                               <tr py:for="i,node in enumerate(nodequery)">
                                        <td></td>
-                                       <td id="node-${node.observed_status}" nowrap="true"><a href="nodeview?hostname=${node.hostname}" py:content="node.hostname">your.host.org</a></td>
+                                       <td id="node-${node.observed_status}" nowrap="true">
+                                               <a href="${link('pcuview', hostname=node.hostname)}" py:content="node.hostname">your.host.org</a></td>
                                        <td py:content="node.ping_status"></td>
-                                       <td id="status-${node.pcu_short_status}" py:content="node.pcu_short_status"></td>
+                                       <td py:if="node.pcu_short_status != 'none'" id="status-${node.pcu_short_status}">
+                                               <a href="${link('pcuview', pcuid=node.plc_node_stats['pcu_ids'])}">${node.pcu_short_status}</a></td>
+                                       <td py:if="node.pcu_short_status == 'none'" id="status-${node.pcu_short_status}">
+                                               ${node.pcu_short_status}</td>
                                        <td nowrap="true" py:content="node.kernel"></td>
                                        <td py:content="diff_time(node.plc_node_stats['last_contact'])"></td>
                                </tr>