diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.jsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.jsx index 088fd79906a70..6fcbfdad43848 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.jsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.jsx @@ -1016,4 +1016,24 @@ describe('DatabaseModal', () => { }); }); }); + describe('DatabaseModal w/ Deeplinking Engine', () => { + const renderAndWait = async () => { + const mounted = act(async () => { + render(, { + useRedux: true, + }); + }); + + return mounted; + }; + + beforeEach(async () => { + await renderAndWait(); + }); + + it('enters step 2 of 3 when proper database is selected', () => { + const step2of3text = screen.getByText(/step 2 of 3/i); + expect(step2of3text).toBeVisible(); + }); + }); }); diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 8283aeb2eb644..990ab4bba95ea 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -135,6 +135,7 @@ interface DatabaseModalProps { onHide: () => void; show: boolean; databaseId: number | undefined; // If included, will go into edit mode + dbEngine: string | undefined; // if included goto step 2 with engine already set } enum ActionType { @@ -428,6 +429,7 @@ const DatabaseModal: FunctionComponent = ({ onHide, show, databaseId, + dbEngine, }) => { const [db, setDB] = useReducer< Reducer | null, DBReducerActionType> @@ -850,6 +852,11 @@ const DatabaseModal: FunctionComponent = ({ if (isLoading) { setLoading(false); } + + if (availableDbs && dbEngine) { + // set model if passed into props + setDatabaseModel(dbEngine); + } }, [availableDbs]); const tabChange = (key: string) => {