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:30 UTC
[superset] branch xp/db-modal-anywhere created (now 7325379)
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a change to branch xp/db-modal-anywhere
in repository https://gitbox.apache.org/repos/asf/superset.git.
at 7325379 remove for testing
This branch includes the following new commits:
new fe62064 saving this now
new 7325379 remove for testing
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/02: saving this now
Posted by hu...@apache.org.
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
[superset] 02/02: remove for testing
Posted by hu...@apache.org.
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 73253796e09580f9e9464c468e59d9537430f351
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Feb 9 16:15:52 2022 -0800
remove for testing
---
.../src/views/CRUD/data/database/DatabaseModal/index.tsx | 9 ++++-----
superset-frontend/src/views/components/MenuRight.tsx | 12 ------------
2 files changed, 4 insertions(+), 17 deletions(-)
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 fdfa8de..a74e944 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -135,7 +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
+ setDBEngine: string | undefined; // if included goto step 2 with engine already set
}
enum ActionType {
@@ -429,9 +429,8 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
onHide,
show,
databaseId,
- deeplinkDb,
+ setDBEngine,
}) => {
- console.log(deeplinkDb);
const [db, setDB] = useReducer<
Reducer<Partial<DatabaseObject> | null, DBReducerActionType>
>(dbReducer, null);
@@ -855,9 +854,9 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
setLoading(false);
}
- if (deeplinkDb && availableDbs) {
+ if (availableDbs && setDBEngine) {
// set model if passed into props
- setDatabaseModel(deeplinkDb);
+ setDatabaseModel(setDBEngine);
}
}, [availableDbs]);
diff --git a/superset-frontend/src/views/components/MenuRight.tsx b/superset-frontend/src/views/components/MenuRight.tsx
index 43d56f3..e38df7e 100644
--- a/superset-frontend/src/views/components/MenuRight.tsx
+++ b/superset-frontend/src/views/components/MenuRight.tsx
@@ -106,18 +106,6 @@ 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