in /nodes, click row to show info[]
authorTom Clegg <tom@clinicalfuture.com>
Sun, 13 Jan 2013 19:35:20 +0000 (11:35 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Sun, 13 Jan 2013 19:35:20 +0000 (11:35 -0800)
app/assets/javascripts/nodes.js
app/views/nodes/index.html.erb

index dee720facdcda703fe5067aef3fcec32c121f50b..a734426a756187aab66f4f10f6b2ceade2685eb0 100644 (file)
@@ -1,2 +1,17 @@
+// -*- mode: javascript; js-indent-level: 4; indent-tabs-mode: nil; -*-
 // Place all the behaviors and hooks related to the matching controller here.
 // All this logic will automatically be available in application.js.
+
+var loaded_nodes_js;
+$(function(){
+    if (loaded_nodes_js) return; loaded_nodes_js = true;
+
+    $('[data-showhide-selector]').on('click', function(e){
+        var x = $($(this).attr('data-showhide-selector'));
+        if (x.css('display') == 'none')
+            x.show();
+        else
+            x.hide();
+    });
+    $('[data-showhide-default]').hide();
+});
index 34480ce24fc295e5bd8e00ba4baf84059d35b5d8..d4e8aa1edafb560b620aa19f020de828c82cd25e 100644 (file)
@@ -1,4 +1,4 @@
-<table>
+<table style="width:100%">
   <tr class="contain-align-left">
     <th>
       status
       startup delay
     </th><th>
       last ping
+    </th><th>
+      instance_id
     </th>
   </tr>
 
   <% @objects.each do |o| %>
 
-  <tr class="node-status node-status-<%= o.status %>">
+  <tr class="node-status node-status-<%= o.status %>" data-showhide-selector="tr#extra-info-<%= o.uuid %>" style="cursor:pointer">
     <td>
       <%= o.status %>
     </td><td>
     </td>
   </tr>
 
-  <% if o.info[:ec2_start_command] and !o.first_ping_at %>
-  <tr>
+  <% if  %>
+  <tr id="extra-info-<%= o.uuid %>" <%= 'data-showhide-default' unless o.info[:ec2_start_command] and !o.first_ping_at %>>
     <td colspan="8">
-      <%= o.info[:ec2_start_command] %>
-      <br />
-      <%= o.info[:ec2_start_result] %>
+      <dl>
+      <% o.info.each do |k,v| %>
+      <dt><em><%= k %></em></dt>
+      <dd><%= v %></dd>
+      <% end %>
+      </dl>
     </td>
   </tr>