summaryrefslogtreecommitdiff
path: root/buildmaster/build-slaves.php
blob: 2a2f592edd9bf6004bb5d297f934a78ba8f8708f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php

  include "lib/mysql.php";

  $result = mysql_run_query(
    "SELECT" .
    " `build_slaves`.`name`," .
    "`persons`.`name` AS `operator`," .
    "`package_sources`.`pkgbase`," .
    "MAX(`ssh_log`.`date`" .
    ") AS `lc`," .
    "MAX(IF(`ssh_log`.`action`=\"get-assignment\",`ssh_log`.`date`,NULL)" .
    ") AS `bs`," .
    "`build_slaves`.`logged_lines`," .
    "`build_slaves`.`last_action`" .
    " FROM `build_slaves`" .
    " LEFT JOIN `ssh_log` ON" .
    " `ssh_log`.`build_slave`=`build_slaves`.`id`" .
    " JOIN `ssh_keys` ON" .
    " `build_slaves`.`ssh_key`=`ssh_keys`.`id`" .
    " JOIN `persons` ON" .
    " `ssh_keys`.`owner`=`persons`.`id`" .
    " LEFT JOIN `build_assignments` ON" .
    " `build_slaves`.`currently_building`=`build_assignments`.`id`" .
    " LEFT JOIN `package_sources` ON" .
    " `build_assignments`.`package_source`=`package_sources`.`id`" .
    " GROUP BY `build_slaves`.`id`" .
    " ORDER BY `lc`"
  );

?>
<html>
  <head>
    <title>list of build slaves</title>
  </head>
  <body>
<?php
show_warning_on_offline_slave();

  print "<table border=1>\n";
  if ($result->num_rows > 0) {
    print "<tr><th>name</th><th>operator</th><th>currently building</th><th>last connection</th><th>building since</th><th>logged lines</th><th>last action</th></tr>\n";
    while ($row = $result -> fetch_assoc()) {
      foreach ($row as $key => $value) {
        if ($value=="") {
          $row[$key]="&nbsp;";
        }
      }
      print "<tr>";
      print "<td>".$row["name"]."</td>";
      print "<td>".$row["operator"]."</td>";
      print "<td>".$row["pkgbase"]."</td>";
      print "<td>".$row["lc"]."</td>";
      print "<td>".$row["bs"]."</td>";
      print "<td>".$row["logged_lines"]."</td>";
      print "<td>".$row["last_action"]."</td>";
      print "</tr>\n";
    }
  }
  print "</table>\n";

?>
</body></html>