From 82c67f2bb1d48228f0ea3f60ee4bc95368ecda94 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 1 Jul 2003 05:38:42 +0000 Subject: [PATCH] admin interface to DB svn path=/trunk/boinc/; revision=1623 --- checkin_notes | 11 +++ html/ops/db.inc | 130 ++++++++++++++++++++++++++++-------- html/ops/index.php | 16 ++--- html/ops/result_summary.php | 21 +++++- test/test.inc | 1 - 5 files changed, 140 insertions(+), 39 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1a42923151..ad38c80120 100755 --- a/checkin_notes +++ b/checkin_notes @@ -5157,3 +5157,14 @@ Karl 2003/06/30 update_stats.C validate.C validate_test.C + +David June 30 2003 + - change the admin interface to the DB + + html_ops/ + db.inc + db_action.php (new) + db_form.php (new) + index.php + result_summary.php + util.inc diff --git a/html/ops/db.inc b/html/ops/db.inc index 27b18d2970..220c1aef8c 100644 --- a/html/ops/db.inc +++ b/html/ops/db.inc @@ -26,17 +26,62 @@ 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; +function result_server_state_select() { + echo " + \n"; +} + +function result_outcome_select() { + echo " + \n"; +} + +function result_client_state_select() { + echo " + \n"; +} + +function result_sort_select() { + echo " + + "; +} + +function table_title($table) { + switch($table) { + case "platform": return "Platforms"; + case "app": return "Applications"; + case "app_version": return "Application Versions"; + case "host": return "Hosts"; + case "workunit": return "Workunits"; + case "result": return "Results"; + case "team": return "Teams"; + case "user": return "Users"; + default: return "????"; } - printf( - "

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

\n" - ); } function show_platform($platform) { @@ -45,7 +90,7 @@ function show_platform($platform) { row("Created", time_str($platform->create_time)); row("Name", $platform->name); row("User friendly name", $platform->user_friendly_name); - row("","id>App versions for this platform"); + row("","id>App versions for this platform"); end_table(); } @@ -54,8 +99,8 @@ function show_app($app) { row("ID", $app->id); row("Created", time_str($app->create_time)); row("Name", $app->name); - row("","id>App Versions for this application"); - row("","id>Workunits for this application"); + row("","id>App Versions for this application"); + row("","id>Workunits for this application"); end_table(); } @@ -63,9 +108,9 @@ 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("Application", "appid>" . app_name_by_id($app_version->appid) . ""); + 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) . "" ); + row("Platform", "platformid>" . platform_name_by_id($app_version->platformid) . "" ); if ($show_xml_docs) { row("XML doc", "

".htmlspecialchars($app_version->xml_doc)."
"); } @@ -116,6 +161,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"); end_table(); } @@ -152,7 +198,7 @@ function show_workunit($wu,$show_xml_doc) { if ($show_xml_doc) { row("XML doc", "
".htmlspecialchars($wu->xml_doc)."
"); } - row("Application", "appid>" . app_name_by_id($wu->appid) . ""); + row("Application", "appid>" . app_name_by_id($wu->appid) . ""); row("Batch", $wu->batch); row("FP Operations", $wu->rsc_fpops); row("Integer Operations", $wu->rsc_iops); @@ -160,14 +206,14 @@ function show_workunit($wu,$show_xml_doc) { row("Disk Requirement", $wu->rsc_disk); row("Need validate?", $wu->need_validate?"yes":"no"); row("Canonical resultid", - "canonical_resultid>".$wu->canonical_resultid.""); + "canonical_resultid>".$wu->canonical_resultid.""); row("Canonical credit", $wu->canonical_credit); row("Timeout check time", time_str($wu->timeout_check_time)); row("Delay bound", $wu->delay_bound); row("Error mask", wu_error_mask_str($wu->error_mask)); row("File delete state", file_delete_state_str($wu->file_delete_state)); row("Assimilation state", assimilate_state_str($wu->assimilate_state)); - row("","id>Show associated results"); + row("","id>Show associated results"); end_table(); echo "

"; } @@ -179,7 +225,7 @@ function result_server_state_string($s) { case 4: return "In Progress"; case 5: return "Over"; } - return "unknown"; + return "Unknown"; } function result_outcome_string($s) { @@ -190,7 +236,7 @@ function result_outcome_string($s) { case 4: return "No reply"; case 5: return "Didn't need"; } - return "unknown"; + return "Unknown"; } function result_client_state_string($s) { @@ -202,6 +248,7 @@ function result_client_state_string($s) { case 4: return "Uploading"; case 5: return "Done"; } + return "Unknown"; } function validate_state_str($s) { @@ -210,7 +257,7 @@ function validate_state_str($s) { case 1: return "Valid"; case 2: return "Invalid"; } - return "unknown"; + return "Unknown"; } function show_result($result,$show_xml_docs,$show_stderr,$show_times) { @@ -221,11 +268,11 @@ function show_result($result,$show_xml_docs,$show_stderr,$show_times) { row("Received", time_str($result->received_time)); } row("Name", $result->name); - row("Workunit", "workunitid>" . wu_name_by_id($result->workunitid) . "" ); + row("Workunit", "workunitid>" . wu_name_by_id($result->workunitid) . "" ); row("Server state", result_server_state_string($result->server_state)); row("Outcome", result_outcome_string($result->outcome)); row("Client state", result_client_state_string($result->client_state)); - row("Host ID", "hostid>" . host_name_by_id($result->hostid) . ""); + 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) { @@ -244,6 +291,35 @@ function show_result($result,$show_xml_docs,$show_stderr,$show_times) { echo "

"; } +function result_short_header() { + echo " + + ID + WU ID + server state + outcome + client state + host + + "; +} + +function show_result_short($result) { + $ss = result_server_state_string($result->server_state); + $cs = result_client_state_string($result->client_state); + $oc = result_outcome_string($result->outcome); + echo " + + id>$result->id + workunitid>$result->workunitid + $ss + $oc + $cs + hostid>$result->hostid + + "; +} + function show_user($user) { start_table(); row("Created", time_str($user->create_time)); @@ -277,13 +353,13 @@ function team_type_string($s) { function show_team($team) { start_table(); row("ID", $team->id); - row("Team Founder", "userid>" . user_name_by_id($team->userid) . ""); + 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"); + row("", "id>List All Members"); end_table(); } @@ -317,8 +393,8 @@ function platform_name_by_id($plat_id) { return $plat->name; } -function host_name_by_id($host_id) { - $result = mysql_query("select * from host where id = $host_id"); +function host_name_by_id($hostid) { + $result = mysql_query("select * from host where id = $hostid"); $host = mysql_fetch_object($result); if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) return "(blank)"; diff --git a/html/ops/index.php b/html/ops/index.php index 7098e7fd8a..fbb598c6b8 100644 --- a/html/ops/index.php +++ b/html/ops/index.php @@ -10,14 +10,14 @@ echo << Browse database: Result summary, last 24 hours
diff --git a/html/ops/result_summary.php b/html/ops/result_summary.php index 8494404577..b2c2d52fec 100644 --- a/html/ops/result_summary.php +++ b/html/ops/result_summary.php @@ -41,21 +41,36 @@ start_table(); echo "Server state# results\n"; for ($ss=1; $ss<6; $ss++) { - row2(result_server_state_string($ss), $server_state[$ss]);; + if ($server_state[$ss] == 0) { + $x = "0"; + } else { + $x = "".$server_state[$ss].""; + } + row2(result_server_state_string($ss), $x); } end_table(); start_table(); echo "Outcome of 'Over' results# results\n"; for ($ro=0; $ro<6; $ro++) { - row2(result_outcome_string($ro), $outcome[$ro]); + if ($outcome[$ro] == 0) { + $x = "0"; + } else { + $x = "".$outcome[$ro].""; + } + row2(result_outcome_string($ro), $x); } end_table(); start_table(); echo "Client state of 'Client error' results# results\n"; for ($cs=1; $cs<6; $cs++) { - row2(result_client_state_string($cs), $client_state[$cs]); + if ($client_state[$cs] == 0) { + $x = "0"; + } else { + $x = "".$client_state[$cs].""; + } + row2(result_client_state_string($cs), $x); } end_table(); diff --git a/test/test.inc b/test/test.inc index aa6e04a1af..46ee665736 100644 --- a/test/test.inc +++ b/test/test.inc @@ -478,7 +478,6 @@ class Project { $this->copy('html_user/*.html' , 'html_user/'); $this->copy('html_ops/*.php' , 'html_ops/'); $this->copy('html_ops/*.inc' , 'html_ops/'); - // $this->copy('html_ops/*.html' , 'html_ops/'); $this->copy('tools/country_select' , 'html_user/'); if ($this->project_php_file) { $this->copy('html_user/$this->project_php_file', 'html_user/project.inc');