Index: trunk/web2/addons/job_monarch/index.php
===================================================================
--- trunk/web2/addons/job_monarch/index.php (revision 555)
+++ trunk/web2/addons/job_monarch/index.php (revision 592)
@@ -33,9 +33,8 @@
include_once "./libtoga.php";
-if ( !empty( $_GET ) ) {
+if ( !empty( $_GET ) )
+{
extract( $_GET );
}
-
-//printf( "r2%s\n", $range );
global $GANGLIA_PATH;
@@ -55,31 +54,34 @@
if( !isset($sortby) ) $sortby = "id";
-if( isset( $filterorder ) && ($filterorder!='') ) {
+if( isset( $filterorder ) && ($filterorder!='') )
+{
$myfilter_fields = explode( ",", $filterorder );
-} else {
- if( isset($queue) && ($queue!='')) $filter[queue]=$queue;
- if( isset($state) && ($state!='')) $filter[state]=$state;
- if( isset($user) && ($user!='')) $filter[user]=$user;
- if( isset($id) && ($id!='')) $filter[id]=$id;
+}
+else
+{
+ if( isset($queue) && ($queue!='')) $filter['queue']=$queue;
+ if( isset($state) && ($state!='')) $filter['state']=$state;
+ if( isset($user) && ($user!='')) $filter['user']=$user;
+ if( isset($id) && ($id!='')) $filter['id']=$id;
}
// Fill filter array in order they were picked by user
-if( isset($myfilter_fields) ) {
-
- foreach( $myfilter_fields as $myfilter ) {
-
- switch( $myfilter ) {
-
+if( isset($myfilter_fields) )
+{
+ foreach( $myfilter_fields as $myfilter )
+ {
+ switch( $myfilter )
+ {
case "queue":
- $filter[queue]=$queue;
+ $filter['queue']=$queue;
break;
case "state":
- $filter[state]=$state;
+ $filter['state']=$state;
break;
case "user":
- $filter[user]=$user;
+ $filter['user']=$user;
break;
case "id":
- $filter[id]=$id;
+ $filter['id']=$id;
break;
}
@@ -87,16 +89,11 @@
}
-//if( isset($queue) && ($queue!='')) $filter[queue]=$queue;
-//if( isset($state) && ($state!='')) $filter[state]=$state;
-//if( isset($user) && ($user!='')) $filter[user]=$user;
-//if( isset($id) && ($id!='')) $filter[id]=$id;
-
-function epochToDatetime( $epoch ) {
-
+function epochToDatetime( $epoch )
+{
return strftime( "%d-%m-%Y %H:%M:%S", $epoch );
}
-function makeHeader( $page_call, $title, $longtitle ) {
-
+function makeHeader( $page_call, $title, $longtitle )
+{
global $tpl, $grid, $context, $initgrid;
global $jobrange, $jobstart;
@@ -120,17 +117,22 @@
# Maintain our path through the grid tree.
- $me = $self . "@" . $grid[$self][AUTHORITY];
+ $me = $self . "@" . $grid[$self]['AUTHORITY'];
$gridstack = array();
$gridstack[] = $me;
- if ($gridwalk=="fwd") {
+ if ($gridwalk=="fwd")
+ {
# push our info on gridstack, format is "name@url>name2@url".
- if (end($gridstack) != $me) {
+ if (end($gridstack) != $me)
+ {
$gridstack[] = $me;
}
- } else if ($gridwalk=="back") {
+ }
+ else if ($gridwalk=="back")
+ {
# pop a single grid off stack.
- if (end($gridstack) != $me) {
+ if (end($gridstack) != $me)
+ {
array_pop($gridstack);
}
@@ -140,5 +142,6 @@
$gridstack_url = rawurlencode($gridstack_str);
- if ($initgrid or $gridwalk) {
+ if ($initgrid or $gridwalk)
+ {
# Use cookie so we dont have to pass gridstack around within this site.
# Cookie values are automatically urlencoded. Expires in a day.
@@ -152,5 +155,6 @@
# Setup a redirect to a remote server if you choose a grid from pulldown menu. Tell
# destination server that we're walking foward in the grid tree.
- if (strstr($clustername, "http://")) {
+ if (strstr($clustername, "http://"))
+ {
$tpl->assign("refresh", "0");
$tpl->assign("redirect", ";URL=$clustername?gw=fwd&gs=$gridstack_url");
@@ -194,5 +198,6 @@
$node_menu = "";
- if ($parentgrid) {
+ if ($parentgrid)
+ {
$node_menu .= "$parentgrid $meta_designator ";
$node_menu .= ">\n";
@@ -205,7 +210,10 @@
if ($physical)
+ {
$node_menu .= hiddenvar("p", $physical);
-
- if ( $clustername ) {
+ }
+
+ if ( $clustername )
+ {
$url = rawurlencode($clustername);
$node_menu .= "$clustername ";
@@ -214,5 +222,6 @@
}
- if (!count($metrics)) {
+ if (!count($metrics))
+ {
echo "
Cannot find any metrics for selected cluster \"$clustername\", exiting.
\n";
echo "Check ganglia XML tree (telnet $ganglia_ip $ganglia_port)\n";
@@ -239,6 +248,6 @@
$node_menu .= "Joblist ";
- if( isset( $hostname ) && ( $view != 'host' ) ) {
-
+ if( isset( $hostname ) && ( $view != 'host' ) )
+ {
$node_menu .= ">\n";
$href = "";
@@ -247,11 +256,11 @@
}
- if( count( $filter ) > 0 && $view != "search" ) {
-
+ if( count( $filter ) > 0 && $view != "search" )
+ {
$my_ct = 1;
$filter_nr = count( $filter );
- foreach( $filter as $filtername=>$filterval ) {
-
+ foreach( $filter as $filtername=>$filterval )
+ {
$node_menu .= ">\n";
@@ -262,7 +271,8 @@
$my_filters = array_keys( $filter );
- foreach( $n_filter as $n_filtername=>$n_filterval ) {
-
- if( $temp_ct < $my_ct ) {
+ foreach( $n_filter as $n_filtername=>$n_filterval )
+ {
+ if( $temp_ct < $my_ct )
+ {
$href .= "&". $n_filtername . "=" . $n_filterval;
@@ -286,26 +296,21 @@
}
- //$m = $metricname;
-
-
$tpl->gotoBlock( "_ROOT" );
$tpl->assignGlobal("view", $view);
-
- if( array_key_exists( "id", $filter ) or isset($hostname) ) {
-
+ if( array_key_exists( "id", $filter ) or isset($hostname) )
+ {
$range = "job";
- //print_r( $context_metrics );
-
if( $page_call != "host_view" )
{
-
- if (is_array($context_metrics) ) {
+ if (is_array($context_metrics) )
+ {
$metric_menu = "Metric "
."