- Timestamp:
- 06/16/05 16:21:06 (18 years ago)
- Location:
- trunk/web/addons/toga
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/index.php
r140 r143 187 187 } 188 188 189 if( $view == "search" ) { 190 $node_menu .= "<B>></B>\n"; 191 $node_menu .= "<B>Jobarchive</B> "; 192 $tpl->assign("view", "search" ); 193 $tpl->assign("form_name", "archive_search_form" ); 194 } else { 195 $tpl->assign("form_name", "toga_form" ); 196 $tpl->assign("view", "overview" ); 197 } 198 189 199 $tpl->assign("node_menu", $node_menu); 190 200 -
trunk/web/addons/toga/libtoga.php
r142 r143 216 216 $this->connect(); 217 217 218 printf( "query = [%s]\n", $query );218 //printf( "query = [%s]\n", $query ); 219 219 $result = pg_query( $this->conn, $query ); 220 220 -
trunk/web/addons/toga/search.php
r142 r143 118 118 119 119 $time_fields = explode( ':', $time ); 120 reset( $time_fields );121 122 print_r( $time_fields );123 120 124 121 $hours = $time_fields[0]; … … 161 158 function makeSearchPage() { 162 159 global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue; 163 global $end_from_time, $end_to_time, $filter; 160 global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up; 161 162 $metricname = $m; 164 163 165 164 $tpl->assign( "cluster", $clustername ); … … 210 209 $tpl->assign( "runningtime", makeTime( $runningtime ) ); 211 210 212 print_r( $job ); 213 print_r( $nodes ); 214 //output jobzooi 215 211 //print_r( $job ); 212 //print_r( $nodes ); 216 213 } 214 217 215 218 216 if( count( $search_ids ) == 1 ) { 219 217 220 218 $tpl->newBlock( "showhosts" ); 219 220 $showhosts = isset($sh) ? $sh : $default_showhosts; 221 //if( !$showhosts) $showhosts = $default_showhosts; 222 $tpl->assign("checked$showhosts", "checked"); 223 224 # Present a width list 225 $cols_menu = "<SELECT NAME=\"hc\" OnChange=\"toga_form.submit();\">\n"; 226 227 $hostcols = ($hc) ? $hc : 4; 228 229 foreach(range(1,25) as $cols) { 230 $cols_menu .= "<OPTION VALUE=$cols "; 231 if ($cols == $hostcols) 232 $cols_menu .= "SELECTED"; 233 $cols_menu .= ">$cols\n"; 234 } 235 $cols_menu .= "</SELECT>\n"; 236 237 $tpl->assign("metric","$metricname $units"); 238 $tpl->assign("id", $id); 239 # Host columns menu defined in header.php 240 $tpl->assign("cols_menu", $cols_menu); 241 242 if( $showhosts ) { 243 //bla 244 245 if( !isset($start) ) $start="jobstart"; 246 if( !isset($stop) ) $stop="now"; 247 //$tpl->assign("start", $start); 248 //$tpl->assign("stop", $stop); 249 250 $sorted_hosts = array(); 251 $hosts_up = $jobs[$filter[id]][nodes]; 252 253 $r = intval($job_runningtime * 1.25); 254 255 $jobrange = ($job_runningtime < 3600) ? -3600 : -$r ; 256 $jobstart = $report_time - $job_runningtime; 257 258 if ($reports[$metricname]) 259 $metricval = "g"; 260 else 261 $metricval = "m"; 262 263 foreach ($hosts_up as $host ) { 264 $host = $host. '.'.$domain; 265 $cpus = $metrics[$host]["cpu_num"][VAL]; 266 if (!$cpus) $cpus=1; 267 $load_one = $metrics[$host]["load_one"][VAL]; 268 $load = ((float) $load_one)/$cpus; 269 $host_load[$host] = $load; 270 $percent_hosts[load_color($load)] += 1; 271 if ($metricname=="load_one") 272 $sorted_hosts[$host] = $load; 273 else 274 $sorted_hosts[$host] = $metrics[$host][$metricname][VAL]; 275 } 276 switch ($sort) { 277 case "descending": 278 arsort($sorted_hosts); 279 break; 280 case "by hostname": 281 ksort($sorted_hosts); 282 break; 283 default: 284 case "ascending": 285 asort($sorted_hosts); 286 break; 287 } 288 289 //$sorted_hosts = array_merge($down_hosts, $sorted_hosts); 290 291 # First pass to find the max value in all graphs for this 292 # metric. The $start,$end variables comes from get_context.php, 293 # included in index.php. 294 list($min, $max) = find_limits($sorted_hosts, $metricname); 295 296 # Second pass to output the graphs or metrics. 297 $i = 1; 298 foreach ( $sorted_hosts as $host=>$value ) { 299 $tpl->newBlock ("sorted_list"); 300 //$host = $host. '.'.$domain; 301 $host_url = rawurlencode($host); 302 $cluster_url = rawurlencode($clustername); 303 304 $textval = ""; 305 //printf("host = %s, value = %s", $host, $value); 306 //echo "$host: $value, "; 307 $val = $metrics[$host][$metricname]; 308 $class = "metric"; 309 $host_link="\"?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\""; 310 311 if ($val[TYPE]=="timestamp" or $always_timestamp[$metricname]) { 312 $textval = date("r", $val[VAL]); 313 } elseif ($val[TYPE]=="string" or $val[SLOPE]=="zero" or $always_constant[$metricname] or ($max_graphs > 0 and $i > $max_graphs )) { 314 $textval = "$val[VAL] $val[UNITS]"; 315 } else { 316 $load_color = load_color($host_load[$host]); 317 $graphargs = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&"; 318 $graphargs .= "z=small&c=$cluster_url&h=$host_url&l=$load_color" ."&v=$val[VAL]&x=$max&n=$min&r=job&jr=$jobrange&js=$jobstart"; 319 } 320 if ($textval) { 321 $cell="<td class=$class>". "<b><a href=$host_link>$host</a></b><br>". "<i>$metricname:</i> <b>$textval</b></td>"; 322 } else { 323 $cell="<td><a href=$host_link>". "<img src=\"../../graph.php?$graphargs\" ". "alt=\"$host\" height=112 width=225 border=0></a></td>"; 324 } 325 326 $tpl->assign("metric_image", $cell); 327 if (! ($i++ % $hostcols) ) 328 $tpl->assign ("br", "</tr><tr>"); 329 } 330 331 //einde bla 332 } 221 333 } 222 334 223 // show search results224 225 335 } 226 336 } -
trunk/web/addons/toga/templates/header.tpl
r140 r143 9 9 <BODY BGCOLOR="#FFFFFF"> 10 10 11 <FORM ACTION="./ " METHOD="GET" NAME="toga_form">11 <FORM ACTION="./?c={cluster}&view={view}" METHOD="GET" NAME="{form_name}"> 12 12 <TABLE WIDTH="100%"> 13 13 <TR> -
trunk/web/addons/toga/templates/search.tpl
r141 r143 3 3 4 4 <SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT> 5 <SCRIPT LANGUAGE="javascript" SRC="libtoga.js"></SCRIPT> 5 <SCRIPT LANGUAGE="javascript"> 6 function setSort( sortbyval ) { 7 8 if( sortbyval != document.archive_search_form.sortby.value ) { 9 10 document.archive_search_form.sortby.value = sortbyval; 11 document.archive_search_form.sortorder.value = "asc"; 12 13 } else { 14 15 if( document.archive_search_form.sortorder.value == "desc" ) 16 document.archive_search_form.sortorder.value = "asc"; 17 else if( document.archive_search_form.sortorder.value == "asc" ) 18 document.archive_search_form.sortorder.value = "desc"; 19 } 20 21 document.forms['archive_search_form'].submit(); 22 } 23 24 function setFilter( filtername, filterval ) { 25 26 var myfilterorder = document.archive_search_form.elements['filterorder'].value; 27 28 if( document.archive_search_form.elements[filtername] ) { 29 document.archive_search_form.elements[filtername].value = filterval; 30 if( myfilterorder != '') 31 myfilterorder = myfilterorder + "," + filtername; 32 else 33 myfilterorder = filtername; 34 35 } 36 document.archive_search_form.elements['filterorder'].value = myfilterorder; 37 38 //setTimeout( "document.forms['archive_search_form'].submit();", 1000 ); 39 40 document.forms['archive_search_form'].submit(); 41 } 42 </SCRIPT> 6 43 <SCRIPT LANGUAGE="javascript"> 7 44 … … 92 129 <TD></TD> 93 130 <TD> 94 Job <B>start</B> between131 Job <B>start</B> 95 132 </TD> 96 133 … … 100 137 <TD> 101 138 <INPUT TYPE="HIDDEN" NAME="start_from_time" VALUE="{start_from_value}"> 102 <INPUT TYPE="TEXT" NAME="start_from_pick" VALUE="{start_from_value}" DISABLED="TRUE"> <A HREF="javascript:show_calendar('document.archive_search_form.start_from_pick', document.archive_search_form.start_from_pick.value );"><IMG SRC="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a> 139 <INPUT TYPE="TEXT" NAME="start_from_pick" VALUE="{start_from_value}" DISABLED="TRUE"> 140 <A HREF="javascript:show_calendar('document.archive_search_form.start_from_pick', document.archive_search_form.start_from_pick.value );"> 141 <IMG SRC="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> 142 <a href="#" onClick="document.archive_search_form.start_from_pick.value=''" alt="Click here to clear field" title="Click here to clear field"><IMG SRC="redcross.jpg" BORDER=0></A> 103 143 </TD> 104 144 … … 108 148 <TD> 109 149 <INPUT TYPE="HIDDEN" NAME="start_to_time" VALUE="{start_to_value}"> 110 <INPUT TYPE="TEXT" NAME="start_to_pick" VALUE="{start_to_value}" DISABLED="TRUE"><a href="javascript:show_calendar('document.archive_search_form.start_to_pick', document.archive_search_form.start_to_pick.value );"> <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a> 111 </TD> 112 113 </TR> 114 115 <TR> 116 117 <TD></TD> 118 <TD> 119 Job <B>end</B> between 150 <INPUT TYPE="TEXT" NAME="start_to_pick" VALUE="{start_to_value}" DISABLED="TRUE"> 151 <a href="javascript:show_calendar('document.archive_search_form.start_to_pick', document.archive_search_form.start_to_pick.value );"> 152 <img src="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> 153 <a href="#" onClick="document.archive_search_form.start_to_pick.value=''" alt="Click here to clear field" title="Click here to clear field"> 154 <IMG SRC="redcross.jpg" BORDER=0></A> 155 </TD> 156 157 </TR> 158 159 <TR> 160 161 <TD></TD> 162 <TD> 163 Job <B>finish</B> 120 164 </TD> 121 165 … … 125 169 <TD> 126 170 <INPUT TYPE="HIDDEN" NAME="end_from_time" VALUE="{end_from_value}"> 127 <INPUT TYPE="TEXT" NAME="end_from_pick" VALUE="{end_from_value}" DISABLED="TRUE"> <A HREF="javascript:show_calendar('document.archive_search_form.end_from_pick', document.archive_search_form.end_from_pick.value );"><IMG SRC="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a> 171 <INPUT TYPE="TEXT" NAME="end_from_pick" VALUE="{end_from_value}" DISABLED="TRUE"> 172 <A HREF="javascript:show_calendar('document.archive_search_form.end_from_pick', document.archive_search_form.end_from_pick.value );"> 173 <IMG SRC="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> 174 <a href="#" onClick="document.archive_search_form.end_from_pick.value=''" alt="Click here to clear field" title="Click here to clear field"> 175 <IMG SRC="redcross.jpg" BORDER=0></A> 128 176 </TD> 129 177 … … 133 181 <TD> 134 182 <INPUT TYPE="HIDDEN" NAME="end_to_time" VALUE="{end_to_value}"> 135 <INPUT TYPE="TEXT" NAME="end_to_pick" VALUE="{end_to_value}" DISABLED="TRUE"><a href="javascript:show_calendar('document.archive_search_form.end_to_pick', document.archive_search_form.end_to_pick.value );"> <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a> 183 <INPUT TYPE="TEXT" NAME="end_to_pick" VALUE="{end_to_value}" DISABLED="TRUE"> 184 <a href="javascript:show_calendar('document.archive_search_form.end_to_pick', document.archive_search_form.end_to_pick.value );"> 185 <img src="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> 186 <a href="#" onClick="document.archive_search_form.end_to_pick.value=''" alt="Click here to clear field" title="Click here to clear field"> 187 <IMG SRC="redcross.jpg" BORDER=0></A> 136 188 </TD> 137 189 … … 199 251 <FONT SIZE="-1"> 200 252 Show Hosts: 201 yes<INPUT type=radio name="sh" value="1" OnClick=" toga_form.submit();" {checked1}>202 no<INPUT type=radio name="sh" value="0" OnClick=" toga_form.submit();" {checked0}>253 yes<INPUT type=radio name="sh" value="1" OnClick="archive_search_form.submit();" {checked1}> 254 no<INPUT type=radio name="sh" value="0" OnClick="archive_search_form.submit();" {checked0}> 203 255 </FONT> 204 256 | … … 212 264 <INPUT TYPE="HIDDEN" NAME="stop" VALUE="{stop}"> 213 265 Set graph timeperiod from 214 <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" SIZE=12 ALT="Start time" DISABLED="TRUE"> 215 <a href="javascript:show_calendar('document.archive_search_form.period_start_pick', document.archive_search_form.period_start_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> 266 <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" ALT="Start time" DISABLED="TRUE"> 267 <a href="javascript:show_calendar('document.archive_search_form.period_start_pick', document.archive_search_form.period_start_pick.value);" alt="Click to select a date/time" title="Click to select a date/time"> 268 <img src="cal.gif" width="16" height="16" border="0"></a> 269 <a href="#" onClick="javascript: document.archive_search_form.period_start_pick.value=''" alt="Click here to clear field" title="Click here to clear field"> 270 <IMG SRC="redcross.jpg" BORDER=0></A> 216 271 to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{stop}" SIZE=12 ALT="Stop time" DISABLED="TRUE"> 217 <a href="javascript:show_calendar('document.archive_search_form.period_stop_pick', document.archive_search_form.period_stop_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> 272 <a href="javascript:show_calendar('document.archive_search_form.period_stop_pick', document.archive_search_form.period_stop_pick.value);" alt="Click to select a date/time" title="Click to select a date/time"> 273 <img src="cal.gif" width="16" height="16" border="0"></a> 274 <a href="#" onClick="javascript: document.archive_search_form.period_to_pick.value=''" alt="Click here to clear field" title="Click here to clear field"> 275 <IMG SRC="redcross.jpg" BORDER=0></A> 218 276 <INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs"> 219 277 </FONT>
Note: See TracChangeset
for help on using the changeset viewer.