old_sql 1.21.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
Old SQL
|
2
|
-
=======
|
1
|
+
# Old SQL
|
3
2
|
|
4
3
|
Old SQL is a Rails Engine database reporting gem that uses plain old SQL.
|
5
4
|
|
@@ -25,8 +24,7 @@ Some features of Old SQL are:
|
|
25
24
|
even add Devise support to an existing model (by default users).
|
26
25
|
* Support for multiple database connections.
|
27
26
|
|
28
|
-
Quick Setup and Demo
|
29
|
-
--------------------
|
27
|
+
## Quick Setup and Demo
|
30
28
|
|
31
29
|
1. Add gem 'old_sql', and gem 'devise' to your Gemfile.
|
32
30
|
2. bundle install
|
@@ -40,8 +38,8 @@ Quick Setup and Demo
|
|
40
38
|
9. Authenticate using your old_sql_admin user.
|
41
39
|
10. Select user from the Reports drop down list. Click run.
|
42
40
|
|
43
|
-
Screenshots
|
44
|
-
|
41
|
+
## Screenshots
|
42
|
+
|
45
43
|
#### jqGrid
|
46
44
|
|
47
45
|
![jqGrid view](https://github.com/egonz/old_sql/raw/master/screenshots/jqgrid.png "jqGrid view")
|
@@ -54,8 +52,7 @@ Screenshots
|
|
54
52
|
|
55
53
|
![table view](https://github.com/egonz/old_sql/raw/master/screenshots/chart.png "Chart view")
|
56
54
|
|
57
|
-
Installation
|
58
|
-
------------
|
55
|
+
## Installation
|
59
56
|
|
60
57
|
To install Old SQL type:
|
61
58
|
|
@@ -70,8 +67,7 @@ This generator will also create a migration that will add a old_sql_admin column
|
|
70
67
|
|
71
68
|
If not already installed Devise is setup.
|
72
69
|
|
73
|
-
Creating Reports
|
74
|
-
----------------
|
70
|
+
## Creating Reports
|
75
71
|
|
76
72
|
Configure your reports config/old_sql/report.yml. An example configuration is created when you run the old_sql:install generator.
|
77
73
|
|
@@ -109,7 +105,7 @@ Configure your reports config/old_sql/report.yml. An example configuration is cr
|
|
109
105
|
report_view: jqgrid
|
110
106
|
query_vars:
|
111
107
|
-
|
112
|
-
|
108
|
+
old_sql_admin: 0
|
113
109
|
fields:
|
114
110
|
- 'id'
|
115
111
|
- 'name'
|
@@ -214,8 +210,7 @@ Optionally create a processor under lib/old_sql_report_processor:
|
|
214
210
|
end
|
215
211
|
end
|
216
212
|
|
217
|
-
Design File Tips
|
218
|
-
----------------
|
213
|
+
## Design File Tips
|
219
214
|
|
220
215
|
Design files, both CSV and CHART, work best (only?) with queries that return a single record.
|
221
216
|
Ideally the query returns aggregate results, from one or more tables. For example:
|
@@ -236,8 +231,7 @@ Ideally the query returns aggregate results, from one or more tables. For exampl
|
|
236
231
|
If you need to process more than a single record create a subclass of OldSql::ReportProcessor::Base. See
|
237
232
|
[UserOldSqlDemoProcessor](https://github.com/egonz/old_sql/blob/master/lib/generators/old_sql/templates/user_processor.rb.example).
|
238
233
|
|
239
|
-
Customize
|
240
|
-
---------
|
234
|
+
## Customize
|
241
235
|
|
242
236
|
All css and html template files can be copied to your installation by executing:
|
243
237
|
|
@@ -245,8 +239,7 @@ All css and html template files can be copied to your installation by executing:
|
|
245
239
|
|
246
240
|
Settings for Old SQL can be configured in config/initializers/old_sql.rb.
|
247
241
|
|
248
|
-
Rake Examples
|
249
|
-
-------------
|
242
|
+
## Rake Examples
|
250
243
|
|
251
244
|
rake old_sql:print:range[user_table,'development','2011-03-01','2011-09-01']
|
252
245
|
|
@@ -254,8 +247,7 @@ Rake Examples
|
|
254
247
|
|
255
248
|
rake old_sql:print:week[user_table,'development']
|
256
249
|
|
257
|
-
Contributing to old_sql
|
258
|
-
-----------------------
|
250
|
+
## Contributing to old_sql
|
259
251
|
|
260
252
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
261
253
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -265,8 +257,7 @@ Contributing to old_sql
|
|
265
257
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
266
258
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
267
259
|
|
268
|
-
Copyright
|
269
|
-
---------
|
260
|
+
## Copyright
|
270
261
|
|
271
262
|
Copyright (c) 2011 Eddie Gonzales. See LICENSE.txt for
|
272
263
|
further details.
|
@@ -60,6 +60,7 @@ module OldSql
|
|
60
60
|
|
61
61
|
@width = 800
|
62
62
|
@height = 500
|
63
|
+
@google_chart_colors = google_chart_colors
|
63
64
|
|
64
65
|
processor = load_base_processor
|
65
66
|
@report = processor.execute_query(@reports[@report_name],@start_date,@end_date,query_vars(@report_name))
|
@@ -199,6 +200,11 @@ module OldSql
|
|
199
200
|
return nil if @report.nil?
|
200
201
|
@report.keys.first
|
201
202
|
end
|
203
|
+
|
204
|
+
def google_chart_colors
|
205
|
+
json = OldSql.google_chart_colors.to_json
|
206
|
+
json.html_safe
|
207
|
+
end
|
202
208
|
end
|
203
209
|
end
|
204
210
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
var chart_title = "<%=@reports[@report_name]['description']%> Report";
|
6
6
|
var chart_type = "<%=chart_type%>";
|
7
7
|
var chart_data = <%=chart_data%>;
|
8
|
-
var chart_colors =
|
8
|
+
var chart_colors = <%=@google_chart_colors%>;
|
9
9
|
var width = <%=@width%>;
|
10
10
|
var height = <%=@height%>;
|
11
11
|
</script>
|
@@ -26,4 +26,8 @@ OldSql.setup do |config|
|
|
26
26
|
# ==> jqGrid Report View Configuration
|
27
27
|
# Number of rows to display in the jqGrid component in the jqGrid report view.
|
28
28
|
config.jqgrid_row_num = 25
|
29
|
+
|
30
|
+
# ==> Google Chart View Configuration
|
31
|
+
# Google chart colors.
|
32
|
+
config.google_chart_colors = ['#E35F18','#307CC7','#D95117','#0A4592','#B33A13','#073D8D','#902811','#052D79','#7A1904','#061E59','#6E0E02','#071253','#530005','#1F3058','#2A437F','#3657A8','#5675BB','#7A94CC','#F38200','#C4794B','#BF5D29','#B8410B','#AD3300','#802205','#36170F']
|
29
33
|
end
|
data/lib/old_sql.rb
CHANGED
@@ -34,6 +34,10 @@ module OldSql
|
|
34
34
|
mattr_accessor :jqgrid_row_num
|
35
35
|
@@jqgrid_row_num = 25
|
36
36
|
|
37
|
+
# Google chart colors.
|
38
|
+
mattr_accessor :google_chart_colors
|
39
|
+
@@google_chart_colors = ['#E35F18','#307CC7','#D95117','#0A4592','#B33A13','#073D8D','#902811','#052D79','#7A1904','#061E59','#6E0E02','#071253','#530005','#1F3058','#2A437F','#3657A8','#5675BB','#7A94CC','#F38200','#C4794B','#BF5D29','#B8410B','#AD3300','#802205','#36170F']
|
40
|
+
|
37
41
|
# Default way to setup Old SQL. Run rails generate old_sql:install to create
|
38
42
|
# a fresh initializer with all configuration values.
|
39
43
|
def self.setup
|
@@ -26,8 +26,8 @@ function drawChart() {
|
|
26
26
|
chart.draw(data, {
|
27
27
|
width: width,
|
28
28
|
height: height,
|
29
|
-
title:chart_title,
|
30
|
-
colors:
|
29
|
+
title: chart_title,
|
30
|
+
colors: chart_colors,
|
31
31
|
is3D: true
|
32
32
|
});
|
33
33
|
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: old_sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.22.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Eddie Gonzales
|
@@ -193,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
193
|
requirements:
|
194
194
|
- - ">="
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
hash: -
|
196
|
+
hash: -1682679697401515691
|
197
197
|
segments:
|
198
198
|
- 0
|
199
199
|
version: "0"
|