- Timestamp:
- 02/04/09 13:51:28 (15 years ago)
- Location:
- trunk/web2/addons/job_monarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web2/addons/job_monarch/image.php
r563 r582 28 28 include_once "./libtoga.php"; 29 29 30 if ( !empty( $_GET ) ) { 30 if ( !empty( $_GET ) ) 31 { 31 32 extract( $_GET ); 32 33 } 33 34 34 function checkSessionData() {35 35 function checkSessionData() 36 { 36 37 global $_SESSION; 37 38 38 39 session_start(); 39 40 40 if( isset( $_SESSION["data"] ) ) { 41 $myxml_data = &$_SESSION["data"]; 42 } else { 41 if( isset( $_SESSION['data'] ) ) 42 { 43 $myxml_data = &$_SESSION['data']; 44 } 45 else 46 { 43 47 $myxml_data = 0; 44 48 } … … 48 52 $myxml_data = $ds->getData(); 49 53 50 //print_f( "%s\n", $myxml_data );51 54 } 52 55 return $myxml_data; … … 54 57 55 58 56 $httpvars 57 $view 58 $host 59 $query 60 $clustername 59 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); 60 $view = $httpvars->getHttpVar( "view" ); 61 $host = $httpvars->getHttpVar( "host" ); 62 $query = $httpvars->getHttpVar( "query" ); 63 $clustername = $httpvars->getClusterName(); 61 64 62 if( isset($jid) && ($jid!='')) $filter[jid]=$jid; 63 if( isset($state) && ($state!='')) $filter[state]=$state; 64 if( isset($owner) && ($owner!='')) $filter[owner]=$owner; 65 if( isset($queue) && ($queue!='')) $filter[queue]=$queue; 66 if( isset($host) && ($host!='')) $filter[host]=$host; 67 if( isset($query) && ($query!='')) $filter[query]=$query; 68 //printf("host = %s\n", $filter[host] ); 65 if( isset($jid) && ($jid!='')) $filter['jid']=$jid; 66 if( isset($state) && ($state!='')) $filter['state']=$state; 67 if( isset($owner) && ($owner!='')) $filter['owner']=$owner; 68 if( isset($queue) && ($queue!='')) $filter['queue']=$queue; 69 if( isset($host) && ($host!='')) $filter['host']=$host; 70 if( isset($query) && ($query!='')) $filter['query']=$query; 69 71 70 72 function drawHostImage() { … … 80 82 81 83 if( $data_gatherer->isJobmonRunning() ) 84 { 82 85 $ic = new HostImage( $data_gatherer, $clustername, $hostname ); 86 } 83 87 else 88 { 84 89 $ic = new EmptyImage(); 90 } 85 91 86 92 $ic->draw(); … … 98 104 $data_gatherer->parseXML( $myxml_data ); 99 105 100 if( $data_gatherer->isJobmonRunning() ) { 106 if( $data_gatherer->isJobmonRunning() ) 107 { 101 108 $ic = new ClusterImage( $myxml_data, $clustername ); 102 109 $ic->setSmall(); 103 } else { 110 } 111 else 112 { 104 113 $ic = new EmptyImage(); 105 114 } … … 117 126 $ic->setBig(); 118 127 119 if( isset( $filter ) ) { 120 foreach( $filter as $filtername=>$filtervalue ) { 121 //printf("filter %s,%s\n", $filtername, $filtervalue); 122 switch( $filtername ) { 123 124 case "jid": 125 $ic->setFilter( 'jobid', $filtervalue ); 126 break; 127 case "owner": 128 $ic->setFilter( 'owner', $filtervalue); 129 break; 130 case "queue": 131 $ic->setFilter( 'queue', $filtervalue); 132 break; 133 case "state": 134 $ic->setFilter( 'status', $filtervalue); 135 break; 136 case "host": 137 $ic->setFilter( 'host', $filtervalue); 138 break; 139 case "query": 140 $ic->setFilter( 'query', $filtervalue); 141 break; 142 default: 143 break; 144 } 128 if( isset( $filter ) ) 129 { 130 foreach( $filter as $filtername=>$filtervalue ) 131 { 132 $ic->setFilter( $filtername, $filtervalue ); 145 133 } 146 134 } -
trunk/web2/addons/job_monarch/libtoga.php
r578 r582 1402 1402 $filtered_nodes = array(); 1403 1403 1404 $filter_checks = array(); 1405 1404 1406 foreach( $nodes as $node ) 1405 1407 { 1406 $hostname = $node->getHostname(); 1407 1408 $addhost = 1; 1409 1410 if( count( $this->filters ) > 0 ) 1411 { 1412 $mynjobs = $node->getJobs(); 1413 1414 if( $filtername == 'host' && $hostname == $filtervalue ) 1415 { 1416 $addhost = 1; 1417 $this->selected = $hostname; 1418 } 1419 else if( count( $mynjobs ) > 0 ) 1420 { 1421 foreach( $mynjobs as $myjob ) 1422 { 1423 foreach( $this->filters as $filtername => $filtervalue ) 1424 { 1425 if( $filtername!=null && $filtername!='' ) 1408 $hostname = $node->getHostname(); 1409 $mynjobs = $node->getJobs(); 1410 1411 foreach( $this->filters as $filtername => $filtervalue ) 1412 { 1413 $filter_checks[$filtername] = false; 1414 } 1415 1416 if( array_key_exists( 'host', $this->filters ) ) 1417 { 1418 if( $hostname == $this->filters['host'] ) 1419 { 1420 $this->selected = $hostname; 1421 $filtered_nodes[] = $hostname; 1422 //$filter_checks['host'] = true; 1423 } 1424 } 1425 1426 if( count( $mynjobs ) == 0 ) 1427 { 1428 continue; 1429 } 1430 1431 foreach( $mynjobs as $myjob ) 1432 { 1433 foreach( $this->filters as $filtername => $filtervalue ) 1434 { 1435 if( $filtername == 'jid' ) 1436 { 1437 if( $myjob == $filtervalue ) 1438 { 1439 $filter_checks['jid'] = true; 1440 } 1441 } 1442 if( $filtername == 'query' ) 1443 { 1444 foreach( $jobs[$myjob] as $myj_attr => $myj_val ) 1445 { 1446 if( is_array( $myj_val ) ) 1426 1447 { 1427 if( $filtername == 'jobid')1448 foreach( $myj_val as $myj_v ) 1428 1449 { 1429 if ( $myjob != $filtervalue )1450 if( strpos( $myj_v, $filtervalue ) !== false ) 1430 1451 { 1431 $addhost = 0; 1432 break; 1433 } 1434 else 1435 { 1436 $addhost = 1; 1437 break; 1438 } 1439 } 1440 else 1441 { 1442 if( $jobs[$myjob][$filtername] == $filtervalue ) 1443 { 1444 $addhost = 1; 1445 continue; 1446 } 1447 else if( $jobs[$myjob][$filtername] != $filtervalue ) 1448 { 1449 $addhost = 0; 1450 } 1451 if( $filtername == 'query' ) 1452 { 1453 foreach( $jobs[$myjob] as $myj_attr => $myj_val ) 1454 { 1455 if(!is_array( $myj_val ) ) 1456 { 1457 if( strpos( $myj_val, $filtervalue ) !== false ) 1458 { 1459 $addhost = 1; 1460 continue; 1461 } 1462 } 1463 else 1464 { 1465 foreach( $myj_val as $myj_v ) 1466 { 1467 if( strpos( $myj_v, $filtervalue ) !== false ) 1468 { 1469 $addhost = 1; 1470 continue; 1471 } 1472 } 1473 } 1474 if( strpos( $myjob, $filtervalue ) !== false ) 1475 { 1476 $addhost = 1; 1477 continue; 1478 } 1479 } 1452 $filter_checks['query'] = true; 1480 1453 } 1481 1454 } 1482 1455 } 1483 } 1484 } 1485 } 1486 else 1487 { 1488 $addhost = 0; 1489 } 1490 } 1491 1492 if( $addhost ) 1456 else 1457 { 1458 if( strpos( $myj_v, $filtervalue ) !== false ) 1459 { 1460 $filter_checks['query'] = true; 1461 } 1462 } 1463 } 1464 } 1465 if( $filtername != 'host' ) 1466 { 1467 if( $jobs[$myjob][$filtername] == $filtervalue ) 1468 { 1469 $filter_checks[$filtername] = true; 1470 } 1471 } 1472 } 1473 } 1474 1475 $addhost = true; 1476 1477 foreach( $filter_checks as $c_filtername => $c_filterfound ) 1478 { 1479 if( ! $c_filterfound ) 1480 { 1481 $addhost = false; 1482 } 1483 } 1484 1485 if( $addhost == true ) 1493 1486 { 1494 1487 $filtered_nodes[] = $hostname;
Note: See TracChangeset
for help on using the changeset viewer.