Added caching to clearadm
[clearscm.git] / clearadm / vobdetails.cgi
index 89a38d6..420700c 100755 (executable)
@@ -57,6 +57,7 @@ use CGI::Carp 'fatalsToBrowser';
 
 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
 
+use Clearadm;
 use ClearadmWeb;
 use Clearcase;
 use Clearcase::Vob;
@@ -91,6 +92,10 @@ sub DisplayTable ($) {
     -class          => 'main',
   };
 
+  my $clearadm = Clearadm->new;
+
+  my %clearadmvob = $clearadm->GetVob($vob->tag, $vob->region);
+
   display start_Tr;
     display th {class => 'label'},              'Tag:';
     display td {class => 'data', colspan => 3}, setField $vob->tag;
@@ -199,53 +204,80 @@ sub DisplayTable ($) {
     display th {class => 'labelCentered', colspan => 10}, 'VOB Storage Pools';
   display end_Tr;
 
+  my $image = $clearadmvob{adminsmall}
+    ? "data:image/png;base64,$clearadmvob{adminsmall}"
+    : "plotstorage.cgi?type=vob&storage=admin&tiny=1&tag=" . $vob->tag;
+
   display start_Tr;
     display th {class => 'label'},                                'Admin:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=admin&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=admin&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=admin&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
+
+    $image = $clearadmvob{sourcesmall}
+      ? "data:image/png;base64,$clearadmvob{sourcesmall}"
+      : 'plotstorage.cgi?type=vob&storage=source&tiny=1&region=' . $vob->region . '&tag=' . $vob->tag;
+
     display th {class => 'label'},                                'Source Size:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=source&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=source&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=source&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
   display end_Tr;
 
   display start_Tr;
+    $image = $clearadmvob{dbsmall}
+      ? "data:image/png;base64,$clearadmvob{dbsmall}"
+      : 'plotstorage.cgi?type=vob&storage=db&tiny=1&region=' . $vob->region . '&tag=' . $vob->tag;
+
     display th {class => 'label'},                                'Database:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=db&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=db&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=db&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
+
+    $image = $clearadmvob{derivedobjsmall}
+      ? "data:image/png;base64,$clearadmvob{derivedobjsmall}"
+      : 'plotstorage.cgi?type=vob&storage=derivedobj&tiny=1&region=' . $vob->region . '&tag=' . $vob->tag;
+
     display th {class => 'label'},                                'Derived Obj:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=derivedobj&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=derivedobj&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=derivedobj&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
   display end_Tr;
 
   display start_Tr;
+    $image = $clearadmvob{cleartextsmall}
+      ? "data:image/png;base64,$clearadmvob{cleartextsmall}"
+      : 'plotstorage.cgi?type=vob&storage=cleartext&tiny=1&region=' . $vob->retion . '&tag=' . $vob->tag;
+
     display th {class => 'label'},                                'Cleartext:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=cleartext&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=cleartext&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=cleartext&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
+
+    $image = $clearadmvob{totalsmall}
+      ? "data:image/png;base64,$clearadmvob{totalsmall}"
+      : 'plotstorage.cgi?type=vob&storage=total&tiny=1&region=' . $vob->region . '&tag=' . $vob->tag;
+
     display th {class => 'label'},                                'Total Size:';
     display td {class => 'data', colspan => 4, align => 'center'}, a {href =>
-      "plot.cgi?type=vob&storage=total&scaling=Hour&points=24&tag=" . $vob->tag
+      'plot.cgi?type=vob&storage=total&scaling=Day&points=7&region=' . $vob->region . '&tag=' . $vob->tag
     }, img {
-      src    => "plotstorage.cgi?type=vob&storage=total&tiny=1&tag=" . $vob->tag,
+      src    => $image,
       border => 0,
     };
   display end_Tr;
@@ -388,6 +420,7 @@ L<Getopt::Long|Getopt::Long>
 =begin html
 
 <blockquote>
+<a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
 <a href="http://clearscm.com/php/scm_man.php?file=lib/Clearcase.pm">Clearcase</a><br>
 <a href="http://clearscm.com/php/scm_man.php?file=lib/Clearcase/View.pm">Clearcase::View</a><br>