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 2021/06/07 19:07:23 UTC

[superset] branch hugh/allow-imgs-via-s2text updated (d2e31aa -> 7d8dae7)

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a change to branch hugh/allow-imgs-via-s2text
in repository https://gitbox.apache.org/repos/asf/superset.git.


    from d2e31aa  pull from master
     new 57d159d  fix some styles
     new 7d8dae7  add database images

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.


Summary of changes:
 superset-frontend/src/components/IconButton/index.tsx    |  1 -
 .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 16 ++++------------
 superset-frontend/src/views/CRUD/hooks.ts                |  4 ++++
 3 files changed, 8 insertions(+), 13 deletions(-)

[superset] 01/02: fix some styles

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch hugh/allow-imgs-via-s2text
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 57d159df763210f06fea1c3b5f8b145675fb05ef
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Jun 7 13:31:47 2021 -0400

    fix some styles
---
 superset-frontend/src/components/IconButton/index.tsx                 | 1 -
 .../src/views/CRUD/data/database/DatabaseModal/index.tsx              | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/superset-frontend/src/components/IconButton/index.tsx b/superset-frontend/src/components/IconButton/index.tsx
index 711aee9..773b31c 100644
--- a/superset-frontend/src/components/IconButton/index.tsx
+++ b/superset-frontend/src/components/IconButton/index.tsx
@@ -83,7 +83,6 @@ const StyledBottom = styled.div`
   background-color: ${({ theme }) => theme.colors.grayscale.light4};
   width: 100%;
   line-height: 1.5em;
-  overflow: hidden;
   white-space: no-wrap;
   text-overflow: ellipsis;
 
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 7b1be56..1e43b04 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -48,7 +48,6 @@ import {
   DatabaseForm,
   CONFIGURATION_METHOD,
 } from 'src/views/CRUD/data/database/types';
-import Label from 'src/components/Label';
 import ExtraOptions from './ExtraOptions';
 import SqlAlchemyForm from './SqlAlchemyForm';
 import DatabaseConnectionForm from './DatabaseConnectionForm';
@@ -345,7 +344,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
       <span className="available-label">
         Or choose from a list of other databases we support{' '}
       </span>
-      <Label className="label-available-select">supported databases</Label>
       <Select
         style={{ width: '100%' }}
         onChange={setDatabaseModel}
@@ -366,7 +364,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
         ?.filter((db: DatabaseForm) => db.preferred)
         .map((database: DatabaseForm) => (
           <IconButton
-            icon="preferred-item"
+            className="preferred-item"
             onClick={() => setDatabaseModel(database.engine)}
             buttonText={database.name}
             icon={getPreferredImage('postgresql')}

[superset] 02/02: add database images

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch hugh/allow-imgs-via-s2text
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7d8dae79489c378a2331cbe63c09d4f7d7b2f556
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Jun 7 15:05:05 2021 -0400

    add database images
---
 .../src/views/CRUD/data/database/DatabaseModal/index.tsx     | 12 +++---------
 superset-frontend/src/views/CRUD/hooks.ts                    |  4 ++++
 2 files changed, 7 insertions(+), 9 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 1e43b04..67ad8ea 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -40,9 +40,9 @@ import {
   useSingleViewResource,
   useAvailableDatabases,
   useDatabaseValidation,
+  getDatabaseImages,
 } from 'src/views/CRUD/hooks';
 import { useCommonConf } from 'src/views/CRUD/data/database/state';
-import SupersetText from 'src/utils/textUtils';
 import {
   DatabaseObject,
   DatabaseForm,
@@ -129,13 +129,6 @@ type DBReducerActionType =
       payload: { configuration_method: CONFIGURATION_METHOD };
     };
 
-const getPreferredImage = async (engine) => {
-  const config = await SupersetText;
-  return config.DATABASE_CONNECTION.images[engine];
-};
-
-getPreferredImage('postgresql');
-
 function dbReducer(
   state: Partial<DatabaseObject> | null,
   action: DBReducerActionType,
@@ -221,6 +214,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
   const [dbName, setDbName] = useState('');
   const [isLoading, setLoading] = useState<boolean>(false);
   const conf = useCommonConf();
+  const dbImages = getDatabaseImages();
   const isEditMode = !!databaseId;
   const sslForced = isFeatureEnabled(
     FeatureFlag.FORCE_DATABASE_CONNECTIONS_SSL,
@@ -367,7 +361,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
             className="preferred-item"
             onClick={() => setDatabaseModel(database.engine)}
             buttonText={database.name}
-            icon={getPreferredImage('postgresql')}
+            icon={dbImages[database.engine]}
           />
         ))}
     </div>
diff --git a/superset-frontend/src/views/CRUD/hooks.ts b/superset-frontend/src/views/CRUD/hooks.ts
index aaa3599..0c2b342 100644
--- a/superset-frontend/src/views/CRUD/hooks.ts
+++ b/superset-frontend/src/views/CRUD/hooks.ts
@@ -26,6 +26,8 @@ import { FilterValue } from 'src/components/ListView/types';
 import Chart, { Slice } from 'src/types/Chart';
 import copyTextToClipboard from 'src/utils/copy';
 import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+import SupersetText from 'src/utils/textUtils';
+import supersetText from 'src/utils/textUtils';
 import { FavoriteStatus, ImportResourceName, DatabaseObject } from './types';
 
 interface ListViewResourceState<D extends object = any> {
@@ -625,6 +627,8 @@ export const copyQueryLink = (
     });
 };
 
+export const getDatabaseImages = () => SupersetText.DB_IMAGES;
+
 export const testDatabaseConnection = (
   connection: DatabaseObject,
   handleErrorMsg: (errorMsg: string) => void,