Sha256: 28f3e6229659cafaf6427eb5053e744be21f61afc611397167872858d2c04180

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module Naf
  class LogParsersController < Naf::ApiSimpleClusterAuthenticatorApplicationController

    def logs
      if naf_cookie_valid?
        if params['record_id'].present?
          response = params['logical_type'].constantize.new(params).logs

          if response.present?
            success = true
          else
            success = false
          end
        else
          response = {
            logs: '&nbsp;&nbsp;<span>Record id is not present</br></span>'
          }
          success = false
        end

        render json: "convertToJsonCallback(" + { success: success }.merge(response).to_json + ")"
      else
        render json: "convertToJsonCallback(" + { success: false }.to_json + ")"
      end
    end

    def download
      job_log_downloader = Logical::Naf::LogParser::JobDownloader.new({ 
        'record_id' => params[:record_id]
      })
      logs = job_log_downloader.logs_for_download + "\n"
      send_data logs, filename: "job_#{params[:record_id]}_log.txt",
        type: "text/plain", disposition: 'attachment'
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
naf-2.1.13 app/controllers/naf/log_parsers_controller.rb