/[Frey]/trunk/lib/Frey/jQuery/flot.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/jQuery/flot.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 920 by dpavlin, Mon Jan 5 20:22:37 2009 UTC revision 926 by dpavlin, Mon Jan 5 22:10:59 2009 UTC
# Line 11  with 'Frey::Web::IFrame'; Line 11  with 'Frey::Web::IFrame';
11  use DateTimeX::Easy;  use DateTimeX::Easy;
12    
13  use lib 'lib';  use lib 'lib';
 use Frey::Shell::sar;  
14  use JSON;  use JSON;
15    
16  has sar_command => (  has 'sponge' => (
17          is => 'rw',          is => 'rw',
18          isa => 'Str',          isa => 'Sponge',
19          required => 1,          required => 1,
         default => 'ssh www.rot13.org sar -n 1',  
20  );  );
21    
 with 'Frey::Sponge'; # has sponge  
   
22  sub as_markup {  sub as_markup {
23          my ($self) = @_;          my ($self) = @_;
24    
# Line 75  sub as_markup { Line 71  sub as_markup {
71    
72          warn "# $data_js" if $self->debug;          warn "# $data_js" if $self->debug;
73    
74          my $sar = $self->sar_command;          my $form = '<!-- no sar_command in sponge -->';
75          my $c = $sar;          my $sar_command = $sponge->{sar_command} || warn "no sar_command in spunge";
76          $c =~ s{sar\s(-n\s*\d+)?(.*?)$}{sar $1};          if ( my $c = $sar_command ) {
77                    $c =~ s{sar\s(-n\s*\d+)?(.*?)$}{sar $1};
78          my $form = qq|  
79                  <form method="post">                  $form = qq|
80                  <b>From</b> <input type="submit" value="refresh"><br>                          <form method="post">
81          |;                          <b>From</b> <input type="submit" value="refresh"><br>
82                    |;
83          my $flags = `atsar help 2>&1`;  
84          $flags =~ s{^.+flags:\s+}{}s;                  my $flags = `atsar help 2>&1`;
85          $flags =~ s{^\s*-[AS].+$}{}gm; # remove -A and -S flags which doesn't make sense                  $flags =~ s{^.+flags:\s+}{}s;
86          $flags =~ s{^\s+}{}s;                  $flags =~ s{^\s*-[AS].+$}{}gm; # remove -A and -S flags which doesn't make sense
87                    $flags =~ s{^\s+}{}s;
88          foreach my $line ( split(/\s*\n\s*/, $flags ) ) {  
89                  my ( $flag, $desc ) = split(/\s+/, $line, 2 );                  foreach my $line ( split(/\s*\n\s*/, $flags ) ) {
90                  warn "# $flag | $desc" if $self->debug;                          my ( $flag, $desc ) = split(/\s+/, $line, 2 );
91                  my $v = "$c $flag";                          warn "# $flag | $desc" if $self->debug;
92                  my $checked = '';                          my $v = "$c $flag";
93                  $checked = " checked" if $self->sar_command =~ m{$flag};                          my $checked = '';
94                  $form .= qq|<input type="radio" name="sar_command" value="$v"$checked>$desc<br>\n|;                          $checked = " checked" if $sar_command =~ m{$flag};
95          }                          $form .= qq|<input type="radio" name="sar_command" value="$v"$checked>$desc<br>\n|;
96                    }
         $form .= qq|  
                 </form>  
         |;  
97    
98          $self->add_css(q|                  $form .= qq|
99                  #choices, form { float: left; }                          </form>
100          |);                  |;
101    
102                    $self->add_css(q|
103                            #choices, form { float: left; }
104                    |);
105            }
106    
107          return          return
108          qq|          qq|
109    
110                  <code>$sar</code>                  <code>$sar_command</code>
111    
112                  $placeholder                  $placeholder
113    

Legend:
Removed from v.920  
changed lines
  Added in v.926

  ViewVC Help
Powered by ViewVC 1.1.26