sql-jarvis 2.1 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@ require "blazer/data_source"
12
12
  require "blazer/result"
13
13
  require "blazer/excel_parser"
14
14
  require "blazer/run_statement"
15
+ require "blazer/run_integration"
15
16
 
16
17
  # adapters
17
18
  require "blazer/adapters/base_adapter"
@@ -42,15 +43,18 @@ module Blazer
42
43
  attr_accessor :before_action
43
44
  attr_accessor :from_email
44
45
  attr_accessor :host
46
+ attr_accessor :preview_rows_number
45
47
  attr_accessor :cache
46
48
  attr_accessor :transform_statement
47
49
  attr_accessor :transform_variable
48
50
  attr_accessor :check_schedules
49
51
  attr_accessor :mapbox_access_token
50
52
  attr_accessor :assignees
53
+ attr_accessor :teams
51
54
  attr_accessor :anomaly_checks
52
55
  attr_accessor :forecasting
53
56
  attr_accessor :async
57
+ attr_accessor :integration
54
58
  attr_accessor :images
55
59
  attr_accessor :query_viewable
56
60
  attr_accessor :query_editable
@@ -58,12 +62,15 @@ module Blazer
58
62
  attr_accessor :slack_webhook_url
59
63
  attr_accessor :query_creatable
60
64
  end
65
+
61
66
  self.audit = true
62
67
  self.user_name = :name
63
68
  self.check_schedules = ["5 minutes", "1 hour", "1 day"]
64
69
  self.mapbox_access_token = nil
65
70
  self.assignees = []
71
+ self.teams = []
66
72
  self.host = nil
73
+ self.preview_rows_number = 365
67
74
  self.anomaly_checks = false
68
75
  self.forecasting = false
69
76
  self.async = false
@@ -86,6 +93,11 @@ module Blazer
86
93
  @time_zone = time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone[time_zone.to_s]
87
94
  end
88
95
 
96
+ def self.integration
97
+ return @integration if defined?(@integration)
98
+ @integration = settings.key?("integration") ? settings["integration"] : false
99
+ end
100
+
89
101
  def self.user_class
90
102
  if !defined?(@user_class)
91
103
  @user_class = settings.key?("user_class") ? settings["user_class"] : (User.name rescue nil)
@@ -52,11 +52,11 @@ module Blazer
52
52
 
53
53
  def preview_statement
54
54
  if postgresql?
55
- "SELECT * FROM \"{table}\" LIMIT 10"
55
+ "SELECT * FROM \"{table}\" LIMIT 30"
56
56
  elsif sqlserver?
57
- "SELECT TOP (10) * FROM {table}"
57
+ "SELECT TOP (30) * FROM {table}"
58
58
  else
59
- "SELECT *\nFROM {table}\nORDER BY id DESC\nLIMIT 10"
59
+ "SELECT *\nFROM {table}\nORDER BY id DESC\nLIMIT 30"
60
60
  end
61
61
  end
62
62
 
@@ -37,6 +37,10 @@ module Blazer
37
37
  settings["variable_defaults"] || {}
38
38
  end
39
39
 
40
+ def select_all_variables
41
+ settings["select_all_variables"] || {}
42
+ end
43
+
40
44
  def timeout
41
45
  settings["timeout"]
42
46
  end
@@ -13,10 +13,6 @@ module Blazer
13
13
  save_file!
14
14
  end
15
15
 
16
- def filename
17
- "#{query.name.to_s.parameterize}-#{Time.current.strftime('%y-%m-%d')}.xlsx"
18
- end
19
-
20
16
  private
21
17
 
22
18
  attr_reader :query, :excel
@@ -31,7 +27,7 @@ module Blazer
31
27
  end
32
28
 
33
29
  def save_file!
34
- tmp_file = "tmp/#{filename}"
30
+ tmp_file = Tempfile.new.path
35
31
  excel.serialize(tmp_file)
36
32
  return tmp_file
37
33
  end
@@ -0,0 +1,24 @@
1
+ module Blazer
2
+ class RunIntegration
3
+
4
+ def initialize(results, integration)
5
+ @results = results
6
+ @integration = integration
7
+ end
8
+
9
+ def call
10
+ return if integration.blank?
11
+ eval integration
12
+ return {
13
+ headers: @headers,
14
+ rows: @rows
15
+ }
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :results
21
+ attr_reader :integration
22
+
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Blazer
2
- VERSION = '2.1'
2
+ VERSION = '2.1.5'
3
3
  end
@@ -61,6 +61,7 @@ audit: true
61
61
  # mapbox_access_token: <%= ENV["MAPBOX_ACCESS_TOKEN"] %>
62
62
 
63
63
  # assignees: 'SELECT id, name FROM users ORDER BY id ASC'
64
+ # teams: 'SELECT id, name FROM teams'
64
65
 
65
66
  check_schedules:
66
67
  - "1 day"
@@ -7,6 +7,8 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
7
7
  t.text :statement
8
8
  t.string :data_source
9
9
  t.string :assignee_ids
10
+ t.string :team_ids
11
+ t.text :integration
10
12
  t.timestamps null: false
11
13
  end
12
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql-jarvis
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -171,9 +171,11 @@ files:
171
171
  - app/assets/javascripts/blazer/ace.js
172
172
  - app/assets/javascripts/blazer/ace/ace.js
173
173
  - app/assets/javascripts/blazer/ace/ext-language_tools.js
174
+ - app/assets/javascripts/blazer/ace/mode-ruby.js
174
175
  - app/assets/javascripts/blazer/ace/mode-sql.js
175
176
  - app/assets/javascripts/blazer/ace/snippets/sql.js
176
177
  - app/assets/javascripts/blazer/ace/snippets/text.js
178
+ - app/assets/javascripts/blazer/ace/theme-ambiance.js
177
179
  - app/assets/javascripts/blazer/ace/theme-twilight.js
178
180
  - app/assets/javascripts/blazer/application.js
179
181
  - app/assets/javascripts/blazer/bootstrap.js
@@ -227,6 +229,7 @@ files:
227
229
  - app/views/blazer/dashboards/edit.html.haml
228
230
  - app/views/blazer/dashboards/new.html.haml
229
231
  - app/views/blazer/dashboards/show.html.haml
232
+ - app/views/blazer/queries/_chart.html.haml
230
233
  - app/views/blazer/queries/_form.html.haml
231
234
  - app/views/blazer/queries/_tips.html.haml
232
235
  - app/views/blazer/queries/docs.html.haml
@@ -255,6 +258,7 @@ files:
255
258
  - lib/blazer/engine.rb
256
259
  - lib/blazer/excel_parser.rb
257
260
  - lib/blazer/result.rb
261
+ - lib/blazer/run_integration.rb
258
262
  - lib/blazer/run_statement.rb
259
263
  - lib/blazer/run_statement_job.rb
260
264
  - lib/blazer/version.rb
@@ -281,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
285
  - !ruby/object:Gem::Version
282
286
  version: '0'
283
287
  requirements: []
284
- rubygems_version: 3.0.3
288
+ rubygems_version: 3.1.2
285
289
  signing_key:
286
290
  specification_version: 4
287
291
  summary: Fork from ankane! Explore your data with SQL. Easily create charts and dashboards,