Ignore:
Timestamp:
06/02/05 15:12:32 (19 years ago)
Author:
bastiaans
Message:

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

  • Setup javascript for multiple filters
  • Cosmetic updates

web/addons/toga/index.php:

  • Rearranged filter order

web/addons/toga/overview.php:

  • Changed for multiple filters
  • Cosmetic updates

web/addons/toga/image.php:

  • Changed for multiple filters

web/addons/toga/libtoga.php:

  • Changed filterNodes() for multiple filters
File:
1 edited

Legend:

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

    r122 r124  
    156156        }
    157157
     158        function getCpus() {
     159                $handler = $this->xmlhandler;
     160                return $handler->getCpus();
     161        }
     162
    158163        function getJobs() {
    159164                $handler = $this->xmlhandler;
     
    176181                $nodes = array();
    177182                $heartbeat = array();
     183        }
     184
     185        function getCpus() {
     186
     187                $cpus = 0;
     188
     189                foreach( $this->jobs as $jobid=>$jobattrs ) {
     190
     191                        $nodes = count( $jobattrs[nodes] );
     192                        $ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
     193                        $mycpus = $nodes * $ppn;
     194
     195                        $cpus = $cpus + $mycpus;
     196                }
    178197        }
    179198
     
    485504
    486505        var $dataget, $image, $clustername;
    487         var $filtername, $filtervalue;
     506        var $filtername, $filters;
    488507
    489508        function ClusterImage( $clustername ) {
     
    491510                $this->dataget = new DataGatherer();
    492511                $this->clustername = $clustername;
    493                 $this->filtername = null;
    494                 $this->filtervalue = null;
     512                $this->filters = array();
    495513        }
    496514
    497515        function setFilter( $filtername, $filtervalue ) {
    498516
     517                //printf("filter %s = %s\n", $filtername, $filtervalue );
    499518                //printf( "filter set to %s = %s\n", $filtername, $filtervalue );
    500                 $this->filtername = $filtername;
    501                 $this->filtervalue = $filtervalue;
     519                $this->filters[$filtername] = $filtervalue;
     520                //print_r($this->filters);
    502521        }
    503522
     
    508527                foreach( $nodes as $node ) {
    509528
    510                         $mynjobs = $node->getJobs();
    511529                        $hostname = $node->getHostname();
    512530
    513                         if( $this->filtername ) {
    514                                 foreach( $mynjobs as $myjob )
    515 
    516                                         if( $this->filtername == 'jobid' && $node->hasJob( $this->filtervalue) )
    517                                                 $filtered_nodes[] = $hostname;
    518                                         else if( $jobs[$myjob][$this->filtername] == $this->filtervalue  && !in_array( $hostname, $filtered_nodes  ) )
    519                                                 $filtered_nodes[] = $hostname;
    520                         } else
     531                        $addhost = 1;
     532
     533                        if( count( $this->filters ) > 0 ) {
     534
     535                                $mynjobs = $node->getJobs();
     536
     537                                if( count( $mynjobs ) > 0 ) {
     538
     539                                        foreach( $mynjobs as $myjob ) {
     540
     541                                                foreach( $this->filters as $filtername => $filtervalue ) {
     542
     543                                                        //printf("filter bla %s = %s\n", $filtername,$filtervalue );
     544
     545                                                        if( $filtername!=null && $filtername!='' ) {
     546
     547                                                                if( $filtername == 'jobid' && !$node->hasJob( $filtervalue) ) {
     548                                                                        $addhost = 0;
     549                                                                        //printf("host %s has no job %s\n", $hostname, $filtervalue);
     550                                                                } else if( $filtername != 'jobid' ) {
     551                                                                        //printf("myjob is %s\n", $myjob );
     552                                                                        if( $jobs[$myjob][$filtername] != $filtervalue ) {
     553                                                                                //printf("host %s has no job with %s=%s\n", $hostname, $filtername, $filtervalue);
     554                                                                                $addhost = 0;
     555                                                                        }
     556                                                                }
     557                                                        }
     558                                                }
     559                                        }
     560                                } else
     561                                        $addhost = 0;
     562                        }
     563
     564                        if( $addhost )
    521565                                $filtered_nodes[] = $hostname;
    522566                }
     
    526570
    527571        function draw() {
     572
     573                //printf("stopt met uitvoer");
     574                //return;
    528575
    529576                global $SMALL_CLUSTERIMAGE_MAXWIDTH, $SMALL_CLUSTERIMAGE_NODEWIDTH;
Note: See TracChangeset for help on using the changeset viewer.