Added caching to clearadm
[clearscm.git] / clearadm / viewdetails.cgi
index 72b486b..ef9df9b 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::View;
@@ -94,6 +95,10 @@ sub DisplayTable ($) {
     -class          => 'main',
   };
 
+  my $clearadm = Clearadm->new;
+
+  my %clearadmview = $clearadm->GetView($view->tag, $view->region);
+
   display start_Tr;
     display th {class => 'label'},              'Tag:';
     display td {class => 'data', colspan => 3}, setField $view->tag;
@@ -154,36 +159,54 @@ sub DisplayTable ($) {
     display th {class => 'labelCentered', colspan => 10}, 'View Storage Pools';
   display end_Tr;
 
+  my $image = $clearadmview{dbsmall}
+    ? "data:image/png;base64,$clearadmview{dbsmall}"
+    : "plotstorage.cgi?type=view&storage=db&tiny=1&tag=" . $view->tag;
+
   display start_Tr;
     display th {class => 'label'},                                'Database:';
     display td {class => 'data', colspan => 3, align => 'center'}, a {href =>
-       "plot.cgi?type=view&storage=private&tag=" . $view->tag
+       "plot.cgi?type=view&storage=db&scaling=Day&points=7&region=" . $view->region . '&tag=' . $view->tag
     }, img {
-      src    => "plotstorage.cgi?type=view&storage=private&tiny=1&tag=" . $view->tag,
+      src    => $image,
       border => 0,
     };
+
+    $image = $clearadmview{privatesmall}
+      ? "data:image/png;base64,$clearadmview{privatesmall}"
+      : "plotstorage.cgi?type=view&storage=private&tiny=1&tag=" . $view->tag;
+
     display th {class => 'label'},                                'Private:';
     display td {class => 'data', colspan => 5, align => 'center'}, a {href =>
-       "plot.cgi?type=view&storage=db&tag=" . $view->tag
+       "plot.cgi?type=view&storage=private&scaling=Day&points=7&region=" . $view->region . '&tag=' . $view->tag
     }, img {
-      src    => "plotstorage.cgi?type=view&storage=db&tiny=1&tag=" . $view->tag,
+      src    => $image,
       border => 0,
     };
   display end_Tr;
 
+  $image = $clearadmview{adminsmall}
+    ? "data:image/png;base64,$clearadmview{adminsmall}"
+    : "plotstorage.cgi?type=view&storage=admin&tiny=1&tag=" . $view->tag;
+
   display start_Tr;
     display th {class => 'label'},                                'Admin:';
     display td {class => 'data', colspan => 3, align => 'center'}, a {href =>
-       "plot.cgi?type=view&storage=admin&tag=" . $view->tag
+       "plot.cgi?type=view&storage=admin&scaling=Day&points=7&region=" . $view->region . '&tag=' . $view->tag
     }, img {
-      src    => "plotstorage.cgi?type=view&storage=admin&tiny=1&tag=" . $view->tag,
+      src    => $image,
       border => 0,
     };
+
+    $image = $clearadmview{totalsmall}
+      ? "data:image/png;base64,$clearadmview{totalsmall}"
+      : "plotstorage.cgi?type=view&storage=total&tiny=1&tag=" . $view->tag;
+
     display th {class => 'label'},                                'Total Space:';
     display td {class => 'data', colspan => 5, align => 'center'}, a {href =>
-       "plot.cgi?type=view&storage=total&tag=" . $view->tag
+       "plot.cgi?type=view&storage=total&scaling=Day&points=7&region=" . $view->region . '&tag=' . $view->tag
     }, img {
-      src    => "plotstorage.cgi?type=view&storage=total&tiny=1&tag=" . $view->tag,
+      src    => $image,
       border => 0,
     };
   display end_Tr;
@@ -283,9 +306,7 @@ unless ($opts{tag}) {
   exit;
 } # unless
 
-my $view = Clearcase::View->new ($opts{tag}, $opts{region});
-
-DisplayTable $view;
+DisplayTable(Clearcase::View->new($opts{tag}, $opts{region}));
 
 footing;
 
@@ -315,6 +336,7 @@ L<Getopt::Long|Getopt::Long>
 
 =begin man 
 
+ Clearadm
  ClearadmWeb
  Clearcase
  Clearcase::View
@@ -327,6 +349,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>