Sha256: 1039bf37ad2c07740828210ffe6f3b9f96002cb899976b300fb6eaeb218116bd

Contents?: true

Size: 890 Bytes

Versions: 13

Compression:

Stored size: 890 Bytes

Contents

class ApiController < ApplicationController
  def tree
    render json: Treeview.tree(params[:path])
  end

  def file_preview
    file = params[:file]
    unless File.exists?(file)
      return render json: [], status: 404
    end
    unless File.file?(file) && File.readable?(file)
      return render json: [], status: 403
    end
    render json: file_tail(file)
  end

  def empty_json
    render json: []
  end

  def regexp_preview
    preview = RegexpPreview.new(params[:file], params[:format], regexp: params[:regexp], time_format: params[:time_format])
    matches = preview.matches
    render json: {
      regexp: preview.regexp.try(:source),
      time_format: preview.time_format,
      matches: matches.compact,
    }
  end

  def grok_to_regexp
    grok = GrokConverter.new
    grok.load_patterns
    render text: grok.convert_to_regexp(params[:grok_str]).source
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fluentd-ui-0.3.8 app/controllers/api_controller.rb
fluentd-ui-0.3.7 app/controllers/api_controller.rb
fluentd-ui-0.3.6 app/controllers/api_controller.rb
fluentd-ui-0.3.5 app/controllers/api_controller.rb
fluentd-ui-0.3.3 app/controllers/api_controller.rb
fluentd-ui-0.3.2 app/controllers/api_controller.rb
fluentd-ui-0.3.1 app/controllers/api_controller.rb
fluentd-ui-0.3.0 app/controllers/api_controller.rb
fluentd-ui-0.2.0 app/controllers/api_controller.rb
fluentd-ui-0.1.4 app/controllers/api_controller.rb
fluentd-ui-0.1.3 app/controllers/api_controller.rb
fluentd-ui-0.1.2 app/controllers/api_controller.rb
fluentd-ui-0.1.1 app/controllers/api_controller.rb