Sha256: 132ad0e9acb837a364bd4cf27c85048374c4a881a1ae87d13fccbabbb025ca22

Contents?: true

Size: 917 Bytes

Versions: 4

Compression:

Stored size: 917 Bytes

Contents

module RestFtpDaemon
  module API
    class Root < Grape::API


####### HELPERS

      helpers do
      end


####### DASHBOARD - GET /

      # Server global status
      get '/' do
        info "GET /"

        # Initialize Facter
        Facter.loadfacts

        # Detect QS filters
        only = params["only"].to_s

        # 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_variables = $pool.worker_variables

        # Compile haml template
        output = render :dashboard, {queue: queue, current: current, only: only}

        # Send response
        env['api.format'] = :html
        format "html"
        status 200
        content_type "text/html"
        body output
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest-ftp-daemon-0.212.0 lib/rest-ftp-daemon/api/dashboard.rb
rest-ftp-daemon-0.210.2 lib/rest-ftp-daemon/api/dashboard.rb
rest-ftp-daemon-0.210.1 lib/rest-ftp-daemon/api/dashboard.rb
rest-ftp-daemon-0.210.0 lib/rest-ftp-daemon/api/dashboard.rb