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