app/controllers/naf/machines_controller.rb in naf-1.1.4 vs app/controllers/naf/machines_controller.rb in naf-2.0.0
- old
+ new
@@ -1,9 +1,10 @@
module Naf
class MachinesController < Naf::ApplicationController
include Naf::ApplicationHelper
+ include Naf::TimeHelper
before_filter :set_rows_per_page
def index
respond_to do |format|
@@ -19,11 +20,11 @@
machines = []
machine = []
@total_records = Naf::Machine.count(:all)
Logical::Naf::Machine.all(filter).map(&:to_hash).map do |hash|
- add_urls(hash).map do |key, value|
+ hash.map do |key, value|
value = '' if value.nil?
machine << value
end
machines << machine
machine =[]
@@ -34,11 +35,11 @@
end
end
end
def show
- @machine = Naf::Machine.find(params[:id])
+ @machine = Naf::Machine.includes(:machine_affinity_slots).find(params[:id])
end
def new
@machine = Naf::Machine.new
end
@@ -79,17 +80,14 @@
end
end
end
end
- private
-
- def add_urls(hash)
- machine = ::Naf::Machine.find(hash[:id])
- hash[:papertrail_url] = naf_papertrail_link(machine)
- hash[:papertrail_runner_url] = naf_papertrail_link(machine, true)
-
- hash
+ def last_checked_schedule_at
+ render json: {
+ last_checked_schedule_at: time_format(::Naf::Machine.last_time_schedules_were_checked)
+ }
end
+
end
end