feat: Add toast for successful table or schema refreshes in Sqllab (#18169)

* save

* add use redux to test

* update test for db selector

* add condition for refresh only
This commit is contained in:
Hugh A. Miles II
2022-01-26 20:26:50 -05:00
committed by GitHub
parent ac564ea6b7
commit e6bb0fc7ad
4 changed files with 15 additions and 10 deletions

View File

@@ -23,6 +23,7 @@ import { Select } from 'src/components';
import Label from 'src/components/Label';
import { FormLabel } from 'src/components/Form';
import RefreshLabel from 'src/components/RefreshLabel';
import { useToasts } from 'src/components/MessageToasts/withToasts';
const DatabaseSelectorWrapper = styled.div`
${({ theme }) => `
@@ -144,7 +145,7 @@ export default function DatabaseSelector({
schema ? { label: schema, value: schema } : undefined,
);
const [refresh, setRefresh] = useState(0);
const { addSuccessToast } = useToasts();
const loadDatabases = useMemo(
() =>
async (
@@ -224,6 +225,7 @@ export default function DatabaseSelector({
}
setSchemaOptions(options);
setLoadingSchemas(false);
if (refresh > 0) addSuccessToast('List refreshed');
})
.catch(() => {
setLoadingSchemas(false);