Commit 2d5ccbd5 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

first report, yay :)

parent 43524289
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
{
  "klass": "NumericTimeseriesReport",
  "title": "Gross Search Volume",
  "since": 1336873946,
  "until": 1336879946,
  "query": "filter(_type & 'search_with_filter','search_without_filter')",
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ module FnordQuery; end

require "eventmachine"
require "json"
require "haml"

require "fnordquery/backends/redis_backend"
require "fnordquery/acceptor"
+22 −0
Original line number Diff line number Diff line
@@ -4,4 +4,26 @@ class FnordQuery::Report
  	@opts = opts
  end

  def execute(runner, _backend)
  	%x{mkdir -p #{basedir}}
  end

private

  def render_haml(in_file, out_file)
    in_file = ::File.expand_path("../../../web/haml/#{in_file}.haml", __FILE__)
    haml_engine = Haml::Engine.new(File.read(in_file))
    @render_inner = haml_engine.render(binding)
    layout_file = ::File.expand_path("../../../web/haml/layout.haml", __FILE__)
    haml_engine = Haml::Engine.new(File.read(layout_file))
    File.open(::File.join(basedir, out_file), "w+") do |f|
      f.write(haml_engine.render(binding))
    end
    puts ">> rendered: #{::File.join(basedir, out_file)}"
  end

  def basedir
  	'./web/'
  end

end
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
class FnordQuery::NumericTimeseriesReport < FnordQuery::Report

  def execute(runner, _backend)
  	super
  	backend = _backend[0].new(_backend[1])

  	t_since = @opts["since"].to_i
@@ -35,7 +36,7 @@ class FnordQuery::NumericTimeseriesReport < FnordQuery::Report
private

  def render_result
  	puts @timeline.inspect
  	render_haml(:numeric_timeseries_report, 'report.html')
  end

end
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -24,6 +24,6 @@
        <h1><a class="current">Gross Search Volume</a> &nbsp; <a>(07.05.12-15.05.12)</a></h1>
      </div>
    
      <iframe src="test.html" width="100%" height="1500" scrolling="no" frameborder="none"></iframe>
      <iframe src="report.html" width="100%" height="1500" scrolling="no" frameborder="none"></iframe>

</body>
Loading