Ignore:
Timestamp:
08/05/05 12:55:27 (19 years ago)
Author:
bastiaans
Message:

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

  • Removed graph timeperiod selection -> to be placed in header

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

  • Added graph timeperiod selection when browsing jobarchive
  • Now a user can change graphing timeperiods for the node detail graphs from the archive!

web/addons/toga/host_view.php:

  • Added correct parsing of timeperiod

web/addons/toga/index.php:

  • Added placement of graph timeperiod selection and variables

web/addons/toga/search.php:

  • Small cleanup
File:
1 edited

Legend:

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

    r178 r189  
    5959//if( isset($id) && ($id!='')) $filter[id]=$id;
    6060
     61function epochToDatetime( $epoch ) {
     62
     63        return strftime( "%d-%m-%Y %H:%M:%S", $epoch );
     64}
     65
    6166function makeHeader() {
    6267
     
    6974        global $default_refresh, $filterorder, $view;
    7075        global $TARCHD, $period_start, $period_stop, $h, $id;
     76        global $job_start, $job_stop;
    7177       
    7278        if( isset($default_metric) and !isset($m) )
     
    223229        }
    224230
    225         if( $view == "search" ) {
     231        $m = $metricname;
     232
     233
     234        $tpl->gotoBlock( "_ROOT" );
     235        $tpl->assignGlobal("view", $view);
     236
     237        if( array_key_exists( "id", $filter ) or isset($hostname) ) {
     238
     239                //print_r( $context_metrics );
     240
     241                if( !isset( $hostname ) ) {
     242
     243                        if (is_array($context_metrics) ) {
     244                                $metric_menu = "<B>Metric</B>&nbsp;&nbsp;"
     245                                        ."<SELECT NAME=\"m\" OnChange=\"".$form_name.".submit();\">\n";
     246
     247                                sort($context_metrics);
     248                                foreach( $context_metrics as $k ) {
     249                                        $url = rawurlencode($k);
     250                                        $metric_menu .= "<OPTION VALUE=\"$url\" ";
     251                                        if ($k == $metricname )
     252                                                $metric_menu .= "SELECTED";
     253                                        $metric_menu .= ">$k\n";
     254                                }
     255                                $metric_menu .= "</SELECT>\n";
     256
     257                        }
     258                }
     259
     260                $tpl->assign("metric_menu", $metric_menu );
     261
     262                if( $view == "search" or $view == "host" ) {
     263                        $tpl->newBlock("timeperiod");
     264                        if( is_numeric( $period_start ) ) {
     265                                $period_start = epochToDatetime( $period_start );
     266                        }
     267                        if( is_numeric( $period_stop ) ) {
     268                                $period_stop = epochToDatetime( $period_stop );
     269                        }
     270                        $tpl->assign("period_start", $period_start );
     271                        $tpl->assign("period_stop", $period_stop );
     272                        $tpl->assign("hostname", $hostname );
     273
     274                        if( $view == "host" ) {
     275                                $tpl->newBlock("hostview");
     276                                $tpl->assign("job_start", $job_start );
     277                                $tpl->assign("job_stop", $job_stop );
     278                        }
     279                }
     280
     281        }
     282
     283        if( $view == "search" or $view == "host" ) {
    226284
    227285                $node_menu .= "<B>&gt;</B>\n";
    228286                $node_menu .= "<B>Jobarchive</B> ";
    229                 $tpl->assign("view", "search" );
    230287                $form_name = "archive_search_form";
    231288                $tpl->assignGlobal("form_name", $form_name );
     
    234291                $form_name = "toga_form";
    235292                $tpl->assignGlobal("form_name", $form_name );
    236                 $tpl->assign("view", "overview" );
    237         }
    238 
    239         $tpl->assign("node_menu", $node_menu);
    240 
    241         if( array_key_exists( "id", $filter ) ) {
    242 
    243                 //print_r( $context_metrics );
    244 
    245                 if (is_array($context_metrics) ) {
    246                         $metric_menu = "<B>Metric</B>&nbsp;&nbsp;"
    247                                 ."<SELECT NAME=\"m\" OnChange=\"".$form_name.".submit();\">\n";
    248 
    249                         sort($context_metrics);
    250                         foreach( $context_metrics as $k ) {
    251                                 $url = rawurlencode($k);
    252                                 $metric_menu .= "<OPTION VALUE=\"$url\" ";
    253                                 if ($k == $metricname )
    254                                         $metric_menu .= "SELECTED";
    255                                 $metric_menu .= ">$k\n";
    256                         }
    257                         $metric_menu .= "</SELECT>\n";
    258 
    259                 }
    260 
    261                 $tpl->assign("metric_menu", $metric_menu );
    262         }
    263         $m = $metricname;
     293        }
    264294
    265295        if( $TARCHD ) {
     
    267297                $tpl->assignGlobal( "cluster_url", rawurlencode($clustername) );
    268298                $tpl->assignGlobal( "cluster", $clustername );
    269                 $tpl->gotoBlock( "_ROOT" );
    270         }
     299        }
     300        $tpl->gotoBlock( "_ROOT" );
     301        $tpl->assignGlobal( "cluster", $clustername );
     302        $tpl->assign("node_menu", $node_menu);
    271303
    272304        # Make sure that no data is cached..
Note: See TracChangeset for help on using the changeset viewer.