add VirtualMachine resource to workbench
authorTom Clegg <tom@clinicalfuture.com>
Sat, 8 Jun 2013 06:04:42 +0000 (02:04 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Sat, 8 Jun 2013 06:04:42 +0000 (02:04 -0400)
13 files changed:
apps/workbench/app/assets/javascripts/virtual_machines.js.coffee [new file with mode: 0644]
apps/workbench/app/assets/stylesheets/virtual_machines.css.scss [new file with mode: 0644]
apps/workbench/app/controllers/virtual_machines_controller.rb [new file with mode: 0644]
apps/workbench/app/helpers/virtual_machines_helper.rb [new file with mode: 0644]
apps/workbench/app/models/virtual_machine.rb [new file with mode: 0644]
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/app/views/virtual_machines/index.html.erb [new file with mode: 0644]
apps/workbench/app/views/virtual_machines/show.html.erb [new file with mode: 0644]
apps/workbench/config/routes.rb
apps/workbench/test/fixtures/virtual_machines.yml [new file with mode: 0644]
apps/workbench/test/functional/virtual_machines_controller_test.rb [new file with mode: 0644]
apps/workbench/test/unit/helpers/virtual_machines_helper_test.rb [new file with mode: 0644]
apps/workbench/test/unit/virtual_machine_test.rb [new file with mode: 0644]

diff --git a/apps/workbench/app/assets/javascripts/virtual_machines.js.coffee b/apps/workbench/app/assets/javascripts/virtual_machines.js.coffee
new file mode 100644 (file)
index 0000000..7615679
--- /dev/null
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/apps/workbench/app/assets/stylesheets/virtual_machines.css.scss b/apps/workbench/app/assets/stylesheets/virtual_machines.css.scss
new file mode 100644 (file)
index 0000000..5532eb9
--- /dev/null
@@ -0,0 +1,3 @@
+// Place all the styles related to the VirtualMachines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/apps/workbench/app/controllers/virtual_machines_controller.rb b/apps/workbench/app/controllers/virtual_machines_controller.rb
new file mode 100644 (file)
index 0000000..9ccbfa6
--- /dev/null
@@ -0,0 +1,2 @@
+class VirtualMachinesController < ApplicationController
+end
diff --git a/apps/workbench/app/helpers/virtual_machines_helper.rb b/apps/workbench/app/helpers/virtual_machines_helper.rb
new file mode 100644 (file)
index 0000000..cbb398d
--- /dev/null
@@ -0,0 +1,2 @@
+module VirtualMachinesHelper
+end
diff --git a/apps/workbench/app/models/virtual_machine.rb b/apps/workbench/app/models/virtual_machine.rb
new file mode 100644 (file)
index 0000000..a6b845c
--- /dev/null
@@ -0,0 +1,2 @@
+class VirtualMachine < ArvadosBase
+end
index 57c4ace6711e461d807f26cc8adbba167d21c3bf..a06a9bef7930f412348f98983a0e2df2e20b0983 100644 (file)
@@ -34,6 +34,7 @@
           <ul class="nav">
            <% [
               [true, 'Keys', authorized_keys_path],
+              [true, 'VMs', virtual_machines_path],
               [true, 'Data', collections_path],
               [true, 'Groups', groups_path],
               [true, 'Pipeline Templates', pipeline_templates_path],
diff --git a/apps/workbench/app/views/virtual_machines/index.html.erb b/apps/workbench/app/views/virtual_machines/index.html.erb
new file mode 100644 (file)
index 0000000..adc4095
--- /dev/null
@@ -0,0 +1,41 @@
+<table class="table">
+  <thead>
+    <tr class="contain-align-left">
+      <th>
+       id
+      </th><th>
+       owner
+      </th><th>
+       hostname
+      </th>
+    </tr>
+  </thead>
+  <tbody>
+
+    <% @objects.sort_by { |vm| vm[:hostname] }.each do |vm| %>
+
+    <tr>
+      <td>
+        <%= link_to_if_arvados_object vm %>
+      </td><td>
+        <%= render_editable_attribute vm, 'owner' %>
+      </td><td>
+        <%= render_editable_attribute vm, 'hostname' %>
+      </td>
+    </tr>
+
+    <% end %>
+    <% if @objects.count == 0 %>
+    <tr>
+      <td colspan="7">
+        (no VMs)
+      </td>
+    </tr>
+    <% end %>
+
+  </tbody>
+</table>
+
+<% if current_user and current_user.is_admin %>
+<%= button_to "Add a new VM", { action: 'create', return_to: './' }, { class: 'btn btn-primary' } %>
+<% end %>
diff --git a/apps/workbench/app/views/virtual_machines/show.html.erb b/apps/workbench/app/views/virtual_machines/show.html.erb
new file mode 100644 (file)
index 0000000..9079085
--- /dev/null
@@ -0,0 +1 @@
+<%= render :partial => 'application/arvados_object' %>
index 57e4897d7eee6cc22821735a0d974e52416ff543..8e50e0d196ad5b3d1a1ea715a38a925badfdce41 100644 (file)
@@ -1,4 +1,7 @@
 ArvadosWorkbench::Application.routes.draw do
+  resources :virtual_machines
+
+
   resources :authorized_keys
 
 
diff --git a/apps/workbench/test/fixtures/virtual_machines.yml b/apps/workbench/test/fixtures/virtual_machines.yml
new file mode 100644 (file)
index 0000000..c63aac0
--- /dev/null
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined.  If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+#  column: value
diff --git a/apps/workbench/test/functional/virtual_machines_controller_test.rb b/apps/workbench/test/functional/virtual_machines_controller_test.rb
new file mode 100644 (file)
index 0000000..3f92b6f
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class VirtualMachinesControllerTest < ActionController::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
diff --git a/apps/workbench/test/unit/helpers/virtual_machines_helper_test.rb b/apps/workbench/test/unit/helpers/virtual_machines_helper_test.rb
new file mode 100644 (file)
index 0000000..03ded1c
--- /dev/null
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class VirtualMachinesHelperTest < ActionView::TestCase
+end
diff --git a/apps/workbench/test/unit/virtual_machine_test.rb b/apps/workbench/test/unit/virtual_machine_test.rb
new file mode 100644 (file)
index 0000000..69258b5
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class VirtualMachineTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end