add trait resource
authorTom Clegg <tom@clinicalfuture.com>
Thu, 27 Jun 2013 15:53:23 +0000 (11:53 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Thu, 27 Jun 2013 15:53:23 +0000 (11:53 -0400)
23 files changed:
apps/workbench/app/assets/javascripts/traits.js.coffee [new file with mode: 0644]
apps/workbench/app/assets/stylesheets/traits.css.scss [new file with mode: 0644]
apps/workbench/app/controllers/traits_controller.rb [new file with mode: 0644]
apps/workbench/app/helpers/traits_helper.rb [new file with mode: 0644]
apps/workbench/app/models/trait.rb [new file with mode: 0644]
apps/workbench/config/routes.rb
apps/workbench/test/fixtures/traits.yml [new file with mode: 0644]
apps/workbench/test/functional/traits_controller_test.rb [new file with mode: 0644]
apps/workbench/test/unit/helpers/traits_helper_test.rb [new file with mode: 0644]
apps/workbench/test/unit/trait_test.rb [new file with mode: 0644]
doc/api/index.md
services/api/app/assets/javascripts/traits.js.coffee [new file with mode: 0644]
services/api/app/assets/stylesheets/traits.css.scss [new file with mode: 0644]
services/api/app/controllers/arvados/v1/traits_controller.rb [new file with mode: 0644]
services/api/app/helpers/traits_helper.rb [new file with mode: 0644]
services/api/app/models/trait.rb [new file with mode: 0644]
services/api/config/routes.rb
services/api/db/migrate/20130627154537_create_traits.rb [new file with mode: 0644]
services/api/db/schema.rb
services/api/test/fixtures/traits.yml [new file with mode: 0644]
services/api/test/functional/traits_controller_test.rb [new file with mode: 0644]
services/api/test/unit/helpers/traits_helper_test.rb [new file with mode: 0644]
services/api/test/unit/trait_test.rb [new file with mode: 0644]

diff --git a/apps/workbench/app/assets/javascripts/traits.js.coffee b/apps/workbench/app/assets/javascripts/traits.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/traits.css.scss b/apps/workbench/app/assets/stylesheets/traits.css.scss
new file mode 100644 (file)
index 0000000..5f30857
--- /dev/null
@@ -0,0 +1,3 @@
+// Place all the styles related to the Traits 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/traits_controller.rb b/apps/workbench/app/controllers/traits_controller.rb
new file mode 100644 (file)
index 0000000..38f33a3
--- /dev/null
@@ -0,0 +1,2 @@
+class TraitsController < ApplicationController
+end
diff --git a/apps/workbench/app/helpers/traits_helper.rb b/apps/workbench/app/helpers/traits_helper.rb
new file mode 100644 (file)
index 0000000..a4260eb
--- /dev/null
@@ -0,0 +1,2 @@
+module TraitsHelper
+end
diff --git a/apps/workbench/app/models/trait.rb b/apps/workbench/app/models/trait.rb
new file mode 100644 (file)
index 0000000..ab65ad5
--- /dev/null
@@ -0,0 +1,2 @@
+class Trait < ArvadosBase
+end
index e93fa42fc3f079db514286ec8fd957fd6ae2e636..87e44728e96ccf303930c40beea73f6b9402b0da 100644 (file)
@@ -1,4 +1,7 @@
 ArvadosWorkbench::Application.routes.draw do
+  resources :traits
+
+
   resources :api_client_authorizations
   resources :repositories
   resources :virtual_machines
diff --git a/apps/workbench/test/fixtures/traits.yml b/apps/workbench/test/fixtures/traits.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/traits_controller_test.rb b/apps/workbench/test/functional/traits_controller_test.rb
new file mode 100644 (file)
index 0000000..165284d
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TraitsControllerTest < ActionController::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
diff --git a/apps/workbench/test/unit/helpers/traits_helper_test.rb b/apps/workbench/test/unit/helpers/traits_helper_test.rb
new file mode 100644 (file)
index 0000000..da69c06
--- /dev/null
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class TraitsHelperTest < ActionView::TestCase
+end
diff --git a/apps/workbench/test/unit/trait_test.rb b/apps/workbench/test/unit/trait_test.rb
new file mode 100644 (file)
index 0000000..45df2ed
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TraitTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
index 094f5ffa0fe15c0b954430d83af9d48e29116828..31c0d18a5b6123a12b4a74077365472ad774344b 100644 (file)
@@ -30,6 +30,7 @@ navorder: 0
 * PipelineInstances
 * Groups
 * Specimens
+* Traits
 * Users
 * Variants
 * VariantAnnotations
diff --git a/services/api/app/assets/javascripts/traits.js.coffee b/services/api/app/assets/javascripts/traits.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/services/api/app/assets/stylesheets/traits.css.scss b/services/api/app/assets/stylesheets/traits.css.scss
new file mode 100644 (file)
index 0000000..5f30857
--- /dev/null
@@ -0,0 +1,3 @@
+// Place all the styles related to the Traits controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/services/api/app/controllers/arvados/v1/traits_controller.rb b/services/api/app/controllers/arvados/v1/traits_controller.rb
new file mode 100644 (file)
index 0000000..c4bdc5b
--- /dev/null
@@ -0,0 +1,2 @@
+class Arvados::V1::TraitsController < ApplicationController
+end
diff --git a/services/api/app/helpers/traits_helper.rb b/services/api/app/helpers/traits_helper.rb
new file mode 100644 (file)
index 0000000..a4260eb
--- /dev/null
@@ -0,0 +1,2 @@
+module TraitsHelper
+end
diff --git a/services/api/app/models/trait.rb b/services/api/app/models/trait.rb
new file mode 100644 (file)
index 0000000..d16e7d0
--- /dev/null
@@ -0,0 +1,11 @@
+class Trait < ArvadosModel
+  include AssignUuid
+  include KindAndEtag
+  include CommonApiTemplate
+  serialize :properties, Hash
+
+  api_accessible :superuser, :extend => :common do |t|
+    t.add :name
+    t.add :properties
+  end
+end
index ca4f7b0ed06e0d7433a5efc1bdf75fbcbc7b6f53..f50ae5a69b38ae5e0524c6c1e926e6908248386d 100644 (file)
@@ -1,4 +1,5 @@
 Server::Application.routes.draw do
+  resources :traits
   resources :repositories
   resources :virtual_machines
   resources :authorized_keys
@@ -104,6 +105,7 @@ Server::Application.routes.draw do
       resources :authorized_keys
       resources :virtual_machines
       resources :repositories
+      resources :traits
     end
   end
 
diff --git a/services/api/db/migrate/20130627154537_create_traits.rb b/services/api/db/migrate/20130627154537_create_traits.rb
new file mode 100644 (file)
index 0000000..541a313
--- /dev/null
@@ -0,0 +1,17 @@
+class CreateTraits < ActiveRecord::Migration
+  def change
+    create_table :traits do |t|
+      t.string :uuid, :null => false
+      t.string :owner, :null => false
+      t.string :modified_by_client
+      t.string :modified_by_user
+      t.datetime :modified_at
+      t.string :name
+      t.text :properties
+
+      t.timestamps
+    end
+    add_index :traits, :uuid, :unique => true
+    add_index :traits, :name
+  end
+end
index c0b6597265160efc84a5ee8b24e1666fe4ba6cdf..11d1ec806757739dcb030c1f21634d12c022fc43 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20130626022810) do
+ActiveRecord::Schema.define(:version => 20130627154537) do
 
   create_table "api_client_authorizations", :force => true do |t|
     t.string   "api_token",               :null => false
