give row an error class if data structure contains an error message
[scpubgit/JSON-Tree-Viewer.git] / br.pl
diff --git a/br.pl b/br.pl
index 054a5ec..21eec68 100644 (file)
--- a/br.pl
+++ b/br.pl
@@ -11,7 +11,7 @@ has root => (is => 'lazy');
 has json => (is => 'lazy');
 
 sub _build_root {
-  io->dir("/home/matthewt/tmp/introspection-data/host/services-dev/stable/node/host/")
+  io->dir( $ENV{JTV_ROOT} || die "JTV_ROOT env var not set" )
 }
 
 sub _build_json {
@@ -32,7 +32,7 @@ sub dispatch_request {
   },
   sub (/) {
     sub (?@host=) {
-      [ 302, [ 'Location', '/'.join('+', @{$_[1]}) ], [] ];
+      [ 302, [ 'Location', '/'.join('+', @{$_[1]}).'/' ], [] ];
     },
     sub () {
       $self->root_structure;
@@ -176,7 +176,7 @@ sub render_table {
       ($data->{wrapper}||sub{@_})->(
         '', <table>, "\n",
           (map { my $el = $_;
-            '  ', <tr>,
+            '  ', ($el->{key} eq '__error__') ? <tr class="error"> : <tr>,
               (map {
                 <td>, $self->render_el($el, $_, $el->{$_}), </td>
               } @{$data->{columns}}),