📄 sortedstatstemplate.tmpl
字号:
#encoding UTF-8#extends nav.web.templates.MainTemplate#import re#def additionalCSS$default_table_CSS()#end def#def content<h2>Statistics</h2><ul> <li><a href="/cricket/">Cricket</a> - Traffic statistics from router interfaces and switch ports, CPU utilization, memory usage and more</li></ul><h3>Ranked Statistics</h3><form action="" method="get"><table> <tr> <td>Choose view</td> <td>Timeframe</td> <td>Rows</td> <td>Live</td> <td> </td> </tr> <tr>## Drop-down to choose view <td><select name="view">#set $sectionslist = $config.sections()$sectionslist.sort()#for $s in $sectionslist #if $s == 'ss_general' #continue #end if ## If we have a view, mark it as selected, else don't bother. #if $view == $s <option value="$s" selected>$config.get($s, 'name')</option> #else <option value="$s">$config.get($s, 'name')</option> #end if#end for </select></td>## Drop-down to choose timeframe <td><select name="fromtime">#for $t in $fromtimes.keys() #if $fromtime == $t <option value="$t" selected="selected">$fromtimes[$t]</option> #else <option value="$t">$fromtimes[$t]</option> #end if#end for </select></td> <td><input type="text" name="numrows" value="$numrows" size="3" /></td>#if $forcedview == '1' <td><input type="checkbox" name="forcedview" value="1" checked="checked" /></td>#else <td><input type="checkbox" name="forcedview" value="1" /></td>#end if <td><input type="submit" name="normalview" value="View" /></td> </tr></table></form><br />#if $showArr<table class="horiztable"> <caption> <span class="cornerkludge"></span> Ranked Statistics for $config.get($view, 'name')<br /> <span class="subtitle">$fromtimes[$fromtime]</span> </caption> <tr class="header"> <td class="leftkludge"></td> <th>Rank</th> <th>Target</th> <th>Value</th> <th>Unit</th> <td class="rightkludge"></td> </tr>## Walk the sortedkeys and print the values#set $counter = 1#for $line in $sortedKeys ## Find target to use when making link. #if $linkview #set $target = $re.search("cricket-data(/.*)", $line).groups()[0] #end if ## Format the values. #set $output = $re.sub(".*/([^\/]+/[^\/]+)$","\\1", $line) #set value = "%.2f" %($showArr[$line]) <tr class="$rowcycler"> <td style="background: white;"></td> <td>$counter</td> <td> ## If we got a linkview from the config-file, add a link #if $linkview <a href='/cricket/?target=$target;view=$linkview'>$output</a> #else $output #end if </td> <td align="right">$value</td> <td>$units</td> <td style="background: white;"></td> </tr> #set $counter += 1 #if $counter > int($numrows) #break #end if#end for</table>#end if#if $exetime != 0<p>Got data in $exetime seconds ($footer).</p>#end if#end def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -