mirror of https://github.com/apache/superset.git
feat: auto select schema (#22160)
This commit is contained in:
parent
9cebc1fde9
commit
17c2bd89a6
|
@ -221,6 +221,13 @@ export default function DatabaseSelector({
|
|||
);
|
||||
}, [db]);
|
||||
|
||||
function changeSchema(schema: SchemaValue) {
|
||||
setCurrentSchema(schema);
|
||||
if (onSchemaChange) {
|
||||
onSchemaChange(schema.value);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (currentDb) {
|
||||
setLoadingSchemas(true);
|
||||
|
@ -240,6 +247,7 @@ export default function DatabaseSelector({
|
|||
}
|
||||
setSchemaOptions(options);
|
||||
setLoadingSchemas(false);
|
||||
if (options.length === 1) changeSchema(options[0]);
|
||||
if (refresh > 0) addSuccessToast('List refreshed');
|
||||
})
|
||||
.catch(err => {
|
||||
|
@ -270,13 +278,6 @@ export default function DatabaseSelector({
|
|||
}
|
||||
}
|
||||
|
||||
function changeSchema(schema: SchemaValue) {
|
||||
setCurrentSchema(schema);
|
||||
if (onSchemaChange) {
|
||||
onSchemaChange(schema.value);
|
||||
}
|
||||
}
|
||||
|
||||
function renderSelectRow(select: ReactNode, refreshBtn: ReactNode) {
|
||||
return (
|
||||
<div className="section">
|
||||
|
|
Loading…
Reference in New Issue