Browse Source

working vpcs

Chris Mague 7 years ago
parent
commit
fa749d31c4
2 changed files with 35 additions and 1 deletions
  1. 7 1
      web/controllers/views.rb
  2. 28 0
      web/views/view_vpcs.html.erb

+ 7 - 1
web/controllers/views.rb

@@ -17,7 +17,13 @@ class Views < Sinatra::Base
 
   get '/vpcs' do
     w = NeoInfra::Vpcs.new
-    w.list_vpcs.to_json
+    respond_to do |wants|
+      wants.html {
+        erb :view_vpcs,
+        :layout => :base_layout,
+        :locals => {:vpcs => w.list_vpcs}
+      }
+    end
   end
 
   get '/buckets' do

+ 28 - 0
web/views/view_vpcs.html.erb

@@ -0,0 +1,28 @@
+<h2 class="title"><br><br><center>VPCs</center></h2>
+
+<div class="container">
+  <table class="table table-hover">
+    <thead>
+      <tr>
+        <th>Name</th>
+        <th>Account</th>
+        <th>Region</th>
+        <th>CIDR</th>
+        <th>Default</th>
+        <th>VPC-ID</th>
+      </tr>
+    </thead>
+    <tbody>
+<% vpcs.each do |vpc| %>
+<tr>
+<td><%= vpc['name'] %></td>
+<td><%= vpc['owner'] %></td>
+<td><%= vpc['region'] %></td>
+<td><%= vpc['cidr'] %></td>
+<td><%= vpc['default'] %></td>
+<td><%= vpc['vpc_id'] %></td>
+</tr>
+<% end %>
+    </tbody>
+  </table>
+</div>