mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
Fix database typeahead in SQL Lab (#6917)
* Fix database typeahead in SQL Lab * Fix lint * Use string interpolation
This commit is contained in:
parent
3f96b0c5c4
commit
25ec00b3c6
@ -111,7 +111,11 @@ export default class TableSelector extends React.PureComponent {
|
||||
if (data.result.length === 0) {
|
||||
this.props.handleError(t("It seems you don't have access to any database"));
|
||||
}
|
||||
return data.result;
|
||||
return data.result.map(row => ({
|
||||
...row,
|
||||
// label is used for the typeahead
|
||||
label: `${row.backend} ${row.database_name}`,
|
||||
}));
|
||||
}
|
||||
fetchTables(force, substr) {
|
||||
// This can be large so it shouldn't be put in the Redux store
|
||||
|
@ -1524,12 +1524,17 @@ class Superset(BaseSupersetView):
|
||||
db.session
|
||||
.query(models.Database)
|
||||
.filter_by(id=db_id)
|
||||
.one()
|
||||
.first()
|
||||
)
|
||||
schemas = database.all_schema_names(cache=database.schema_cache_enabled,
|
||||
cache_timeout=database.schema_cache_timeout,
|
||||
force=force_refresh)
|
||||
schemas = security_manager.schemas_accessible_by_user(database, schemas)
|
||||
if database:
|
||||
schemas = database.all_schema_names(
|
||||
cache=database.schema_cache_enabled,
|
||||
cache_timeout=database.schema_cache_timeout,
|
||||
force=force_refresh)
|
||||
schemas = security_manager.schemas_accessible_by_user(database, schemas)
|
||||
else:
|
||||
schemas = []
|
||||
|
||||
return Response(
|
||||
json.dumps({'schemas': schemas}),
|
||||
mimetype='application/json')
|
||||
|
Loading…
Reference in New Issue
Block a user