Changeset 140


Ignore:
Timestamp:
06/15/05 10:48:34 (17 years ago)
Author:
bastiaans
Message:

web/addons/toga/templates/header.tpl:

  • Use block to include link to archive search

web/addons/toga/templates/overview.tpl:

  • Cleanup
  • Javascript moved to seperate .js file

web/addons/toga/templates/search.tpl:

  • Added search results and future showhosts block section

web/addons/toga/index.php:

  • Use block instead of include for archive search link

web/addons/toga/search.php:

  • Setup of working search style

web/addons/toga/libtoga.php:

  • searchDbase() will return a list of jobids matching the criteria
Location:
trunk/web/addons/toga
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/toga/index.php

    r138 r140  
    3838        global $metrics, $reports, $m, $default_metric;
    3939        global $default_refresh, $filterorder, $view;
     40        global $TARCHD;
    4041
    4142        if( isset($default_metric) and !isset($m) )
     
    209210        $m = $metricname;
    210211
     212        if( $TARCHD ) {
     213                $tpl->newBlock( "search" );
     214                $tpl->assignGlobal( "cluster_url", rawurlencode($clustername) );
     215                $tpl->assignGlobal( "cluster", $clustername );
     216                $tpl->gotoBlock( "_ROOT" );
     217        }
     218
    211219        # Make sure that no data is cached..
    212220        header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    # Date in the past
     
    242250}
    243251
    244 function includeSearchThumb() {
    245         global $tpl;
    246 
    247         $tpl->assignInclude( "archive", "templates/inc_search.tpl" );
    248 
    249 }
    250 
    251252function includeOverview() {
    252253        global $tpl;
     
    264265
    265266                includeOverview();
    266                 if( $TARCHD )
    267                         includeSearchThumb();
    268267                break;
    269268
  • trunk/web/addons/toga/libtoga.php

    r138 r140  
    141141
    142142                $ids = $this->queryDbase( $query );
    143                 print_r($ids);
     143
     144                $ret = array();
     145
     146                foreach( $ids as $crow)
     147                        $ret[] = $crow[job_id];
     148
     149                return $ret;
    144150        }
    145151
  • trunk/web/addons/toga/overview.php

    r138 r140  
    22global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
    33global $hosts_up, $m, $start, $end, $filterorder;
     4
     5//$tpl->assign("_ROOT.summary", "" );
    46
    57$data_gatherer = new DataGatherer();
  • trunk/web/addons/toga/search.php

    r138 r140  
    3232function makeSearchPage() {
    3333        global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
    34         global $end_from_time, $end_to_time;
     34        global $end_from_time, $end_to_time, $filter;
    3535
    3636        $tpl->assign( "cluster", $clustername );
     
    4646        if( validateFormInput() ) {
    4747
     48                $tpl->newBlock( "search_results" );
    4849                $tdb = new TarchDbase();
    49                 $tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
    50                 $tpl->assign( "search_results", "templates/search_results.tpl" );
     50                $search_ids = $tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
     51
     52                foreach( $search_ids as $foundid ) {
     53
     54                        printf("found job %s\n", $foundid );
     55                        //output jobzooi
     56
     57                }
     58               
     59                if( count( $search_ids ) == 1 ) {
     60
     61                        $tpl->newBlock( "showhosts" );
     62                }
    5163
    5264                // show search results
  • trunk/web/addons/toga/templates/header.tpl

    r129 r140  
    4040      <B>{alt_view}</B>
    4141     </TD>
    42 <!-- INCLUDE BLOCK : archive -->
     42
     43<!-- START BLOCK : search -->
     44     <TD><CENTER>
     45       <A HREF="./?c={cluster_url}&view=search">
     46       Jobarchive<BR>
     47       <IMG SRC="./bricks.jpg" HEIGHT=50 WIDTH=50 ALT="Search the archive for {cluster}" TITLE="Search the archive for {cluster}" BORDER=0></A></CENTER>
     48     </TD>
     49<!-- END BLOCK : search -->
     50
    4351  </TR>
    4452  </TABLE>
  • trunk/web/addons/toga/templates/overview.tpl

    r138 r140  
    2929<BR>
    3030
    31 <SCRIPT TYPE="text/javascript" SRC="ts_picker.js"></SCRIPT>
    32 <SCRIPT TYPE="text/javascript">
    33         function setSort( sortbyval ) {
    34 
    35                 if( sortbyval != document.toga_form.sortby.value ) {
    36 
    37                         document.toga_form.sortby.value = sortbyval;
    38                         document.toga_form.sortorder.value = "asc";
    39 
    40                 } else {
    41 
    42                         if( document.toga_form.sortorder.value == "desc" )
    43                                 document.toga_form.sortorder.value = "asc";
    44                         else if( document.toga_form.sortorder.value == "asc" )
    45                                 document.toga_form.sortorder.value = "desc";
    46                 }
    47 
    48                 document.forms['toga_form'].submit();
    49         }
    50 
    51         function setFilter( filtername, filterval ) {
    52 
    53                 //document.toga_form.id.value = '';
    54                 //document.toga_form.queue.value = '';
    55                 //document.toga_form.state.value = '';
    56                 //document.toga_form.user.value = '';
    57                 var myfilterorder = document.toga_form.elements['filterorder'].value;
    58 
    59                 if( document.toga_form.elements[filtername] ) {
    60                         document.toga_form.elements[filtername].value = filterval;
    61                         if( myfilterorder != '')
    62                                 myfilterorder = myfilterorder + "," + filtername;
    63                         else
    64                                 myfilterorder = filtername;
    65                                
    66                 }
    67                 document.toga_form.elements['filterorder'].value = myfilterorder;
    68 
    69                 //setTimeout( "document.forms['toga_form'].submit();", 1000 );
    70 
    71                 document.forms['toga_form'].submit();
    72         }
    73 
    74         //function removeFilters( filters ) {
    75 
    76                 //var myfilter_fields = filters.split( " " );
    77                 //for( var i=0; i<myfilter_fields.length; i++ ) {
    78                         //removeFilter( myfilter_fields[i] );
    79                         //setTimeout( "removeFilter( "+myfilter_fields[i]+" );", 50 );
    80                 //}
    81                 // delay 100 ms before submit or fields might not be set
    82                 //document.forms['toga_form'].submit();", 100 );
    83 
    84                 //setTimeout( "document.forms['toga_form'].submit();", 1000 );
    85         //}
    86 
    87         //function removeFilter( filtername ) {
    88 
    89         //      var filterorder_fields = document.toga_form.elements['filterorder'].value.split( "," );
    90         //      var myfilterorder = '';
    91 
    92         //      for( var i=0; i<filterorder_fields.length; i++ ) {
    93         //              if( filterorder_fields[i] != filtername ) {
    94         //                      if( myfilterorder != '') {
    95         //                              myfilterorder = myfilterorder + "," + filterorder_fields[i];
    96         //                              //alert('myfilterorder = '+myfilterorder);
    97         //                      } else {
    98         //                              myfilterorder = filterorder_fields[i];
    99         //                              //alert('emyfilterorder = '+myfilterorder);
    100         //                      }
    101         //              }
    102         //      }
    103         //      document.toga_form.elements[filtername].value = '';
    104         //      document.toga_form.elements['filterorder'].value = myfilterorder;
    105         //}
    106 
    107 </SCRIPT>
     31<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
    10832
    10933<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}">
     
    16185   <FONT SIZE="-1">
    16286   Columns&nbsp;&nbsp;{cols_menu}
    163    </FONT><!-- <BR>
    164    <FONT SIZE="-1">
    165     Set graph timeperiod from <INPUT TYPE="text" NAME="start" VALUE="{start}" SIZE=12 ALT="Start time"><a href="javascript:show_calendar('document.toga_form.start', document.toga_form.start.value);"><img src="cal.gif" width="16" height="16" border="0"></a> to <INPUT TYPE="text" NAME="stop" VALUE="{stop}" SIZE=12 ALT="Stop time"><a href="javascript:show_calendar('document.toga_form.stop', document.toga_form.stop.value);"><img src="cal.gif" width="16" height="16" border="0"></a><INPUT TYPE="submit" VALUE="Refresh graphs">
    166    </FONT> -->
     87   </FONT>
    16788  </TD>
    16889</TR>
  • trunk/web/addons/toga/templates/search.tpl

    r138 r140  
    22</FORM>
    33<SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT>
     4<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
    45<SCRIPT LANGUAGE="javascript">
    56
    6         function setHiddenTimestamps() {
     7        function setSearchTimestamps() {
    78
    89                document.archive_search_form.start_from_time.value = document.archive_search_form.start_from_pick.value;
     
    1011                document.archive_search_form.end_from_time.value = document.archive_search_form.end_from_pick.value;
    1112                document.archive_search_form.end_to_time.value = document.archive_search_form.end_to_pick.value;
    12                 alert( "poep gezet" );
     13        }
     14
     15        function setPeriodTimestamps() {
     16
     17                document.archive_search_form.start.value = document.archive_search_form.period_start_pick.value;
     18                document.archive_search_form.stop.value = document.archive_search_form.period_stop_pick.value;
    1319        }
    1420
     
    139145  <TD>{form_error_msg}</TD>
    140146  <TD>
    141   <INPUT TYPE="submit" VALUE="Search archive" onClick="setHiddenTimestamps();">
     147  <INPUT TYPE="submit" VALUE="Search archive" onClick="setSearchTimestamps();">
    142148  </TD>
    143149
     
    147153</FORM>
    148154<BR><BR>
    149 <!-- INCLUDE BLOCK : search_results -->
    150 <BR><BR>
    151 <!-- INCLUDE BLOCK : job_details -->
     155<!-- START BLOCK : search_results -->
     156<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
     157
     158<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}">
     159<INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{sortorder}">
     160<INPUT TYPE="HIDDEN" NAME="c" VALUE="{clustername}">
     161<INPUT TYPE="HIDDEN" NAME="queue" VALUE="{f_queue}">
     162<INPUT TYPE="HIDDEN" NAME="state" VALUE="{f_state}">
     163<INPUT TYPE="HIDDEN" NAME="user" VALUE="{f_user}">
     164<INPUT TYPE="HIDDEN" NAME="id" VALUE="{f_id}">
     165<INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{f_order}">
     166
     167<TABLE WIDTH="90%" CELLPADDING="8" CELLSPACING="3" BORDER=0>
     168<TR CLASS="toga">
     169<TH><B><A HREF="#" onClick="setSort( 'id' )">Id</A></B></TH>
     170<TH><B><A HREF="#" onClick="setSort( 'state' )">State</A></B></TH>
     171<TH><B><A HREF="#" onClick="setSort( 'user' )">User</A></B></TH>
     172<TH><B><A HREF="#" onClick="setSort( 'queue' )">Queue</A></B></TH>
     173<TH><B><A HREF="#" onClick="setSort( 'name' )">Name</A></B></TH>
     174<TH><B><A HREF="#" onClick="setSort( 'req_cpu' )">Req. CPU time</A></B></TH>
     175<TH><B><A HREF="#" onClick="setSort( 'req_mem' )">Req. Memory</A></B></TH>
     176<TH><B><A HREF="#" onClick="setSort( 'nodes' )">Nodes</A>/<A HREF="#" onClick="setSort( 'cpus' )">Cpus</A></
     177B></TH>
     178<TH><B><A HREF="#" onClick="setSort( 'start' )">Started</A></B></TH>
     179<TH><B><A HREF="#" onClick="setSort( 'finished' )">Finished</A></B></TH>
     180<TH><B><A HREF="#" onClick="setSort( 'runningtime' )">Runningtime</A></B></TH>
     181</TR>
     182
     183<!-- START BLOCK : node -->
     184  <TR CLASS="{nodeclass}">
     185    <TD><A HREF="#" onClick="setFilter( 'id', '{id}' )">{id}</A></TD>
     186    <TD><A HREF="#" onClick="setFilter( 'state', '{state}' )">{state}</A></TD>
     187    <TD><A HREF="#" onClick="setFilter( 'user', '{user}' )">{user}</A></TD>
     188    <TD><A HREF="#" onClick="setFilter( 'queue', '{queue}' )">{queue}</A></TD>
     189    <TD>{name}</TD>
     190    <TD>{req_cpu}</TD>
     191    <TD>{req_memory}</TD>
     192    <TD>{nodes}/{cpus}</TD>
     193    <TD>{started}</TD>
     194    <TD>{finished}</TD>
     195    <TD>{runningtime}</TD>
     196  </TR>
     197<!-- END BLOCK : node -->
     198</TABLE>
    152199</CENTER>
     200
     201<!-- START BLOCK : showhosts -->
     202<TABLE BORDER="0" WIDTH="100%">
     203<TR>
     204  <TD CLASS=title COLSPAN="2">
     205  <FONT SIZE="-1">
     206  Show Hosts:
     207  yes<INPUT type=radio name="sh" value="1" OnClick="toga_form.submit();" {checked1}>
     208  no<INPUT type=radio name="sh" value="0" OnClick="toga_form.submit();" {checked0}>
     209  </FONT>
     210  |
     211  job <strong>{id}</strong> metric <strong>{metric}</strong>
     212  |
     213   <FONT SIZE="-1">
     214   Columns&nbsp;&nbsp;{cols_menu}
     215   </FONT><BR>
     216   <FONT SIZE="-1">
     217    <INPUT TYPE="HIDDEN" NAME="start" VALUE="{start}">
     218    <INPUT TYPE="HIDDEN" NAME="stop" VALUE="{stop}">
     219    Set graph timeperiod from <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" SIZE=12 ALT="Start time"><a href="javascript:show_calendar('document.search_form.period_start_pick', document.search_form.period_start_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{stop}" SIZE=12 ALT="Stop time"><a href="javascript:show_calendar('document.toga_form.period_stop_pick', document.search_form.period_stop_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a><INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs">
     220   </FONT>
     221  </TD>
     222</TR>
     223
     224</TABLE>
     225
     226<CENTER>
     227<TABLE>
     228<TR>
     229<!-- START BLOCK : sorted_list -->
     230{metric_image}{br}
     231<!-- END BLOCK : sorted_list -->
     232</TR>
     233</TABLE>
     234
     235<p>
     236(Nodes colored by 1-minute load) | <A HREF="../../node_legend.html" ALT="Node Image egend">Legend</A>
     237
     238</CENTER>
     239
     240<!-- END BLOCK : showhosts -->
     241<!-- END BLOCK : search_results -->
     242</CENTER>
Note: See TracChangeset for help on using the changeset viewer.