rails_db_admin 2.0.2 → 2.0.3
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.
- data/app/controllers/rails_db_admin/erp_app/desktop/base_controller.rb +3 -0
- data/lib/rails_db_admin/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/database_combo.js +4 -3
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/module.js +401 -405
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +196 -190
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/readonly_table_data_grid.js +2 -5
- data/spec/controllers/rails_db_admin/erp_app/desktop/base_controller_spec.rb +50 -70
- data/spec/controllers/rails_db_admin/erp_app/desktop/queries_controller_spec.rb +15 -17
- metadata +7 -7
@@ -16,9 +16,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
16
16
|
|
17
17
|
it "should return success:true" do
|
18
18
|
|
19
|
-
post :
|
20
|
-
|
21
|
-
:table => 'role_types'}
|
19
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
20
|
+
:table => 'role_types'}
|
22
21
|
|
23
22
|
parsed_body = JSON.parse(response.body)
|
24
23
|
parsed_body["success"].should eq(true)
|
@@ -26,9 +25,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
26
25
|
|
27
26
|
it "should return model, columns, and fields" do
|
28
27
|
|
29
|
-
post :
|
30
|
-
|
31
|
-
:table => 'role_types'}
|
28
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
29
|
+
:table => 'role_types'}
|
32
30
|
|
33
31
|
parsed_body = JSON.parse(response.body)
|
34
32
|
parsed_body["model"].should eq("role_types")
|
@@ -38,9 +36,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
38
36
|
|
39
37
|
it "should return true even if there is not an 'id' column on the table in question" do
|
40
38
|
|
41
|
-
post :
|
42
|
-
|
43
|
-
:table => 'preference_options_preference_types'}
|
39
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
40
|
+
:table => 'preference_options_preference_types'}
|
44
41
|
|
45
42
|
parsed_body = JSON.parse(response.body)
|
46
43
|
parsed_body["success"].should eq(true)
|
@@ -49,9 +46,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
49
46
|
it "should return model, columns, and fields even if there is not an 'id' column on a table
|
50
47
|
and should have a 'fake_id' column in the fields and columns array" do
|
51
48
|
|
52
|
-
post :
|
53
|
-
|
54
|
-
:table => 'preference_options_preference_types'}
|
49
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
50
|
+
:table => 'preference_options_preference_types'}
|
55
51
|
|
56
52
|
parsed_body = JSON.parse(response.body)
|
57
53
|
|
@@ -73,9 +69,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
73
69
|
|
74
70
|
it "should return a value called id_property that equals 'fake_id'" do
|
75
71
|
|
76
|
-
post :
|
77
|
-
|
78
|
-
:table => 'preference_options_preference_types'}
|
72
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
73
|
+
:table => 'preference_options_preference_types'}
|
79
74
|
|
80
75
|
parsed_body = JSON.parse(response.body)
|
81
76
|
parsed_body["id_property"].should eq("fake_id")
|
@@ -83,9 +78,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
83
78
|
|
84
79
|
it "should return a value called id_property that equals 'id'" do
|
85
80
|
|
86
|
-
post :
|
87
|
-
|
88
|
-
:table => 'role_types'}
|
81
|
+
post :setup_table_grid, {:use_route => :rails_db_admin,
|
82
|
+
:table => 'role_types'}
|
89
83
|
|
90
84
|
parsed_body = JSON.parse(response.body)
|
91
85
|
parsed_body["id_property"].should eq("id")
|
@@ -96,9 +90,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
96
90
|
|
97
91
|
it "should return JSON to display in an ExtJS data grid for Rails tables with an Id column" do
|
98
92
|
|
99
|
-
get :
|
100
|
-
|
101
|
-
:table => "role_types"}
|
93
|
+
get :table_data, {:use_route => :rails_db_admin,
|
94
|
+
:table => "role_types"}
|
102
95
|
|
103
96
|
parsed_body = JSON.parse(response.body)
|
104
97
|
parsed_body["total"].should eq(2)
|
@@ -106,10 +99,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
106
99
|
|
107
100
|
it "should return 1 row because start is increased by 1, but total should remain 2" do
|
108
101
|
|
109
|
-
get :
|
110
|
-
|
111
|
-
|
112
|
-
:start => "1"}
|
102
|
+
get :table_data, {:use_route => :rails_db_admin,
|
103
|
+
:table => "role_types",
|
104
|
+
:start => "1"}
|
113
105
|
|
114
106
|
parsed_body = JSON.parse(response.body)
|
115
107
|
parsed_body["total"].should eq(2)
|
@@ -118,10 +110,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
118
110
|
|
119
111
|
it "should return 1 row because limit is set to 1, but total should remain 2" do
|
120
112
|
|
121
|
-
get :
|
122
|
-
|
123
|
-
|
124
|
-
:limit => "1"}
|
113
|
+
get :table_data, {:use_route => :rails_db_admin,
|
114
|
+
:table => "role_types",
|
115
|
+
:limit => "1"}
|
125
116
|
|
126
117
|
parsed_body = JSON.parse(response.body)
|
127
118
|
parsed_body["total"].should eq(2)
|
@@ -131,9 +122,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
131
122
|
#TODO: Need to setup Factory Girl to dummy up data for this test
|
132
123
|
it "should return successfully with a fake_id column because there is no id column defined in the DB" do
|
133
124
|
|
134
|
-
get :
|
135
|
-
|
136
|
-
:table => 'preference_options_preference_types'}
|
125
|
+
get :table_data, {:use_route => :rails_db_admin,
|
126
|
+
:table => 'preference_options_preference_types'}
|
137
127
|
|
138
128
|
parsed_body = JSON.parse(response.body)
|
139
129
|
parsed_body["total"].should eq(13)
|
@@ -191,10 +181,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
191
181
|
@json_data_builder.should_receive(:get_row_data).with(
|
192
182
|
@table, @pkey).and_return(@role_types_data)
|
193
183
|
|
194
|
-
put :
|
195
|
-
|
196
|
-
|
197
|
-
:data => [@role_types_data, @role_types_data] }
|
184
|
+
put :table_data, {:use_route => :rails_db_admin,
|
185
|
+
:table => @table,
|
186
|
+
:data => [@role_types_data, @role_types_data] }
|
198
187
|
|
199
188
|
parsed_body = JSON.parse(response.body)
|
200
189
|
parsed_body["success"].should eq(true)
|
@@ -219,10 +208,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
219
208
|
@table, @pref_opt_types_data).and_return(
|
220
209
|
@pref_opt_types_data)
|
221
210
|
|
222
|
-
put :
|
223
|
-
|
224
|
-
|
225
|
-
:data => [@pref_opt_types_data, @pref_opt_types_data]}
|
211
|
+
put :table_data, {:use_route => :rails_db_admin,
|
212
|
+
:table => @table,
|
213
|
+
:data => [@pref_opt_types_data, @pref_opt_types_data]}
|
226
214
|
|
227
215
|
parsed_body = JSON.parse(response.body)
|
228
216
|
parsed_body["success"].should eq(true)
|
@@ -276,10 +264,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
276
264
|
@json_data_builder.should_receive(:get_row_data).with(@table,["id",3]).
|
277
265
|
and_return(@role_types_data)
|
278
266
|
|
279
|
-
post :
|
280
|
-
|
281
|
-
|
282
|
-
:data => @role_types_data}
|
267
|
+
post :table_data, {:use_route => :rails_db_admin,
|
268
|
+
:table => @table,
|
269
|
+
:data => @role_types_data}
|
283
270
|
|
284
271
|
parsed_body = JSON.parse(response.body)
|
285
272
|
parsed_body["success"].should eq(true)
|
@@ -320,10 +307,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
320
307
|
@json_data_builder.should_receive(:get_row_data).with(@table,["id",3]).
|
321
308
|
and_return(@role_types_data)
|
322
309
|
|
323
|
-
post :
|
324
|
-
|
325
|
-
|
326
|
-
:data => @role_types_data}
|
310
|
+
post :table_data, {:use_route => :rails_db_admin,
|
311
|
+
:table => @table,
|
312
|
+
:data => @role_types_data}
|
327
313
|
|
328
314
|
parsed_body = JSON.parse(response.body)
|
329
315
|
parsed_body["success"].should eq(true)
|
@@ -357,10 +343,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
357
343
|
@table, @mod_data).and_return(
|
358
344
|
@pref_opt_types_data)
|
359
345
|
|
360
|
-
post :
|
361
|
-
|
362
|
-
|
363
|
-
:data => @pref_opt_types_data}
|
346
|
+
post :table_data, {:use_route => :rails_db_admin,
|
347
|
+
:table => @table,
|
348
|
+
:data => @pref_opt_types_data}
|
364
349
|
|
365
350
|
parsed_body = JSON.parse(response.body)
|
366
351
|
parsed_body["success"].should eq(true)
|
@@ -394,10 +379,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
394
379
|
@table, @mod_data).and_return(
|
395
380
|
@pref_opt_types_data)
|
396
381
|
|
397
|
-
post :
|
398
|
-
|
399
|
-
|
400
|
-
:data => @pref_opt_types_data}
|
382
|
+
post :table_data, {:use_route => :rails_db_admin,
|
383
|
+
:table => @table,
|
384
|
+
:data => @pref_opt_types_data}
|
401
385
|
|
402
386
|
parsed_body = JSON.parse(response.body)
|
403
387
|
parsed_body["success"].should eq(true)
|
@@ -424,10 +408,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
424
408
|
@table_support.should_receive(:delete_row).with(
|
425
409
|
@table, id)
|
426
410
|
|
427
|
-
delete :
|
428
|
-
|
429
|
-
|
430
|
-
:id => "2"}
|
411
|
+
delete :table_data, {:use_route => :rails_db_admin,
|
412
|
+
:table => @table,
|
413
|
+
:id => "2"}
|
431
414
|
end
|
432
415
|
|
433
416
|
it "should fail because we don't send an id parameter" do
|
@@ -435,10 +418,9 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
435
418
|
id = "2"
|
436
419
|
@table_support.should_receive(:primary_key?).and_return(false)
|
437
420
|
|
438
|
-
delete :
|
439
|
-
|
440
|
-
|
441
|
-
:id => id}
|
421
|
+
delete :table_data, {:use_route => :rails_db_admin,
|
422
|
+
:table => "role_types",
|
423
|
+
:id => id}
|
442
424
|
|
443
425
|
parsed_body = JSON.parse(response.body)
|
444
426
|
parsed_body["success"].should eq(false)
|
@@ -451,9 +433,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
451
433
|
|
452
434
|
it "should return data for a tree grid of tables" do
|
453
435
|
|
454
|
-
get :
|
455
|
-
|
456
|
-
:node => "root"}
|
436
|
+
get :tables, {:use_route => :rails_db_admin,
|
437
|
+
:node => "root"}
|
457
438
|
|
458
439
|
parsed_body = JSON.parse(response.body)
|
459
440
|
parsed_body[0].should eq({"isTable"=>true, "text"=>"app_containers",
|
@@ -463,9 +444,8 @@ describe RailsDbAdmin::ErpApp::Desktop::BaseController do
|
|
463
444
|
|
464
445
|
it "should create nested tree of column names if a node id is passed in" do
|
465
446
|
|
466
|
-
get :
|
467
|
-
|
468
|
-
:node => "app_containers"}
|
447
|
+
get :tables, {:use_route => :rails_db_admin,
|
448
|
+
:node => "app_containers"}
|
469
449
|
|
470
450
|
parsed_body = JSON.parse(response.body)
|
471
451
|
parsed_body[0].should eq({"text"=>"id : integer",
|
@@ -15,8 +15,9 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
15
15
|
|
16
16
|
it "returns unsuccessful because of an empty result set" do
|
17
17
|
|
18
|
-
post :
|
19
|
-
|
18
|
+
post :execute_query, {:use_route => :rails_db_admin,
|
19
|
+
:cursor_pos => "0",
|
20
|
+
:sql => "SELECT * FROM relationship_types;"}
|
20
21
|
|
21
22
|
parsed_body = JSON.parse(response.body)
|
22
23
|
parsed_body["success"].should eq(false)
|
@@ -25,12 +26,11 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
25
26
|
|
26
27
|
it "should not throw exception if there is 1 statement and no semi-colon" do
|
27
28
|
|
28
|
-
post :
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
" = 'execute_query_test_role'"}
|
29
|
+
post :execute_query, {:use_route => :rails_db_admin,
|
30
|
+
:cursor_pos => "0",
|
31
|
+
:sql => "SELECT * FROM role_types "\
|
32
|
+
"WHERE internal_identifier"\
|
33
|
+
" = 'execute_query_test_role'"}
|
34
34
|
|
35
35
|
parsed_body = JSON.parse(response.body)
|
36
36
|
parsed_body["success"].should eq(true)
|
@@ -38,7 +38,7 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
38
38
|
|
39
39
|
it "should work on multi-line queries" do
|
40
40
|
|
41
|
-
post :
|
41
|
+
post :execute_query, {:use_route => :rails_db_admin,
|
42
42
|
:cursor_pos => "1",
|
43
43
|
:sql => "SELECT * FROM role_types \n"\
|
44
44
|
"WHERE internal_identifier ="\
|
@@ -59,7 +59,7 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
59
59
|
@sql = CGI::unescape(@sql)
|
60
60
|
@cursor_pos = "6"
|
61
61
|
|
62
|
-
post :
|
62
|
+
post :execute_query, {:use_route => :rails_db_admin,
|
63
63
|
:cursor_pos => @cursor_pos,
|
64
64
|
:sql => @sql}
|
65
65
|
|
@@ -69,7 +69,7 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
69
69
|
|
70
70
|
it "should work on input of multiple queries spanning several lines each " do
|
71
71
|
|
72
|
-
post :
|
72
|
+
post :execute_query, {:use_route => :rails_db_admin,
|
73
73
|
:cursor_pos => "1",
|
74
74
|
:sql => "SELECT * FROM role_types \n"\
|
75
75
|
"WHERE internal_identifier = 'execute_query_test_role';\n"\
|
@@ -100,9 +100,8 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
100
100
|
@query_support.should_receive(:execute_sql).and_return([columns, values, nil])
|
101
101
|
RailsDbAdmin::QuerySupport.should_receive(:new).and_return(@query_support)
|
102
102
|
|
103
|
-
post :
|
104
|
-
|
105
|
-
:query_name => "some_query"}
|
103
|
+
post :open_and_execute_query, {:use_route => :rails_db_admin,
|
104
|
+
:query_name => "some_query"}
|
106
105
|
|
107
106
|
parsed_body = JSON.parse(response.body)
|
108
107
|
parsed_body["success"].should eq(true)
|
@@ -114,9 +113,8 @@ describe RailsDbAdmin::ErpApp::Desktop::QueriesController do
|
|
114
113
|
|
115
114
|
it "should return true, a sql statement, grid columns & fields, and data" do
|
116
115
|
|
117
|
-
post :
|
118
|
-
|
119
|
-
:table => "role_types"}
|
116
|
+
post :select_top_fifty, {:use_route => :rails_db_admin,
|
117
|
+
:table => "role_types"}
|
120
118
|
|
121
119
|
expected_sql = "SELECT * FROM \"role_types\" LIMIT 50"
|
122
120
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_db_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erp_forms
|
16
|
-
requirement: &
|
16
|
+
requirement: &70191058725800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70191058725800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: erp_dev_svcs
|
27
|
-
requirement: &
|
27
|
+
requirement: &70191058725280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70191058725280
|
36
36
|
description: RailsDB Admin is similar in functionality to PHPMyAdmin and other database
|
37
37
|
browsing and data editing tools. It uses the CompassAE database connection information
|
38
38
|
to discover the schema for an installation, and generates Extjs UIs for creating
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.8.
|
133
|
+
rubygems_version: 1.8.11
|
134
134
|
signing_key:
|
135
135
|
specification_version: 3
|
136
136
|
summary: RailsDB Admin is similar in functionality to PHPMyAdmin and other database
|