|
|
@@ -40,6 +40,7 @@ LOG = logging.getLogger(__name__)
|
|
|
def get_db_component(request):
|
|
|
format_ = {'data': [], 'status': 1, 'message': ''}
|
|
|
db = None
|
|
|
+
|
|
|
try:
|
|
|
source = json.loads(request.POST.get('source', '{}'))
|
|
|
user = User.objects.get(username=request.user)
|
|
|
@@ -76,11 +77,13 @@ def get_db_component(request):
|
|
|
assist = Assist(db)
|
|
|
else:
|
|
|
assist = JdbcAssist(db)
|
|
|
+
|
|
|
if not source['rdbmsDatabaseName']:
|
|
|
data = assist.get_databases()
|
|
|
elif source['rdbmsDatabaseName']:
|
|
|
data = assist.get_tables(source['rdbmsDatabaseName'])
|
|
|
- format_['data'] = [{'name': element, 'value': element} for element in data]
|
|
|
+
|
|
|
+ format_['data'] = [{'name': element, 'value': element} for element in data]
|
|
|
format_['status'] = 0
|
|
|
except Exception, e:
|
|
|
message = _('Error accessing the database %s: %s') % (name, e)
|