Skip to content

Commit

Permalink
0.1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenya committed Nov 4, 2017
1 parent 67b27bc commit 9b77c5e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/foreman_datacenter/devices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions app/models/foreman_datacenter/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/foreman_datacenter/devices/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
</div>
<%= 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.' %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/foreman_datacenter/devices/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</tr>
<tr>
<td>Position</td>
<td><%= @device.position %> / <%= @device.face %></td>
<td><%= @device.position %> / <%= @device.face %> / <%= @device.side %></td>
</tr>
<tr>
<td>Device Type</td>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20170824122025_add_side_to_device.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSideToDevice < ActiveRecord::Migration
def change
add_column :devices, :side, :integer, null: true
end
end
2 changes: 1 addition & 1 deletion lib/foreman_datacenter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ForemanDatacenter
VERSION = '0.1.13'.freeze
VERSION = '0.1.14'.freeze
end

0 comments on commit 9b77c5e

Please sign in to comment.