IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30948


Ignore:
Timestamp:
Mar 17, 2011, 3:11:29 PM (15 years ago)
Author:
rhenders
Message:

Added pending postage stamp request table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/czartool_labels.php

    r30943 r30948  
    1313
    1414$gpc1db = dbconnect($ID['proj']);
     15
    1516
    1617$PATH = getenv("PATH");
     
    211212     echo "</td>\n";
    212213     echo "<td>\n";
    213       createDatesTable($czardb);
     214
     215      echo "<table>\n";
     216       echo "<tr>\n";
     217         echo "<td>\n";
     218          createDatesTable($czardb);
     219         echo "</td>\n";
     220       echo "</tr>\n";
     221       echo "<tr>\n";
     222         echo "<td>\n";
     223          createPStampDataTable();
     224         echo "</td>\n";
     225       echo "</tr>\n";
     226       echo "<tr>\n";
     227         echo "<td>\n";
     228               if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);
     229         echo "</td>\n";
     230       echo "</tr>\n";
     231       echo "<tr>\n";
     232         echo "<td>\n";
     233          # This is awful
     234          echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
     235          echo "<tr>";
     236          echo "<th colspan=\"2\">Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)</th>";
     237          echo "<tr>";
     238          echo "<th>Database</th>";
     239          echo "<th>Status</th>";
     240          showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
     241          showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
     242          showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
     243          echo "</table>";
     244         echo "</td>\n";
     245       echo "</tr>\n";
     246      echo "</table>\n";
     247
    214248     echo "</td>\n";
    215249    echo "</tr>\n";
     
    218252 echo "</tr>\n";
    219253
    220  # 5th row
    221  echo "<tr>\n";
    222   echo "<td>\n";
    223    echo "<table>\n";
    224     echo "<tr valign=top>\n";
    225      echo "<td> \n";
    226       if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);
    227      echo "</td>\n";
    228      echo "<td>\n";
    229       # This is awful
    230       echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
    231       echo "<tr>";
    232       echo "<th colspan=\"2\">Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)</th>";
    233       echo "<tr>";
    234       echo "<th>Database</th>";
    235       echo "<th>Status</th>";
    236       showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
    237       showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
    238       showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
    239       echo "</table>";
    240      echo "</td>\n";
    241     echo "</tr>\n";
    242    echo "</table>\n";
    243   echo "</td> \n";
    244  echo "</tr>\n";
    245 
    246254echo "</table>\n";
    247255
    248256menu_end();
    249257
     258
     259###########################################################################
     260#
     261# Creates a postage stamp status table
     262#
     263###########################################################################
     264function createPStampDataTable() {
     265
     266    $sql = "SELECT label, COUNT(job_id) AS 'Unfinished Jobs', IFNULL(priority,10000) AS priority FROM pstampRequest JOIN pstampJob USING(req_id) LEFT JOIN Label USING(label) WHERE pstampJob.state ='run' and pstampRequest.state ='run' GROUP by label";
     267
     268    $pstampdb = DB::connect("mysql://ippuser:ippuser@ippc17/ippRequestServer");
     269    $qry = $pstampdb->query($sql);
     270    if (dberror($qry)) {
     271        echo "<b>error reading pstamp table</b><br>\n";
     272        echo "<br><small><b> table query : $sql </b></small><br>\n";
     273        menu_end();
     274    }
     275
     276    // set up the table
     277    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
     278    echo "<tr>";
     279    echo "<th colspan=\"3\">Postage stamp requests</th>";
     280    echo "<tr>";
     281    echo "<th>Label</th>";
     282    echo "<th>Unfinished jobs</th>";
     283    echo "<th>Priority</th>";
     284
     285    // list the results
     286    while ($qry->fetchInto($row)) {
     287
     288        echo "<tr>";
     289
     290        echo "<td>$row[0]</td>";
     291        echo "<td>$row[1]</td>";
     292        echo "<td>$row[2]</td>";
     293       
     294        echo "</tr>";
     295    }
     296
     297    echo "</table>\n";
     298
     299}
    250300
    251301###########################################################################
     
    886936        echo "<tr><td>$replDatabaseName</td><td bgcolor=\"red\">MySQL DB connection error - check configuration</td></tr>";
    887937        //die("MySQL DB connection error: Check the configuration for $replDatabaseName");
    888         #die("");
     938        die("");
    889939        return;
    890940
Note: See TracChangeset for help on using the changeset viewer.