tweaked the header of the node page to display the 'UP' and 'DOWN'
[monitor.git] / web / MonitorWeb / monitorweb / templates / nodelist.kid
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <?python
3 layout_params['page_title'] = "MyOps Node List"
4 from monitor.util import diff_time
5 from time import mktime
6 from links import *
7
8 def up_label (query):
9    up=len([agg for agg in query if agg.node.status in ('online', 'good')])
10    total=len(query)
11    return "%d (%d %%)" %(up,100*up/total)
12 def down_label (query):
13    down=len([agg for agg in query if agg.node.status not in ('online', 'good')])
14    total=len(query)
15    return "%d (%d %%)" %(down,100*down/total)
16
17 ?>
18 <html py:layout="'sitemenu.kid'"
19       xmlns:py="http://purl.org/kid/ns#"
20           xmlns:mochi="http://www.mochi.org">
21
22 <div py:match="item.tag == 'content'">
23
24   <script type="text/javascript">
25     function nodelist_paginator(opts) { plekit_table_paginator(opts, "nodelist"); }
26   </script>
27
28   <center>
29   <!-- NOTE: agg.node is a FindbadNodeRecord not a HistoryNodeRecord, so there is not 'status' attribute -->
30   <!--b py:content="'UP: %s' % up_label(query)"></b> | 
31   <b py:content="'DOWN: %s' % down_label(query)"></b><br/-->
32   </center>
33
34 <table id="nodelist" cellpadding="0" border="0" class="plekit_table sortable-onload-2 colstyle-alt no-arrow paginationcallback-nodelist_paginator max-pages-10 paginate-999">
35   <thead>
36
37     <tr class='pagesize_area'><td class='pagesize_area' colspan='10'>
38         <form class='pagesize' action='satisfy_xhtml_validator'><fieldset>
39             <input class='pagesize_input' type='text' id="nodelist_pagesize" value='25'
40                    onkeyup='plekit_pagesize_set("nodelist","nodelist_pagesize", 25);' 
41                    size='3' maxlength='3' />                                                          
42             <label class='pagesize_label'> items/page </label>                                     
43             <img class='reset' src="/planetlab/icons/clear.png" alt="reset visible size"           
44                  onmousedown='plekit_pagesize_reset("nodelist","nodelist_pagesize", 999);' />
45     </fieldset></form></td></tr>                                                                        
46     
47     <tr class='search_area'><td class='search_area' colspan='10'>
48         <div class='search'><fieldset>
49             <label class='search_label'> Refine List</label>                 
50             <input class='search_input' type='text' id='nodelist_search' 
51                    onkeyup='plekit_table_filter("nodelist","nodelist_search","nodelist_search_and");'
52                    size='self.search_width' maxlength='256' />                                            
53             <label>and</label>                                                                        
54             <input id='nodelist_search_and' class='search_and'                                        
55                    type='checkbox' checked='checked'                                                      
56                    onchange='plekit_table_filter("nodelist","nodelist_search","nodelist_search_and");' />
57             <img class='reset' src="/planetlab/icons/clear.png" alt="reset search"
58                  onmousedown='plekit_table_filter_reset("nodelist","nodelist_search","nodelist_search_and");' />
59     </fieldset></div></td></tr>
60     
61     <tr>
62       ${nodewidget.display(node=None, header=True)}
63   </tr>
64   </thead>
65   <tbody>
66     <tr py:for="i,node in enumerate(query)">
67       ${nodewidget.display(node=node, header=None)}
68     </tr>
69
70   </tbody>  
71 </table>
72
73 </div>
74
75 </html>