Commit 34a7ee96 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

basic gauge rendering merge

parent a46d6d54
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -72,4 +72,8 @@ class FnordMetric::Gauge
    values_at(ticks_in(range))
  end

  def renderable?
    false
  end

end
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
class FnordMetric::NumericTimeseriesGauge < FnordMetric::MultiGauge
class FnordMetric::NumericTimeseriesGauge < FnordMetric::Gauge

  #def execute(runner, _backend)
    # super
@@ -51,6 +51,10 @@ class FnordMetric::NumericTimeseriesGauge < FnordMetric::MultiGauge
    # end
  #end

  def renderable?
    true
  end

private

  # def render_result
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ class FnordMetric::Namespace

  def opt_gauge(gauge_key, opts={})
    opts.merge!(:key => gauge_key, :key_prefix => key_prefix)
    klass = "FnordMetric::#{(opts[:type] || "").camelize}Gauge".constantize
    klass = "FnordMetric::#{(opts[:type] || "").to_s.camelize}Gauge".constantize
    @gauges[gauge_key] ||= klass.new(opts)
  end

+10 −2
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ class FnordMetric::Reactor
    return false unless ns = @namespaces[event["namespace"].to_sym]
    messages << discover(ns) if event["type"] == "discover_request"
    messages << widget(ns, event) if event["type"] == "widget_request"
    messages << gauge(ns, event) if event["type"] == "render_request"
    messages.flatten.each{ |m| socket.send(m.to_json) }
  end

@@ -18,13 +19,20 @@ private
    "FnordMetric::#{event["klass"]}".constantize.execute(namespace, event) # FIXPAUL
  end

  def gauge(namespace, event)
    { "type" => "render_response", "gauge" => event["gauge"], "payload" => {
      "title" => "fnord"
    } }
  end

  def discover(namespace)
    [namespace.dashboards.map do |dash_key, gauge|
    [namespace.dashboards.map do |dash_key, dash|
      { "type" => "discover_response", "gauge_key" => dash_key, "view" => "dashboard" }
    end,
    namespace.gauges.map do |gauge_key, gauge|
      next unless gauge.renderable?
      { "type" => "discover_response", "gauge_key" => gauge_key, "view" => "gauge" }
    end]
    end.compact]
  end

end
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ a.link:hover{
  background:url('img/navbar.png');
  position:absolute;
  z-index: 11004;
  top:0;
}

.navbar h1{
Loading