blazer 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of blazer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/controllers/blazer/base_controller.rb +8 -2
- data/app/models/blazer/audit.rb +2 -2
- data/app/models/blazer/query.rb +1 -1
- data/app/views/blazer/queries/{_tables.html → _tables.html.erb} +0 -0
- data/lib/blazer.rb +5 -0
- data/lib/blazer/data_source.rb +6 -1
- data/lib/blazer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16ac494e37f4c14e418e50320667f1b371f05190
|
4
|
+
data.tar.gz: 8ebadcac25cbbf06a86c16e01d4b17f3f077eac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3437a6d97706f7a7e3b394012f9b17d5b36661fda013966e80c66bc1b279ada234a6c968a4e6f567b4c13ed5946564f581ca4835d247f740b6a08de21d9a88b2
|
7
|
+
data.tar.gz: d56d5300d8267dcd5f866ce25ce4e40f7e27ffe4659c893b615effd40610ccd7d3326d5fc827ac412d2feb40ddfb4494474e6ca833ad7972038e6d0168309393
|
data/CHANGELOG.md
CHANGED
@@ -33,7 +33,13 @@ module Blazer
|
|
33
33
|
if @success
|
34
34
|
@bind_vars.each do |var|
|
35
35
|
value = params[var].presence
|
36
|
-
|
36
|
+
if value
|
37
|
+
if value =~ /\A\d+\z/
|
38
|
+
value = value.to_i
|
39
|
+
elsif value =~ /\A\d+\.\d+\z/
|
40
|
+
value = value.to_f
|
41
|
+
end
|
42
|
+
end
|
37
43
|
if var.end_with?("_at")
|
38
44
|
value = Blazer.time_zone.parse(value) rescue nil
|
39
45
|
end
|
@@ -51,7 +57,7 @@ module Blazer
|
|
51
57
|
helper_method :extract_vars
|
52
58
|
|
53
59
|
def variable_params
|
54
|
-
params.except(:controller, :action, :id, :host, :query, :dashboard, :query_id, :query_ids, :table_names, :authenticity_token, :utf8, :_method, :commit, :statement, :data_source, :name, :fork_query_id)
|
60
|
+
params.except(:controller, :action, :id, :host, :query, :dashboard, :query_id, :query_ids, :table_names, :authenticity_token, :utf8, :_method, :commit, :statement, :data_source, :name, :fork_query_id).permit!
|
55
61
|
end
|
56
62
|
helper_method :variable_params
|
57
63
|
|
data/app/models/blazer/audit.rb
CHANGED
data/app/models/blazer/query.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Blazer
|
2
2
|
class Query < ActiveRecord::Base
|
3
|
-
belongs_to :creator, class_name: Blazer.user_class.to_s if Blazer.user_class
|
3
|
+
belongs_to :creator, class_name: Blazer.user_class.to_s, required: false if Blazer.user_class
|
4
4
|
has_many :checks, dependent: :destroy
|
5
5
|
has_many :dashboard_queries, dependent: :destroy
|
6
6
|
has_many :dashboards, through: :dashboard_queries
|
File without changes
|
data/lib/blazer.rb
CHANGED
@@ -74,6 +74,11 @@ module Blazer
|
|
74
74
|
Rails.logger.info "[blazer timeout] query=#{check.query.name}"
|
75
75
|
tries += 1
|
76
76
|
sleep(10)
|
77
|
+
elsif error.start_with?("PG::ConnectionBad")
|
78
|
+
data_sources[check.query.data_source].reconnect
|
79
|
+
Rails.logger.info "[blazer reconnect] query=#{check.query.name}"
|
80
|
+
tries += 1
|
81
|
+
sleep(10)
|
77
82
|
else
|
78
83
|
break
|
79
84
|
end
|
data/lib/blazer/data_source.rb
CHANGED
@@ -90,10 +90,11 @@ module Blazer
|
|
90
90
|
end
|
91
91
|
|
92
92
|
result = connection_model.connection.select_all("#{statement} /*#{comment}*/")
|
93
|
+
cast_method = Rails::VERSION::MAJOR < 5 ? :type_cast : :cast_value
|
93
94
|
result.each do |untyped_row|
|
94
95
|
row = {}
|
95
96
|
untyped_row.each do |k, v|
|
96
|
-
row[k] = result.column_types.empty? ? v : result.column_types[k].send(
|
97
|
+
row[k] = result.column_types.empty? ? v : result.column_types[k].send(cast_method, v)
|
97
98
|
end
|
98
99
|
rows << row
|
99
100
|
end
|
@@ -139,6 +140,10 @@ module Blazer
|
|
139
140
|
["MySQL", "Mysql2", "Mysql2Spatial"].include?(adapter_name)
|
140
141
|
end
|
141
142
|
|
143
|
+
def reconnect
|
144
|
+
connection_model.establish_connection(settings["url"])
|
145
|
+
end
|
146
|
+
|
142
147
|
protected
|
143
148
|
|
144
149
|
def adapter_name
|
data/lib/blazer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,7 +136,7 @@ files:
|
|
136
136
|
- app/views/blazer/dashboards/new.html.erb
|
137
137
|
- app/views/blazer/dashboards/show.html.erb
|
138
138
|
- app/views/blazer/queries/_form.html.erb
|
139
|
-
- app/views/blazer/queries/_tables.html
|
139
|
+
- app/views/blazer/queries/_tables.html.erb
|
140
140
|
- app/views/blazer/queries/edit.html.erb
|
141
141
|
- app/views/blazer/queries/home.html.erb
|
142
142
|
- app/views/blazer/queries/new.html.erb
|