Skip to content

Business intelligence made simple

Added inline docs - #190

Andrew Kane767a178f8c1a
diff --git a/app/assets/stylesheets/blazer/application.css b/app/assets/stylesheets/blazer/application.css
index 8af41e97..a9165145 100644
--- a/app/assets/stylesheets/blazer/application.css
+++ b/app/assets/stylesheets/blazer/application.css
@@ -200,3 +200,11 @@ input.search:focus {
.query-error {
color: red;
}
+
+h1 {
+ font-size: 32px;
+}
+
+h2 {
+ font-size: 24px;
+}
diff --git a/app/views/blazer/queries/_form.html.erb b/app/views/blazer/queries/_form.html.erb
index bce33043..99206b11 100644
--- a/app/views/blazer/queries/_form.html.erb
+++ b/app/views/blazer/queries/_form.html.erb
@@ -16,7 +16,7 @@
<div class="pull-left" style="margin-top: 9px;">
<%= link_to "Back", :back %>
</div>
- <a :href="dataSourcePath" target="_blank" style="margin-right: 10px;">Schema</a>
+ <a :href="dataSourcePath" target="_blank" style="margin-right: 10px;">Docs</a>
<%= f.select :data_source, Blazer.data_sources.values.select { |ds| q = @query.dup; q.data_source = ds.id; q.editable?(blazer_user) }.map { |ds| [ds.name, ds.id] }, {}, class: ("hide" if Blazer.data_sources.size <= 1), style: "width: 140px;" %>
<div id="tables" style="display: inline-block; width: 250px; margin-right: 10px;">
<select id="table_names" style="width: 240px;" placeholder="Preview table"></select>
diff --git a/app/views/blazer/queries/schema.html.erb b/app/views/blazer/queries/schema.html.erb
index 0fdd025e..4d83f601 100644
--- a/app/views/blazer/queries/schema.html.erb
+++ b/app/views/blazer/queries/schema.html.erb
@@ -1,13 +1,131 @@
-<% blazer_title "Database Schema" %>
+<% blazer_title @data_source.name %>
-<% @schema.each do |table| %>
- <h4>
- <%= table[:table] %>
- <% if table[:schema] != "public" %>
- <small><%= table[:schema] %></small>
+<h1><%= @data_source.name %></h1>
+
+<h2>Smart Variables</h2>
+
+<p>Use these variable names to get a dropdown.</p>
+
+<table class="table" style="max-width: 500px;">
+ <thead>
+ <tr>
+ <th>Variable</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @data_source.smart_variables.each do |k, _| %>
+ <tr>
+ <td><code>{<%= k %>}</code></td>
+ </tr>
<% end %>
- </h4>
+ </tbody>
+</table>
+
+<p>Use <code>{start_time}</code> and <code>{end_time}</code> for a date range selector. End a variable name with <code>_at</code> for a date selector.</p>
+
+<h2>Linked Columns</h2>
+
+<p>Use these column names to link results to other pages.</p>
+
+<table class="table" style="max-width: 500px;">
+ <thead>
+ <tr>
+ <th style="width: 20%;">Name</th>
+ <th>URL</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @data_source.linked_columns.each do |k, v| %>
+ <tr>
+ <td><%= k %></td>
+ <td><%= v %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<p>Values that match the format of a URL will be linked automatically.</p>
+
+<h2>Smart Columns</h2>
+
+<p>Use these column names to show additional data.</p>
+
+<table class="table" style="max-width: 500px;">
+ <thead>
+ <tr>
+ <th>Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @data_source.smart_columns.each do |k, _| %>
+ <tr>
+ <td><%= k %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<h2>Charts</h2>
+
+<p>Use specific combinations of column types to generate charts.</p>
+
+<table class="table" style="max-width: 500px;">
+ <thead>
+ <tr>
+ <th style="width: 20%;">Chart</th>
+ <th>Column Types</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Line</td>
+ <td>2+ columns - timestamp, numeric(s)</td>
+ </tr>
+ <tr>
+ <td>Line</td>
+ <td>3 columns - timestamp, string, numeric</td>
+ </tr>
+ <tr>
+ <td>Column</td>
+ <td>2+ columns - string, numeric(s)</td>
+ </tr>
+ <tr>
+ <td>Column</td>
+ <td>3 columns - string, string, numeric</td>
+ </tr>
+ <tr>
+ <td>Scatter</td>
+ <td>2 columns - both numeric</td>
+ </tr>
+ <tr>
+ <td>Map</td>
+ <td>
+ Named <code>latitude</code> and <code>longitude</code>, or <code>lat</code> and <code>lon</code>, or <code>lat</code> and <code>lng</code>
+ <% if !blazer_maps? %>
+ <br />
+ <strong>Needs configured</strong>
+ <% end %>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<p>Use the column name <code>target</code> to draw a line for goals.</p>
+
+<h2>Schema</h2>
+
+<% @schema.each do |table| %>
<table class="table" style="max-width: 500px;">
+ <thead>
+ <tr>
+ <th colspan="2">
+ <%= table[:table] %>
+ <% if table[:schema] != "public" %>
+ <span class="text-muted" style="font-weight: normal;"><%= table[:schema] %></span>
+ <% end %>
+ </th>
+ </tr>
+ </thead>
<tbody>
<% table[:columns].each do |column| %>
<tr>