lib/rest-ftp-daemon/api/dashboard.rb in rest-ftp-daemon-0.202.2 vs lib/rest-ftp-daemon/api/dashboard.rb in rest-ftp-daemon-0.210.0

- old
+ new

@@ -1,10 +1,16 @@ module RestFtpDaemon module API class Root < Grape::API +####### HELPERS + + helpers do + end + + ####### DASHBOARD - GET / # Server global status get '/' do info "GET /" @@ -13,17 +19,21 @@ Facter.loadfacts # Detect QS filters only = params["only"].to_s - # Get jobs to display - jobs = $queue.sorted_by_status(only) + # Get jobs for this view, order jobs by their weights + current = $queue.filter_jobs only + # Provide queue only if no filtering set + queue = [] + queue = $queue.queue if only.empty? + # Get workers status - @worker_vars = $pool.worker_vars + @worker_variables = $pool.worker_variables # Compile haml template - output = render :dashboard, {jobs: jobs, only: only} + output = render :dashboard, {queue: queue, current: current, only: only} # Send response env['api.format'] = :html format "html" status 200