@@ -356,6 +356,21 @@ ActiveRecord::Schema.define(:version => 20130626022810) do
   add_index "specimens", ["modified_at"], :name => "index_specimens_on_modified_at"
   add_index "specimens", ["uuid"], :name => "index_specimens_on_uuid", :unique => true
 
+  create_table "traits", :force => true do |t|
+    t.string   "uuid",               :null => false
+    t.string   "owner",              :null => false
+    t.string   "modified_by_client"
+    t.string   "modified_by_user"
+    t.datetime "modified_at"
+    t.string   "name"
+    t.text     "properties"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  add_index "traits", ["name"], :name => "index_traits_on_name"
+  add_index "traits", ["uuid"], :name => "index_traits_on_uuid", :unique => true
+
   create_table "users", :force => true do |t|
     t.string   "uuid"
     t.string   "owner"
diff --git a/services/api/test/fixtures/traits.yml b/services/api/test/fixtures/traits.yml
new file mode 100644 (file)
index 0000000..594081f
--- /dev/null
@@ -0,0 +1,19 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  uuid: MyString
+  owner: MyString
+  modified_by_client: MyString
+  modified_by_user: MyString
+  modified_at: 2013-06-27 11:45:37
+  name: MyString
+  properties: MyText
+
+two:
+  uuid: MyString
+  owner: MyString
+  modified_by_client: MyString
+  modified_by_user: MyString
+  modified_at: 2013-06-27 11:45:37
+  name: MyString
+  properties: MyText
diff --git a/services/api/test/functional/traits_controller_test.rb b/services/api/test/functional/traits_controller_test.rb
new file mode 100644 (file)
index 0000000..165284d
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TraitsControllerTest < ActionController::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
diff --git a/services/api/test/unit/helpers/traits_helper_test.rb b/services/api/test/unit/helpers/traits_helper_test.rb
new file mode 100644 (file)
index 0000000..da69c06
--- /dev/null
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class TraitsHelperTest < ActionView::TestCase
+end
diff --git a/services/api/test/unit/trait_test.rb b/services/api/test/unit/trait_test.rb
new file mode 100644 (file)
index 0000000..45df2ed
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TraitTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end