From 9b77c5e0623ce76ffd3d4561d0bf4341507edf74 Mon Sep 17 00:00:00 2001 From: eugene Date: Sat, 4 Nov 2017 19:36:09 +0200 Subject: [PATCH] 0.1.14 --- app/controllers/foreman_datacenter/devices_controller.rb | 4 ++-- app/models/foreman_datacenter/device.rb | 1 + app/views/foreman_datacenter/devices/_form.html.erb | 2 ++ app/views/foreman_datacenter/devices/show.html.erb | 2 +- db/migrate/20170824122025_add_side_to_device.rb | 5 +++++ lib/foreman_datacenter/version.rb | 2 +- 6 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20170824122025_add_side_to_device.rb diff --git a/app/controllers/foreman_datacenter/devices_controller.rb b/app/controllers/foreman_datacenter/devices_controller.rb index 0c8ca06..6f4566f 100644 --- a/app/controllers/foreman_datacenter/devices_controller.rb +++ b/app/controllers/foreman_datacenter/devices_controller.rb @@ -105,8 +105,8 @@ def set_device def device_params params[:device].permit(:device_type_id, :device_role_id, :platform_id, - :name, :serial, :rack_id, :position, :face, - :status, :primary_ip4, :primary_ip6, :comments, + :name, :serial, :rack_id, :position, :side, + :face, :status, :primary_ip4, :primary_ip6, :comments, :host_id) end diff --git a/app/models/foreman_datacenter/device.rb b/app/models/foreman_datacenter/device.rb index 9472b25..3821814 100644 --- a/app/models/foreman_datacenter/device.rb +++ b/app/models/foreman_datacenter/device.rb @@ -29,6 +29,7 @@ class Device < ActiveRecord::Base has_one :site, :through => :rack enum face: [:front, :rear] + enum side: [:left, :right, :full] enum status: [:active, :offline] validates :device_type_id, presence: true diff --git a/app/views/foreman_datacenter/devices/_form.html.erb b/app/views/foreman_datacenter/devices/_form.html.erb index 27d232a..ae16fee 100644 --- a/app/views/foreman_datacenter/devices/_form.html.erb +++ b/app/views/foreman_datacenter/devices/_form.html.erb @@ -54,6 +54,8 @@ <%= selectable_f f, :face, ForemanDatacenter::Device.faces.keys, { include_blank: 'Choose a rack face', label: 'Rack face' } %> + <%= selectable_f f, :side, ForemanDatacenter::Device.sides.keys, + { include_blank: 'Choose a rack side', label: 'Rack side' } %> <%= text_f f, :position, type: 'number', min: 0, help_inline: 'For multi-U devices, this is the lowest occupied rack unit.' %> diff --git a/app/views/foreman_datacenter/devices/show.html.erb b/app/views/foreman_datacenter/devices/show.html.erb index 3f24718..3edf2f8 100644 --- a/app/views/foreman_datacenter/devices/show.html.erb +++ b/app/views/foreman_datacenter/devices/show.html.erb @@ -54,7 +54,7 @@ Position - <%= @device.position %> / <%= @device.face %> + <%= @device.position %> / <%= @device.face %> / <%= @device.side %> Device Type diff --git a/db/migrate/20170824122025_add_side_to_device.rb b/db/migrate/20170824122025_add_side_to_device.rb new file mode 100644 index 0000000..bc69a3f --- /dev/null +++ b/db/migrate/20170824122025_add_side_to_device.rb @@ -0,0 +1,5 @@ +class AddSideToDevice < ActiveRecord::Migration + def change + add_column :devices, :side, :integer, null: true + end +end diff --git a/lib/foreman_datacenter/version.rb b/lib/foreman_datacenter/version.rb index 3687d81..a207855 100644 --- a/lib/foreman_datacenter/version.rb +++ b/lib/foreman_datacenter/version.rb @@ -1,3 +1,3 @@ module ForemanDatacenter - VERSION = '0.1.13'.freeze + VERSION = '0.1.14'.freeze end