reports_kits 0.7.5 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/.rubocop.yml +85 -0
- data/.travis.yml +21 -0
- data/Appraisals +27 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +20 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/reports_kits/application.js +14 -0
- data/app/assets/javascripts/reports_kits/lib/_init.js +9 -0
- data/app/assets/javascripts/reports_kits/lib/chart.js +73 -0
- data/app/assets/javascripts/reports_kits/lib/report.js +135 -0
- data/app/assets/javascripts/reports_kits/lib/table.js +87 -0
- data/app/assets/javascripts/reports_kits/vendor/chart.js +12269 -0
- data/app/assets/javascripts/reports_kits/vendor/daterangepicker.js +1627 -0
- data/app/assets/javascripts/reports_kits/vendor/jquery.tablesorter.min.js +4 -0
- data/app/assets/javascripts/reports_kits/vendor/moment.js +4040 -0
- data/app/assets/javascripts/reports_kits/vendor/select2.full.js +6436 -0
- data/app/assets/stylesheets/reports_kits/application.css.scss +3 -0
- data/app/assets/stylesheets/reports_kits/reports.css.sass +33 -0
- data/app/assets/stylesheets/reports_kits/select2_overrides.css.sass +7 -0
- data/app/assets/stylesheets/reports_kits/vendor/daterangepicker.css +269 -0
- data/app/assets/stylesheets/reports_kits/vendor/select2-bootstrap.css +721 -0
- data/app/assets/stylesheets/reports_kits/vendor/select2.css +484 -0
- data/config/initializers/mime_types.rb +1 -0
- data/config/routes.rb +10 -0
- data/docs/images/demo.gif +0 -0
- data/docs/images/users_by_created_at.png +0 -0
- data/gemfiles/mysql.gemfile +7 -0
- data/gemfiles/mysql.gemfile.lock +167 -0
- data/gemfiles/postgresql.gemfile +7 -0
- data/gemfiles/postgresql.gemfile.lock +165 -0
- data/gemfiles/postgresql_rails_5.1.4.gemfile +8 -0
- data/gemfiles/postgresql_rails_5.1.4.gemfile.lock +168 -0
- data/gemfiles/rails_4_mysql.gemfile +8 -0
- data/gemfiles/rails_4_mysql.gemfile.lock +165 -0
- data/gemfiles/rails_4_postgresql.gemfile +8 -0
- data/gemfiles/rails_4_postgresql.gemfile.lock +163 -0
- data/gemfiles/rails_5.1.4_postgresql.gemfile +8 -0
- data/gemfiles/rails_5.1.4_postgresql.gemfile.lock +169 -0
- data/gemfiles/rails_5_mysql.gemfile +8 -0
- data/gemfiles/rails_5_mysql.gemfile.lock +171 -0
- data/gemfiles/rails_5_postgresql.gemfile +8 -0
- data/gemfiles/rails_5_postgresql.gemfile.lock +169 -0
- data/lib/reports_kits/base_controller.rb +17 -0
- data/lib/reports_kits/cache.rb +37 -0
- data/lib/reports_kits/configuration.rb +50 -0
- data/lib/reports_kits/engine.rb +21 -0
- data/lib/reports_kits/entity.rb +3 -0
- data/lib/reports_kits/filters_controller.rb +11 -0
- data/lib/reports_kits/form_builder.rb +66 -0
- data/lib/reports_kits/helper.rb +24 -0
- data/lib/reports_kits/model.rb +16 -0
- data/lib/reports_kits/model_configuration.rb +28 -0
- data/lib/reports_kits/normalized_params.rb +16 -0
- data/lib/reports_kits/order.rb +33 -0
- data/lib/reports_kits/relative_time.rb +42 -0
- data/lib/reports_kits/report_builder.rb +88 -0
- data/lib/reports_kits/reports/abstract_series.rb +9 -0
- data/lib/reports_kits/reports/adapters/mysql.rb +26 -0
- data/lib/reports_kits/reports/adapters/postgresql.rb +26 -0
- data/lib/reports_kits/reports/composite_series.rb +48 -0
- data/lib/reports_kits/reports/contextual_filter.rb +19 -0
- data/lib/reports_kits/reports/data/add_table_aggregations.rb +105 -0
- data/lib/reports_kits/reports/data/aggregate_composite.rb +97 -0
- data/lib/reports_kits/reports/data/aggregate_one_dimension.rb +39 -0
- data/lib/reports_kits/reports/data/aggregate_two_dimensions.rb +39 -0
- data/lib/reports_kits/reports/data/chart_data_for_data_method.rb +62 -0
- data/lib/reports_kits/reports/data/chart_options.rb +155 -0
- data/lib/reports_kits/reports/data/format_one_dimension.rb +140 -0
- data/lib/reports_kits/reports/data/format_table.rb +63 -0
- data/lib/reports_kits/reports/data/format_two_dimensions.rb +143 -0
- data/lib/reports_kits/reports/data/generate.rb +156 -0
- data/lib/reports_kits/reports/data/generate_for_properties.rb +97 -0
- data/lib/reports_kits/reports/data/normalize_properties.rb +62 -0
- data/lib/reports_kits/reports/data/populate_one_dimension.rb +54 -0
- data/lib/reports_kits/reports/data/populate_two_dimensions.rb +104 -0
- data/lib/reports_kits/reports/data/utils.rb +178 -0
- data/lib/reports_kits/reports/dimension.rb +27 -0
- data/lib/reports_kits/reports/dimension_with_series.rb +144 -0
- data/lib/reports_kits/reports/filter.rb +29 -0
- data/lib/reports_kits/reports/filter_types/base.rb +48 -0
- data/lib/reports_kits/reports/filter_types/boolean.rb +47 -0
- data/lib/reports_kits/reports/filter_types/datetime.rb +51 -0
- data/lib/reports_kits/reports/filter_types/number.rb +30 -0
- data/lib/reports_kits/reports/filter_types/records.rb +26 -0
- data/lib/reports_kits/reports/filter_types/string.rb +38 -0
- data/lib/reports_kits/reports/filter_with_series.rb +97 -0
- data/lib/reports_kits/reports/generate_autocomplete_method_results.rb +29 -0
- data/lib/reports_kits/reports/generate_autocomplete_results.rb +57 -0
- data/lib/reports_kits/reports/inferrable_configuration.rb +116 -0
- data/lib/reports_kits/reports/model_settings.rb +30 -0
- data/lib/reports_kits/reports/properties.rb +10 -0
- data/lib/reports_kits/reports/properties_to_filter.rb +40 -0
- data/lib/reports_kits/reports/series.rb +121 -0
- data/lib/reports_kits/reports_controller.rb +65 -0
- data/lib/reports_kits/utils.rb +11 -0
- data/lib/reports_kits/value.rb +3 -0
- data/lib/reports_kits/version.rb +3 -0
- data/lib/reports_kits.rb +79 -0
- data/reports_kits.gemspec +26 -0
- data/spec/factories/issue_factory.rb +4 -0
- data/spec/factories/issues_label_factory.rb +4 -0
- data/spec/factories/label_factory.rb +4 -0
- data/spec/factories/pro_repo_factory.rb +5 -0
- data/spec/factories/repo_factory.rb +5 -0
- data/spec/factories/tag_factory.rb +4 -0
- data/spec/fixtures/generate_inputs.yml +254 -0
- data/spec/fixtures/generate_outputs.yml +1216 -0
- data/spec/reports_kit/form_builder_spec.rb +26 -0
- data/spec/reports_kit/relative_time_spec.rb +29 -0
- data/spec/reports_kit/reports/data/generate/contextual_filters_spec.rb +60 -0
- data/spec/reports_kit/reports/data/generate_spec.rb +1371 -0
- data/spec/reports_kit/reports/data/normalize_properties_spec.rb +196 -0
- data/spec/reports_kit/reports/dimension_with_series_spec.rb +67 -0
- data/spec/reports_kit/reports/filter_with_series_spec.rb +39 -0
- data/spec/reports_kit/reports/generate_autocomplete_results_spec.rb +69 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/support/config.rb +41 -0
- data/spec/support/example_data_methods.rb +25 -0
- data/spec/support/factory_girl.rb +5 -0
- data/spec/support/helpers.rb +25 -0
- data/spec/support/models/issue.rb +14 -0
- data/spec/support/models/issues_label.rb +4 -0
- data/spec/support/models/label.rb +5 -0
- data/spec/support/models/pro/repo.rb +5 -0
- data/spec/support/models/pro/special_issue.rb +4 -0
- data/spec/support/models/repo.rb +13 -0
- data/spec/support/models/tag.rb +4 -0
- data/spec/support/schema.rb +39 -0
- metadata +134 -4
@@ -0,0 +1,169 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
reports_kit (0.7.1)
|
5
|
+
rails (>= 3)
|
6
|
+
spreadsheet (>= 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.4)
|
12
|
+
actionpack (= 5.1.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.4)
|
16
|
+
actionpack (= 5.1.4)
|
17
|
+
actionview (= 5.1.4)
|
18
|
+
activejob (= 5.1.4)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.4)
|
22
|
+
actionview (= 5.1.4)
|
23
|
+
activesupport (= 5.1.4)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.4)
|
29
|
+
activesupport (= 5.1.4)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.4)
|
35
|
+
activesupport (= 5.1.4)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.4)
|
38
|
+
activesupport (= 5.1.4)
|
39
|
+
activerecord (5.1.4)
|
40
|
+
activemodel (= 5.1.4)
|
41
|
+
activesupport (= 5.1.4)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.4)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
appraisal (2.2.0)
|
49
|
+
bundler
|
50
|
+
rake
|
51
|
+
thor (>= 0.14.0)
|
52
|
+
arel (8.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
byebug (2.7.0)
|
55
|
+
columnize (~> 0.3)
|
56
|
+
debugger-linecache (~> 1.2)
|
57
|
+
coderay (1.1.2)
|
58
|
+
columnize (0.9.0)
|
59
|
+
concurrent-ruby (1.0.5)
|
60
|
+
crass (1.0.2)
|
61
|
+
database_cleaner (1.6.1)
|
62
|
+
debugger-linecache (1.2.0)
|
63
|
+
diff-lcs (1.3)
|
64
|
+
erubi (1.7.0)
|
65
|
+
factory_girl (4.8.1)
|
66
|
+
activesupport (>= 3.0.0)
|
67
|
+
globalid (0.4.0)
|
68
|
+
activesupport (>= 4.2.0)
|
69
|
+
groupdate (3.2.0)
|
70
|
+
activesupport (>= 3)
|
71
|
+
i18n (0.8.6)
|
72
|
+
loofah (2.1.1)
|
73
|
+
crass (~> 1.0.2)
|
74
|
+
nokogiri (>= 1.5.9)
|
75
|
+
mail (2.6.6)
|
76
|
+
mime-types (>= 1.16, < 4)
|
77
|
+
method_source (0.9.0)
|
78
|
+
mime-types (3.1)
|
79
|
+
mime-types-data (~> 3.2015)
|
80
|
+
mime-types-data (3.2016.0521)
|
81
|
+
mini_portile2 (2.3.0)
|
82
|
+
minitest (5.10.3)
|
83
|
+
nio4r (2.1.0)
|
84
|
+
nokogiri (1.8.1)
|
85
|
+
mini_portile2 (~> 2.3.0)
|
86
|
+
pg (0.21.0)
|
87
|
+
pry (0.11.1)
|
88
|
+
coderay (~> 1.1.0)
|
89
|
+
method_source (~> 0.9.0)
|
90
|
+
pry-byebug (1.3.3)
|
91
|
+
byebug (~> 2.7)
|
92
|
+
pry (~> 0.10)
|
93
|
+
rack (2.0.3)
|
94
|
+
rack-test (0.7.0)
|
95
|
+
rack (>= 1.0, < 3)
|
96
|
+
rails (5.1.4)
|
97
|
+
actioncable (= 5.1.4)
|
98
|
+
actionmailer (= 5.1.4)
|
99
|
+
actionpack (= 5.1.4)
|
100
|
+
actionview (= 5.1.4)
|
101
|
+
activejob (= 5.1.4)
|
102
|
+
activemodel (= 5.1.4)
|
103
|
+
activerecord (= 5.1.4)
|
104
|
+
activesupport (= 5.1.4)
|
105
|
+
bundler (>= 1.3.0)
|
106
|
+
railties (= 5.1.4)
|
107
|
+
sprockets-rails (>= 2.0.0)
|
108
|
+
rails-dom-testing (2.0.3)
|
109
|
+
activesupport (>= 4.2.0)
|
110
|
+
nokogiri (>= 1.6)
|
111
|
+
rails-html-sanitizer (1.0.3)
|
112
|
+
loofah (~> 2.0)
|
113
|
+
railties (5.1.4)
|
114
|
+
actionpack (= 5.1.4)
|
115
|
+
activesupport (= 5.1.4)
|
116
|
+
method_source
|
117
|
+
rake (>= 0.8.7)
|
118
|
+
thor (>= 0.18.1, < 2.0)
|
119
|
+
rake (12.1.0)
|
120
|
+
rspec (3.6.0)
|
121
|
+
rspec-core (~> 3.6.0)
|
122
|
+
rspec-expectations (~> 3.6.0)
|
123
|
+
rspec-mocks (~> 3.6.0)
|
124
|
+
rspec-core (3.6.0)
|
125
|
+
rspec-support (~> 3.6.0)
|
126
|
+
rspec-expectations (3.6.0)
|
127
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
+
rspec-support (~> 3.6.0)
|
129
|
+
rspec-mocks (3.6.0)
|
130
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
131
|
+
rspec-support (~> 3.6.0)
|
132
|
+
rspec-support (3.6.0)
|
133
|
+
ruby-ole (1.2.12.1)
|
134
|
+
spreadsheet (1.1.7)
|
135
|
+
ruby-ole (>= 1.0)
|
136
|
+
sprockets (3.7.1)
|
137
|
+
concurrent-ruby (~> 1.0)
|
138
|
+
rack (> 1, < 3)
|
139
|
+
sprockets-rails (3.2.1)
|
140
|
+
actionpack (>= 4.0)
|
141
|
+
activesupport (>= 4.0)
|
142
|
+
sprockets (>= 3.0.0)
|
143
|
+
thor (0.20.0)
|
144
|
+
thread_safe (0.3.6)
|
145
|
+
timecop (0.9.1)
|
146
|
+
tzinfo (1.2.3)
|
147
|
+
thread_safe (~> 0.1)
|
148
|
+
websocket-driver (0.6.5)
|
149
|
+
websocket-extensions (>= 0.1.0)
|
150
|
+
websocket-extensions (0.1.2)
|
151
|
+
|
152
|
+
PLATFORMS
|
153
|
+
ruby
|
154
|
+
|
155
|
+
DEPENDENCIES
|
156
|
+
appraisal
|
157
|
+
database_cleaner (~> 1)
|
158
|
+
factory_girl (~> 4)
|
159
|
+
groupdate (~> 3)
|
160
|
+
pg
|
161
|
+
pry (~> 0)
|
162
|
+
pry-byebug (~> 1)
|
163
|
+
rails (= 5.1.4)
|
164
|
+
reports_kit!
|
165
|
+
rspec (~> 3)
|
166
|
+
timecop (~> 0)
|
167
|
+
|
168
|
+
BUNDLED WITH
|
169
|
+
1.16.1
|
@@ -0,0 +1,171 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
reports_kit (0.7.1)
|
5
|
+
rails (>= 3)
|
6
|
+
spreadsheet (>= 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.3)
|
12
|
+
actionpack (= 5.1.3)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.3)
|
16
|
+
actionpack (= 5.1.3)
|
17
|
+
actionview (= 5.1.3)
|
18
|
+
activejob (= 5.1.3)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.3)
|
22
|
+
actionview (= 5.1.3)
|
23
|
+
activesupport (= 5.1.3)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (~> 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.3)
|
29
|
+
activesupport (= 5.1.3)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.3)
|
35
|
+
activesupport (= 5.1.3)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.3)
|
38
|
+
activesupport (= 5.1.3)
|
39
|
+
activerecord (5.1.3)
|
40
|
+
activemodel (= 5.1.3)
|
41
|
+
activesupport (= 5.1.3)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.3)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
appraisal (2.2.0)
|
49
|
+
bundler
|
50
|
+
rake
|
51
|
+
thor (>= 0.14.0)
|
52
|
+
arel (8.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
byebug (2.7.0)
|
55
|
+
columnize (~> 0.3)
|
56
|
+
debugger-linecache (~> 1.2)
|
57
|
+
coderay (1.1.2)
|
58
|
+
columnize (0.9.0)
|
59
|
+
concurrent-ruby (1.0.5)
|
60
|
+
crass (1.0.2)
|
61
|
+
database_cleaner (1.6.1)
|
62
|
+
debugger-linecache (1.2.0)
|
63
|
+
diff-lcs (1.3)
|
64
|
+
erubi (1.7.0)
|
65
|
+
factory_girl (4.8.1)
|
66
|
+
activesupport (>= 3.0.0)
|
67
|
+
globalid (0.4.0)
|
68
|
+
activesupport (>= 4.2.0)
|
69
|
+
groupdate (3.2.0)
|
70
|
+
activesupport (>= 3)
|
71
|
+
i18n (0.8.6)
|
72
|
+
loofah (2.1.1)
|
73
|
+
crass (~> 1.0.2)
|
74
|
+
nokogiri (>= 1.5.9)
|
75
|
+
mail (2.6.6)
|
76
|
+
mime-types (>= 1.16, < 4)
|
77
|
+
method_source (0.9.0)
|
78
|
+
mime-types (3.1)
|
79
|
+
mime-types-data (~> 3.2015)
|
80
|
+
mime-types-data (3.2016.0521)
|
81
|
+
mini_portile2 (2.3.0)
|
82
|
+
minitest (5.10.3)
|
83
|
+
mysql2 (0.4.9)
|
84
|
+
nio4r (2.1.0)
|
85
|
+
nokogiri (1.8.1)
|
86
|
+
mini_portile2 (~> 2.3.0)
|
87
|
+
pg (0.21.0)
|
88
|
+
pry (0.11.1)
|
89
|
+
coderay (~> 1.1.0)
|
90
|
+
method_source (~> 0.9.0)
|
91
|
+
pry-byebug (1.3.3)
|
92
|
+
byebug (~> 2.7)
|
93
|
+
pry (~> 0.10)
|
94
|
+
rack (2.0.3)
|
95
|
+
rack-test (0.6.3)
|
96
|
+
rack (>= 1.0)
|
97
|
+
rails (5.1.3)
|
98
|
+
actioncable (= 5.1.3)
|
99
|
+
actionmailer (= 5.1.3)
|
100
|
+
actionpack (= 5.1.3)
|
101
|
+
actionview (= 5.1.3)
|
102
|
+
activejob (= 5.1.3)
|
103
|
+
activemodel (= 5.1.3)
|
104
|
+
activerecord (= 5.1.3)
|
105
|
+
activesupport (= 5.1.3)
|
106
|
+
bundler (>= 1.3.0)
|
107
|
+
railties (= 5.1.3)
|
108
|
+
sprockets-rails (>= 2.0.0)
|
109
|
+
rails-dom-testing (2.0.3)
|
110
|
+
activesupport (>= 4.2.0)
|
111
|
+
nokogiri (>= 1.6)
|
112
|
+
rails-html-sanitizer (1.0.3)
|
113
|
+
loofah (~> 2.0)
|
114
|
+
railties (5.1.3)
|
115
|
+
actionpack (= 5.1.3)
|
116
|
+
activesupport (= 5.1.3)
|
117
|
+
method_source
|
118
|
+
rake (>= 0.8.7)
|
119
|
+
thor (>= 0.18.1, < 2.0)
|
120
|
+
rake (12.1.0)
|
121
|
+
rspec (3.6.0)
|
122
|
+
rspec-core (~> 3.6.0)
|
123
|
+
rspec-expectations (~> 3.6.0)
|
124
|
+
rspec-mocks (~> 3.6.0)
|
125
|
+
rspec-core (3.6.0)
|
126
|
+
rspec-support (~> 3.6.0)
|
127
|
+
rspec-expectations (3.6.0)
|
128
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
129
|
+
rspec-support (~> 3.6.0)
|
130
|
+
rspec-mocks (3.6.0)
|
131
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
132
|
+
rspec-support (~> 3.6.0)
|
133
|
+
rspec-support (3.6.0)
|
134
|
+
ruby-ole (1.2.12.1)
|
135
|
+
spreadsheet (1.1.7)
|
136
|
+
ruby-ole (>= 1.0)
|
137
|
+
sprockets (3.7.1)
|
138
|
+
concurrent-ruby (~> 1.0)
|
139
|
+
rack (> 1, < 3)
|
140
|
+
sprockets-rails (3.2.1)
|
141
|
+
actionpack (>= 4.0)
|
142
|
+
activesupport (>= 4.0)
|
143
|
+
sprockets (>= 3.0.0)
|
144
|
+
thor (0.20.0)
|
145
|
+
thread_safe (0.3.6)
|
146
|
+
timecop (0.9.1)
|
147
|
+
tzinfo (1.2.3)
|
148
|
+
thread_safe (~> 0.1)
|
149
|
+
websocket-driver (0.6.5)
|
150
|
+
websocket-extensions (>= 0.1.0)
|
151
|
+
websocket-extensions (0.1.2)
|
152
|
+
|
153
|
+
PLATFORMS
|
154
|
+
ruby
|
155
|
+
|
156
|
+
DEPENDENCIES
|
157
|
+
appraisal
|
158
|
+
database_cleaner (~> 1)
|
159
|
+
factory_girl (~> 4)
|
160
|
+
groupdate (~> 3)
|
161
|
+
mysql2
|
162
|
+
pg (>= 0.15)
|
163
|
+
pry (~> 0)
|
164
|
+
pry-byebug (~> 1)
|
165
|
+
rails (= 5.1.3)
|
166
|
+
reports_kit!
|
167
|
+
rspec (~> 3)
|
168
|
+
timecop (~> 0)
|
169
|
+
|
170
|
+
BUNDLED WITH
|
171
|
+
1.16.1
|
@@ -0,0 +1,169 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
reports_kit (0.7.1)
|
5
|
+
rails (>= 3)
|
6
|
+
spreadsheet (>= 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.3)
|
12
|
+
actionpack (= 5.1.3)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.3)
|
16
|
+
actionpack (= 5.1.3)
|
17
|
+
actionview (= 5.1.3)
|
18
|
+
activejob (= 5.1.3)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.3)
|
22
|
+
actionview (= 5.1.3)
|
23
|
+
activesupport (= 5.1.3)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (~> 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.3)
|
29
|
+
activesupport (= 5.1.3)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.3)
|
35
|
+
activesupport (= 5.1.3)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.3)
|
38
|
+
activesupport (= 5.1.3)
|
39
|
+
activerecord (5.1.3)
|
40
|
+
activemodel (= 5.1.3)
|
41
|
+
activesupport (= 5.1.3)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.3)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
appraisal (2.2.0)
|
49
|
+
bundler
|
50
|
+
rake
|
51
|
+
thor (>= 0.14.0)
|
52
|
+
arel (8.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
byebug (2.7.0)
|
55
|
+
columnize (~> 0.3)
|
56
|
+
debugger-linecache (~> 1.2)
|
57
|
+
coderay (1.1.2)
|
58
|
+
columnize (0.9.0)
|
59
|
+
concurrent-ruby (1.0.5)
|
60
|
+
crass (1.0.2)
|
61
|
+
database_cleaner (1.6.1)
|
62
|
+
debugger-linecache (1.2.0)
|
63
|
+
diff-lcs (1.3)
|
64
|
+
erubi (1.7.0)
|
65
|
+
factory_girl (4.8.1)
|
66
|
+
activesupport (>= 3.0.0)
|
67
|
+
globalid (0.4.0)
|
68
|
+
activesupport (>= 4.2.0)
|
69
|
+
groupdate (3.2.0)
|
70
|
+
activesupport (>= 3)
|
71
|
+
i18n (0.8.6)
|
72
|
+
loofah (2.1.1)
|
73
|
+
crass (~> 1.0.2)
|
74
|
+
nokogiri (>= 1.5.9)
|
75
|
+
mail (2.6.6)
|
76
|
+
mime-types (>= 1.16, < 4)
|
77
|
+
method_source (0.9.0)
|
78
|
+
mime-types (3.1)
|
79
|
+
mime-types-data (~> 3.2015)
|
80
|
+
mime-types-data (3.2016.0521)
|
81
|
+
mini_portile2 (2.3.0)
|
82
|
+
minitest (5.10.3)
|
83
|
+
nio4r (2.1.0)
|
84
|
+
nokogiri (1.8.1)
|
85
|
+
mini_portile2 (~> 2.3.0)
|
86
|
+
pg (0.21.0)
|
87
|
+
pry (0.11.1)
|
88
|
+
coderay (~> 1.1.0)
|
89
|
+
method_source (~> 0.9.0)
|
90
|
+
pry-byebug (1.3.3)
|
91
|
+
byebug (~> 2.7)
|
92
|
+
pry (~> 0.10)
|
93
|
+
rack (2.0.3)
|
94
|
+
rack-test (0.6.3)
|
95
|
+
rack (>= 1.0)
|
96
|
+
rails (5.1.3)
|
97
|
+
actioncable (= 5.1.3)
|
98
|
+
actionmailer (= 5.1.3)
|
99
|
+
actionpack (= 5.1.3)
|
100
|
+
actionview (= 5.1.3)
|
101
|
+
activejob (= 5.1.3)
|
102
|
+
activemodel (= 5.1.3)
|
103
|
+
activerecord (= 5.1.3)
|
104
|
+
activesupport (= 5.1.3)
|
105
|
+
bundler (>= 1.3.0)
|
106
|
+
railties (= 5.1.3)
|
107
|
+
sprockets-rails (>= 2.0.0)
|
108
|
+
rails-dom-testing (2.0.3)
|
109
|
+
activesupport (>= 4.2.0)
|
110
|
+
nokogiri (>= 1.6)
|
111
|
+
rails-html-sanitizer (1.0.3)
|
112
|
+
loofah (~> 2.0)
|
113
|
+
railties (5.1.3)
|
114
|
+
actionpack (= 5.1.3)
|
115
|
+
activesupport (= 5.1.3)
|
116
|
+
method_source
|
117
|
+
rake (>= 0.8.7)
|
118
|
+
thor (>= 0.18.1, < 2.0)
|
119
|
+
rake (12.1.0)
|
120
|
+
rspec (3.6.0)
|
121
|
+
rspec-core (~> 3.6.0)
|
122
|
+
rspec-expectations (~> 3.6.0)
|
123
|
+
rspec-mocks (~> 3.6.0)
|
124
|
+
rspec-core (3.6.0)
|
125
|
+
rspec-support (~> 3.6.0)
|
126
|
+
rspec-expectations (3.6.0)
|
127
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
+
rspec-support (~> 3.6.0)
|
129
|
+
rspec-mocks (3.6.0)
|
130
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
131
|
+
rspec-support (~> 3.6.0)
|
132
|
+
rspec-support (3.6.0)
|
133
|
+
ruby-ole (1.2.12.1)
|
134
|
+
spreadsheet (1.1.7)
|
135
|
+
ruby-ole (>= 1.0)
|
136
|
+
sprockets (3.7.1)
|
137
|
+
concurrent-ruby (~> 1.0)
|
138
|
+
rack (> 1, < 3)
|
139
|
+
sprockets-rails (3.2.1)
|
140
|
+
actionpack (>= 4.0)
|
141
|
+
activesupport (>= 4.0)
|
142
|
+
sprockets (>= 3.0.0)
|
143
|
+
thor (0.20.0)
|
144
|
+
thread_safe (0.3.6)
|
145
|
+
timecop (0.9.1)
|
146
|
+
tzinfo (1.2.3)
|
147
|
+
thread_safe (~> 0.1)
|
148
|
+
websocket-driver (0.6.5)
|
149
|
+
websocket-extensions (>= 0.1.0)
|
150
|
+
websocket-extensions (0.1.2)
|
151
|
+
|
152
|
+
PLATFORMS
|
153
|
+
ruby
|
154
|
+
|
155
|
+
DEPENDENCIES
|
156
|
+
appraisal
|
157
|
+
database_cleaner (~> 1)
|
158
|
+
factory_girl (~> 4)
|
159
|
+
groupdate (~> 3)
|
160
|
+
pg
|
161
|
+
pry (~> 0)
|
162
|
+
pry-byebug (~> 1)
|
163
|
+
rails (= 5.1.3)
|
164
|
+
reports_kit!
|
165
|
+
rspec (~> 3)
|
166
|
+
timecop (~> 0)
|
167
|
+
|
168
|
+
BUNDLED WITH
|
169
|
+
1.16.1
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ReportsKits
|
2
|
+
class BaseController < ActionController::Base
|
3
|
+
include ReportsKits::NormalizedParams
|
4
|
+
|
5
|
+
# This is intentionally public to allow external code to access it
|
6
|
+
def context_record
|
7
|
+
ReportsKits.configuration.context_record(self)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def modify_context_params
|
13
|
+
modify_context_params_method = ReportsKits.configuration.modify_context_params_method
|
14
|
+
params[:context_params] = modify_context_params_method.call(params[:context_params], self) if modify_context_params_method
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ReportsKits
|
2
|
+
class Cache
|
3
|
+
CACHE_PREFIX = 'reports_kit:reports:'
|
4
|
+
|
5
|
+
def self.get(properties, context_record)
|
6
|
+
return unless store
|
7
|
+
key = self.key(properties, context_record)
|
8
|
+
json_string = store.get(key)
|
9
|
+
return if json_string.blank?
|
10
|
+
ActiveSupport::JSON.decode(json_string)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.set(properties, context_record, data)
|
14
|
+
return unless store
|
15
|
+
key = self.key(properties, context_record)
|
16
|
+
json_string = ActiveSupport::JSON.encode(data)
|
17
|
+
store.setex(key, duration, json_string)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def self.key(properties, context_record)
|
23
|
+
key = properties.to_json
|
24
|
+
key += "#{context_record.class}#{context_record.id}" if context_record
|
25
|
+
key = Digest::MD5.hexdigest(key)
|
26
|
+
"#{CACHE_PREFIX}#{key}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.duration
|
30
|
+
@duration ||= ReportsKits.configuration.cache_duration
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.store
|
34
|
+
@store ||= ReportsKits.configuration.cache_store
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module ReportsKits
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :autocomplete_results_method, :cache_duration, :cache_store, :context_record_method, :custom_methods,
|
4
|
+
:default_dimension_limit, :default_properties, :first_day_of_week, :modify_context_params_method, :properties_method,
|
5
|
+
:report_filename_method, :use_concurrent_queries
|
6
|
+
|
7
|
+
DEFAULT_PROPERTIES_METHOD = lambda do |env|
|
8
|
+
path = Rails.root.join('config', 'reports_kit', 'reports', "#{report_key}.yml")
|
9
|
+
YAML.load_file(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
self.autocomplete_results_method = nil
|
14
|
+
self.cache_duration = 5.minutes
|
15
|
+
self.cache_store = nil
|
16
|
+
self.custom_methods = {}
|
17
|
+
self.default_dimension_limit = 30
|
18
|
+
self.default_properties = nil
|
19
|
+
self.first_day_of_week = :sunday
|
20
|
+
self.modify_context_params_method = nil
|
21
|
+
self.properties_method = DEFAULT_PROPERTIES_METHOD
|
22
|
+
self.report_filename_method = nil
|
23
|
+
self.use_concurrent_queries = false
|
24
|
+
end
|
25
|
+
|
26
|
+
def custom_method(method_name)
|
27
|
+
return if method_name.blank?
|
28
|
+
method = evaluated_custom_methods[method_name.to_sym]
|
29
|
+
raise ArgumentError.new("A method named '#{method_name}' is not defined") unless method
|
30
|
+
method
|
31
|
+
end
|
32
|
+
|
33
|
+
def evaluated_custom_methods
|
34
|
+
return custom_methods if custom_methods.is_a?(Hash)
|
35
|
+
return custom_methods.call if custom_methods.is_a?(Proc)
|
36
|
+
raise ArgumentError.new("Invalid type for custom_methods configuration: #{custom_methods.class}")
|
37
|
+
end
|
38
|
+
|
39
|
+
def context_record_method=(context_record_method)
|
40
|
+
warn "[DEPRECATION] `context_record_method` is deprecated. Please use contextual filters instead: https://www.ReportsKits.co/subcategories/contextual_filters"
|
41
|
+
|
42
|
+
@context_record_method = context_record_method
|
43
|
+
end
|
44
|
+
|
45
|
+
def context_record(context)
|
46
|
+
return unless context_record_method
|
47
|
+
context.instance_eval(&context_record_method)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ReportsKits
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
engine_name 'reports_kits'
|
4
|
+
|
5
|
+
initializer 'reports_kits.helpers.helper' do
|
6
|
+
ActiveSupport.on_load(:action_view) do
|
7
|
+
include Helper
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer 'reports_kits.assets.precompile' do |app|
|
12
|
+
if app.config.respond_to?(:assets)
|
13
|
+
if defined?(Sprockets) && Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new('4.0.0.beta1')
|
14
|
+
app.config.assets.precompile += %w(reports_kits.js reports_kits.css)
|
15
|
+
else
|
16
|
+
app.config.assets.precompile << proc { |path| path.start_with?('reports_kits.') }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ReportsKits
|
2
|
+
class FiltersController < ReportsKits::BaseController
|
3
|
+
before_action :modify_context_params
|
4
|
+
|
5
|
+
def autocomplete
|
6
|
+
properties = Reports::Properties.generate(self)
|
7
|
+
results = Reports::GenerateAutocompleteResults.new(params, properties, context_record: context_record).perform
|
8
|
+
render json: { data: results }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|