Sha256: 24711493c7ff5b8b15204099e87b6fcd09cd2ede640044ee273d30e0ed57de04

Contents?: true

Size: 952 Bytes

Versions: 14

Compression:

Stored size: 952 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: {
      params: {
        setting: {
          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

14 entries across 14 versions & 1 rubygems

Version Path
fluentd-ui-0.4.0 app/controllers/api_controller.rb
fluentd-ui-0.3.21 app/controllers/api_controller.rb
fluentd-ui-0.3.20 app/controllers/api_controller.rb
fluentd-ui-0.3.19 app/controllers/api_controller.rb
fluentd-ui-0.3.18 app/controllers/api_controller.rb
fluentd-ui-0.3.17 app/controllers/api_controller.rb
fluentd-ui-0.3.16 app/controllers/api_controller.rb
fluentd-ui-0.3.15 app/controllers/api_controller.rb
fluentd-ui-0.3.14 app/controllers/api_controller.rb
fluentd-ui-0.3.13 app/controllers/api_controller.rb
fluentd-ui-0.3.12 app/controllers/api_controller.rb
fluentd-ui-0.3.11 app/controllers/api_controller.rb
fluentd-ui-0.3.10 app/controllers/api_controller.rb
fluentd-ui-0.3.9 app/controllers/api_controller.rb