rails_db_admin 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_16x16.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_24x24.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_32x32.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_64x64.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_light_16x16.png +0 -0
- data/app/assets/images/splash/db_admin_splash.png +0 -0
- data/{public → app/assets}/images/splash/images/console-icon.png +0 -0
- data/{public → app/assets}/images/splash/images/data-model-icon.png +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/app.js +20 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/database_combo.js +1 -1
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/module.js +227 -135
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/queries_tree_menu.js +6 -6
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +383 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/readonly_table_data_grid.js +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/ParamWindow.js +426 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/ParamsManager.js +177 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/RolesPanel.js +95 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/SetDefaultWindow.js +244 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/Settings.js +155 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/TreePanel.js +391 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/splash_screen.js +163 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/tables_tree_menu.js +5 -3
- data/app/assets/javascripts/erp_app/shared/MultiOption.js +151 -0
- data/app/assets/javascripts/erp_app/shared/ReportsParams.js +289 -0
- data/app/assets/javascripts/erp_app/shared/rails_db_admin_shared.js +13 -0
- data/{public/stylesheets/erp_app/desktop/applications/rails_db_admin/rails_db_admin.css → app/assets/stylesheets/erp_app/shared/rails_db_admin_shared.css} +5 -10
- data/app/controllers/rails_db_admin/erp_app/desktop/base_controller.rb +7 -6
- data/app/controllers/rails_db_admin/erp_app/desktop/queries_controller.rb +88 -74
- data/app/controllers/rails_db_admin/erp_app/desktop/reports_controller.rb +361 -30
- data/app/controllers/rails_db_admin/reports/base_controller.rb +105 -22
- data/app/mailers/report_mailer.rb +15 -0
- data/app/models/report.rb +227 -14
- data/app/views/rails_db_admin/reports/base/error_report.erb +27 -0
- data/app/views/report_mailer/email_report.html.erb +255 -0
- data/config/routes.rb +2 -1
- data/db/data_migrations/20110816005525_rails_db_admin_application.rb +6 -14
- data/db/data_migrations/20151015093724_add_report_role_type.rb +15 -0
- data/db/migrate/20121210160131_add_reports.rb +2 -0
- data/db/migrate/20150926061259_add_meta_data_to_reports.rb +9 -0
- data/lib/rails_db_admin.rb +4 -2
- data/lib/rails_db_admin/engine.rb +12 -4
- data/lib/rails_db_admin/erp_string_parser.rb +26 -0
- data/lib/rails_db_admin/extensions/railties/action_view/helpers/report_helper.rb +167 -10
- data/lib/rails_db_admin/extjs/json_data_builder.rb +36 -20
- data/lib/rails_db_admin/query_params.rb +14 -0
- data/lib/rails_db_admin/query_support.rb +56 -46
- data/lib/rails_db_admin/services/report_helper.rb +241 -0
- data/lib/rails_db_admin/version.rb +1 -1
- metadata +41 -30
- data/app/assets/javascripts/rails_db_admin/application.js +0 -9
- data/app/assets/stylesheets/rails_db_admin/application.css +0 -7
- data/app/views/rails_db_admin/reports/base/show_report.erb +0 -11
- data/db/migrate/20131112013053_add_rails_db_admin_missing_indexes.rb +0 -17
- data/lib/rails_db_admin/report_support.rb +0 -52
- data/public/images/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +0 -223
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/report_panel.js +0 -78
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/reports_tree_panel.js +0 -237
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/splash_screen.js +0 -136
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 819efd23c003fa483f7ab527c7506d53b6314f4f
|
4
|
+
data.tar.gz: 7108ee71fe7536b9b213edf141ea001b8705408f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61af3dd640ca9127245f8ed2a8af9a5c54ee64245cd0d0236d8b65b08065023ef9dc1762c8c4589b8d366bd1c190bf5e9684e280d33fd0b74a0067a265e34a09
|
7
|
+
data.tar.gz: 107e4ee3addec7311d455fd4e01167964c4358cb2231c7c04d292cd436f491d72c8497a302d60ddb5649f3416beabe6428bbb264a8854ec52e91e97a797632ac
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
File without changes
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require ./module
|
14
|
+
//= require ./database_combo
|
15
|
+
//= require ./queries_tree_menu
|
16
|
+
//= require ./query_panel
|
17
|
+
//= require ./readonly_table_data_grid
|
18
|
+
//= require ./splash_screen
|
19
|
+
//= require ./tables_tree_menu
|
20
|
+
//= require_tree ./reports
|
data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/database_combo.js
RENAMED
@@ -43,7 +43,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.DatabaseComboBox",
|
|
43
43
|
listeners: {
|
44
44
|
'select': function (combo, record, index) {
|
45
45
|
// switch databases
|
46
|
-
combo.initialConfig.module.
|
46
|
+
combo.initialConfig.module.connectToDatabase();
|
47
47
|
},
|
48
48
|
render: function (combo) {
|
49
49
|
combo.getStore().load();
|
data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/module.js
RENAMED
@@ -2,23 +2,23 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
2
2
|
extend: "Ext.ux.desktop.Module",
|
3
3
|
id: 'rails_db_admin-win',
|
4
4
|
|
5
|
-
getWindow: function
|
5
|
+
getWindow: function() {
|
6
6
|
return this.app.getDesktop().getWindow('rails_db_admin');
|
7
7
|
},
|
8
8
|
|
9
|
-
queriesTreePanel: function
|
9
|
+
queriesTreePanel: function() {
|
10
10
|
return this.accordion.down('.railsdbadmin_queriestreemenu');
|
11
11
|
},
|
12
12
|
|
13
|
-
setWindowStatus: function
|
13
|
+
setWindowStatus: function(status) {
|
14
14
|
this.getWindow().setStatus(status);
|
15
15
|
},
|
16
16
|
|
17
|
-
clearWindowStatus: function
|
17
|
+
clearWindowStatus: function() {
|
18
18
|
this.getWindow().clearStatus();
|
19
19
|
},
|
20
20
|
|
21
|
-
getTableData: function
|
21
|
+
getTableData: function(table) {
|
22
22
|
var self = this,
|
23
23
|
id = 'ext-' + table + '-data';
|
24
24
|
|
@@ -31,6 +31,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
31
31
|
setupUrl: '/rails_db_admin/erp_app/desktop/base/setup_table_grid/' + table,
|
32
32
|
dataUrl: '/rails_db_admin/erp_app/desktop/base/table_data/' + table,
|
33
33
|
editable: true,
|
34
|
+
searchable: true,
|
34
35
|
page: true,
|
35
36
|
pageSize: 25,
|
36
37
|
displayMsg: 'Displaying {0} - {1} of {2}',
|
@@ -42,7 +43,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
42
43
|
},
|
43
44
|
grid_listeners: {
|
44
45
|
validateedit: {
|
45
|
-
fn: function
|
46
|
+
fn: function(editor, e) {
|
46
47
|
this.store.proxy.setOldModel(e.record);
|
47
48
|
}
|
48
49
|
}
|
@@ -50,16 +51,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
50
51
|
proxy: {
|
51
52
|
type: 'rest',
|
52
53
|
url: '/rails_db_admin/erp_app/desktop/base/table_data/' + table,
|
53
|
-
//private var to store the previous model in an
|
54
|
-
//update operation
|
55
|
-
oldModel: null,
|
56
|
-
setOldModel: function (old_model) {
|
57
|
-
this.oldModel = old_model.copy();
|
58
|
-
},
|
59
|
-
update: function (operation, callback, scope) {
|
60
|
-
operation.records.push(this.oldModel);
|
61
|
-
Ext.data.proxy.Rest.superclass.update.call(this, operation, callback, scope);
|
62
|
-
},
|
63
54
|
reader: {
|
64
55
|
type: 'json',
|
65
56
|
successProperty: 'success',
|
@@ -72,7 +63,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
72
63
|
root: 'data'
|
73
64
|
},
|
74
65
|
listeners: {
|
75
|
-
exception: function
|
66
|
+
exception: function(proxy, response, operation) {
|
76
67
|
var msg;
|
77
68
|
if (operation.getError() === undefined) {
|
78
69
|
var responseObject = Ext.JSON.decode(response.responseText);
|
@@ -97,7 +88,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
97
88
|
self.container.setActiveTab(grid);
|
98
89
|
},
|
99
90
|
|
100
|
-
selectTopFifty: function
|
91
|
+
selectTopFifty: function(table) {
|
101
92
|
this.setWindowStatus('Selecting Top 50 from ' + table + '...');
|
102
93
|
var self = this;
|
103
94
|
|
@@ -107,7 +98,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
107
98
|
params: {
|
108
99
|
database: self.getDatabase()
|
109
100
|
},
|
110
|
-
success: function
|
101
|
+
success: function(responseObject) {
|
111
102
|
self.clearWindowStatus();
|
112
103
|
var response = Ext.decode(responseObject.responseText);
|
113
104
|
var sql = response.sql;
|
@@ -139,15 +130,14 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
139
130
|
//queryPanel.gridContainer.add(readOnlyDataGrid);
|
140
131
|
//queryPanel.gridContainer.getLayout().setActiveItem(0);
|
141
132
|
},
|
142
|
-
failure: function
|
133
|
+
failure: function() {
|
143
134
|
self.clearWindowStatus();
|
144
135
|
Ext.Msg.alert('Status', 'Error loading grid');
|
145
136
|
}
|
146
137
|
});
|
147
138
|
},
|
148
139
|
|
149
|
-
|
150
|
-
addConsolePanel: function () {
|
140
|
+
addConsolePanel: function() {
|
151
141
|
this.container.add({
|
152
142
|
xtype: 'compass_ae_console_panel',
|
153
143
|
module: this
|
@@ -156,15 +146,16 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
156
146
|
|
157
147
|
},
|
158
148
|
|
159
|
-
addNewQueryTab: function
|
149
|
+
addNewQueryTab: function() {
|
160
150
|
this.container.add({
|
161
151
|
xtype: 'railsdbadmin_querypanel',
|
152
|
+
isNewQuery: true,
|
162
153
|
module: this
|
163
154
|
});
|
164
155
|
this.container.setActiveTab(this.container.items.length - 1);
|
165
156
|
},
|
166
157
|
|
167
|
-
|
158
|
+
connectToDatabase: function() {
|
168
159
|
var database = this.getDatabase();
|
169
160
|
var tablestreePanelStore = this.accordion.down('.railsdbadmin_tablestreemenu').store;
|
170
161
|
var queriesTreePanelStore = this.accordion.down('.railsdbadmin_queriestreemenu').store;
|
@@ -188,17 +179,16 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
188
179
|
queriesTreePanelStore.load();
|
189
180
|
},
|
190
181
|
|
191
|
-
getDatabase: function
|
182
|
+
getDatabase: function() {
|
192
183
|
return Ext.getCmp('databaseCombo').getValue();
|
193
184
|
},
|
194
185
|
|
195
|
-
deleteQuery: function
|
186
|
+
deleteQuery: function(queryName) {
|
196
187
|
var self = this;
|
197
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this query?', function
|
188
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this query?', function(btn) {
|
198
189
|
if (btn === 'no') {
|
199
190
|
return false;
|
200
|
-
}
|
201
|
-
else if (btn === 'yes') {
|
191
|
+
} else if (btn === 'yes') {
|
202
192
|
self.setWindowStatus('Deleting ' + queryName + '...');
|
203
193
|
var database = self.getDatabase();
|
204
194
|
Ext.Ajax.request({
|
@@ -207,11 +197,18 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
207
197
|
database: database,
|
208
198
|
query_name: queryName
|
209
199
|
},
|
210
|
-
success: function
|
200
|
+
success: function(responseObject) {
|
211
201
|
self.clearWindowStatus();
|
202
|
+
var centerRegion = Ext.getCmp('rails_db_admin').down('#centerRegion'),
|
203
|
+
itemId = Compass.ErpApp.Utility.Encryption.MD5(queryName),
|
204
|
+
item = centerRegion.down('#' + itemId);
|
205
|
+
|
206
|
+
if (!Compass.ErpApp.Utility.isBlank(item)) {
|
207
|
+
centerRegion.remove(item);
|
208
|
+
}
|
209
|
+
|
212
210
|
var response = Ext.decode(responseObject.responseText);
|
213
211
|
if (response.success) {
|
214
|
-
Ext.Msg.alert('Error', 'Query deleted');
|
215
212
|
var queriesTreePanelStore = self.accordion.down('.railsdbadmin_queriestreemenu').store;
|
216
213
|
queriesTreePanelStore.setProxy({
|
217
214
|
type: 'ajax',
|
@@ -221,13 +218,12 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
221
218
|
}
|
222
219
|
});
|
223
220
|
queriesTreePanelStore.load();
|
224
|
-
}
|
225
|
-
else {
|
221
|
+
} else {
|
226
222
|
Ext.Msg.alert('Error', response.exception);
|
227
223
|
}
|
228
224
|
|
229
225
|
},
|
230
|
-
failure: function
|
226
|
+
failure: function() {
|
231
227
|
self.clearWindowStatus();
|
232
228
|
Ext.Msg.alert('Status', 'Error deleting query');
|
233
229
|
}
|
@@ -236,49 +232,74 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
236
232
|
});
|
237
233
|
},
|
238
234
|
|
239
|
-
displayAndExecuteQuery: function
|
235
|
+
displayAndExecuteQuery: function(queryName) {
|
240
236
|
this.setWindowStatus('Executing ' + queryName + '...');
|
241
|
-
var self = this
|
242
|
-
|
237
|
+
var self = this,
|
238
|
+
database = this.getDatabase(),
|
239
|
+
itemId = Compass.ErpApp.Utility.Encryption.MD5(queryName);
|
240
|
+
|
243
241
|
Ext.Ajax.request({
|
244
242
|
url: '/rails_db_admin/erp_app/desktop/queries/open_and_execute_query/',
|
245
243
|
params: {
|
246
244
|
database: database,
|
247
245
|
query_name: queryName
|
248
246
|
},
|
249
|
-
success: function
|
250
|
-
var response = Ext.decode(responseObject.responseText)
|
251
|
-
|
252
|
-
|
253
|
-
var queryPanel = null;
|
247
|
+
success: function(responseObject) {
|
248
|
+
var response = Ext.decode(responseObject.responseText),
|
249
|
+
query = response.query,
|
250
|
+
queryPanel = null;
|
254
251
|
|
255
252
|
if (response.success) {
|
256
253
|
self.clearWindowStatus();
|
257
254
|
var columns = response.columns;
|
258
255
|
var fields = response.fields;
|
259
256
|
var data = response.data;
|
257
|
+
var centerRegion = Ext.getCmp('rails_db_admin').down('#centerRegion');
|
258
|
+
var item = centerRegion.down('#' + itemId);
|
259
|
+
|
260
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
261
|
+
var readOnlyDataGrid = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReadOnlyTableDataGrid', {
|
262
|
+
region: 'south',
|
263
|
+
columns: columns,
|
264
|
+
fields: fields,
|
265
|
+
data: data,
|
266
|
+
collapseDirection: 'bottom',
|
267
|
+
height: '50%',
|
268
|
+
collapsible: true
|
269
|
+
});
|
270
|
+
item = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
271
|
+
module: self,
|
272
|
+
title: queryName,
|
273
|
+
itemId: itemId,
|
274
|
+
sqlQuery: query,
|
275
|
+
southRegion: readOnlyDataGrid,
|
276
|
+
closable: true
|
277
|
+
});
|
278
|
+
self.container.add(item);
|
279
|
+
} else {
|
280
|
+
if (!Ext.isEmpty(item.down('railsdbadmin_readonlytabledatagrid'))) {
|
281
|
+
var jsonStore = new Ext.data.JsonStore({
|
282
|
+
fields: fields,
|
283
|
+
data: data
|
284
|
+
});
|
260
285
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
});
|
270
|
-
|
271
|
-
queryPanel = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
272
|
-
module: self,
|
273
|
-
sqlQuery: query,
|
274
|
-
southRegion: readOnlyDataGrid,
|
275
|
-
closable: true
|
276
|
-
});
|
286
|
+
item.down('railsdbadmin_readonlytabledatagrid').reconfigure(jsonStore, columns);
|
287
|
+
} else {
|
288
|
+
var readOnlyDataGrid = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.ReadOnlyTableDataGrid', {
|
289
|
+
layout: 'fit',
|
290
|
+
columns: columns,
|
291
|
+
fields: fields,
|
292
|
+
data: data
|
293
|
+
});
|
277
294
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
295
|
+
var cardPanel = item.down('#resultCardPanel');
|
296
|
+
cardPanel.removeAll(true);
|
297
|
+
cardPanel.add(readOnlyDataGrid);
|
298
|
+
cardPanel.getLayout().setActiveItem(readOnlyDataGrid);
|
299
|
+
}
|
300
|
+
}
|
301
|
+
self.container.setActiveTab(item);
|
302
|
+
} else {
|
282
303
|
Ext.Msg.alert('Error', response.exception);
|
283
304
|
queryPanel = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
284
305
|
module: self,
|
@@ -291,7 +312,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
291
312
|
}
|
292
313
|
|
293
314
|
},
|
294
|
-
failure: function
|
315
|
+
failure: function() {
|
295
316
|
self.clearWindowStatus();
|
296
317
|
Ext.Msg.alert('Status', 'Error loading query');
|
297
318
|
}
|
@@ -300,35 +321,70 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
300
321
|
|
301
322
|
//************ Reporting ************************************************
|
302
323
|
|
303
|
-
|
324
|
+
editQuery: function(report, query) {
|
325
|
+
var self = this;
|
326
|
+
var centerRegion = Ext.getCmp('rails_db_admin').down('#centerRegion');
|
327
|
+
var itemId = report.get('internalIdentifier') + '-query';
|
328
|
+
var item = centerRegion.getComponent(itemId);
|
329
|
+
|
330
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
331
|
+
item = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
332
|
+
module: self,
|
333
|
+
itemId: itemId,
|
334
|
+
isReportQuery: true,
|
335
|
+
hideSave: true,
|
336
|
+
title: 'Query' + ' (' + report.get('text') + ')',
|
337
|
+
sqlQuery: query,
|
338
|
+
report: report,
|
339
|
+
closable: true
|
340
|
+
});
|
341
|
+
centerRegion.add(item);
|
342
|
+
}
|
343
|
+
|
344
|
+
centerRegion.setActiveTab(item);
|
345
|
+
},
|
346
|
+
|
347
|
+
showImage: function(node, reportId) {
|
348
|
+
var self = this;
|
349
|
+
var centerRegion = self.container;
|
350
|
+
var itemId = Compass.ErpApp.Utility.Encryption.MD5(node.data.id);
|
351
|
+
var item = centerRegion.getComponent(itemId);
|
352
|
+
var imgSrc = '/download/' + node.data.text + '?path=' + node.data.parentId;
|
353
|
+
var title = node.data.text + ' (' + node.parentNode.data.reportName + ')'
|
354
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
355
|
+
item = Ext.create('Ext.panel.Panel', {
|
356
|
+
closable: true,
|
357
|
+
itemId: itemId,
|
358
|
+
title: title,
|
359
|
+
layout: 'fit',
|
360
|
+
html: '<img src="' + imgSrc + '" />'
|
361
|
+
});
|
362
|
+
self.container.add(item);
|
363
|
+
}
|
364
|
+
self.container.setActiveTab(item);
|
365
|
+
},
|
366
|
+
|
367
|
+
loadReport: function(report) {
|
304
368
|
var me = this;
|
305
369
|
|
306
|
-
me.
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
query: reportObj.query,
|
311
|
-
reportId: reportObj.id,
|
312
|
-
template: reportObj.template,
|
313
|
-
internalIdentifier: reportObj.internalIdentifier,
|
314
|
-
closable: true
|
315
|
-
});
|
316
|
-
me.container.setActiveTab(me.container.items.length - 1);
|
370
|
+
me.eastRegion.show();
|
371
|
+
me.eastRegion.down('railsdbadminreportssettings').setReportSettings(report);
|
372
|
+
me.eastRegion.down('railsdbadminreportsparamsmanager').setReportData(report);
|
373
|
+
me.eastRegion.down('railsdbadminreportsrolespanel').setReportRoles(report);
|
317
374
|
},
|
318
375
|
|
319
376
|
//***********************************************************************
|
320
377
|
|
321
|
-
init: function
|
378
|
+
init: function() {
|
322
379
|
this.launcher = {
|
323
380
|
text: 'Database Tools',
|
324
381
|
iconCls: 'icon-rails_db_admin',
|
325
382
|
handler: this.createWindow,
|
326
383
|
scope: this
|
327
|
-
|
328
384
|
};
|
329
385
|
},
|
330
386
|
|
331
|
-
displayQuery: function
|
387
|
+
displayQuery: function(queryName) {
|
332
388
|
this.setWindowStatus('Retrieving ' + queryName + '...');
|
333
389
|
var self = this;
|
334
390
|
var database = this.getDatabase();
|
@@ -338,25 +394,29 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
338
394
|
database: database,
|
339
395
|
query_name: queryName
|
340
396
|
},
|
341
|
-
success: function
|
397
|
+
success: function(responseObject) {
|
342
398
|
var response = Ext.decode(responseObject.responseText);
|
343
399
|
var query = response.query;
|
344
|
-
|
345
400
|
var queryPanel = null;
|
346
401
|
|
347
402
|
if (response.success) {
|
348
|
-
|
403
|
+
var centerRegion = Ext.getCmp('rails_db_admin').down('#centerRegion');
|
404
|
+
var itemId = Compass.ErpApp.Utility.Encryption.MD5(queryName);
|
405
|
+
var item = centerRegion.down('#' + itemId);
|
349
406
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
407
|
+
self.clearWindowStatus();
|
408
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
409
|
+
var item = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
410
|
+
module: self,
|
411
|
+
closable: true,
|
412
|
+
sqlQuery: query,
|
413
|
+
title: queryName,
|
414
|
+
itemId: itemId
|
415
|
+
});
|
416
|
+
centerRegion.add(item);
|
417
|
+
}
|
418
|
+
centerRegion.setActiveTab(item);
|
419
|
+
} else {
|
360
420
|
Ext.Msg.alert('Error', response.exception);
|
361
421
|
queryPanel = Ext.create('Compass.ErpApp.Desktop.Applications.RailsDbAdmin.QueryPanel', {
|
362
422
|
module: self,
|
@@ -369,19 +429,19 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
369
429
|
}
|
370
430
|
|
371
431
|
},
|
372
|
-
failure: function
|
432
|
+
failure: function() {
|
373
433
|
self.clearWindowStatus();
|
374
434
|
Ext.Msg.alert('Status', 'Error loading query');
|
375
435
|
}
|
376
436
|
});
|
377
437
|
},
|
378
438
|
|
379
|
-
|
380
|
-
openIframeInTab: function (title, url) {
|
439
|
+
openIframeInTab: function(title, url) {
|
381
440
|
var self = this;
|
382
441
|
|
383
442
|
var item = Ext.create('Ext.panel.Panel', {
|
384
443
|
iframeId: 'tutorials_iframe',
|
444
|
+
itemId: 'preview_report',
|
385
445
|
closable: true,
|
386
446
|
layout: 'fit',
|
387
447
|
title: title,
|
@@ -392,36 +452,46 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
392
452
|
self.container.setActiveTab(item);
|
393
453
|
},
|
394
454
|
|
395
|
-
createWindow: function
|
396
|
-
|
397
|
-
var self = this;
|
455
|
+
createWindow: function() {
|
456
|
+
var me = this;
|
398
457
|
var desktop = this.app.getDesktop();
|
399
458
|
var win = desktop.getWindow('rails_db_admin');
|
459
|
+
|
400
460
|
if (!win) {
|
401
461
|
this.container = Ext.create('Ext.tab.Panel', {
|
402
462
|
itemId: 'centerRegion',
|
403
463
|
region: 'center',
|
404
464
|
margins: '0 0 0 0',
|
405
465
|
border: false,
|
406
|
-
minsize: 300
|
466
|
+
minsize: 300,
|
467
|
+
listeners: {
|
468
|
+
beforetabchange: function(tabPanel, newPanel, oldPanel, eOpts) {
|
469
|
+
var isActivatingReportPanel =
|
470
|
+
oldPanel &&
|
471
|
+
newPanel.isXType('railsdbadmin_querypanel') &&
|
472
|
+
newPanel.isReportQuery;
|
473
|
+
|
474
|
+
// the panel to be activated is the report panel show the query params panel in the east region else hide the east region
|
475
|
+
if (isActivatingReportPanel) {
|
476
|
+
me.loadReport(newPanel.report);
|
477
|
+
} else {
|
478
|
+
me.eastRegion.hide();
|
479
|
+
}
|
480
|
+
}
|
481
|
+
}
|
407
482
|
});
|
408
483
|
|
409
484
|
this.accordion = Ext.create('Ext.panel.Panel', {
|
410
|
-
dockedItems: [
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
module: self
|
421
|
-
}
|
422
|
-
]
|
423
|
-
}
|
424
|
-
],
|
485
|
+
dockedItems: [{
|
486
|
+
xtype: 'toolbar',
|
487
|
+
dock: 'top',
|
488
|
+
items: [{
|
489
|
+
text: 'Database:'
|
490
|
+
}, {
|
491
|
+
xtype: 'railsdbadmin_databasecombo',
|
492
|
+
module: this
|
493
|
+
}]
|
494
|
+
}],
|
425
495
|
ui: 'rounded-panel',
|
426
496
|
region: 'west',
|
427
497
|
margins: '0 0 0 0',
|
@@ -431,22 +501,40 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
431
501
|
header: false,
|
432
502
|
split: true,
|
433
503
|
layout: 'accordion',
|
434
|
-
items: [
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
xtype: 'railsdbadmin_reportstreepanel',
|
445
|
-
module: this
|
446
|
-
}
|
447
|
-
]
|
504
|
+
items: [{
|
505
|
+
xtype: 'railsdbadmin_tablestreemenu',
|
506
|
+
module: this
|
507
|
+
}, {
|
508
|
+
xtype: 'railsdbadmin_queriestreemenu',
|
509
|
+
module: this
|
510
|
+
}, {
|
511
|
+
xtype: 'railsdbadmin_reportstreepanel',
|
512
|
+
module: this
|
513
|
+
}]
|
448
514
|
});
|
449
515
|
|
516
|
+
this.eastRegion = Ext.create('Ext.panel.Panel', {
|
517
|
+
ui: 'rounded-panel',
|
518
|
+
region: 'east',
|
519
|
+
id: 'reports_accordian_panel',
|
520
|
+
margins: '0 0 0 0',
|
521
|
+
cmargins: '0 0 0 0',
|
522
|
+
width: 300,
|
523
|
+
collapsible: true,
|
524
|
+
header: false,
|
525
|
+
split: true,
|
526
|
+
layout: 'accordion',
|
527
|
+
hidden: true,
|
528
|
+
items: [{
|
529
|
+
xtype: 'railsdbadminreportssettings'
|
530
|
+
}, {
|
531
|
+
xtype: 'railsdbadminreportsparamsmanager'
|
532
|
+
}, {
|
533
|
+
xtype: 'railsdbadminreportsrolespanel'
|
534
|
+
}]
|
535
|
+
});
|
536
|
+
|
537
|
+
|
450
538
|
win = desktop.createWindow({
|
451
539
|
id: 'rails_db_admin',
|
452
540
|
title: 'RailsDBAdmin',
|
@@ -458,10 +546,14 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
458
546
|
animCollapse: false,
|
459
547
|
constrainHeader: true,
|
460
548
|
layout: 'border',
|
461
|
-
items: [
|
549
|
+
items: [
|
550
|
+
this.accordion,
|
551
|
+
this.container,
|
552
|
+
this.eastRegion
|
553
|
+
]
|
462
554
|
});
|
463
555
|
|
464
|
-
win.addListener('render', function
|
556
|
+
win.addListener('render', function(win) {
|
465
557
|
win.down('#centerRegion').add({
|
466
558
|
xtype: 'railsdbadmin_splash_screen',
|
467
559
|
module: self,
|
@@ -478,18 +570,18 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin", {
|
|
478
570
|
Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.BooleanEditor", {
|
479
571
|
extend: "Ext.form.ComboBox",
|
480
572
|
alias: 'widget.booleancolumneditor',
|
481
|
-
initComponent: function
|
573
|
+
initComponent: function() {
|
482
574
|
this.store = Ext.create('Ext.data.ArrayStore', {
|
483
575
|
fields: ['display', 'value'],
|
484
576
|
data: [
|
485
|
-
['False',
|
486
|
-
['True',
|
577
|
+
['False', false],
|
578
|
+
['True', true]
|
487
579
|
]
|
488
580
|
});
|
489
581
|
|
490
582
|
this.callParent(arguments);
|
491
583
|
},
|
492
|
-
constructor: function
|
584
|
+
constructor: function(config) {
|
493
585
|
config = Ext.apply({
|
494
586
|
valueField: 'value',
|
495
587
|
displayField: 'display',
|
@@ -502,6 +594,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.BooleanEditor", {
|
|
502
594
|
}
|
503
595
|
});
|
504
596
|
|
505
|
-
Compass.ErpApp.Desktop.Applications.RailsDbAdmin.renderBooleanColumn = function
|
597
|
+
Compass.ErpApp.Desktop.Applications.RailsDbAdmin.renderBooleanColumn = function(v) {
|
506
598
|
return (v == 1) ? "True" : "False";
|
507
|
-
};
|
599
|
+
};
|