source: trunk/web2/addons/job_monarch/image.php @ 550

Last change on this file since 550 was 550, checked in by ramonb, 16 years ago

job_monarch/image.php:

  • fix filter typos

job_monarch/js/jobgrid.js:

  • fixed filter cell click enable/disable check
  • reloading is now a function
  • wil reload both grid and clusterimage now when filters are changed

job_monarch/jobstore.php:

  • set memory limit
  • respect host filter
  • use fqdn setting for nodes
File size: 3.5 KB
Line 
1<?php
2/*
3 *
4 * This file is part of Jobmonarch
5 *
6 * Copyright (C) 2006  Ramon Bastiaans
7 *
8 * Jobmonarch is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Jobmonarch is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 *
22 * SVN $Id: image.php 329 2007-04-22 13:36:26Z bastiaans $
23 */
24
25include_once "./libtoga.php";
26
27if ( !empty( $_GET ) ) {
28        extract( $_GET );
29}
30
31function checkSessionData() {
32
33        global $_SESSION;
34
35        session_start();
36
37        if( isset( $_SESSION["data"] ) ) {
38                $myxml_data     = &$_SESSION["data"];
39        } else {
40                $myxml_data     = 0;
41        }
42
43        if( !$myxml_data ) {
44                $ds             = new DataSource();
45                $myxml_data     = $ds->getData();
46
47                //print_f( "%s\n", $myxml_data );
48        }
49        return $myxml_data;
50}
51
52
53$httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
54$view = $httpvars->getHttpVar( "view" );
55$host = $httpvars->getHttpVar( "host" );
56$clustername = $httpvars->getClusterName();
57
58if( isset($jid) && ($jid!='')) $filter[jid]=$jid;
59if( isset($state) && ($state!='')) $filter[state]=$state;
60if( isset($owner) && ($owner!='')) $filter[owner]=$owner;
61if( isset($queue) && ($queue!='')) $filter[queue]=$queue;
62if( isset($host) && ($host!='')) $filter[host]=$host;
63//printf("host = %s\n", $filter[host] );
64
65function drawHostImage() {
66
67        global $clustername, $hostname, $data_gatherer;
68
69        $ds             = new DataSource();
70        $myxml_data     = $ds->getData();
71
72        $data_gatherer  = new DataGatherer( $clustername );
73
74        $data_gatherer->parseXML( $myxml_data );
75
76        if( $data_gatherer->isJobmonRunning() )
77                $ic = new HostImage( $data_gatherer, $clustername, $hostname );
78        else
79                $ic = new EmptyImage();
80
81        $ic->draw();
82}
83
84function drawSmallClusterImage() {
85
86        global $clustername, $data_gatherer;
87
88        $ds             = new DataSource();
89        $myxml_data     = $ds->getData();
90
91        $data_gatherer  = new DataGatherer( $clustername );
92
93        $data_gatherer->parseXML( $myxml_data );
94
95        if( $data_gatherer->isJobmonRunning() ) {
96                $ic = new ClusterImage( $myxml_data, $clustername );
97                $ic->setSmall();
98        } else {
99                $ic = new EmptyImage();
100        }
101
102        $ic->draw();
103}
104
105function drawBigClusterImage() {
106
107        global $filter, $clustername;
108
109        $myxml_data     = checkSessionData();
110
111        $ic = new ClusterImage( $myxml_data, $clustername );
112        $ic->setBig();
113
114        if( isset( $filter ) ) {
115                foreach( $filter as $filtername=>$filtervalue ) {
116                        //printf("filter %s,%s\n", $filtername, $filtervalue);
117                        switch( $filtername ) {
118
119                                case "jid":
120                                        $ic->setFilter( 'jobid', $filtervalue );
121                                        break;
122                                case "owner":
123                                        $ic->setFilter( 'owner', $filtervalue);
124                                        break;
125                                case "queue":
126                                        $ic->setFilter( 'queue', $filtervalue);
127                                        break;
128                                case "state":
129                                        $ic->setFilter( 'status', $filtervalue);
130                                        break;
131                                case "host":
132                                        $ic->setFilter( 'host', $filtervalue);
133                                        break;
134                                default:
135                                        break;
136                        }
137                }
138        }
139        $ic->draw();
140}
141
142switch( $view ) {
143
144        case "small-clusterimage":
145
146                drawSmallClusterImage();
147               
148                break;
149
150        case "big-clusterimage":
151
152                drawBigClusterImage();
153       
154                break;
155
156        case "hostimage":
157
158                drawHostImage();
159       
160                break;
161
162        default:
163
164                break;
165}
166
167?>
Note: See TracBrowser for help on using the repository browser.