66 |
|
|
67 |
|
|
68 |
sub menu { |
sub menu { |
69 |
my $couch_url = $url; |
my $store_url = $url; |
70 |
$couch_url =~ s{:\d+.+}{:5984/_utils/}; |
$store_url =~ s{:\d+.+}{:28017}; |
71 |
qq{ |
qq{ |
72 |
<div style="font-size: 80%; color: #888"> |
<div style="font-size: 80%; color: #888"> |
73 |
<a target=pids href=/ >home</a> |
<a target=pids href=/ >home</a> |
76 |
<a target=server href=/brctl >brctl</a> |
<a target=server href=/brctl >brctl</a> |
77 |
<a target=server href=/ip >ip</a> |
<a target=server href=/ip >ip</a> |
78 |
| |
| |
79 |
<a target=couch href=$couch_url >couchdb</a> |
<a target=store href=$store_url >store</a> |
80 |
|
<a target=store href=/store/query >query</a> |
81 |
| |
| |
82 |
<a target=client href=/nmap >nmap</a> |
<a target=client href=/nmap >nmap</a> |
83 |
<a target=client href=/client >client</a> |
<a target=client href=/client >client</a> |
269 |
| |
| |
270 |
; |
; |
271 |
|
|
272 |
|
} elsif ( $path =~ m{^/store/query} ) { |
273 |
|
print $client ok |
274 |
|
, qq| |
275 |
|
<style type=text/css> |
276 |
|
.z { |
277 |
|
background: #eee; |
278 |
|
} |
279 |
|
td > pre { |
280 |
|
margin: 0; |
281 |
|
max-height: 3em; |
282 |
|
overflow: hidden; |
283 |
|
} |
284 |
|
td:hover > pre { |
285 |
|
max-height: 100%; |
286 |
|
overflow: show; |
287 |
|
} |
288 |
|
</style> |
289 |
|
| |
290 |
|
, qq|<table>| |
291 |
|
; |
292 |
|
my ( $s1,$s2 ) = ( ' class=z', '' ); |
293 |
|
my @cols; |
294 |
|
|
295 |
|
store::query( sub { |
296 |
|
my $o = shift; |
297 |
|
my $p = delete( $o->{package} ); |
298 |
|
delete( $o->{_id} ); |
299 |
|
|
300 |
|
if ( ! @cols ) { |
301 |
|
@cols = keys %$p; |
302 |
|
print $client qq|<tr><th>| |
303 |
|
, join(qq|</th><th>|, @cols) |
304 |
|
, qq|</th><th></th></tr>| |
305 |
|
; |
306 |
|
} |
307 |
|
|
308 |
|
# XXX sigh, dump dies if we don't do this |
309 |
|
delete $o->{$_} foreach ( grep { ! defined $o->{$_} } keys %$o ); |
310 |
|
|
311 |
|
print $client qq|<tr$s1><td>| |
312 |
|
, join(qq|</td><td>|, map { $p->{$_} } @cols ) |
313 |
|
, qq|</td><td><pre>| |
314 |
|
, dump( $o ) |
315 |
|
, qq|</pre></td></tr>\n| |
316 |
|
; |
317 |
|
( $s1, $s2 ) = ( $s2, $s1 ); |
318 |
|
}); |
319 |
|
print $client qq|</table>|; |
320 |
|
|
321 |
} elsif ( $path =~ m!^/client(?:/$RE{net}{IPv4}{-keep})?! ) { |
} elsif ( $path =~ m!^/client(?:/$RE{net}{IPv4}{-keep})?! ) { |
322 |
my $ip = $1; |
my $ip = $1; |
323 |
$title = $ip if $ip; |
$title = $ip if $ip; |