Commit 27cdff23 authored by Chad Barb's avatar Chad Barb

Added "thumbnail view" to Experiment List page.
Added thumbnail rendering to renderer.

Note that thumbnail view is not available when viewing the idle list.

Also, loading thumbnails for "all" as admin takes a while!
parent ba2dc611
...@@ -15,10 +15,10 @@ use Getopt::Std; ...@@ -15,10 +15,10 @@ use Getopt::Std;
sub usage() sub usage()
{ {
print STDOUT print STDOUT
"Usage: dbvistoplogy [-o <outputfile>] [-z <zoomfactor>] [-d <detaillevel>] <pid> <eid>\n"; "Usage: dbvistoplogy [-o <outputfile>] [-t <thumbsize> ] [-z <zoomfactor>] [-d <detaillevel>] <pid> <eid>\n";
exit(-1); exit(-1);
} }
my $optlist = "o:z:d:"; my $optlist = "o:z:d:t:";
# #
# Configure variables # Configure variables
...@@ -37,6 +37,7 @@ my $render = "$TB/libexec/vis/render"; ...@@ -37,6 +37,7 @@ my $render = "$TB/libexec/vis/render";
my $output; my $output;
my $zoom; my $zoom;
my $detail; my $detail;
my $thumb;
# #
# Turn off line buffering on output # Turn off line buffering on output
...@@ -63,6 +64,17 @@ if (@ARGV != 2) { ...@@ -63,6 +64,17 @@ if (@ARGV != 2) {
my $pid = $ARGV[0]; my $pid = $ARGV[0];
my $eid = $ARGV[1]; my $eid = $ARGV[1];
if (defined($options{"t"})) {
$thumb = $options{"t"};
if ($thumb =~ /^([0-9]+)$/) {
$thumb = $1;
}
else {
die("Bad data in thumbnail size: $thumb");
}
}
if (defined($options{"o"})) { if (defined($options{"o"})) {
$output = $options{"o"}; $output = $options{"o"};
...@@ -138,6 +150,10 @@ if (defined($detail)) { ...@@ -138,6 +150,10 @@ if (defined($detail)) {
$args .= "-d $detail "; $args .= "-d $detail ";
} }
if (defined($thumb)) {
$args .= "-t $thumb ";
}
$args .= "$pid $eid "; $args .= "$pid $eid ";
if (defined($output)) { if (defined($output)) {
......
This diff is collapsed.
...@@ -27,16 +27,19 @@ if (! isset($showtype)) ...@@ -27,16 +27,19 @@ if (! isset($showtype))
$showtype="active"; $showtype="active";
if (! isset($sortby)) if (! isset($sortby))
$sortby = "normal"; $sortby = "normal";
if (! isset($thumb))
$thumb = 0;
echo "<b>Show: echo "<b>Show:
<a href='showexp_list.php3?showtype=active&sortby=$sortby'>active</a>, <a href='showexp_list.php3?showtype=active&sortby=$sortby&thumb=$thumb'>active</a>,
<a href='showexp_list.php3?showtype=batch&sortby=$sortby'>batch</a>,"; <a href='showexp_list.php3?showtype=batch&sortby=$sortby&thumb=$thumb'>batch</a>,";
if ($isadmin) if ($isadmin)
echo "\n<a href='showexp_list.php3?showtype=idle&sortby=$sortby'". echo "\n<a href='showexp_list.php3?showtype=idle&sortby=$sortby&thumb=$thumb'".
">idle</a>,"; ">idle</a>,";
echo "\n <a href='showexp_list.php3?showtype=all&sortby=$sortby'>all</a>. echo "\n <a href='showexp_list.php3?showtype=all&sortby=$sortby&thumb=$thumb'>all</a>.
</b><br><br>\n"; </b><br />\n";
# #
# Handle showtype # Handle showtype
...@@ -69,6 +72,22 @@ else { ...@@ -69,6 +72,22 @@ else {
$active = 1; $active = 1;
} }
if (!$idle) {
if (!$thumb) {
echo "<b><a href='showexp_list.php3?showtype=$showtype&sortby=pid&thumb=1'>".
"Switch to Thumbnail view".
"</a></b><br />";
} else {
echo "<b><a href='showexp_list.php3?showtype=$showtype&sortby=pid&thumb=0'>".
"Switch to List view".
"</a></b><br />";
}
}
echo "<br />\n";
# #
# Handle sortby. # Handle sortby.
# #
...@@ -207,6 +226,57 @@ if (mysql_num_rows($experiments_result)) { ...@@ -207,6 +226,57 @@ if (mysql_num_rows($experiments_result)) {
# #
# Now shove out the column headers. # Now shove out the column headers.
# #
if ($thumb && !$idle) {
echo "<table border=2 cols=0
cellpadding=0 cellspacing=2 align=center><tr>";
$thumbCount = 0;
while ($row = mysql_fetch_array($experiments_result)) {
$pid = $row["pid"];
$eid = $row["eid"];
$huid = $row["expt_head_uid"];
$name = stripslashes($row["expt_name"]);
$date = $row["d"];
if ($idle && ($str=="&nbsp;" || !$pcs)) { continue; }
echo "<td width=33%><img src='top2image.php3?pid=$pid&eid=$eid&thumb=128' align=center><br />\n" .
"<b><a href='showproject.php3?pid=$pid'>$pid</a>/".
"<a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a></b></h4><br />\n".
"<font size=-1>$name</font><br />\n";
# echo "<font size=-2>Using 69 PCs</font>\n";
if ($isadmin) {
$swappable= $row["swappable"];
$swapreq=$row["swap_requests"];
$lastswapreq=$row["lastreq"];
$lastlogin = "";
if ($lastexpnodelogins = TBExpUidLastLogins($pid, $eid)) {
$daysidle=$lastexpnodelogins["daysidle"];
#if ($idle && $daysidle < 1)
# continue;
$lastlogin .= $lastexpnodelogins["date"] . " " .
"(" . $lastexpnodelogins["uid"] . ")";
} elseif ($state=="active") {
$daysidle=$row["lastswap"];
$lastlogin .= "$date Swapped In";
}
# if ($lastlogin=="") { $lastlogin="<td>&nbsp;</td>\n"; }
if ($lastlogin != "") {
echo "<font size=-2>Last Login: $lastlogin</font><br />\n";
}
}
echo "</td>\n";
$thumbcount++;
if (($thumbcount % 3) == 0) { echo "</tr><tr>\n"; }
}
echo "</tr></table>";
} else {
echo "<table border=2 cols=0 echo "<table border=2 cols=0
cellpadding=0 cellspacing=2 align=center> cellpadding=0 cellspacing=2 align=center>
<tr> <tr>
...@@ -361,6 +431,8 @@ if (mysql_num_rows($experiments_result)) { ...@@ -361,6 +431,8 @@ if (mysql_num_rows($experiments_result)) {
} }
echo "</table>\n"; echo "</table>\n";
}
echo "<ol> echo "<ol>
<li><font color=red>Red</font> indicates nodes other than PCs. <li><font color=red>Red</font> indicates nodes other than PCs.
A $idlemark mark by the node count indicates that the A $idlemark mark by the node count indicates that the
......
...@@ -36,10 +36,13 @@ $exp_pid = $pid; ...@@ -36,10 +36,13 @@ $exp_pid = $pid;
# note: one can use is_numeric in php4 instead of ereg. # note: one can use is_numeric in php4 instead of ereg.
if (!isset($zoom) || !ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $zoom)) { $zoom = 1; } if (!isset($zoom) || !ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $zoom)) { $zoom = 1; }
if (!isset($detail) || !ereg("^[0-9]{1,50}$", $detail)) { $detail = 0; } if (!isset($detail) || !ereg("^[0-9]{1,50}$", $detail)) { $detail = 0; }
if (!isset($thumb) || !ereg("^[0-9]{1,50}$", $detail)) { $thumb = 0; }
if ($zoom > 8.0) { $zoom = 8.0; } if ($zoom > 8.0) { $zoom = 8.0; }
if ($zoom <= 0.0) { $zoom = 1.0; } if ($zoom <= 0.0) { $zoom = 1.0; }
if ($thumb > 1024) { $thumb = 1024; }
# #
# Check to make sure this is a valid PID/EID tuple. # Check to make sure this is a valid PID/EID tuple.
# #
...@@ -65,15 +68,18 @@ if (ISADMIN($uid)) { ...@@ -65,15 +68,18 @@ if (ISADMIN($uid)) {
$gid = $exp_pid; $gid = $exp_pid;
} }
# note that we've already ensured that $detail is numeric above. $arguments = "";
if ($detail != 0) { $detailstring = "-d $detail"; } else { $detailstring = ""; }
# note that we've already ensured that $detail and $thumb are numeric above.
if ($detail != 0) { $arguments .= " -d $detail"; }
if ($thumb != 0) { $arguments .= " -t $thumb"; }
# #
# Spit out the image with a content header. # Spit out the image with a content header.
# #
if ($fp = popen("$TBSUEXEC_PATH $uid $gid webvistopology " . if ($fp = popen("$TBSUEXEC_PATH $uid $gid webvistopology " .
"$detailstring -z $zoom $pid $eid", "r")) { "$arguments -z $zoom $pid $eid", "r")) {
header("Content-type: image/png"); header("Content-type: image/png");
fpassthru($fp); fpassthru($fp);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment