rails_db_admin 2.1.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/app/controllers/rails_db_admin/erp_app/desktop/base_controller.rb +6 -4
  3. data/app/controllers/rails_db_admin/erp_app/desktop/queries_controller.rb +1 -1
  4. data/db/migrate/20131112013053_add_rails_db_admin_missing_indexes.rb +17 -0
  5. data/lib/rails_db_admin.rb +0 -1
  6. data/lib/rails_db_admin/engine.rb +1 -1
  7. data/lib/rails_db_admin/extjs/json_column_builder.rb +53 -43
  8. data/lib/rails_db_admin/table_support.rb +24 -15
  9. data/lib/rails_db_admin/version.rb +7 -3
  10. data/public/images/icons/rails_db_admin/rails_db_admin_16x16.png +0 -0
  11. data/public/images/icons/rails_db_admin/rails_db_admin_64x64.png +0 -0
  12. data/public/images/icons/rails_db_admin/rails_db_admin_light_16x16.png +0 -0
  13. data/public/images/splash/images/console-icon.png +0 -0
  14. data/public/images/splash/images/data-model-icon.png +0 -0
  15. data/public/images/splash/splash.png +0 -0
  16. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/database_combo.js +28 -25
  17. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/module.js +276 -215
  18. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/queries_tree_menu.js +3 -3
  19. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +100 -97
  20. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/readonly_table_data_grid.js +22 -18
  21. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/report_panel.js +1 -1
  22. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/reports_tree_panel.js +2 -2
  23. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/splash_screen.js +136 -0
  24. data/public/javascripts/erp_app/desktop/applications/rails_db_admin/tables_tree_menu.js +25 -10
  25. data/public/stylesheets/erp_app/desktop/applications/rails_db_admin/rails_db_admin.css +4 -0
  26. metadata +44 -44
  27. data/app/helpers/rails_db_admin/application_helper.rb +0 -4
  28. data/public/images/icons/rails_db_admin/rails_db_admin_48x48.png +0 -0
@@ -17,7 +17,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueriesMenuTreePane
17
17
  text: 'Queries',
18
18
  expanded: true,
19
19
  draggable:false,
20
- iconCls:'icon-content'
20
+ iconCls:'icon-query'
21
21
  }
22
22
  }),
23
23
  animate:false,
@@ -36,7 +36,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueriesMenuTreePane
36
36
  items:[
37
37
  {
38
38
  text:"Execute",
39
- iconCls:'icon-settings',
39
+ iconCls:'icon-playpause',
40
40
  listeners:{
41
41
  scope:record,
42
42
  'click':function(){
@@ -62,7 +62,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueriesMenuTreePane
62
62
  items:[
63
63
  {
64
64
  text:"New Query",
65
- iconCls:'icon-new',
65
+ iconCls:'icon-sql',
66
66
  listeners:{
67
67
  'click':function(){
68
68
  self.initialConfig.module.addNewQueryTab();
@@ -1,39 +1,39 @@
1
1
  Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
2
- extend:"Ext.panel.Panel",
3
- alias:'widget.railsdbadmin_querypanel',
2
+ extend: "Ext.panel.Panel",
3
+ alias: 'widget.railsdbadmin_querypanel',
4
4
 
5
- getSql: function(){
5
+ getSql: function () {
6
6
  return this.down('codemirror').getValue();
7
7
  },
8
8
 
9
- initComponent:function () {
9
+ initComponent: function () {
10
10
  var self = this;
11
11
  var messageBox = null;
12
12
 
13
13
  var savedQueriesJsonStore = Ext.create('Ext.data.Store', {
14
- proxy:{
15
- type:'ajax',
16
- url:'/rails_db_admin/erp_app/desktop/queries/saved_queries',
17
- reader:{
18
- type:'json',
19
- root:'data'
14
+ proxy: {
15
+ type: 'ajax',
16
+ url: '/rails_db_admin/erp_app/desktop/queries/saved_queries',
17
+ reader: {
18
+ type: 'json',
19
+ root: 'data'
20
20
  }
21
21
  },
22
- fields:[
22
+ fields: [
23
23
  {
24
- name:'value'
24
+ name: 'value'
25
25
  },
26
26
  {
27
- name:'display'
27
+ name: 'display'
28
28
  }
29
29
  ]
30
30
  });
31
31
 
32
32
  var tbarItems = [
33
33
  {
34
- text:'Execute',
35
- iconCls:'icon-settings',
36
- handler:function (button) {
34
+ text: 'Execute',
35
+ iconCls: 'icon-playpause',
36
+ handler: function (button) {
37
37
  var textarea = self.query('.codemirror')[0];
38
38
  var sql = textarea.getValue();
39
39
  var selected_sql = textarea.getSelection();
@@ -43,15 +43,15 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
43
43
  messageBox = Ext.Msg.wait('Status', 'Executing..');
44
44
 
45
45
  Ext.Ajax.request({
46
- url:'/rails_db_admin/erp_app/desktop/queries/execute_query',
47
- params:{
48
- sql:sql,
49
- database:database,
50
- cursor_pos:cursor_pos,
51
- selected_sql:selected_sql
46
+ url: '/rails_db_admin/erp_app/desktop/queries/execute_query',
47
+ params: {
48
+ sql: sql,
49
+ database: database,
50
+ cursor_pos: cursor_pos,
51
+ selected_sql: selected_sql
52
52
  },
53
- method:'post',
54
- success:function (responseObject) {
53
+ method: 'post',
54
+ success: function (responseObject) {
55
55
  messageBox.hide();
56
56
  var response = Ext.decode(responseObject.responseText);
57
57
 
@@ -62,18 +62,18 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
62
62
 
63
63
  if (!Ext.isEmpty(self.down('railsdbadmin_readonlytabledatagrid'))) {
64
64
  var jsonStore = new Ext.data.JsonStore({
65
- fields:fields,
66
- data:data
65
+ fields: fields,
66
+ data: data
67
67
  });
68
68
 
69
69
  self.down('railsdbadmin_readonlytabledatagrid').reconfigure(jsonStore, columns);
70
70
  }
71
71
  else {
72
72
  var readOnlyDataGrid = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReadOnlyTableDataGrid', {
73
- layout:'fit',
74
- columns:columns,
75
- fields:fields,
76
- data:data
73
+ layout: 'fit',
74
+ columns: columns,
75
+ fields: fields,
76
+ data: data
77
77
  });
78
78
 
79
79
  var cardPanel = self.down('#resultCardPanel');
@@ -87,7 +87,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
87
87
  }
88
88
 
89
89
  },
90
- failure:function () {
90
+ failure: function () {
91
91
  messageBox.hide();
92
92
  Ext.Msg.alert('Status', 'Error loading grid');
93
93
  }
@@ -98,95 +98,95 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
98
98
 
99
99
  if (!this.initialConfig['hideSave']) {
100
100
  tbarItems.push({
101
- text:'Save',
102
- iconCls:'icon-save',
103
- handler:function () {
101
+ text: 'Save',
102
+ iconCls: 'icon-save',
103
+ handler: function () {
104
104
  var textarea = self.down('.codemirror');
105
105
  var save_window = new Ext.Window({
106
- layout:'fit',
107
- width:375,
108
- title:'Save Query',
109
- height:125,
110
- buttonAlign:'center',
111
- closeAction:'hide',
112
- plain:true,
113
- items:new Ext.FormPanel({
114
- frame:false,
115
- bodyStyle:'padding:5px 5px 0',
116
- width:500,
117
- items:[
106
+ layout: 'fit',
107
+ width: 375,
108
+ title: 'Save Query',
109
+ height: 125,
110
+ buttonAlign: 'center',
111
+ closeAction: 'hide',
112
+ plain: true,
113
+ items: {
114
+ xtype: 'form',
115
+ frame: false,
116
+ bodyStyle: 'padding:5px 5px 0',
117
+ width: 500,
118
+ items: [
118
119
  {
119
- xtype:'combo',
120
- fieldLabel:'Query Name',
121
- name:'query_name',
122
- allowBlank:false,
123
- store:savedQueriesJsonStore,
124
- valueField:'value',
125
- displayField:'display',
126
- triggerAction:'all',
127
- forceSelection:false,
128
- mode:'remote'
120
+ xtype: 'combo',
121
+ fieldLabel: 'Query Name',
122
+ name: 'query_name',
123
+ allowBlank: false,
124
+ store: savedQueriesJsonStore,
125
+ valueField: 'value',
126
+ displayField: 'display',
127
+ triggerAction: 'all',
128
+ forceSelection: false,
129
+ mode: 'remote'
129
130
  },
130
131
  {
131
- xtype:'hidden',
132
- value:textarea.getValue(),
133
- name:'query'
132
+ xtype: 'hidden',
133
+ value: textarea.getValue(),
134
+ name: 'query'
134
135
  },
135
136
  {
136
- xtype:'hidden',
137
- value:self.module.getDatabase(),
138
- name:'database'
137
+ xtype: 'hidden',
138
+ value: self.module.getDatabase(),
139
+ name: 'database'
139
140
  }
140
141
  ]
141
- }),
142
- buttons:[
142
+ },
143
+ buttons: [
143
144
  {
144
- text:'Save',
145
- handler:function () {
145
+ text: 'Save',
146
+ handler: function (btn) {
146
147
  var fp = this.up('window').down('.form');
147
148
  if (fp.getForm().isValid()) {
148
149
  fp.getForm().submit({
149
- url:'/rails_db_admin/erp_app/desktop/queries/save_query',
150
- waitMsg:'Saving Query...',
151
- success:function (fp, o) {
150
+ url: '/rails_db_admin/erp_app/desktop/queries/save_query',
151
+ waitMsg: 'Saving Query...',
152
+ success: function (fp, o) {
152
153
  Ext.Msg.alert('Success', 'Saved Query');
153
154
  var database = self.module.getDatabase();
154
155
  self.module.queriesTreePanel().store.setProxy({
155
- type:'ajax',
156
- url:'/rails_db_admin/erp_app/desktop/queries/saved_queries_tree',
157
- extraParams:{
158
- database:database
156
+ type: 'ajax',
157
+ url: '/rails_db_admin/erp_app/desktop/queries/saved_queries_tree',
158
+ extraParams: {
159
+ database: database
159
160
  }
160
161
  });
161
162
  self.module.queriesTreePanel().store.load();
162
- save_window.hide();
163
+ btn.up('window').hide();
163
164
  }
164
165
  });
165
166
  }
166
167
  }
167
168
  },
168
169
  {
169
- text:'Cancel',
170
- handler:function () {
171
- save_window.hide();
170
+ text: 'Cancel',
171
+ handler: function (btn) {
172
+ btn.up('window').hide();
172
173
  }
173
174
  }
174
175
  ]
175
176
 
176
- });
177
- save_window.show();
177
+ }).show();
178
178
  }
179
179
  });
180
180
  }
181
181
 
182
182
  var codeMirrorPanel = {
183
- height:250,
184
- region:'north',
185
- xtype:'codemirror',
186
- parser:'sql',
187
- tbarItems:tbarItems,
188
- sourceCode:this.initialConfig['sqlQuery'],
189
- disableSave:true
183
+ region: 'center',
184
+ xtype: 'codemirror',
185
+ mode: 'sql',
186
+ split: true,
187
+ tbarItems: tbarItems,
188
+ sourceCode: this.initialConfig['sqlQuery'],
189
+ disableSave: true
190
190
  };
191
191
 
192
192
  this.items = [codeMirrorPanel];
@@ -196,25 +196,28 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel", {
196
196
  }
197
197
  else {
198
198
  this.items.push({
199
- layout:'card',
200
- region:'center',
201
- margins:'0 0 0 0',
202
- autoScroll:true,
203
- itemId:'resultCardPanel',
204
- items:[]
199
+ layout: 'card',
200
+ region: 'south',
201
+ margins: '0 0 0 0',
202
+ autoScroll: true,
203
+ split: true,
204
+ collapsible: true,
205
+ collapseDirection: 'bottom',
206
+ height: '50%',
207
+ itemId: 'resultCardPanel',
208
+ items: []
205
209
  })
206
210
  }
207
211
 
208
212
  this.callParent(arguments);
209
213
  },
210
214
 
211
- constructor:function (config) {
215
+ constructor: function (config) {
212
216
  config = Ext.applyIf({
213
- title:'Query',
214
- layout:'border',
215
- border:false
217
+ title: 'Query',
218
+ layout: 'border',
219
+ border: false
216
220
  }, config);
217
221
  this.callParent([config]);
218
222
  }
219
-
220
223
  });
@@ -1,21 +1,25 @@
1
- Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReadOnlyTableDataGrid",{
2
- extend:"Ext.grid.GridPanel",
3
- alias:'widget.railsdbadmin_readonlytabledatagrid',
4
- constructor : function(config) {
5
- var jsonStore = new Ext.data.JsonStore({
6
- fields:config.fields,
7
- data:config.data
8
- });
9
-
10
- config = Ext.apply({
11
- store:jsonStore,
12
- autoScroll:true,
13
- height:'100%',
14
- loadMask:true
15
- }, config);
16
-
17
- this.callParent([config]);
18
- }
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReadOnlyTableDataGrid", {
2
+ extend: "Ext.grid.GridPanel",
3
+ alias: 'widget.railsdbadmin_readonlytabledatagrid',
4
+ constructor: function (config) {
5
+ var jsonStore = new Ext.data.JsonStore({
6
+ fields: config.fields,
7
+ data: config.data
8
+ });
9
+
10
+ config = Ext.apply({
11
+ viewConfig: {
12
+ enableTextSelection: true
13
+
14
+ },
15
+ store: jsonStore,
16
+ autoScroll: true,
17
+ height: '100%',
18
+ loadMask: true
19
+ }, config);
20
+
21
+ this.callParent([config]);
22
+ }
19
23
  });
20
24
 
21
25
 
@@ -64,7 +64,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReportPanel", {
64
64
  },
65
65
  {
66
66
  text:'Execute Report',
67
- iconCls:'icon-settings',
67
+ iconCls:'icon-playpause',
68
68
  handler:function(btn){
69
69
  var webNavigator = window.compassDesktop.getModule('web-navigator-win');
70
70
  webNavigator.createWindow('/reports/display/'+me.initialConfig.internalIdentifier);
@@ -145,7 +145,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReportsTreePanel",
145
145
  text:'Reports',
146
146
  expanded:true,
147
147
  draggable:false,
148
- iconCls:'icon-content'
148
+ iconCls:'icon-reports'
149
149
  },
150
150
  fields:[
151
151
  {
@@ -216,7 +216,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReportsTreePanel",
216
216
  items:[
217
217
  {
218
218
  text:"New Report",
219
- iconCls:'icon-new',
219
+ iconCls:'icon-document',
220
220
  listeners:{
221
221
  'click':function () {
222
222
  me.newReport();
@@ -0,0 +1,136 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.SplashScreen", {
2
+ title: 'Startup',
3
+ extend: "Ext.panel.Panel",
4
+ alias: 'widget.railsdbadmin_splash_screen',
5
+ autoScroll: true,
6
+ items: [
7
+ {
8
+ html: "<div style='margin: 15px 50px 5px 50px;'><hr /><h2 style='margin: 3px 0px 0px 0px; color: #555; text-align: center'>Database Navigator</h2><hr /></div>"
9
+ },
10
+ {
11
+ xtype: 'image',
12
+ style: 'padding-left: 50%; margin-left: -400px;',
13
+ src: '/images/splash/splash.png' // src: 'http://placehold.it/800x250'
14
+ },
15
+ {
16
+ html: "<div style='margin: 15px 50px 5px 50px;'><p style='margin: 0px; color: #222; text-align: center; font-size: 16px; font-weight: 300;'>Click on the shortcuts below to get started.</p></div>"
17
+ },
18
+ {
19
+ xtype: 'panel',
20
+ layout: 'column',
21
+ style: 'width: 480px; margin-top: 0px; margin-left: auto; margin-right: auto;',
22
+ items: [
23
+
24
+ {
25
+ xtype: 'panel',
26
+ height: 140,
27
+ width: 140,
28
+ style:{
29
+ margin: '0px 0px 5px 10px;',
30
+ cursor: 'pointer'
31
+ },
32
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
33
+ border: true,
34
+ bodyBorder: true,
35
+ overCls: 'shortcut-hover',
36
+ items: [
37
+ {
38
+ xtype: 'image',
39
+ src: '/images/splash/images/data-model-icon.png',
40
+ height: 80,
41
+ width: 80,
42
+ style: 'margin: 0px 0px 5px 10px;',
43
+ listeners: {
44
+ render: function (component) {
45
+ component.getEl().on('click', function (e) {
46
+ var module = compassDesktop.getModule('rails_db_admin-win');
47
+
48
+ module.setWindowStatus('Retrieving Docs...');
49
+ module.openIframeInTab('Data Models', 'http://documentation.compassagile.com');
50
+ module.clearWindowStatus();
51
+
52
+ }, component);
53
+ }
54
+ }
55
+ },
56
+ {
57
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>Browse the DB models</p>"
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ xtype: 'panel',
63
+ height: 140,
64
+ width: 140,
65
+ style:{
66
+ margin: '0px 0px 5px 10px;',
67
+ cursor: 'pointer'
68
+ },
69
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
70
+ border: true,
71
+ bodyBorder: true,
72
+ overCls: 'shortcut-hover',
73
+ items: [
74
+ {
75
+ xtype: 'image',
76
+ src: '/images/splash/images/console-icon.png',
77
+ height: 80,
78
+ width: 80,
79
+ style: 'margin: 0px 0px 5px 10px;',
80
+ listeners: {
81
+ render: function (component) {
82
+ component.getEl().on('click', function (e) {
83
+ var module = compassDesktop.getModule('rails_db_admin-win');
84
+
85
+ module.addConsolePanel();
86
+ }, component);
87
+ }
88
+ }
89
+ },
90
+ {
91
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>Open a console</p>"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ xtype: 'panel',
97
+ height: 140,
98
+ width: 140,
99
+ style:{
100
+ margin: '0px 0px 5px 10px;',
101
+ cursor: 'pointer'
102
+ },
103
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
104
+ border: true,
105
+ bodyBorder: true,
106
+ overCls: 'shortcut-hover',
107
+ items: [
108
+ {
109
+ xtype: 'image',
110
+ src: '/images/knitkit/splash/images/tutorials.png',
111
+ height: 80,
112
+ width: 80,
113
+ style: 'margin: 0px 0px 5px 10px;',
114
+ listeners: {
115
+ render: function (component) {
116
+ component.getEl().on('click', function (e) {
117
+ var module = compassDesktop.getModule('rails_db_admin-win');
118
+
119
+ module.setWindowStatus('Retrieving Docs...');
120
+ module.openIframeInTab('Tutorials', 'http://tutorials.compassagile.com');
121
+ module.clearWindowStatus();
122
+
123
+ }, component);
124
+ }
125
+ }
126
+ },
127
+ {
128
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>Learn More!</p>"
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ }
134
+ ]
135
+
136
+ });