% if @error %>
Select variables
<% else %>Cached <%= time_ago_in_words(@cached_at, include_seconds: true) %> ago <% if @query && !params[:data_source] %> <%= link_to "Refresh", refresh_query_path(@query, variable_params), method: :post %> <% end %>
<% end %><%= pluralize(@rows.size, "row") %>
<% end %> <% if @rows.any? %> <% values = @rows.first.values %> <% chart_id = SecureRandom.hex %> <% if values.size >= 2 && (values.first.is_a?(Time) || values.first.is_a?(Date)) && values[1..-1].all?{|v| v.is_a?(Numeric) } %> <% time_k = @columns.keys.first %> <%= line_chart @columns.keys[1..-1].map{|k| {name: k, data: @rows.map{|r| [r[time_k], r[k]] }} }, id: chart_id, min: nil %> <% elsif values.size == 3 && (values.first.is_a?(Time) || values.first.is_a?(Date)) && values[1].is_a?(String) && values[2].is_a?(Numeric) %> <% keys = @columns.keys %> <%= line_chart @rows.group_by { |v| v[keys[1]] }.map { |name, v| {name: name, data: v.map { |v2| [v2[keys[0]], v2[keys[2]]] } } }, id: chart_id, min: nil %> <% elsif values.size == 2 && values.first.is_a?(String) && values.last.is_a?(Numeric) %> <%= pie_chart @rows.map(&:values), library: {sliceVisibilityThreshold: 1 / 40.0}, id: chart_id %> <% elsif @only_chart %> <% if @rows.size == 1 && @rows.first.size == 1 %><%= format_value(@rows.first.keys.first, @rows.first.values.first) %>
<% else %> <% @no_chart = true %> <% end %> <% end %> <% unless @only_chart && !@no_chart %> <% header_width = 100 / @rows.first.keys.size.to_f %>
<%= key %>
|
<% end %>
---|
<% if v.is_a?(Time) %>
<% v = v.in_time_zone(Blazer.time_zone) %>
<% end %>
<% unless v.nil? %>
<% if v == "" %>
empty string
<% elsif @linked_columns[k] %>
<%= link_to format_value(k, v), @linked_columns[k].gsub("{value}", u(v.to_s)), target: "_blank" %>
<% else %>
<%= format_value(k, v) %>
<% end %>
<% if v2 = (@boom[k] || {})[v] %>
<%= v2 %>
<% end %>
<% end %>
|
<% end %>
No rows
<% end %> <% end %>