mirror of https://github.com/apache/superset.git
feat: Allow users to connect via legacy SQLA form (#16201)
* hugh/dbui-other * remove extra condition * add not callable * Update .pylintrc Co-authored-by: Beto Dealmeida <roberto@dealmeida.net> Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
This commit is contained in:
parent
67c4c0116e
commit
171514360e
|
@ -91,7 +91,6 @@ disable=
|
||||||
too-few-public-methods,
|
too-few-public-methods,
|
||||||
too-many-locals,
|
too-many-locals,
|
||||||
|
|
||||||
|
|
||||||
[REPORTS]
|
[REPORTS]
|
||||||
|
|
||||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||||
|
|
|
@ -656,21 +656,34 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const setDatabaseModel = (database_name: string) => {
|
const setDatabaseModel = (database_name: string) => {
|
||||||
const selectedDbModel = availableDbs?.databases.filter(
|
if (database_name === 'Other') {
|
||||||
(db: DatabaseObject) => db.name === database_name,
|
// Allow users to connect to DB via legacy SQLA form
|
||||||
)[0];
|
setDB({
|
||||||
const { engine, parameters } = selectedDbModel;
|
type: ActionType.dbSelected,
|
||||||
const isDynamic = parameters !== undefined;
|
payload: {
|
||||||
setDB({
|
database_name,
|
||||||
type: ActionType.dbSelected,
|
configuration_method: CONFIGURATION_METHOD.SQLALCHEMY_URI,
|
||||||
payload: {
|
engine: undefined,
|
||||||
database_name,
|
},
|
||||||
configuration_method: isDynamic
|
});
|
||||||
? CONFIGURATION_METHOD.DYNAMIC_FORM
|
} else {
|
||||||
: CONFIGURATION_METHOD.SQLALCHEMY_URI,
|
const selectedDbModel = availableDbs?.databases.filter(
|
||||||
engine,
|
(db: DatabaseObject) => db.name === database_name,
|
||||||
},
|
)[0];
|
||||||
});
|
const { engine, parameters } = selectedDbModel;
|
||||||
|
const isDynamic = parameters !== undefined;
|
||||||
|
setDB({
|
||||||
|
type: ActionType.dbSelected,
|
||||||
|
payload: {
|
||||||
|
database_name,
|
||||||
|
configuration_method: isDynamic
|
||||||
|
? CONFIGURATION_METHOD.DYNAMIC_FORM
|
||||||
|
: CONFIGURATION_METHOD.SQLALCHEMY_URI,
|
||||||
|
engine,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setDB({ type: ActionType.addTableCatalogSheet });
|
setDB({ type: ActionType.addTableCatalogSheet });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -694,6 +707,10 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||||
{database.name}
|
{database.name}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
|
{/* Allow users to connect to DB via legacy SQLA form */}
|
||||||
|
<Select.Option value="Other" key="Other">
|
||||||
|
Other
|
||||||
|
</Select.Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Alert
|
<Alert
|
||||||
showIcon
|
showIcon
|
||||||
|
|
Loading…
Reference in New Issue