Class: Dbwatcher::QueriesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/dbwatcher/queries_controller.rb

Instance Method Summary collapse

Instance Method Details

#clearObject



16
17
18
19
20
21
22
# File 'app/controllers/dbwatcher/queries_controller.rb', line 16

def clear
  clear_storage_with_message(
    -> { Storage.query_storage.clear_all },
    "SQL query logs",
    queries_path
  )
end

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/dbwatcher/queries_controller.rb', line 5

def index
  @date = params[:date] || Date.current.strftime("%Y-%m-%d")
  queries = Storage.queries.for_date(@date).all
  @queries = Dbwatcher::Services::QueryFilterProcessor.call(queries, params)

  respond_to do |format|
    format.html
    format.json { render json: @queries }
  end
end