bnb_blazer 0.12.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec69ad8a224fd546013b93951cfe9ce085159ed57ea2522501fad3d4cc6be414
4
- data.tar.gz: 2ef7512602a4fa086133d42f853a75c38b457aaa274fc9375650b7c696af42fd
3
+ metadata.gz: 31b415fdbebedc01c64caa7a2177e945f3ad948b533e7d62cbfc4f84cc98dbfe
4
+ data.tar.gz: 597d28e7e5f0ca0f1805e26129bf0e732fd2f34838cad0e7a769ecd2a4339ba8
5
5
  SHA512:
6
- metadata.gz: 8fe611e118599d7b7dd1fa1c423c27dbac658298517ba1970e11a4153d5de39f2978f5f088a9197ab332e096d68d2248a84edb2494fda578edfd680b1b4b97a6
7
- data.tar.gz: '081328ec4ff145acef6530b9fe07bd4d408e409f494e3f6b44532c2c7195fe0909376f3262092217aad4b2e0bf41dc0ccf1bb022172ebd50a786f4bc940b38d1'
6
+ metadata.gz: e779ff92e9441c6cd3c2131ff31545b8eb18ac5c38c1672587437deba35f40b981ebaedbaf0a415ae5c6acc619a7eddf47dfbe5b494860314dcdab245ff951d5
7
+ data.tar.gz: 5d8757c34480475e2696703059805857dea12eb0f01e108af6dc1dda7e8c87fbb02e15e7d93ffe0b6d5a668c179923627c5781ebdb59d659669bf02849e9da28
data/README.md CHANGED
@@ -41,8 +41,8 @@ This gem comes bundled with a test app to help you test out new display designs
41
41
  2. Make sure you have [Dip](https://github.com/brandnewbox/bnb-dip-defaults) installed and configured
42
42
  3. Run `dip setup`
43
43
  4. In your new `bnb_blazer` directory, run `docker-compose up`
44
- 5. Uncomment the `mount Blazer::Engine, at: "/blazer"` line in your `config/routes.rb` file.
45
- 5. Navigate to http://localhost:3000/blazer in your browser, and away you go!
44
+ 5. Uncomment the `mount Blazer::Engine, at: "/bnb-blazer"` line in your `config/routes.rb` file.
45
+ 5. Navigate to http://localhost:3000/bnb-blazer in your browser, and away you go!
46
46
 
47
47
  For the work of actually overriding the gem, Rails will load any view that we have defined in the `app/views` (not `spec/dummy/app/views`) folder before looking for them in the blazer gem. So any view that we want to override or restyle you just have to create at the same location as it would be found in the blazer gem. E.g. the homepage view for blazer is found at `app/views/blazer/queries/home.html.erb`, so if we want to override what the homepage looks like in our gem then we create a new view at `app/views/blazer/queries/home.html.erb` and copy the existing HTML from the gem and make modifications as necessary.
48
48
 
@@ -18,6 +18,7 @@ body {
18
18
  }
19
19
 
20
20
  .results-container {
21
+ overflow-x: scroll;
21
22
  margin-top: 20px;
22
23
  }
23
24
 
@@ -29,7 +29,9 @@
29
29
  </div>
30
30
  </div>
31
31
  <script>
32
- <%= blazer_js_var "data", {statement: @statements[i], query_id: query.id, data_source: query.data_source, only_chart: true, cohort_period: params[:cohort_period]} %>
32
+ <% data = {statement: query.statement, query_id: query.id, data_source: query.data_source, variables: variable_params(query), only_chart: true} %>
33
+ <% data.merge!(cohort_period: params[:cohort_period]) if params[:cohort_period] %>
34
+ <%= blazer_js_var "data", data %>
33
35
 
34
36
  runQuery(data, function (data) {
35
37
  $("#chart-<%= i %>").html(data)
@@ -0,0 +1,137 @@
1
+ <% blazer_title "Docs: #{@data_source.name}" %>
2
+
3
+ <h1>Docs: <%= @data_source.name %></h1>
4
+
5
+ <hr />
6
+
7
+ <h2>Smart Variables</h2>
8
+
9
+ <% if @smart_variables.any? %>
10
+ <p>Use these variable names to get a dropdown of values.</p>
11
+
12
+ <table class="table" style="max-width: 500px;">
13
+ <thead>
14
+ <tr>
15
+ <th>Variable</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% @smart_variables.each do |k, _| %>
20
+ <tr>
21
+ <td><code>{<%= k %>}</code></td>
22
+ </tr>
23
+ <% end %>
24
+ </tbody>
25
+ </table>
26
+
27
+ <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>
28
+ <% else %>
29
+ <p>None set</p>
30
+ <% end %>
31
+
32
+ <h2>Linked Columns</h2>
33
+
34
+ <% if @linked_columns.any? %>
35
+ <p>Use these column names to link results to other pages.</p>
36
+
37
+ <table class="table" style="max-width: 500px;">
38
+ <thead>
39
+ <tr>
40
+ <th style="width: 20%;">Name</th>
41
+ <th>URL</th>
42
+ </tr>
43
+ </thead>
44
+ <tbody>
45
+ <% @linked_columns.each do |k, v| %>
46
+ <tr>
47
+ <td><%= k %></td>
48
+ <td><%= v %></td>
49
+ </tr>
50
+ <% end %>
51
+ </tbody>
52
+ </table>
53
+
54
+ <p>Values that match the format of a URL will be linked automatically.</p>
55
+ <% else %>
56
+ <p>None set</p>
57
+ <% end %>
58
+
59
+ <h2>Smart Columns</h2>
60
+
61
+ <% if @smart_columns.any? %>
62
+ <p>Use these column names to show additional data.</p>
63
+
64
+ <table class="table" style="max-width: 500px;">
65
+ <thead>
66
+ <tr>
67
+ <th>Name</th>
68
+ </tr>
69
+ </thead>
70
+ <tbody>
71
+ <% @smart_columns.each do |k, _| %>
72
+ <tr>
73
+ <td><%= k %></td>
74
+ </tr>
75
+ <% end %>
76
+ </tbody>
77
+ </table>
78
+ <% else %>
79
+ <p>None set</p>
80
+ <% end %>
81
+
82
+ <h2>Charts</h2>
83
+
84
+ <p>Use specific combinations of column types to generate charts.</p>
85
+
86
+ <table class="table" style="max-width: 500px;">
87
+ <thead>
88
+ <tr>
89
+ <th style="width: 20%;">Chart</th>
90
+ <th>Column Types</th>
91
+ </tr>
92
+ </thead>
93
+ <tbody>
94
+ <tr>
95
+ <td>Line</td>
96
+ <td>2+ columns - timestamp, numeric(s)</td>
97
+ </tr>
98
+ <tr>
99
+ <td>Line</td>
100
+ <td>3 columns - timestamp, string, numeric</td>
101
+ </tr>
102
+ <tr>
103
+ <td>Column</td>
104
+ <td>2+ columns - string, numeric(s)</td>
105
+ </tr>
106
+ <tr>
107
+ <td>Column</td>
108
+ <td>3 columns - string, string, numeric</td>
109
+ </tr>
110
+ <tr>
111
+ <td>Scatter</td>
112
+ <td>2 columns - both numeric</td>
113
+ </tr>
114
+ <tr>
115
+ <td>Pie</td>
116
+ <td>2 columns - string, numeric - and last column named <code>pie</code></td>
117
+ </tr>
118
+ <tr>
119
+ <td>Map</td>
120
+ <td>
121
+ Named <code>latitude</code> and <code>longitude</code>, or <code>lat</code> and <code>lon</code>, or <code>lat</code> and <code>lng</code>
122
+ <% if !blazer_maps? %>
123
+ <br />
124
+ <strong>Needs configured</strong>
125
+ <% end %>
126
+ </td>
127
+ </tr>
128
+ </tbody>
129
+ </table>
130
+
131
+ <p>Use the column name <code>target</code> to draw a line for goals.</p>
132
+
133
+ <% if @data_source.supports_cohort_analysis? %>
134
+ <h2>Cohort Analysis</h2>
135
+
136
+ <p>Create a query with the comment <code>/* cohort analysis */</code>. The result should have columns named <code>user_id</code> and <code>conversion_time</code> and optionally <code>cohort_time</code>.</p>
137
+ <% end %>
@@ -11,6 +11,13 @@
11
11
  <% end %>
12
12
  <% end %>
13
13
 
14
+ <% if @success %>
15
+ <% run_data = {statement: @query.statement, query_id: @query.id, data_source: @query.data_source, variables: variable_params(@query)} %>
16
+ <% run_data.merge!(forecast: "t") if params[:forecast] %>
17
+ <% run_data.merge!(cohort_period: params[:cohort_period]) if params[:cohort_period] %>
18
+ <% run_data.transform_keys!(&:to_s) if Rails::VERSION::MAJOR < 6 %>
19
+ <% end %>
20
+
14
21
  <div style="margin-bottom: 60px;"></div>
15
22
 
16
23
  <% if @sql_errors.any? %>
@@ -46,9 +53,7 @@
46
53
  $("#results").addClass("query-error").html(message)
47
54
  }
48
55
 
49
- <% data = variable_params(@query).merge(statement: @statement, query_id: @query.id, data_source: @query.data_source) %>
50
- <% data.merge!(forecast: "t") if params[:forecast] %>
51
- <%= blazer_js_var "data", data %>
56
+ <%= blazer_js_var "data", run_data %>
52
57
 
53
58
  runQuery(data, showRun, showError)
54
59
  </script>
@@ -25,7 +25,7 @@
25
25
  · #{check.message}
26
26
  - if @query && @result.forecastable? && !params[:forecast]
27
27
  ·
28
- \#{link_to "Forecast", query_path(@query, {forecast: "t"}.merge(variable_params(@query)))}
28
+ \#{link_to "Forecast", query_path(@query, params: {forecast: "t"}.merge(variable_params(@query)))}
29
29
  - if @forecast_error
30
30
  .alert.alert-danger= @forecast_error
31
31
  - if @cohort_error
@@ -56,12 +56,14 @@
56
56
  - color = "#54a3ee"
57
57
  - series_library[1] = {borderDash: [8], borderColor: color, pointBackgroundColor: color, backgroundColor: color, pointHoverBackgroundColor: color}
58
58
  - if blazer_maps? && @markers.any?
59
- #map{:style => "height: #{@only_chart ? 300 : 500}px;"}
59
+ - map_id = SecureRandom.hex
60
+ = content_tag :div, nil, id: map_id, style: "height: #{@only_chart ? 300 : 500}px;"
60
61
  :javascript
61
62
  #{blazer_js_var "mapboxAccessToken", Blazer.mapbox_access_token}
62
63
  #{blazer_js_var "markers", @markers}
64
+ #{blazer_js_var "mapId", map_id }
63
65
  L.mapbox.accessToken = mapboxAccessToken;
64
- var map = L.mapbox.map('map')
66
+ var map = L.mapbox.map(mapId)
65
67
  .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));
