Web UI uses new name calc_reliability_string() rather than old calc_reliability()
[irspy-moved-to-github.git] / web / htdocs / details / found.mc
index dc7caee..0f44196 100644 (file)
@@ -1,4 +1,4 @@
-%# $Id: found.mc,v 1.30 2007-05-03 14:15:56 mike Exp $
+%# $Id: found.mc,v 1.33 2009-04-15 18:16:46 wosch Exp $
 <%once>
 sub print_navlink {
     my($params, $cond, $caption, $skip) = @_;
@@ -19,26 +19,11 @@ sub navlink {
     return $url;
 }
 
-# Identical to the same-named function in full.mc
-# So maybe this should go into IRSpy::Utils.pm?
-#
-sub calc_reliability {
-    my($xc) = @_;
-
-    my @allpings = $xc->findnodes("i:status/i:probe");
-    my $nall = @allpings;
-    return "[untested]" if $nall == 0;
-    my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
-    my $nok = @okpings;
-    return "$nok/$nall = " . int(100*$nok/$nall) . "%";
-}
-
-
 # Just make this once; forge the connection on first use
 our $conn = undef;
 </%once>
 <%perl>
-my %params = map { ( $_, utf8param($r, $_)) } grep { $r->param($_) } $r->param();
+my %params = map { ( $_, utf8param($r, $_)) } grep { &utf8param($r, $_) } &utf8param($r);
 my $query;
 if ($params{_query}) {
     $query = $params{_query};
@@ -71,6 +56,7 @@ if (!defined $conn) {
   OPEN:
     $conn = new ZOOM::Connection("localhost:8018/IR-Explain---1");
     $conn->option(elementSetName => "zeerex");
+    $conn->option(count => 20);
 }
 
 my $rs;
@@ -115,7 +101,7 @@ print_navlink(\%params, $last < $n, "Next", $skip+$count);
       <tr class="thleft">
        <th>#</th>
        <th>Title</th>
-       <th>Reliability <& /help/link.mc, help => "info/reliability" &>
+       <th>Host Connection Reliability <& /help/link.mc, help => "info/reliability" &>
        </th>
        <th>Host</th>
        <th>Port</th>
@@ -124,11 +110,12 @@ print_navlink(\%params, $last < $n, "Next", $skip+$count);
        <th></th>
       </tr>
 % my @ids;
+% $rs->records($first-1, $last-$first+1); ## Force pre-cache
 % foreach my $i ($first .. $last) {
 <%perl>
 my $xc = irspy_xpath_context($rs->record($i-1));
 my $title = $xc->find("e:databaseInfo/e:title") || "[UNTITLED]";
-my $reliability = calc_reliability($xc);
+my $reliability = calc_reliability_string($xc);
 my $host = $xc->find("e:serverInfo/e:host");
 my $port = $xc->find("e:serverInfo/e:port");
 my $db = $xc->find("e:serverInfo/e:database");