You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/02/10 00:17:31 UTC
[superset] 01/02: saving this now
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch xp/db-modal-anywhere
in repository https://gitbox.apache.org/repos/asf/superset.git
commit fe620642516a5f71023e2358307cf159ef8e42b6
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Feb 8 12:55:25 2022 -0800
saving this now
---
.../src/views/CRUD/data/database/DatabaseModal/index.tsx | 9 +++++++++
superset-frontend/src/views/components/MenuRight.tsx | 14 ++++++++++++++
2 files changed, 23 insertions(+)
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 8283aeb..fdfa8de 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
+ deeplinkDb: string | undefined; // if included goto step 2 with engine already set
}
enum ActionType {
@@ -428,7 +429,9 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
onHide,
show,
databaseId,
+ deeplinkDb,
}) => {
+ console.log(deeplinkDb);
const [db, setDB] = useReducer<
Reducer<Partial<DatabaseObject> | null, DBReducerActionType>
>(dbReducer, null);
@@ -656,6 +659,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
},
});
} else {
+ console.log(availableDbs);
const selectedDbModel = availableDbs?.databases.filter(
(db: DatabaseObject) => db.name === database_name,
)[0];
@@ -850,6 +854,11 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
if (isLoading) {
setLoading(false);
}
+
+ if (deeplinkDb && availableDbs) {
+ // set model if passed into props
+ setDatabaseModel(deeplinkDb);
+ }
}, [availableDbs]);
const tabChange = (key: string) => {
diff --git a/superset-frontend/src/views/components/MenuRight.tsx b/superset-frontend/src/views/components/MenuRight.tsx
index 0ece154..43d56f3 100644
--- a/superset-frontend/src/views/components/MenuRight.tsx
+++ b/superset-frontend/src/views/components/MenuRight.tsx
@@ -27,6 +27,8 @@ import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
import LanguagePicker from './LanguagePicker';
import { NavBarProps, MenuObjectProps } from './Menu';
+import DatabaseModal from '../CRUD/data/database/DatabaseModal';
+
export const dropdownItems = [
{
label: t('SQL query'),
@@ -104,6 +106,18 @@ const RightMenu = ({
const showActionDropdown = canSql || canChart || canDashboard;
return (
<StyledDiv align={align}>
+ <DatabaseModal
+ databaseId={null}
+ show
+ onHide={() => {
+ console.log('hide');
+ }}
+ onDatabaseAdd={() => {
+ console.log('adding');
+ }}
+ deeplinkDb={'Trino'}
+ />
+
<Menu mode="horizontal">
{!navbarRight.user_is_anonymous && showActionDropdown && (
<SubMenu