From ff7205e11bf73eb3f7e028fa3a99a69f7b44c591 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Wed, 28 Aug 2002 20:51:17 +0000 Subject: [PATCH] Basic administrative operational interface svn path=/trunk/boinc/; revision=387 --- html/ops/app.php | 29 +++++ html/ops/app_version.php | 46 ++++++++ html/ops/db.inc | 227 ++++++++++++++++++++++++++------------- html/ops/host.php | 63 +++++++++++ html/ops/index.html | 25 ++++- html/ops/platform.php | 30 ++++++ html/ops/result.php | 109 +++++++++++++++++++ html/ops/team.php | 30 ++++++ html/ops/user.php | 30 ++++++ html/ops/util.inc | 38 ++++++- html/ops/workunit.php | 106 ++++++++++++++++++ 11 files changed, 655 insertions(+), 78 deletions(-) create mode 100755 html/ops/app.php create mode 100755 html/ops/app_version.php create mode 100755 html/ops/host.php create mode 100755 html/ops/platform.php create mode 100755 html/ops/result.php create mode 100755 html/ops/team.php create mode 100755 html/ops/user.php create mode 100755 html/ops/workunit.php diff --git a/html/ops/app.php b/html/ops/app.php new file mode 100755 index 0000000000..f81b6d3149 --- /dev/null +++ b/html/ops/app.php @@ -0,0 +1,29 @@ +Query is: $english_query

"; + + $result = mysql_query($query); + while ($app = mysql_fetch_object($result)) { + show_app($app); + } + + print_page_end(); +?> diff --git a/html/ops/app_version.php b/html/ops/app_version.php new file mode 100755 index 0000000000..4577399243 --- /dev/null +++ b/html/ops/app_version.php @@ -0,0 +1,46 @@ +\n" + . "

\n" + . "" + . "Show XML Docs\n" + . "

\n" + . "\n" + . "" + ); + + echo "

Query is: $english_query

"; + + $result = mysql_query($query); + while ($app_version = mysql_fetch_object($result)) { + show_app_version($app_version,$show_xml_docs); + } + + print_page_end(); +?> diff --git a/html/ops/db.inc b/html/ops/db.inc index 6992f9a1b2..eb7709a3ed 100644 --- a/html/ops/db.inc +++ b/html/ops/db.inc @@ -24,42 +24,59 @@ function lookup_user_auth($auth) { } } +function print_query_count($query, $nres, $start) { + $result = mysql_query($query); + $res = mysql_fetch_object($result); + if ($res->cnt < ($nres+$start)) { + $nres = $res->cnt-$start; + } + printf( + "

\n" + . "$res->cnt database entries match the query. Displaying $start to " . ($start+$nres) . "." + . "

\n" + ); +} + function show_platform($platform) { start_table(); row("ID", $platform->id); - row("created", time_str($platform->create_time)); - row("name", $platform->name); - echo ""; + row("Created", time_str($platform->create_time)); + row("Platform Name", $platform->name); + row("","id>Application Versions for Platform $platform->name "); + end_table(); } function show_app($app) { start_table(); row("ID", $app->id); - row("created", time_str($app->create_time)); - row("name", $app->name); - row("result template", "

".htmlspecialchars($app->result_xml_template)."
"); - echo ""; + row("Created", time_str($app->create_time)); + row("Application Name", $app->name); + row("","id>Application Versions for Application $app->name"); + row("","id>Workunits for this Application"); + end_table(); } -function show_app_version($app_version) { +function show_app_version($app_version,$show_xml_docs) { start_table(); row("ID", $app_version->id); - row("created", time_str($app_version->create_time)); - row("app ID", $app_version->appid); - row("version num", $app_version->version_num); - row("platform ID", $app_version->platformid); - row("XML doc", "
".htmlspecialchars($app_version->xml_doc)."
"); - row("min_core_version", $app_version->min_core_version); - row("max_core_version", $app_version->max_core_version); - row("message", $app_version->message); - row("deprecated", $app_version->deprecated); - echo ""; + row("Created", time_str($app_version->create_time)); + row("Application", "appid>" . app_name_by_id($app_version->appid) . ""); + row("Version num", $app_version->version_num); + row("Platform", "platformid>" . platform_name_by_id($app_version->platformid) . "" ); + if ($show_xml_docs) { + row("XML doc", "
".htmlspecialchars($app_version->xml_doc)."
"); + } + row("Min_core_version", $app_version->min_core_version); + row("Max_core_version", $app_version->max_core_version); + row("Message", $app_version->message); + row("Deprecated", $app_version->deprecated); + end_table(); } function show_host($host) { echo TABLE2."\n"; - echo "Below is information on all the hosts you have running the BOINC core client."; + echo ""; echo "

