2021-08-02 21:01:34 +00:00
|
|
|
- blazer_title @query.name
|
|
|
|
.container
|
|
|
|
.row
|
|
|
|
.col-12
|
|
|
|
%h1= @query.name
|
|
|
|
- if @query.description.present?
|
|
|
|
%p.lead= @query.description
|
|
|
|
- unless @result.chart_type.blank?
|
|
|
|
.col-12
|
|
|
|
- case @result.chart_type
|
|
|
|
- when 'line'
|
|
|
|
= line_chart @chart_data, **@chart_options
|
|
|
|
- when 'line2'
|
|
|
|
= line_chart @chart_data, **@chart_options
|
|
|
|
- when 'pie'
|
|
|
|
= pie_chart @chart_data, **@chart_options
|
|
|
|
- when 'bar'
|
|
|
|
= column_chart @chart_data, **@chart_options
|
|
|
|
- when 'bar2'
|
|
|
|
= column_chart @chart_data, **@chart_options
|
|
|
|
- when 'scatter'
|
|
|
|
= scatter_chart @chart_data, **@chart_options
|
|
|
|
.col-12
|
|
|
|
%table.table
|
|
|
|
%thead
|
|
|
|
%tr
|
|
|
|
- @result.columns.each do |key|
|
|
|
|
- next if key.include? 'ciphertext'
|
|
|
|
- next if key.include? 'encrypted'
|
2021-08-03 13:16:26 +00:00
|
|
|
%th.position-sticky.background-white{ style: 'top: 0' }= key
|
2021-08-02 21:01:34 +00:00
|
|
|
%tbody
|
|
|
|
- @result.rows.each do |row|
|
|
|
|
%tr
|
|
|
|
- row.each_with_index do |v, i|
|
|
|
|
- k = @result.columns[i]
|
|
|
|
- next if k.include? 'ciphertext'
|
|
|
|
- next if k.include? 'encrypted'
|
|
|
|
%td
|
|
|
|
- if v.is_a?(Time)
|
|
|
|
- v = blazer_time_value(@data_source, k, v)
|
|
|
|
|
|
|
|
- unless v.nil?
|
|
|
|
- if v.is_a?(String) && v.empty?
|
|
|
|
%span.text-muted= t('.empty')
|
|
|
|
- elsif @data_source.linked_columns[k]
|
|
|
|
= link_to blazer_format_value(k, v), @data_source.linked_columns[k].gsub('{value}', u(v.to_s)), target: '_blank'
|
|
|
|
- else
|
|
|
|
= blazer_format_value(k, v)
|
|
|
|
|
|
|
|
- if (v2 = (@result.boom[k] || {})[v.nil? ? v : v.to_s])
|
|
|
|
%span.text-muted= v2
|