Ops: improve manage_apps.php

- hide deprecated apps by default
- show adaptive replication setting per app
This commit is contained in:
Christian Beer 2016-06-24 14:58:25 +02:00
parent c56f284904
commit 5a3c5c9542
1 changed files with 31 additions and 7 deletions

View File

@ -34,6 +34,9 @@ function do_updates() {
$n = post_int("homogeneous_redundancy"); $n = post_int("homogeneous_redundancy");
$app->update("homogeneous_redundancy=$n"); $app->update("homogeneous_redundancy=$n");
$n = post_int("target_nresults");
$app->update("target_nresults=$n");
$n = post_str("homogeneous_app_version", true)?1:0; $n = post_str("homogeneous_app_version", true)?1:0;
$app->update("homogeneous_app_version=$n"); $app->update("homogeneous_app_version=$n");
@ -73,11 +76,21 @@ function add_app() {
"; ";
} }
function show_form() { function show_form($show_deprecated) {
echo " echo "
<h2>Edit applications</h2> <h2>Edit applications</h2>
"; ";
$app_clause="deprecated=0";
$action_url="manage_apps.php";
if($show_deprecated) {
$app_clause = "";
$action_url="manage_apps.php?show_deprecated=1";
echo "<a href=\"manage_apps.php\">hide deprecated apps</a>";
} else {
echo "<a href=\"manage_apps.php?show_deprecated=1\">show deprecated apps</a>";
}
start_table(); start_table();
table_header( table_header(
"ID", "ID",
@ -86,6 +99,7 @@ function show_form() {
"weight<br><a href=https://boinc.berkeley.edu/trac/wiki/BackendPrograms#feeder><p class=\"text-muted\">details</p></a>", "weight<br><a href=https://boinc.berkeley.edu/trac/wiki/BackendPrograms#feeder><p class=\"text-muted\">details</p></a>",
"shmem items", "shmem items",
"HR type<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy><p class=\"text-muted\">details</p></a>", "HR type<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy><p class=\"text-muted\">details</p></a>",
"Adaptive replication<br><a href=http://boinc.berkeley.edu/trac/wiki/AdaptiveReplication><p class=\"text-muted\">details</p></a>",
"homogeneous app version?<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousAppVersion><p class=\"text-muted\">details</p></a>", "homogeneous app version?<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousAppVersion><p class=\"text-muted\">details</p></a>",
"deprecated?", "deprecated?",
"Non-CPU-intensive?", "Non-CPU-intensive?",
@ -100,7 +114,7 @@ function show_form() {
$swi = 100; $swi = 100;
} }
$apps = BoincApp::enum(""); $apps = BoincApp::enum($app_clause);
$i = 0; $i = 0;
foreach ($apps as $app) { foreach ($apps as $app) {
// grey-out deprecated versions // grey-out deprecated versions
@ -109,7 +123,7 @@ function show_form() {
$f1 = "<font color='GREY'>"; $f1 = "<font color='GREY'>";
$f2 = "</font>"; $f2 = "</font>";
} }
echo "<tr class=row$i><form action=manage_apps.php method=POST>"; echo "<tr class=row$i><form action=$action_url method=POST>";
$i = 1-$i; $i = 1-$i;
echo "<input type=hidden name=id value=$app->id>"; echo "<input type=hidden name=id value=$app->id>";
echo " <TD align='center'>$f1 $app->id $f2</TD>\n"; echo " <TD align='center'>$f1 $app->id $f2</TD>\n";
@ -133,6 +147,11 @@ function show_form() {
<input name='homogeneous_redundancy' value='$v'></TD> <input name='homogeneous_redundancy' value='$v'></TD>
"; ";
$v = $app->target_nresults;
echo " <TD align='center'>
<input name='target_nresults' value='$v'></TD>
";
$v = ''; $v = '';
if ($app->homogeneous_app_version) $v=' CHECKED '; if ($app->homogeneous_app_version) $v=' CHECKED ';
echo " <TD align='center'> echo " <TD align='center'>
@ -162,8 +181,11 @@ function show_form() {
echo " <TD align='center'> echo " <TD align='center'>
<input name='fraction_done_exact' type='checkbox' $v></TD> <input name='fraction_done_exact' type='checkbox' $v></TD>
"; ";
if (!in_rops()) {
echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update>"; echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update>";
} else {
echo "<td>&nbsp;";
}
echo "</tr></form>"; echo "</tr></form>";
} }
@ -179,7 +201,7 @@ function show_form() {
('user friendly name') below. You can then edit the ('user friendly name') below. You can then edit the
application when it appears in the table above. application when it appears in the table above.
<p> <p>
<form action=manage_apps.php method=POST> <form action=$action_url method=POST>
"; ";
start_table("align='center' "); start_table("align='center' ");
@ -199,12 +221,14 @@ function show_form() {
admin_page_head("Manage applications"); admin_page_head("Manage applications");
$show_deprecated = get_int('show_deprecated', true);
if (post_str('add_app', true)) { if (post_str('add_app', true)) {
add_app(); add_app();
} else if (post_str('submit', true)) { } else if (post_str('submit', true)) {
do_updates(); do_updates();
} }
show_form(false); show_form($show_deprecated);
admin_page_tail(); admin_page_tail();
?> ?>