"; echo "".TD2.LG_FONT."Host Information:\n"; row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); @@ -92,81 +109,145 @@ function show_host($host) { row("% of time client on: ", 100*$host->on_frac." %"); row("% of time host connected: ", 100*$host->connected_frac." %"); row("% of time user active: ", 100*$host->active_frac." %"); - echo "\n"; + row("","id>Results Assigned to Host"); + end_table(); } -function show_workunit($wu) { +function show_workunit($wu,$show_xml_doc) { start_table(); - row("created", time_str($wu->create_time)); - row("name", $wu->name); - row("XML doc", "

".htmlspecialchars($wu->xml_doc)."
"); - row("app ID", $wu->appid); - row("batch", $wu->batch); - row("FP operations", $wu->rsc_fpops); - row("integer operations", $wu->rsc_iops); - row("memory requirement", $wu->rsc_memory); - row("disk requirement", $wu->rsc_disk); - row("dynamic results", $wu->dynamic_results?"yes":"no"); - row("max_results", $wu->max_results); - row("nresults", $wu->nresults); - row("nresults_unsent", $wu->nresults_unsent); - row("nresults_done", $wu->nresults_done); - row("nresults_fail", $wu->nresults_fail); - echo ""; + row4("Created", time_str($wu->create_time), "Name", $wu->name); + if ($show_xml_doc) { + row("XML doc", "
".htmlspecialchars($wu->xml_doc)."
"); + } + row4("Application", "appid>" . app_name_by_id($wu->appid) . "", + "Batch", $wu->batch); + row4("FP Operations", $wu->rsc_fpops, "Integer Operations", $wu->rsc_iops); + row4("Memory Requirement", $wu->rsc_memory, "Disk Requirement", $wu->rsc_disk); + row4("Dynamic Results", $wu->dynamic_results?"yes":"no", "Max Results", $wu->max_results); + row4("Number of Results", $wu->nresults, "Number of Unsent Results", $wu->nresults_unsent); + row4("Number of Results Done", $wu->nresults_done, "Number of Failed Results", + $wu->nresults_fail); + row("","id>Show Associated Results"); + end_table(); + echo "

"; } function res_state_string($s) { switch($s) { - case 1: return "inactive"; - case 2: return "unsent"; - case 3: return "in progress"; - case 4: return "done"; - case 5: return "timeout"; - case 6: return "error"; + case 1: return "Inactive"; + case 2: return "Unsent"; + case 3: return "In Progress"; + case 4: return "Done"; + case 5: return "Timeout"; + case 6: return "Error"; } } -function show_result($result) { +function show_result($result,$show_xml_docs,$show_stderr,$show_times) { start_table(); - row("created", time_str($result->create_time)); - row("name", $result->name); - row("workunit ID", $result->workunitid); - row("state", res_state_string($result->state)); - row("host ID", $result->hostid); - row("sent", time_str($result->sent_time)); - row("received", time_str($result->received_time)); - row("exit status", $result->exit_status); - row("CPU time", $result->cpu_time); - row("XML doc in", "

".htmlspecialchars($result->xml_doc_in)."
"); - row("XML doc out", "
".htmlspecialchars($result->xml_doc_out)."
"); - row("stderr out", "
".htmlspecialchars($result->stderr_out)."
"); - row("batch", $result->batch); - row("validated", $result->validated); - echo ""; + if ($show_times) { + row4("created", time_str($result->create_time), "sent", time_str($result->sent_time)); + row4("received", time_str($result->received_time),"",""); + } + row4("Name", $result->name, "Workunit", + "workunitid>" . wu_name_by_id($result->workunitid) . "" ); + + row4("state", res_state_string($result->state), "Host ID", + "hostid>" . host_name_by_id($result->hostid) . ""); + + row4("Exit Status", $result->exit_status, "CPU time", $result->cpu_time); + if ($show_xml_docs) { + row("XML doc in", "
".htmlspecialchars($result->xml_doc_in)."
"); + row("XML doc out", "
".htmlspecialchars($result->xml_doc_out)."
"); + } + if ($show_stderr) { + row("stderr out", "
".htmlspecialchars($result->stderr_out)."
"); + } + row4("batch", $result->batch, "validated", $result->validated); + end_table(); + echo "

