From 3962777cbf8e20c6d643ac5527cc290ffa0e86fc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 1 Jul 2003 18:28:33 +0000 Subject: [PATCH] web DB interface svn path=/trunk/boinc/; revision=1627 --- checkin_notes | 9 +++++++ html/ops/db.inc | 59 +++++++++++++++++++++++++++++++++--------- html/ops/db_action.php | 52 +++++++++++++++++++++++++++++++------ html/ops/db_form.php | 55 +++++++++++++++++++-------------------- html/ops/index.php | 42 ++++++++++++++++-------------- 5 files changed, 149 insertions(+), 68 deletions(-) diff --git a/checkin_notes b/checkin_notes index ad38c80120..81ac67e371 100755 --- a/checkin_notes +++ b/checkin_notes @@ -5168,3 +5168,12 @@ David June 30 2003 index.php result_summary.php util.inc + +David July 1 2003 + - further tweaks to web DB interface + + html_ops/ + db.inc + db_action.php + db_form.php + index.php diff --git a/html/ops/db.inc b/html/ops/db.inc index 220c1aef8c..cd3411c974 100644 --- a/html/ops/db.inc +++ b/html/ops/db.inc @@ -104,14 +104,14 @@ function show_app($app) { end_table(); } -function show_app_version($app_version,$show_xml_docs) { +function show_app_version($app_version, $hide_xml_docs) { start_table(); row("ID", $app_version->id); 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) { + if (!$hide_xml_docs) { row("XML doc", "
".htmlspecialchars($app_version->xml_doc)."
"); } row("Min_core_version", $app_version->min_core_version); @@ -121,9 +121,34 @@ function show_app_version($app_version,$show_xml_docs) { end_table(); } +function host_short_header() { + echo " + + host ID + IP address + name + CPU + OS + + "; +} + +function show_host_short($host) { + echo " + + id>$host->id + $host->last_ip_addr + $host->domain_name + $host->p_vendor $host->p_model + $host->os_name $host->os_version + + "; +} + function show_host($host) { start_table(); + row("ID", $host->id); row("Created", time_str($host->create_time)); row("Venue", $host->venue); row("Total credit", $host->total_credit); @@ -161,7 +186,7 @@ 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." %"); - row("Results", "id>click here"); + row("Results", "id&sort_by=sent_time>click here"); end_table(); } @@ -191,11 +216,11 @@ function file_delete_state_str($s) { } } -function show_workunit($wu,$show_xml_doc) { +function show_workunit($wu, $hide_xml_doc) { start_table(); row("Created", time_str($wu->create_time)); row("Name", $wu->name); - if ($show_xml_doc) { + if (!$hide_xml_doc) { row("XML doc", "
".htmlspecialchars($wu->xml_doc)."
"); } row("Application", "appid>" . app_name_by_id($wu->appid) . ""); @@ -260,9 +285,9 @@ function validate_state_str($s) { return "Unknown"; } -function show_result($result,$show_xml_docs,$show_stderr,$show_times) { +function show_result($result, $hide_xml_docs, $hide_stderr, $hide_times) { start_table(); - if ($show_times) { + if (!$hide_times) { row("Created", time_str($result->create_time)); row("Sent", time_str($result->sent_time)); row("Received", time_str($result->received_time)); @@ -275,11 +300,11 @@ function show_result($result,$show_xml_docs,$show_stderr,$show_times) { row("Host ID", "hostid>" . host_name_by_id($result->hostid) . ""); row("Report deadline", time_str($result->report_deadline)); row("CPU time", $result->cpu_time); - if ($show_xml_docs) { + if (!$hide_xml_docs) { row("XML doc in", "
".htmlspecialchars($result->xml_doc_in)."
"); row("XML doc out", "
".htmlspecialchars($result->xml_doc_out)."
"); } - if ($show_stderr) { + if (!$hide_stderr) { row("stderr out", "
".htmlspecialchars($result->stderr_out)."
"); } row("Batch", $result->batch); @@ -294,7 +319,7 @@ function show_result($result,$show_xml_docs,$show_stderr,$show_times) { function result_short_header() { echo " - ID + result ID WU ID server state outcome @@ -315,13 +340,22 @@ function show_result_short($result) { $ss $oc $cs - hostid>$result->hostid + "; + if ($result->hostid) { + echo " + hostid>$result->hostid + "; + } else { + echo "---\n"; + } + echo " "; } function show_user($user) { start_table(); + row("ID", $user->id); row("Created", time_str($user->create_time)); row("Name", $user->name); row("Authenticator", $user->authenticator); @@ -331,7 +365,8 @@ function show_user($user) { row("Total credit", $user->total_credit); row("Average credit", $user->expavg_credit); row("Last average time", time_str($user->expavg_time)); - row("Venue", $user->venue); + row("Default venue", $user->venue); + row("Hosts", "id&detail=low>click"); end_table(); } diff --git a/html/ops/db_action.php b/html/ops/db_action.php index 9382ef9d39..de80c11d90 100644 --- a/html/ops/db_action.php +++ b/html/ops/db_action.php @@ -16,6 +16,11 @@ function append_sql_query($original,$addition,$first) { $first = 1; + if (strlen($clauses)) { + $query = append_sql_query( $query, $clauses, $first ); + $first = 0; + } + if (strlen($id)) { $query = append_sql_query( $query, "id = $id", $first ); $first = 0; @@ -41,6 +46,11 @@ function append_sql_query($original,$addition,$first) { $first = 0; } + if (strlen($userid)) { + $query = append_sql_query( $query, "userid = $userid", $first ); + $first = 0; + } + if (strlen($team_id)) { $query = append_sql_query( $query, "teamid = $team_id", $first ); $first = 0; @@ -103,7 +113,7 @@ function append_sql_query($original,$addition,$first) { $main_query = "select * from ".$table." ".$query. " limit ".$entries_to_show; } - echo "

Query is: $main_query

\n"; + echo "

Query: $main_query

\n"; echo "

$count database entries match the query. Displaying $start_at to $last.

@@ -112,25 +122,47 @@ function append_sql_query($original,$addition,$first) { $urlquery = urlencode($query); if ($last < $count) { echo " - Next $n + Next $entries_to_show "; } if ($detail == "high") { echo " - Single-line + | Less detail "; } if ($detail == "low") { echo " - Multi-line + | More detail "; } - echo "
Return to main admin page\n"; + echo " | Return to main admin page\n"; + echo "

\n"; + if ($table == "host") { + 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); + $dt = $disk_info->tot_sum/(1024*1024*1024); + $df = $disk_info->free_sum/(1024*1024*1024); + $mt = $disk_info->tot_mem/(1024*1024); + echo "

\n + Sum of total disk space on these hosts: + $dt GB +

+ Sum of available disk space on these hosts: + $df GB +

+ Sum of memory on these hosts: + $mt MB +

+ "; + } + } if ($detail == "low") { start_table(); switch($table) { case "result": result_short_header(); break; + case "host": host_short_header(); break; } } $result = mysql_query($main_query); @@ -138,20 +170,24 @@ function append_sql_query($original,$addition,$first) { if ($detail == "low") { switch ($table) { case "result": show_result_short($res); break; + case "host": show_host_short($res); break; } } else { switch ($table) { case "platform": show_platform($res); break; case "app": show_app($res); break; - case "app_version": show_app_version($res,$show_xml_docs); break; + case "app_version": show_app_version($res, $hide_xml_docs); break; case "host": show_host($res); break; - case "workunit": show_workunit($res,$show_xml_docs); break; - case "result": show_result($res,$show_xml_docs,$show_stderr,$show_times); break; + case "workunit": show_workunit($res, $hide_xml_docs); break; + case "result": show_result($res, $hide_xml_docs, $hide_stderr, $hide_times); break; case "team": show_team($res); break; case "user": show_user($res); break; } } } + if ($detail == "low") { + end_table(); + } page_tail(); ?> diff --git a/html/ops/db_form.php b/html/ops/db_form.php index d5a9815a76..4460ee2e69 100644 --- a/html/ops/db_form.php +++ b/html/ops/db_form.php @@ -6,6 +6,24 @@ parse_str(getenv("QUERY_STRING")); + function print_detail_field() { + echo "Detail level"; + echo " + + "; + } + function print_query_field() { + echo " + + Additional clauses + + + "; + } + $first = 1; $title = table_title($table); @@ -18,26 +36,12 @@ if ($table=="platform") { } else if ($table=="app") { } else if ($table=="app_version") { - print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs); + print_checkbox("Hide XML Docs", "hide_xml_docs", $hide_xml_docs); } else if ($table=="host") { print_checkbox("Show Aggregate Information", "show_aggregate", $show_aggregate); - 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 " . $query); - $disk_info = mysql_fetch_object($result); - printf( "

\n" - . "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" - . "

" - ); - } + print_detail_field(); } else if ($table=="workunit") { - print_checkbox("Show XML fields", "show_xml_docs", $show_xml_docs); + print_checkbox("Hide XML fields", "hide_xml_docs", $hide_xml_docs); } else if ($table=="result") { echo "Server state "; result_server_state_select(); @@ -50,19 +54,14 @@ result_client_state_select(); echo "\n"; - row2("Show XML fields", ""); - row2("Show result stderr", ""); - row2("Show times", ""); + row2("Hide XML fields", ""); + row2("Hide result stderr", ""); + row2("Hide times", ""); echo "Sort by"; result_sort_select(); echo "\n"; - echo "Detail level"; - echo " - - "; + print_detail_field(); + print_query_field(); } else if ($table=="team") { } else if ($table=="user") { @@ -71,7 +70,7 @@ exit(); } - row2("Number of entries to show", ""); + row2("Number of entries to show", ""); row2("", "\n"); end_table(); diff --git a/html/ops/index.php b/html/ops/index.php index fbb598c6b8..eb0a730660 100644 --- a/html/ops/index.php +++ b/html/ops/index.php @@ -4,25 +4,27 @@ require_once("util.inc"); $cgi_url = parse_config(""); -echo <<BOINC Project Management -

BOINC Project Management

-

-Browse database: -

-Result summary, last 24 hours -
-Stripcharts - -EOT; +$w = 7*86400; +echo " + BOINC Project Management +

BOINC Project Management

+

+ Browse database: +

+ Result summary: + last 24 hours + last week +
+ Stripcharts +"; ?>