66
68
  var featureLayer = L.mapbox.featureLayer().addTo(map);
67
69
  var geojson = [];
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title><%= blazer_title ? blazer_title : "Blazer" %></title>
4
+ <title><%= blazer_title ? blazer_title : "BNBintel" %></title>
5
5
 
6
6
  <meta charset="utf-8" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -1,3 +1,3 @@
1
1
  module BnbBlazer
2
- VERSION = "0.12.0"
2
+ VERSION = "0.14.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bnb_blazer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blazer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 2.6.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 2.6.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sassc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +59,7 @@ files:
59
59
  - app/models/user.rb
60
60
  - app/views/blazer/_nav.html.erb
61
61
  - app/views/blazer/dashboards/show.html.erb
62
+ - app/views/blazer/queries/docs.html.erb
62
63
  - app/views/blazer/queries/home.html.erb
63
64
  - app/views/blazer/queries/show.html.erb
64
65
  - app/views/bnb_blazer/_footer.html.erb
@@ -97,14 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
98
  requirements:
98
99
  - - ">="
99
100
  - !ruby/object:Gem::Version
100
- version: 2.3.0
101
+ version: 2.7.0
101
102
  required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  requirements:
103
104
  - - ">="
104
105
  - !ruby/object:Gem::Version
105
106
  version: '0'
106
107
  requirements: []
107
- rubygems_version: 3.1.2
108
+ rubygems_version: 3.1.6
108
109
  signing_key:
109
110
  specification_version: 4
110
111
  summary: Customized branding of the Blazer gem for BNB projects