"; } function show_user($user) { start_table(); - row("created", time_str($user->create_time)); - row("total credit", $user->total_credit); - row("recent averaged credit:", $user->expavg_credit); - row("name", $user->name); - row("email address", $user->email_addr); - row("country", $user->country); - row("postal code", $user->postal_code); - echo "\n"; + row("Created", time_str($user->create_time)); + row("Total Credit", $user->total_credit); + row("Recent Averaged Credit:", $user->expavg_credit); + row("Name", $user->name); + row("Email Address", $user->email_addr); + row("Country", $user->country); + row("Postal Code", $user->postal_code); + row("Team", ($user->teamid == 0 ? "None" : "teamid>" . team_name_by_id($user->teamid) . "" )); + row("", "id>User Hosts"); + end_table(); +} + +function team_type_string($s) { + switch ($s) { + case 1: return "Small Company"; + case 2: return "Medium Company"; + case 3: return "Large Company"; + case 4: return "Club"; + case 5: return "Primary School"; + case 6: return "Secondary School"; + case 7: return "Junior College"; + case 8: return "University or Department"; + case 9: return "Government Agency"; + default: return "Unknown"; + } } function show_team($team) { start_table(); row("ID", $team->id); - row("founder", $team->userid); - row("name", $team->name); - row("url", $team->url); - row("type", $team->type); - row("name_html", $team->name_html); - row("description", $team->description); + row("Team Founder", "userid>" . user_name_by_id($team->userid) . ""); + row("Name", $team->name); + row("Name (HTML Formatted)", "

" . htmlspecialchars($team->name_html) . "
" ); + row("Url", "url>" . $team->url . ""); + row("Type", team_type_string($team->type)); + row("Description", $team->description); + row("", "id>List All Members"); + end_table(); +} + +function team_name_by_id($team_id) { + $result = mysql_query("select * from team where id = $team_id"); + $team = mysql_fetch_object($result); + return $team->name; +} + +function user_name_by_id($user_id) { + $result = mysql_query("select * from user where id = $user_id"); + $user = mysql_fetch_object($result); + return $user->name; +} + +function app_name_by_id($app_id) { + $result = mysql_query("select * from app where id = $app_id"); + $app = mysql_fetch_object($result); + return $app->name; +} + +function wu_name_by_id($wu_id) { + $result = mysql_query("select * from workunit where id = $wu_id"); + $wu = mysql_fetch_object($result); + return $wu->name; +} + +function platform_name_by_id($plat_id) { + $result = mysql_query("select * from platform where id = $plat_id"); + $plat = mysql_fetch_object($result); + return $plat->name; +} + +function host_name_by_id($host_id) { + $result = mysql_query("select * from host where id = $host_id"); + $host = mysql_fetch_object($result); + if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) + return "(blank)"; + else + return $host->domain_name . " (" . $host->last_ip_addr . ")"; } ?> diff --git a/html/ops/host.php b/html/ops/host.php new file mode 100755 index 0000000000..c4f25e8fc9 --- /dev/null +++ b/html/ops/host.php @@ -0,0 +1,63 @@ +\n" + . "" + . "Show Aggregate Information\n" + . "

\n" + . "\n" + . "\n" + ); + + if ($show_aggregate) { + $result = mysql_query("select sum(d_total) as tot_sum, " + . "sum(d_free) as free_sum, " + . "sum(m_nbytes) as tot_mem " + . "from host" . $query); + $disk_info = mysql_fetch_object($result); + printf( + "

" + . "Sum of total disk space on these hosts: " + . $disk_info->tot_sum/(1024*1024*1024) . " GB" + . "

" + . "Sum of available disk space on these hosts: " + . $disk_info->free_sum/(1024*1024*1024) . " GB" + . "

" + . "Sum of memory on these hosts: " . $disk_info->tot_mem/(1024*1024) . " MB" + . "

" + ); + } + + echo "

Query is: $english_query

"; + + $result = mysql_query("select * from host" . $query); + while ($host = mysql_fetch_object($result)) { + show_host($host); + } + + print_page_end(); +?> diff --git a/html/ops/index.html b/html/ops/index.html index 3d5d2cdcc1..14acf2156c 100644 --- a/html/ops/index.html +++ b/html/ops/index.html @@ -1 +1,24 @@ -Database contents + + +Operational Interface + + +Project Information +

+Platform Information +

+Application Information +

+Application Version Information +

+User Information +

+Team Information +

+Host Information +

+Workunit Information +

+Result Information + + diff --git a/html/ops/platform.php b/html/ops/platform.php new file mode 100755 index 0000000000..b696a328b0 --- /dev/null +++ b/html/ops/platform.php @@ -0,0 +1,30 @@ +Query is: $english_query

