easy_reports 0.0.22 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +21 -21
- data/Gemfile +19 -19
- data/MIT-LICENSE +20 -20
- data/README.md +31 -31
- data/Rakefile +10 -10
- data/app/assets/javascripts/application.js +10 -10
- data/app/assets/javascripts/bootstrap.js +3 -3
- data/app/assets/javascripts/easy_reports/application.js +17 -16
- data/app/assets/javascripts/easy_reports/database_configs.js +2 -2
- data/app/assets/javascripts/easy_reports/reports.js +2 -2
- data/app/assets/stylesheets/application.css +8 -8
- data/app/assets/stylesheets/easy_reports/application.css +17 -16
- data/app/assets/stylesheets/easy_reports/bootstrap_and_overrides.css.less +29 -29
- data/app/assets/stylesheets/easy_reports/dashboard/dashboard_content.css +0 -0
- data/app/assets/stylesheets/easy_reports/dashboard/sidebar.css +135 -0
- data/app/assets/stylesheets/easy_reports/database_configs.css +4 -4
- data/app/assets/stylesheets/easy_reports/reports.css +4 -4
- data/app/controllers/easy_reports/application_controller.rb +4 -4
- data/app/controllers/easy_reports/dashboard_controller.rb +17 -0
- data/app/controllers/easy_reports/database_configs_controller.rb +53 -53
- data/app/controllers/easy_reports/reports_controller.rb +56 -57
- data/app/helpers/easy_reports/application_helper.rb +4 -4
- data/app/helpers/easy_reports/database_configs_helper.rb +4 -4
- data/app/helpers/easy_reports/reports_helper.rb +4 -4
- data/app/models/easy_reports/database_config.rb +4 -4
- data/app/models/easy_reports/report.rb +4 -4
- data/app/services/easy_reports/database_mediator.rb +36 -18
- data/app/views/easy_reports/dashboard/show.html.slim +3 -0
- data/app/views/easy_reports/database_configs/_form.html.slim +33 -33
- data/app/views/easy_reports/database_configs/edit.html.slim +8 -8
- data/app/views/easy_reports/database_configs/index.html.slim +35 -35
- data/app/views/easy_reports/database_configs/new.html.slim +5 -5
- data/app/views/easy_reports/database_configs/show.html.slim +27 -27
- data/app/views/easy_reports/reports/_form.html.slim +17 -15
- data/app/views/easy_reports/reports/edit.html.slim +8 -8
- data/app/views/easy_reports/reports/index.html.slim +26 -26
- data/app/views/easy_reports/reports/new.html.slim +5 -5
- data/app/views/easy_reports/reports/show.html.slim +12 -12
- data/app/views/layouts/easy_reports/application.html.slim +15 -0
- data/app/views/shared/_header.html.slim +60 -0
- data/app/views/shared/_sidebar.html.slim +58 -0
- data/bin/rails +12 -12
- data/config/locales/en.bootstrap.yml +23 -23
- data/config/routes.rb +8 -8
- data/db/migrate/20141207141745_create_easy_reports_reports.rb +10 -10
- data/db/migrate/20141213173509_create_easy_reports_database_configs.rb +16 -16
- data/easy_reports.gemspec +36 -35
- data/lib/easy_reports.rb +13 -11
- data/lib/easy_reports/engine.rb +5 -5
- data/lib/easy_reports/version.rb +3 -3
- data/lib/tasks/easy_reports_tasks.rake +4 -4
- data/test/controllers/easy_reports/database_configs_controller_test.rb +51 -51
- data/test/controllers/easy_reports/reports_controller_test.rb +51 -51
- data/test/dummy/Gemfile +16 -16
- data/test/dummy/Gemfile.lock +129 -129
- data/test/dummy/Rakefile +6 -6
- data/test/dummy/app/assets/javascripts/application.js +13 -13
- data/test/dummy/app/assets/javascripts/bootstrap.js +4 -4
- data/test/dummy/app/assets/stylesheets/application.css +15 -15
- data/test/dummy/app/assets/stylesheets/bootstrap_and_overrides.css.less +29 -29
- data/test/dummy/app/controllers/application_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +2 -2
- data/test/dummy/app/views/layouts/application.html.erb +14 -14
- data/test/dummy/bin/bundle +3 -3
- data/test/dummy/bin/rails +4 -4
- data/test/dummy/bin/rake +4 -4
- data/test/dummy/config.ru +4 -4
- data/test/dummy/config/application.rb +23 -23
- data/test/dummy/config/boot.rb +5 -5
- data/test/dummy/config/database.yml +25 -25
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/environments/development.rb +37 -37
- data/test/dummy/config/environments/production.rb +82 -82
- data/test/dummy/config/environments/test.rb +39 -39
- data/test/dummy/config/initializers/assets.rb +8 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -2
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/test/dummy/config/initializers/inflections.rb +16 -16
- data/test/dummy/config/initializers/mime_types.rb +4 -4
- data/test/dummy/config/initializers/session_store.rb +3 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/test/dummy/config/locales/en.bootstrap.yml +23 -23
- data/test/dummy/config/locales/en.yml +23 -23
- data/test/dummy/config/routes.rb +4 -4
- data/test/dummy/config/secrets.yml +22 -22
- data/test/dummy/db/migrate/20141214161417_create_easy_reports_reports.easy_reports.rb +11 -11
- data/test/dummy/db/migrate/20141214161418_create_easy_reports_database_configs.easy_reports.rb +17 -17
- data/test/dummy/public/404.html +67 -67
- data/test/dummy/public/422.html +67 -67
- data/test/dummy/public/500.html +66 -66
- data/test/fixtures/easy_reports/database_configs.yml +19 -19
- data/test/fixtures/easy_reports/reports.yml +9 -9
- data/test/helpers/easy_reports/database_configs_helper_test.rb +6 -6
- data/test/helpers/easy_reports/reports_helper_test.rb +6 -6
- data/test/models/easy_reports/database_config_test.rb +9 -9
- data/test/models/easy_reports/report_test.rb +9 -9
- metadata +24 -5
- data/app/assets/stylesheets/scaffold.css +0 -56
- data/app/views/layouts/easy_reports/application.html.erb +0 -14
@@ -1,4 +1,4 @@
|
|
1
|
-
/*
|
2
|
-
Place all the styles related to the matching controller here.
|
3
|
-
They will automatically be included in application.css.
|
4
|
-
*/
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*
|
2
|
-
Place all the styles related to the matching controller here.
|
3
|
-
They will automatically be included in application.css.
|
4
|
-
*/
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
class ApplicationController < ActionController::Base
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
end
|
4
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
require_dependency "easy_reports/application_controller"
|
2
|
-
|
3
|
-
module EasyReports
|
4
|
-
class DatabaseConfigsController < ApplicationController
|
5
|
-
before_action :set_database_config, only: [:show, :edit, :update, :destroy]
|
6
|
-
|
7
|
-
def index
|
8
|
-
@database_configs = DatabaseConfig.all
|
9
|
-
end
|
10
|
-
|
11
|
-
def show
|
12
|
-
end
|
13
|
-
|
14
|
-
def new
|
15
|
-
@database_config = DatabaseConfig.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def edit
|
19
|
-
end
|
20
|
-
|
21
|
-
def create
|
22
|
-
@database_config = DatabaseConfig.new(database_config_params)
|
23
|
-
|
24
|
-
if @database_config.save
|
25
|
-
redirect_to @database_config, notice: 'Database config was successfully created.'
|
26
|
-
else
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def update
|
32
|
-
if @database_config.update(database_config_params)
|
33
|
-
redirect_to @database_config, notice: 'Database config was successfully updated.'
|
34
|
-
else
|
35
|
-
render :edit
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def destroy
|
40
|
-
@database_config.destroy
|
41
|
-
redirect_to database_configs_url, notice: 'Database config was successfully destroyed.'
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def set_database_config
|
46
|
-
@database_config = DatabaseConfig.find(params[:id])
|
47
|
-
end
|
48
|
-
|
49
|
-
def database_config_params
|
50
|
-
params.require(:database_config).permit(:adapter, :encoding, :pool, :username, :password, :host, :database_name, :port)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
require_dependency "easy_reports/application_controller"
|
2
|
+
|
3
|
+
module EasyReports
|
4
|
+
class DatabaseConfigsController < ApplicationController
|
5
|
+
before_action :set_database_config, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@database_configs = DatabaseConfig.all
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
def new
|
15
|
+
@database_config = DatabaseConfig.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
@database_config = DatabaseConfig.new(database_config_params)
|
23
|
+
|
24
|
+
if @database_config.save
|
25
|
+
redirect_to @database_config, notice: 'Database config was successfully created.'
|
26
|
+
else
|
27
|
+
render :new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
if @database_config.update(database_config_params)
|
33
|
+
redirect_to @database_config, notice: 'Database config was successfully updated.'
|
34
|
+
else
|
35
|
+
render :edit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy
|
40
|
+
@database_config.destroy
|
41
|
+
redirect_to database_configs_url, notice: 'Database config was successfully destroyed.'
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def set_database_config
|
46
|
+
@database_config = DatabaseConfig.find(params[:id])
|
47
|
+
end
|
48
|
+
|
49
|
+
def database_config_params
|
50
|
+
params.require(:database_config).permit(:adapter, :encoding, :pool, :username, :password, :host, :database_name, :port)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,57 +1,56 @@
|
|
1
|
-
require_dependency "easy_reports/application_controller"
|
2
|
-
|
3
|
-
module EasyReports
|
4
|
-
class ReportsController < ApplicationController
|
5
|
-
before_action :set_report, only: [:show, :edit, :update, :destroy]
|
6
|
-
|
7
|
-
def index
|
8
|
-
@reports = Report.all
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
1
|
+
require_dependency "easy_reports/application_controller"
|
2
|
+
|
3
|
+
module EasyReports
|
4
|
+
class ReportsController < ApplicationController
|
5
|
+
before_action :set_report, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@reports = Report.all
|
9
|
+
|
10
|
+
database_mediator = EasyReports::DatabaseMediator.new
|
11
|
+
@table_list = database_mediator.tables
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
end
|
16
|
+
|
17
|
+
def new
|
18
|
+
@report = Report.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
@report = Report.new(report_params)
|
26
|
+
|
27
|
+
if @report.save
|
28
|
+
redirect_to @report, notice: 'Report was successfully created.'
|
29
|
+
else
|
30
|
+
render :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def update
|
35
|
+
if @report.update(report_params)
|
36
|
+
redirect_to @report, notice: 'Report was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
@report.destroy
|
44
|
+
redirect_to reports_url, notice: 'Report was successfully destroyed.'
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def set_report
|
49
|
+
@report = Report.find(params[:id])
|
50
|
+
end
|
51
|
+
|
52
|
+
def report_params
|
53
|
+
params.require(:report).permit(:title, :description)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
module ApplicationHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
module ApplicationHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
module DatabaseConfigsHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
module DatabaseConfigsHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
module ReportsHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
module ReportsHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
class DatabaseConfig < ActiveRecord::Base
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
class DatabaseConfig < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module EasyReports
|
2
|
-
class Report < ActiveRecord::Base
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module EasyReports
|
2
|
+
class Report < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
end
|
@@ -1,18 +1,36 @@
|
|
1
|
-
module EasyReports
|
2
|
-
class DatabaseMediator
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
|
1
|
+
module EasyReports
|
2
|
+
class DatabaseMediator
|
3
|
+
class DatabaseNotFoundError < StandardError; end
|
4
|
+
|
5
|
+
attr_reader :db, :db_config
|
6
|
+
|
7
|
+
delegate :adapter, :username, :password, :host, :port, :database_name,
|
8
|
+
to: :db_config
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@db_config = load_database_config
|
12
|
+
@db = establish_connection
|
13
|
+
rescue => e
|
14
|
+
Rails.logger.info "#{e.message}"
|
15
|
+
raise DatabaseNotFoundError
|
16
|
+
end
|
17
|
+
|
18
|
+
def tables
|
19
|
+
db.tables
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def load_database_config
|
25
|
+
EasyReports::DatabaseConfig.find(params[:db_id])
|
26
|
+
end
|
27
|
+
|
28
|
+
def establish_connection
|
29
|
+
::Sequel.connect(
|
30
|
+
"#{adapter}://#{username}:#{password}@#{host}:#{port}/#{database_name}",
|
31
|
+
:max_connections => db_config.pool,
|
32
|
+
:logger => Logger.new('log/db.log'))
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -1,33 +1,33 @@
|
|
1
|
-
= form_for @database_config do |f|
|
2
|
-
- if @database_config.errors.any?
|
3
|
-
#error_explanation
|
4
|
-
h2 = "#{pluralize(@database_config.errors.count, "error")} prohibited this database_config from being saved:"
|
5
|
-
ul
|
6
|
-
- @database_config.errors.full_messages.each do |message|
|
7
|
-
li = message
|
8
|
-
|
9
|
-
.field
|
10
|
-
= f.label :adapter
|
11
|
-
= f.text_field :adapter
|
12
|
-
.field
|
13
|
-
= f.label :encoding
|
14
|
-
= f.text_field :encoding
|
15
|
-
.field
|
16
|
-
= f.label :pool
|
17
|
-
= f.text_field :pool
|
18
|
-
.field
|
19
|
-
= f.label :username
|
20
|
-
= f.text_field :username
|
21
|
-
.field
|
22
|
-
= f.label :password
|
23
|
-
= f.text_field :password
|
24
|
-
.field
|
25
|
-
= f.label :host
|
26
|
-
= f.text_field :host
|
27
|
-
.field
|
28
|
-
= f.label :port
|
29
|
-
= f.text_field :port
|
30
|
-
.field
|
31
|
-
= f.label :database_name
|
32
|
-
= f.text_field :database_name
|
33
|
-
.actions = f.submit 'Save'
|
1
|
+
= form_for @database_config do |f|
|
2
|
+
- if @database_config.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
h2 = "#{pluralize(@database_config.errors.count, "error")} prohibited this database_config from being saved:"
|
5
|
+
ul
|
6
|
+
- @database_config.errors.full_messages.each do |message|
|
7
|
+
li = message
|
8
|
+
|
9
|
+
.field
|
10
|
+
= f.label :adapter
|
11
|
+
= f.text_field :adapter
|
12
|
+
.field
|
13
|
+
= f.label :encoding
|
14
|
+
= f.text_field :encoding
|
15
|
+
.field
|
16
|
+
= f.label :pool
|
17
|
+
= f.text_field :pool
|
18
|
+
.field
|
19
|
+
= f.label :username
|
20
|
+
= f.text_field :username
|
21
|
+
.field
|
22
|
+
= f.label :password
|
23
|
+
= f.text_field :password
|
24
|
+
.field
|
25
|
+
= f.label :host
|
26
|
+
= f.text_field :host
|
27
|
+
.field
|
28
|
+
= f.label :port
|
29
|
+
= f.text_field :port
|
30
|
+
.field
|
31
|
+
= f.label :database_name
|
32
|
+
= f.text_field :database_name
|
33
|
+
.actions = f.submit 'Save'
|