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