"; + + $result = mysql_query($query); + while ($platform = mysql_fetch_object($result)) { + show_platform($platform); + } + + print_page_end(); +?> diff --git a/html/ops/result.php b/html/ops/result.php new file mode 100755 index 0000000000..4944f37abb --- /dev/null +++ b/html/ops/result.php @@ -0,0 +1,109 @@ +\n" + . "Result State: \n" + . "

\n" + . "Result in Batch: \n" + . "

\n" + . "Result has Exit Code: \n" + . "

\n" + . "Number of Results to Show: \n" + . "

\n" + ); + print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs); + print_checkbox("Show Result stderr", "show_stderr", $show_stderr); + print_checkbox("Show Times", "show_times", $show_times); + printf( "\n" ); + print_submit("Query","new_query"); + print_submit("Show More","show_more"); + + printf( "\n" ); + + echo "

Query is: $english_query

"; + + print_query_count("select count(*) as cnt from result" . $count_query, $results_to_show, $start_at); + + $result = mysql_query($query); + while (($res = mysql_fetch_object($result)) && ($results_to_show > 0)) { + if ($start_at <= 0) { + show_result($res,$show_xml_docs,$show_stderr,$show_times); + $results_to_show--; + } else { + $start_at--; + } + } + + print_page_end(); +?> diff --git a/html/ops/team.php b/html/ops/team.php new file mode 100755 index 0000000000..107c0763f2 --- /dev/null +++ b/html/ops/team.php @@ -0,0 +1,30 @@ +Query is: $english_query

"; + + $result = mysql_query($query); + while ($team = mysql_fetch_object($result)) { + show_team($team); + } + + print_page_end(); +?> diff --git a/html/ops/user.php b/html/ops/user.php new file mode 100755 index 0000000000..03169a01ed --- /dev/null +++ b/html/ops/user.php @@ -0,0 +1,30 @@ +Query is: $english_query

"; + + $result = mysql_query($query); + while ($user = mysql_fetch_object($result)) { + show_user($user); + } + + print_page_end(); +?> diff --git a/html/ops/util.inc b/html/ops/util.inc index aa299bab58..0e877929a1 100644 --- a/html/ops/util.inc +++ b/html/ops/util.inc @@ -62,6 +62,14 @@ function page_tail() { echo "| User Page | Teams | Main Project Page |\n"; } +function append_sql_query($original,$addition,$first) { + if ($first == 1) { + return $original . " where " . $addition; + } else { + return $original . " and " . $addition; + } +} + function date_str($when) { return date("g:i A, l M j", $when); } @@ -72,11 +80,26 @@ function time_str($x) { } function start_table() { - echo ""; + echo "
\n"; +} + +function end_table() { + echo "
\n"; +} + +function print_checkbox($text,$name,$checked) { + echo "" + . "$text\n" + . "

\n"; +} + +function print_submit($text,$name) { + echo "\n"; } function row($x, $y) { - echo "$x$y\n"; + echo "\n$x\n$y\n\n"; } function row2($x, $y) { @@ -87,6 +110,11 @@ function row3($x, $y, $z) { echo "$x$y$z\n"; } +function row4($xx, $xy, $yx, $yy) { + echo "$xx$xy" + . "$yx$yy\n"; +} + function random_string() { return md5(uniqid(rand())); } @@ -100,8 +128,10 @@ function print_page_header($title) { echo "\n"; echo "$title\n"; echo "\n"; - echo "\n"; - echo "

\n"; + echo "\n"; + echo "

$title

\n"; + echo "Return to Main Page\n"; + echo "
\n"; } function print_page_end() { diff --git a/html/ops/workunit.php b/html/ops/workunit.php new file mode 100755 index 0000000000..11bbaffdce --- /dev/null +++ b/html/ops/workunit.php @@ -0,0 +1,106 @@ +\n" + . "Workunits in Batch Number: \n" + . "

" + . "Number of Workunits to Show: \n" + . "

" + . "Number of Results Done: \n" + . "

" + . "Number of Results Failed: \n" + . "

" + . "Number of Results Unsent: \n" + . "

" + ); + + print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs); + printf( "\n" ); + print_submit("Query","new_query"); + print_submit("Show More","show_more"); + + printf( "\n" ); + + echo "

Query is: $english_query

"; + + print_query_count("select count(*) as cnt from workunit" . $count_query, $wus_to_show, $start_at ); + + $result = mysql_query($query); + while (($workunit = mysql_fetch_object($result)) && ($wus_to_show > 0)) { + if ($start_at <= 0) { + show_workunit($workunit,$show_xml_docs); + $wus_to_show--; + } else { + $start_at--; + } + } + + print_page_end(); +?>