sql-jarvis 2.1.4 → 2.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd81a249e949ad7c6fe925701c4221f5d7466aa1a3503b2f3444ceda82282e2f
|
4
|
+
data.tar.gz: aa56786392647652e110c5405f5aa67660f29fa822da7c7f09df88fdeacad836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4c04a6cda8473b157f6605bd2187ef52383e8d2cfb9661f657095bbc22e9653c7570302b756a932d165970f11b466c811244560ccc2eb5355da5dc01606dcff
|
7
|
+
data.tar.gz: 66d479f3aada4eae9e7656e030b805aefb9ed14fb2b04445793899c084a381e39917dcad6ac725ffb012acd1bdaccc1c8c4ea6a418924396224a0dc26b8ce83f
|
@@ -61,6 +61,15 @@ module Blazer
|
|
61
61
|
@statement = @query.statement.dup
|
62
62
|
process_vars(@statement, @query.data_source)
|
63
63
|
|
64
|
+
filename = []
|
65
|
+
filename << @query.name.parameterize if @query
|
66
|
+
filename << params[:start_time].to_s.to_date
|
67
|
+
if params[:end_time]
|
68
|
+
filename << 'to'
|
69
|
+
filename << params[:end_time].to_s.to_date
|
70
|
+
end
|
71
|
+
@filename = filename.compact.join('-')
|
72
|
+
|
64
73
|
@smart_vars = {}
|
65
74
|
@sql_errors = []
|
66
75
|
data_source = Blazer.data_sources[@query.data_source]
|
@@ -253,7 +262,8 @@ module Blazer
|
|
253
262
|
end
|
254
263
|
end
|
255
264
|
|
256
|
-
@filename = @query
|
265
|
+
@filename = params[:filename] || @query&.name&.parameterize
|
266
|
+
|
257
267
|
@min_width_types = @columns.each_with_index.select { |c, i| @first_row[i].is_a?(Time) || @first_row[i].is_a?(String) || @data_source.smart_columns[c] }.map(&:last)
|
258
268
|
|
259
269
|
@boom = @result.boom if @result
|
@@ -278,7 +288,6 @@ module Blazer
|
|
278
288
|
end
|
279
289
|
end
|
280
290
|
|
281
|
-
filename = @query.try(:name).try(:parameterize).presence || 'query'
|
282
291
|
respond_to do |format|
|
283
292
|
format.html do
|
284
293
|
render layout: false
|
@@ -286,10 +295,14 @@ module Blazer
|
|
286
295
|
format.xlsx do
|
287
296
|
parser = ::Blazer::ExcelParser.new(@query, @columns, @rows)
|
288
297
|
tmp_file = parser.export
|
289
|
-
send_file tmp_file,
|
298
|
+
send_file tmp_file,
|
299
|
+
type: 'application/xlsx; charset=utf-8; header=present',
|
300
|
+
disposition: "attachment; filename=\"#{@filename}.xlsx\""
|
290
301
|
end
|
291
302
|
format.csv do
|
292
|
-
send_data csv_data(@columns, @rows, @data_source),
|
303
|
+
send_data csv_data(@columns, @rows, @data_source),
|
304
|
+
type: 'text/csv; charset=utf-8; header=present',
|
305
|
+
disposition: "attachment; filename=\"#{@filename}.csv\""
|
293
306
|
end
|
294
307
|
end
|
295
308
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
- blazer_title @query.name
|
2
|
+
|
2
3
|
.topbar
|
3
4
|
.container
|
4
5
|
.row{:style => "padding-top: 13px;"}
|
@@ -10,8 +11,9 @@
|
|
10
11
|
= link_to "Edit", edit_query_path(@query, variable_params), class: "btn btn-default", disabled: !@query.editable?(blazer_user)
|
11
12
|
= link_to "Fork", new_query_path(variable_params.merge(fork_query_id: @query.id, data_source: @query.data_source, name: @query.name)), class: "btn btn-info"
|
12
13
|
- if !@error && @success
|
13
|
-
= button_to "⤓ .csv", run_queries_path(query_id: @query.id, format: "csv", forecast: params[:forecast]), params: {statement: @statement}, class: "btn btn-primary"
|
14
|
-
= button_to "⤓ .xlsx", run_queries_path(query_id: @query.id, format: "xlsx"), params: {statement: @statement}, class: "btn btn-primary"
|
14
|
+
= button_to "⤓ .csv", run_queries_path(query_id: @query.id, format: "csv", forecast: params[:forecast]), params: { statement: @statement, filename: @filename }, class: "btn btn-primary"
|
15
|
+
= button_to "⤓ .xlsx", run_queries_path(query_id: @query.id, format: "xlsx"), params: { statement: @statement, filename: @filename }, class: "btn btn-primary"
|
16
|
+
|
15
17
|
%div{:style => "margin-bottom: 60px;"}
|
16
18
|
- if @sql_errors.any?
|
17
19
|
.alert.alert-danger
|
data/lib/blazer/excel_parser.rb
CHANGED
@@ -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 = Tempfile.new
|
30
|
+
tmp_file = Tempfile.new.path
|
35
31
|
excel.serialize(tmp_file)
|
36
32
|
return tmp_file
|
37
33
|
end
|
data/lib/blazer/version.rb
CHANGED
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: 2020-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
|
-
rubygems_version: 3.
|
288
|
+
rubygems_version: 3.1.2
|
289
289
|
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Fork from ankane! Explore your data with SQL. Easily create charts and dashboards,
|