Commit fbb83b47 authored by Leigh Stoller's avatar Leigh Stoller

Add the ability to hide runs if they are deemed uninteresting. I did not

deal with the issue of what a hidden run means when doing a replay, cause
more generally, replay needs a lot of work.
parent 59fccafa
......@@ -571,6 +571,7 @@ CREATE TABLE `experiment_runs` (
`start_time` datetime default NULL,
`stop_time` datetime default NULL,
`swapmod` tinyint(1) NOT NULL default '0',
`hidden` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`exptidx`,`idx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
......@@ -4011,3 +4011,8 @@ last_net_act,last_cpu_act,last_ext_act);
`current_tag` varchar(64) default NULL;
alter table archive_tags add `version` tinyint(1)
default '0' after tagtype;
4.121: Add a hidden bit to the runs table.
alter table experiment_runs add hidden tinyint(1) NOT NULL default '0';
......@@ -21,6 +21,7 @@ $isadmin = ISADMIN();
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE);
$optargs = OptionalPageArguments("showhidden", PAGEARG_BOOLEAN);
$template = $instance->GetTemplate();
# Need these below.
$guid = $template->guid();
......@@ -28,6 +29,11 @@ $vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
# Default to not showing hidden
if (!isset($showhidden)) {
$showhidden = 0;
}
if (! $template->AccessCheck($this_user, $TB_EXPT_READINFO)) {
USERERROR("You do not have permission to view experiment template ".
"$guid/$version!", 1);
......@@ -61,7 +67,7 @@ echo "</script>\n";
echo $instance->PageHeader();
echo "<br><br>\n";
$instance->Show(1, 1);
$instance->Show(1, 1, $showhidden);
#
# Standard Testbed Footer
......
......@@ -633,7 +633,7 @@ class Template
echo " <a NAME=$idx></a>\n";
echo "<td>&nbsp</td>\n";
echo " <td colspan=4>\n";
$instance->ShowRunList(0);
$instance->ShowRunList(0, 0);
echo " </td>\n";
echo "</tr>\n";
}
......@@ -1112,7 +1112,7 @@ class TemplateInstance
#
# Show an instance.
#
function Show($detailed, $withanno = 0) {
function Show($detailed, $withanno = 0, $showhidden = 0) {
$exptidx = $this->exptidx();
$runidx = $this->runidx();
$guid = $this->guid();
......@@ -1141,6 +1141,13 @@ class TemplateInstance
$showexp_url = CreateURL("showexp", $this->experiment);
}
# If there are hidden runs, then add an option to show them
$query_result =
DBQueryFatal("select count(*) from experiment_runs ".
"where exptidx='$exptidx' and hidden!=0");
$row = mysql_fetch_array($query_result);
$numhidden = $row[0];
if ($detailed) {
SUBPAGESTART();
SUBMENUSTART("Options");
......@@ -1156,6 +1163,15 @@ class TemplateInstance
WRITESUBMENUBUTTON("Replay",
CreateURL("swapin", $template,
"replay_instance_idx", $exptidx));
if ($numhidden) {
$tag = ($showhidden ? "Hide" : "Show");
$val = ($showhidden ? 0 : 1);
WRITESUBMENUBUTTON("$tag Hidden Runs",
CreateURL("instance_show", $this,
"showhidden", $val));
}
SUBMENUEND();
}
......@@ -1234,7 +1250,7 @@ class TemplateInstance
}
if ($detailed) {
$this->ShowRunList(1);
$this->ShowRunList(1, $showhidden);
}
echo "</center>\n";
......@@ -1412,7 +1428,7 @@ class TemplateInstance
#
# Show the run list for an instance.
#
function ShowRunList($withheader) {
function ShowRunList($withheader, $showhidden) {
$exptidx = $this->exptidx();
$guid = $this->guid();
$vers = $this->vers();
......@@ -1447,6 +1463,7 @@ class TemplateInstance
$exptidx = $rrow['exptidx'];
$start_tag = $rrow['starting_archive_tag'];
$end_tag = $rrow['ending_archive_tag'];
$hidden = $rrow['hidden'];
$description = $rrow['description'];
$onmouseover = "";
......@@ -1454,6 +1471,9 @@ class TemplateInstance
$stop = "&nbsp";
}
if ($hidden && !$showhidden)
continue;
if (isset($description) && $description != "") {
$onmouseover = MakeMouseOver($description);
if (strlen($description) > 30) {
......@@ -1645,6 +1665,21 @@ class TemplateInstance
return (mysql_num_rows($query_result) ? 0 : 1);
}
#
# Set/Clear the hidden bit.
#
function SetRunHidden($runidx, $hidden) {
$exptidx = $this->exptidx();
$runidx = addslashes($runidx);
$hidden = ($hidden ? 1 : 0);
$query_result =
DBQueryFatal("update experiment_runs set hidden=$hidden ".
"where exptidx='$exptidx' and idx='$runidx'");
return 0;
}
#
# Show details for an experiment run
#
......@@ -1671,6 +1706,7 @@ class TemplateInstance
$start_tag = $row['starting_archive_tag'];
$end_tag = $row['ending_archive_tag'];
$description = $row['description'];
$hidden = $row['hidden'];
# Run descriptions are metatdata that can be changed.
# But use a naming convention.
......@@ -1689,6 +1725,17 @@ class TemplateInstance
CreateURL("record_revise",
$this, "runidx", $runidx));
if ($hidden) {
WRITESUBMENUBUTTON("UnHide Record",
CreateURL("toggle", $this, "runidx", $runidx,
"type", "hiderun", "value", 0));
}
else {
WRITESUBMENUBUTTON("Hide Record",
CreateURL("toggle", $this, "runidx", $runidx,
"type", "hiderun", "value", 1));
}
if (isset($end_tag) && $end_tag != "") {
WRITESUBMENUBUTTON("View Archive",
CreateURL("archive_view",
......@@ -1714,6 +1761,9 @@ class TemplateInstance
ShowItem("Instance",
MakeLink("instance", "instance=$exptidx", "$exptidx"));
ShowItem("ID", $runidx);
if ($hidden) {
ShowItem("Hidden", "<font color=red>Yes</font>");
}
if ($description && $description != "") {
$onmouseover = MakeMouseOver($description);
......
......@@ -24,7 +24,7 @@ $isadmin = ISADMIN();
# List of valid toggles
$toggles = array("adminon", "webfreeze", "cvsweb", "lockdown", "stud",
"cvsrepo_public", "workbench");
"cvsrepo_public", "workbench", "hiderun");
# list of valid values for each toggle
$values = array("adminon" => array(0,1),
......@@ -33,7 +33,8 @@ $values = array("adminon" => array(0,1),
"stud" => array(0,1),
"lockdown" => array(0,1),
"cvsrepo_public" => array(0,1),
"workbench" => array(0,1));
"workbench" => array(0,1),
"hiderun" => array(0,1));
# list of valid extra variables for the each toggle, and mandatory flag.
$optargs = array("adminon" => array(),
......@@ -42,7 +43,8 @@ $optargs = array("adminon" => array(),
"stud" => array("user" => 1),
"lockdown" => array("pid" => 1, "eid" => 1),
"cvsrepo_public" => array("pid" => 1),
"workbench" => array("pid" => 1));
"workbench" => array("pid" => 1),
"hiderun" => array("instance" => 1, "runidx" => 1));
# Mandatory page arguments.
$reqargs = RequiredPageArguments("type", PAGEARG_STRING,
......@@ -159,6 +161,15 @@ elseif ($type == "workbench") {
$zapurl = CreateURL("showproject", $project);
$project->SetAllowWorkbench($value);
}
elseif ($type == "hiderun") {
RequiredPageArguments("instance", PAGEARG_INSTANCE,
"runidx", PAGEARG_INTEGER);
if (! $instance->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to modify this instance", 1);
}
$instance->SetRunHidden($runidx, $value);
}
else {
USERERROR("Nobody has permission to toggle $type!", 1);
}
......
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