treport 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/controllers/connects_controller.rb +56 -0
- data/app/controllers/dictionaries_controller.rb +56 -0
- data/app/controllers/reports_controller.rb +62 -0
- data/app/controllers/requirements_controller.rb +60 -0
- data/app/controllers/series_controller.rb +60 -0
- data/app/models/.keep +0 -0
- data/app/models/connect.rb +26 -0
- data/app/models/dictionary.rb +4 -0
- data/app/models/report.rb +34 -0
- data/app/models/requirement.rb +42 -0
- data/app/models/series.rb +4 -0
- data/app/views/connects/_form.html.erb +68 -0
- data/app/views/connects/edit.html.erb +1 -0
- data/app/views/connects/index.html.erb +48 -0
- data/app/views/connects/new.html.erb +1 -0
- data/app/views/dictionaries/_form.html.erb +49 -0
- data/app/views/dictionaries/edit.html.erb +1 -0
- data/app/views/dictionaries/index.html.erb +42 -0
- data/app/views/dictionaries/new.html.erb +1 -0
- data/app/views/layouts/report.html.erb +54 -0
- data/app/views/reports/_form.html.erb +65 -0
- data/app/views/reports/edit.html.erb +1 -0
- data/app/views/reports/index.html.erb +49 -0
- data/app/views/reports/new.html.erb +1 -0
- data/app/views/requirements/_form.html.erb +72 -0
- data/app/views/requirements/edit.html.erb +1 -0
- data/app/views/requirements/index.html.erb +51 -0
- data/app/views/requirements/new.html.erb +1 -0
- data/app/views/series/_form.html.erb +47 -0
- data/app/views/series/edit.html.erb +1 -0
- data/app/views/series/index.html.erb +40 -0
- data/app/views/series/new.html.erb +1 -0
- data/app/views/templates/public_one.html.erb +75 -0
- data/app/views/templates/public_two.html.erb +76 -0
- data/app/views/templates/text.html.erb +9 -0
- data/db/migrate/20160607002137_create_connects.rb +15 -0
- data/db/migrate/20160608123333_create_reports.rb +15 -0
- data/db/migrate/20160608124539_create_requirements.rb +16 -0
- data/db/migrate/20160608124549_create_dictionaries.rb +12 -0
- data/db/migrate/20160608124602_create_series.rb +11 -0
- data/lib/generators/report/install_generator.rb +26 -0
- data/lib/treport/db.rb +49 -0
- data/lib/treport.rb +9 -0
- data/public/report/css/AdminLTE.css +4906 -0
- data/public/report/css/AdminLTE.min.css +7 -0
- data/public/report/css/bootstrap.min.css +6 -0
- data/public/report/css/skins/_all-skins.css +1799 -0
- data/public/report/css/skins/_all-skins.min.css +1 -0
- data/public/report/js/app.js +44 -0
- data/public/report/js/echarts.min.js +35 -0
- data/treport.gemspec +12 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8eb2e9b04b2b6ea9aa53a710a74cfb35239bfb02
|
4
|
+
data.tar.gz: 37a343450468a12e4d86d8614d7729ff77402533
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0dde88abf7403029b83ef6a8525e24e9946b0bfb0b1fabc7d2ae2293a2d29cdf60a99636083e0f4df7deef8be6e627eaf1367df92fb5aae7a16dc5ca8ea1568d
|
7
|
+
data.tar.gz: 85966ed3e215eb6a78c003011a51acff98febc0d88cf05f687d7cd69a356a711072f9504ba47b7c9c4cc7211f10801b0620c0834b1c7fbab8fb6f12382c3e409
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class ConnectsController < ApplicationController
|
2
|
+
before_action :set_connect, only: [:show, :edit, :update, :destroy]
|
3
|
+
layout 'report'
|
4
|
+
|
5
|
+
def index
|
6
|
+
@connects = Connect.all
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@connect = Connect.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
end
|
18
|
+
|
19
|
+
def create
|
20
|
+
@connect = Connect.new(connect_params)
|
21
|
+
|
22
|
+
respond_to do |format|
|
23
|
+
if @connect.save
|
24
|
+
format.html { redirect_to connects_url, notice: '添加成功' }
|
25
|
+
else
|
26
|
+
format.html { render :new }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
respond_to do |format|
|
33
|
+
if @connect.update(connect_params)
|
34
|
+
format.html { redirect_to connects_url, notice: '修改成功' }
|
35
|
+
else
|
36
|
+
format.html { render :edit }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
@connect.destroy
|
43
|
+
respond_to do |format|
|
44
|
+
format.html { redirect_to connects_url, notice: '删除成功' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def set_connect
|
50
|
+
@connect = Connect.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
def connect_params
|
54
|
+
params.require(:connect).permit(:name, :adapter, :database, :username, :password, :host, :port)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class DictionariesController < ApplicationController
|
2
|
+
before_action :set_dictionary, only: [:show, :edit, :update, :destroy]
|
3
|
+
layout 'report'
|
4
|
+
def index
|
5
|
+
@dictionaries = Dictionary.where(resource_type: params[:resource_type], resource_id: params[:resource_id])
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
@dictionary = Dictionary.new(resource_type: params[:resource_type], resource_id: params[:resource_id])
|
13
|
+
end
|
14
|
+
|
15
|
+
def edit
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
@dictionary = Dictionary.new(dictionary_params)
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
if @dictionary.save
|
23
|
+
format.html { redirect_to dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id), notice: '添加成功' }
|
24
|
+
else
|
25
|
+
format.html { render :new }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def update
|
31
|
+
respond_to do |format|
|
32
|
+
if @dictionary.update(dictionary_params)
|
33
|
+
format.html { redirect_to dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id), notice: '修改成功' }
|
34
|
+
else
|
35
|
+
format.html { render :edit }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
url = dictionaries_url(resource_type: @dictionary.resource_type, resource_id: @dictionary.resource_id)
|
42
|
+
@dictionary.destroy
|
43
|
+
respond_to do |format|
|
44
|
+
format.html { redirect_to url, notice: '删除成功' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def set_dictionary
|
50
|
+
@dictionary = Dictionary.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
def dictionary_params
|
54
|
+
params.require(:dictionary).permit(:resource_type, :resource_id, :key, :value)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class ReportsController < ApplicationController
|
2
|
+
before_action :set_report, only: [:show, :edit, :update, :destroy]
|
3
|
+
layout 'report'
|
4
|
+
def index
|
5
|
+
@reports = Report.all
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
@data = @report.report_date(params)
|
10
|
+
#@result = @report.get_chart_date(params)
|
11
|
+
if @report.template.blank?
|
12
|
+
render text: "没有模板,请先添加report模板"
|
13
|
+
else
|
14
|
+
render @report.template
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def new
|
19
|
+
@report = Report.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def edit
|
23
|
+
end
|
24
|
+
|
25
|
+
def create
|
26
|
+
@report = Report.new(report_params)
|
27
|
+
|
28
|
+
respond_to do |format|
|
29
|
+
if @report.save
|
30
|
+
format.html { redirect_to reports_url, notice: '添加成功' }
|
31
|
+
else
|
32
|
+
format.html { render :new }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
respond_to do |format|
|
39
|
+
if @report.update(report_params)
|
40
|
+
format.html { redirect_to reports_url, notice: '修改成功' }
|
41
|
+
else
|
42
|
+
format.html { render :edit }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def destroy
|
48
|
+
@report.destroy
|
49
|
+
respond_to do |format|
|
50
|
+
format.html { redirect_to reports_url, notice: '删除成功' }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def set_report
|
56
|
+
@report = Report.find(params[:id])
|
57
|
+
end
|
58
|
+
|
59
|
+
def report_params
|
60
|
+
params.require(:report).permit(:name, :sql_code, :is_sql_category, :category_name, :connect_id, :template, :url)
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class RequirementsController < ApplicationController
|
2
|
+
before_action :set_report
|
3
|
+
before_action :set_requirement, only: [:show, :edit, :update, :destroy]
|
4
|
+
layout 'report'
|
5
|
+
def index
|
6
|
+
@requirements = @report.requirements
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@requirement = Requirement.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
end
|
18
|
+
|
19
|
+
def create
|
20
|
+
@requirement = Requirement.new(requirement_params)
|
21
|
+
@requirement.report = @report
|
22
|
+
respond_to do |format|
|
23
|
+
if @requirement.save
|
24
|
+
format.html { redirect_to report_requirements_url, notice: '添加成功' }
|
25
|
+
else
|
26
|
+
format.html { render :new }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
respond_to do |format|
|
33
|
+
if @requirement.update(requirement_params)
|
34
|
+
format.html { redirect_to report_requirements_url, notice: '修改成功' }
|
35
|
+
else
|
36
|
+
format.html { render :edit }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
@requirement.destroy
|
43
|
+
respond_to do |format|
|
44
|
+
format.html { redirect_to report_requirements_url, notice: '删除成功' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def set_requirement
|
50
|
+
@requirement = Requirement.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_report
|
54
|
+
@report = Report.find(params[:report_id])
|
55
|
+
end
|
56
|
+
|
57
|
+
def requirement_params
|
58
|
+
params.require(:requirement).permit(:report_id, :name, :sql_key, :sql_default, :sql_replace, :sql_str, :sql_type, :form_type)
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class SeriesController < ApplicationController
|
2
|
+
before_action :set_report
|
3
|
+
before_action :set_series, only: [:show, :edit, :update, :destroy]
|
4
|
+
layout 'report'
|
5
|
+
def index
|
6
|
+
@series = @report.series
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@series = Series.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
end
|
18
|
+
|
19
|
+
def create
|
20
|
+
@series = Series.new(series_params)
|
21
|
+
@series.report = @report
|
22
|
+
respond_to do |format|
|
23
|
+
if @series.save
|
24
|
+
format.html { redirect_to report_series_index_url, notice: '添加成功' }
|
25
|
+
else
|
26
|
+
format.html { render :new }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
respond_to do |format|
|
33
|
+
if @series.update(series_params)
|
34
|
+
format.html { redirect_to report_series_index_url, notice: '修改成功' }
|
35
|
+
else
|
36
|
+
format.html { render :edit }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
@series.destroy
|
43
|
+
respond_to do |format|
|
44
|
+
format.html { redirect_to report_series_index_url, notice: '删除成功' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def set_series
|
50
|
+
@series = Series.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_report
|
54
|
+
@report = Report.find(params[:report_id])
|
55
|
+
end
|
56
|
+
|
57
|
+
def series_params
|
58
|
+
params.require(:series).permit(:report_id, :name, :sql_key)
|
59
|
+
end
|
60
|
+
end
|
data/app/models/.keep
ADDED
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Connect < ActiveRecord::Base
|
2
|
+
has_many :reports
|
3
|
+
|
4
|
+
def exec(sql)
|
5
|
+
result = []
|
6
|
+
if (self.adapter==Treport::Db::AdapterType[:Oracle])
|
7
|
+
result = Treport::Db.oracle_query self.serializable_hash, sql
|
8
|
+
elsif (self.adapter==Treport::Db::AdapterType[:Mysql])
|
9
|
+
result = Treport::Db.mysql_query self.serializable_hash, sql
|
10
|
+
elsif (self.adapter==Treport::Db::AdapterType[:Sqlserver])
|
11
|
+
result = Treport::Db.sqlserver_query self.serializable_hash, sql
|
12
|
+
end
|
13
|
+
return result
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.connect_options
|
17
|
+
Connect.all.map { |c| [c.name, c.id] }
|
18
|
+
end
|
19
|
+
|
20
|
+
def adapter_name
|
21
|
+
return "Mysql" if self.adapter == Treport::Db::AdapterType[:Mysql]
|
22
|
+
return "PostgreSQL" if self.adapter == Treport::Db::AdapterType[:PostgreSQL]
|
23
|
+
return "Oracle" if self.adapter == Treport::Db::AdapterType[:Oracle]
|
24
|
+
return "Sqlserver" if self.adapter == Treport::Db::AdapterType[:Sqlserver]
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class Report < ActiveRecord::Base
|
2
|
+
belongs_to :connect
|
3
|
+
has_many :requirements, dependent: :destroy
|
4
|
+
has_many :series, dependent: :destroy
|
5
|
+
has_many :dictionaries, dependent: :destroy, as: :resource
|
6
|
+
|
7
|
+
def report_date(params)
|
8
|
+
results = {charts: [], texts: []}
|
9
|
+
sql_code = self.sql_code
|
10
|
+
self.requirements.each do |r|
|
11
|
+
sql_code = params[r.sql_key].blank? ? sql_code.gsub(r.sql_default, r.sql_replace) : sql_code.gsub("${#{r.sql_key}}", params[r.sql_key])
|
12
|
+
end
|
13
|
+
sql_results = self.connect.exec(sql_code).clone
|
14
|
+
series = self.series.clone
|
15
|
+
series.each do |s|
|
16
|
+
data = []
|
17
|
+
sql_results.each do |r|
|
18
|
+
name = self.is_sql_category ? r[self.category_name] : self.dictionaries.where(value: r[self.category_name]).first.key
|
19
|
+
data << {category_name: name, value: r[s.sql_key].to_i}
|
20
|
+
end
|
21
|
+
results[:charts] << {series_name: s.name, data: data}
|
22
|
+
end
|
23
|
+
sql_results.each do |r|
|
24
|
+
cols = []
|
25
|
+
cols << (self.is_sql_category ? r[self.category_name] : self.dictionaries.where(value: r[self.category_name]).first.key)
|
26
|
+
self.series.each do |s|
|
27
|
+
cols << r[s.sql_key].to_i
|
28
|
+
end
|
29
|
+
results[:texts] << cols
|
30
|
+
end
|
31
|
+
results
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Requirement < ActiveRecord::Base
|
2
|
+
belongs_to :report
|
3
|
+
has_many :dictionaries, dependent: :destroy, as: :resource
|
4
|
+
|
5
|
+
#搜索类型
|
6
|
+
FormType = {
|
7
|
+
form_select: 1, #下拉
|
8
|
+
form_datetime: 2, #时间
|
9
|
+
form_text: 3 #输入
|
10
|
+
}
|
11
|
+
# enum form_type: FormType
|
12
|
+
|
13
|
+
#下拉数据来源类型
|
14
|
+
SqlType = {
|
15
|
+
sql_dict: 1, #字典
|
16
|
+
sql_query: 2 #sql查询所得
|
17
|
+
}
|
18
|
+
# enum sql_type: SqlType
|
19
|
+
|
20
|
+
def form_type_name
|
21
|
+
return "下拉" if self.form_type == FormType[:form_select]
|
22
|
+
return "时间" if self.form_type == FormType[:form_datetime]
|
23
|
+
return "输入" if self.form_type == FormType[:form_text]
|
24
|
+
end
|
25
|
+
|
26
|
+
def sql_type_name
|
27
|
+
return "字典" if self.sql_type == SqlType[:sql_dict]
|
28
|
+
return "sql查询所得" if self.sql_type == SqlType[:sql_query]
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.sql_type_options
|
32
|
+
[["", 0],["字典", SqlType[:sql_dict]],["sql查询所得", SqlType[:sql_query]]]
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.form_type_options
|
36
|
+
[["下拉", FormType[:form_select]],["时间", FormType[:form_datetime]],["输入", FormType[:form_text]]]
|
37
|
+
end
|
38
|
+
|
39
|
+
def dict_options
|
40
|
+
self.dictionaries.collect{|s|[s.key, s.value]}
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<% if @connect.errors.any? %>
|
2
|
+
<% errors = "" %>
|
3
|
+
<% @connect.errors.messages.values.each_with_index { |message, index| errors = errors +
|
4
|
+
"#{index+1}.#{message.join(";")}; " } %>
|
5
|
+
<h5 style="color: red;"><%= errors %></h5>
|
6
|
+
<% end %>
|
7
|
+
<!-- Content Header (Page header) -->
|
8
|
+
<section class="content-header">
|
9
|
+
<h1>
|
10
|
+
数据库链接池管理
|
11
|
+
</h1>
|
12
|
+
</section>
|
13
|
+
|
14
|
+
<!-- Main content -->
|
15
|
+
<section class="content">
|
16
|
+
<div class="row">
|
17
|
+
<!-- right column -->
|
18
|
+
<div class="col-md-6">
|
19
|
+
<!-- general form elements disabled -->
|
20
|
+
<div class="box box-primary">
|
21
|
+
<div class="box-header with-border">
|
22
|
+
<h3 class="box-title">数据库链接池管理</h3>
|
23
|
+
</div>
|
24
|
+
<!-- /.box-header -->
|
25
|
+
<div class="box-body">
|
26
|
+
<%= form_for(@connect) do |f| %>
|
27
|
+
<div class="form-group">
|
28
|
+
<label>数据库链接名称</label>
|
29
|
+
<%= f.text_field :name, class: "form-control", placeholder: "name" %>
|
30
|
+
</div>
|
31
|
+
<div class="form-group">
|
32
|
+
<label>数据库</label>
|
33
|
+
<%= f.select :adapter, options_for_select(Treport::Db.adapter_options, @connect.adapter), {}, class: "form-control" %>
|
34
|
+
</div>
|
35
|
+
<div class="form-group">
|
36
|
+
<label>数据库名称</label>
|
37
|
+
<%= f.text_field :database, class: "form-control", placeholder: "database" %>
|
38
|
+
</div>
|
39
|
+
<div class="form-group">
|
40
|
+
<label>用户名</label>
|
41
|
+
<%= f.text_field :username, class: "form-control", placeholder: "username" %>
|
42
|
+
</div>
|
43
|
+
<div class="form-group">
|
44
|
+
<label>密码</label>
|
45
|
+
<%= f.text_field :password, class: "form-control", placeholder: "password" %>
|
46
|
+
</div>
|
47
|
+
<div class="form-group">
|
48
|
+
<label>IP地址</label>
|
49
|
+
<%= f.text_field :host, class: "form-control", placeholder: "host" %>
|
50
|
+
</div>
|
51
|
+
<div class="form-group">
|
52
|
+
<label>端口</label>
|
53
|
+
<%= f.text_field :port, class: "form-control", placeholder: "port" %>
|
54
|
+
</div>
|
55
|
+
<div class="box-footer">
|
56
|
+
<button type="submit" class="btn btn-primary">提交</button>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
<!-- /.box-body -->
|
61
|
+
</div>
|
62
|
+
<!-- /.box -->
|
63
|
+
</div>
|
64
|
+
<!--/.col (right) -->
|
65
|
+
</div>
|
66
|
+
<!-- /.row -->
|
67
|
+
</section>
|
68
|
+
<!-- /.content -->
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<section class="content-header">
|
2
|
+
<h1>
|
3
|
+
数据库连接池管理
|
4
|
+
</h1>
|
5
|
+
</section>
|
6
|
+
<!-- Main content -->
|
7
|
+
<section class="content">
|
8
|
+
<div class="row">
|
9
|
+
<div class="col-xs-12">
|
10
|
+
<div class="box">
|
11
|
+
<div class="box-header">
|
12
|
+
<h3 class="box-title">数据库连接池管理</h3>
|
13
|
+
</div>
|
14
|
+
<!-- /.box-header -->
|
15
|
+
<div class="box-body table-responsive no-padding">
|
16
|
+
<%= link_to '添加链接', new_connect_path, class: "btn" %>
|
17
|
+
<table class="table table-hover">
|
18
|
+
<tr>
|
19
|
+
<th>数据库链接名称</th>
|
20
|
+
<th>数据库</th>
|
21
|
+
<th>数据库名称</th>
|
22
|
+
<th>用户名</th>
|
23
|
+
<th>密码</th>
|
24
|
+
<th>IP</th>
|
25
|
+
<th>端口</th>
|
26
|
+
<th colspan="2"></th>
|
27
|
+
</tr>
|
28
|
+
<% @connects.each do |connect| %>
|
29
|
+
<tr>
|
30
|
+
<td><%= connect.name %></td>
|
31
|
+
<td><%= connect.adapter_name %></td>
|
32
|
+
<td><%= connect.database %></td>
|
33
|
+
<td><%= connect.username %></td>
|
34
|
+
<td><%= connect.password %></td>
|
35
|
+
<td><%= connect.host %></td>
|
36
|
+
<td><%= connect.port %></td>
|
37
|
+
<td><%= link_to '修改', edit_connect_path(connect) %></td>
|
38
|
+
<td><%= link_to '删除', connect, method: :delete, data: {confirm: '你确定要删除么?'} %></td>
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</table>
|
42
|
+
</div>
|
43
|
+
<!-- /.box-body -->
|
44
|
+
</div>
|
45
|
+
<!-- /.box -->
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</section>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<% if @dictionary.errors.any? %>
|
2
|
+
<% errors = "" %>
|
3
|
+
<% @dictionary.errors.messages.values.each_with_index { |message, index| errors = errors +
|
4
|
+
"#{index+1}.#{message.join(";")}; " } %>
|
5
|
+
<h5 style="color: red;"><%= errors %></h5>
|
6
|
+
<% end %>
|
7
|
+
<!-- Content Header (Page header) -->
|
8
|
+
<section class="content-header">
|
9
|
+
<h1>
|
10
|
+
字典管理
|
11
|
+
</h1>
|
12
|
+
</section>
|
13
|
+
<!-- Main content -->
|
14
|
+
<section class="content">
|
15
|
+
<div class="row">
|
16
|
+
<!-- right column -->
|
17
|
+
<div class="col-md-6">
|
18
|
+
<!-- general form elements disabled -->
|
19
|
+
<div class="box box-primary">
|
20
|
+
<div class="box-header with-border">
|
21
|
+
<h3 class="box-title">字典管理</h3>
|
22
|
+
</div>
|
23
|
+
<!-- /.box-header -->
|
24
|
+
<div class="box-body">
|
25
|
+
<%= form_for(@dictionary) do |f| %>
|
26
|
+
<%= f.hidden_field :resource_type %>
|
27
|
+
<%= f.hidden_field :resource_id %>
|
28
|
+
<div class="form-group">
|
29
|
+
<label>键</label>
|
30
|
+
<%= f.text_field :key, class: "form-control", placeholder: "key" %>
|
31
|
+
</div>
|
32
|
+
<div class="form-group">
|
33
|
+
<label>值</label>
|
34
|
+
<%= f.text_field :value, class: "form-control", placeholder: "value" %>
|
35
|
+
</div>
|
36
|
+
<div class="box-footer">
|
37
|
+
<button type="submit" class="btn btn-primary">提交</button>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
<!-- /.box-body -->
|
42
|
+
</div>
|
43
|
+
<!-- /.box -->
|
44
|
+
</div>
|
45
|
+
<!--/.col (right) -->
|
46
|
+
</div>
|
47
|
+
<!-- /.row -->
|
48
|
+
</section>
|
49
|
+
<!-- /.content -->
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<section class="content-header">
|
2
|
+
<h1>
|
3
|
+
字典管理
|
4
|
+
</h1>
|
5
|
+
</section>
|
6
|
+
<!-- Main content -->
|
7
|
+
<section class="content">
|
8
|
+
<div class="row">
|
9
|
+
<div class="col-xs-12">
|
10
|
+
<div class="box">
|
11
|
+
<div class="box-header">
|
12
|
+
<h3 class="box-title">字典管理</h3>
|
13
|
+
</div>
|
14
|
+
<!-- /.box-header -->
|
15
|
+
<div class="box-body table-responsive no-padding">
|
16
|
+
<%= link_to '添加字典', new_dictionary_path(resource_type: params[:resource_type], resource_id: params[:resource_id]), class: "btn" %>
|
17
|
+
<table class="table table-hover">
|
18
|
+
<tr>
|
19
|
+
<th>资源类型</th>
|
20
|
+
<th>资源id</th>
|
21
|
+
<th>键</th>
|
22
|
+
<th>值</th>
|
23
|
+
<th colspan="2"></th>
|
24
|
+
</tr>
|
25
|
+
<% @dictionaries.each do |dictionary| %>
|
26
|
+
<tr>
|
27
|
+
<td><%= dictionary.resource_type %></td>
|
28
|
+
<td><%= dictionary.resource_id %></td>
|
29
|
+
<td><%= dictionary.key %></td>
|
30
|
+
<td><%= dictionary.value %></td>
|
31
|
+
<td><%= link_to '修改', edit_dictionary_path(dictionary) %></td>
|
32
|
+
<td><%= link_to '删除', dictionary, method: :delete, data: {confirm: '你确定要删除么?'} %></td>
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</table>
|
36
|
+
</div>
|
37
|
+
<!-- /.box-body -->
|
38
|
+
</div>
|
39
|
+
<!-- /.box -->
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</section>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|