Changeset 811


Ignore:
Timestamp:
04/08/13 22:15:47 (8 years ago)
Author:
ramonb
Message:

index.php:

  • dont show metric menu for search anymore
  • preparation for meta view

search.php,
templates/search.tpl:

  • set metric menu next to period selection now
  • populate metric menu from archive, since we no longer parse XML in search
Location:
branches/0.4/web/addons/job_monarch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/index.php

    r794 r811  
    6161$filter = array();
    6262
    63 if( !isset($view) ) $view = "overview";
     63if( !isset($view) && $clustername!='') $view = "overview";
    6464if( !isset($sortorder) ) $sortorder = "desc";
    6565if( !isset($sortby) ) $sortby = "id";
     
    238238    }
    239239
    240     if (!count($metrics) && $view!='search' && $view!='host')
     240    if (!count($metrics) && $view!='' && $view!='search' && $view!='host')
    241241    {
    242242        echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n";
     
    322322        #$range = "job";
    323323
    324         if( $page_call != "host_view" )
     324        if( ( $page_call != "host_view" ) && ( $page_call != "search" ) )
    325325        {
    326326
     
    505505    default:
    506506
    507         include "./overview.php";
    508         makeOverview();
     507        include "./meta_view.php";
     508        makeMetaview();
    509509        break;
    510510}
  • branches/0.4/web/addons/job_monarch/search.php

    r810 r811  
    226226    global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up, $hc;
    227227    global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY;
    228     global $SEARCH_RESULT_LIMIT, $COLUMN_NODES, $metricname, $self;
     228    global $SEARCH_RESULT_LIMIT, $COLUMN_NODES, $metricname, $self, $conf;
    229229
    230230    $longtitle = "Batch Archive Search :: Powered by Job Monarch!";
     
    420420                }
    421421
     422                $trd = new TarchRrdGraph( $clustername, $host );
     423                $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
     424
     425                $metric_menu = "<B>Metric</B>&nbsp;&nbsp;"
     426                    ."<SELECT NAME=\"m\" OnChange=\"toga_form.submit();\">\n";
     427
     428                $archive_reports = array( "load_report", "cpu_report", "network_report", "packet_report", "mem_report" );
     429                $file_metrics = $trd->dirList( $rrd_dirs[0] );
     430
     431                $archive_metrics = array();
     432
     433                foreach( $file_metrics as $k )
     434                {
     435                    $a_metric_file = explode( '.', $k);
     436                    $archive_metrics[] = $a_metric_file[0];
     437                }
     438
     439                $sorted_metrics = array_merge( $archive_reports, $archive_metrics );
     440
     441                asort( $sorted_metrics );
     442
     443                $selected_metric = $conf['default_metric'];
     444
     445                if( $metricname != '')
     446                {
     447                    $selected_metric = $metricname;
     448                }
     449
     450                foreach( $sorted_metrics as $k )
     451                {
     452                    $url = rawurlencode($k);
     453                    $metric_menu .= "<OPTION VALUE=\"$url\" ";
     454                    if ($k == $selected_metric )
     455                        $metric_menu .= "SELECTED";
     456                    $metric_menu .= ">$k\n";
     457                }
     458                $metric_menu .= "</SELECT>\n";
     459
     460                $tpl_data->assign("metric_menu", $metric_menu );
     461
    422462                # First pass to find the max value in all graphs for this
    423463                # metric. The $start,$end variables comes from get_context.php,
  • branches/0.4/web/addons/job_monarch/templates/search.tpl

    r806 r811  
    266266    <INPUT TYPE="HIDDEN" NAME="period_start" VALUE="{$period_start}">
    267267    <INPUT TYPE="HIDDEN" NAME="period_stop" VALUE="{$period_stop}">
    268     <BR><BR><B>Graph/ from
     268    <BR><B>Graph {$metric_menu} from
    269269    <INPUT TYPE="text" NAME="period_start_pick" VALUE="{$period_start}" ALT="Start time" DISABLED="TRUE">
    270270    <a href="javascript:show_calendar('document.{$form_name}.period_start_pick', document.{$form_name}.period_start_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
Note: See TracChangeset for help on using the changeset viewer.