From dbbf58c10d20ffccd1d2e035db79e9fafe02a9d7 Mon Sep 17 00:00:00 2001 From: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Date: Fri, 11 Jun 2021 11:55:17 -0400 Subject: [PATCH 1/4] fix: add icons (#15122) * added alerts * revisions * added icon --- .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 40721000a9ed..e35020065974 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -361,6 +361,7 @@ const DatabaseModal: FunctionComponent = ({ ))} antDAlertStyles(theme)} type="info" message={t('Want to add a new database?')} @@ -532,6 +533,7 @@ const DatabaseModal: FunctionComponent = ({ antDAlertStyles(theme)} message="Additional fields may be required" + showIcon description={ <> Select databases require additional fields to be completed in @@ -548,7 +550,6 @@ const DatabaseModal: FunctionComponent = ({ } type="info" - showIcon /> )} @@ -660,6 +661,7 @@ const DatabaseModal: FunctionComponent = ({ antDAlertStyles(theme)} type="info" + showIcon message={t('Whitelisting IPs')} description={connectionAlert.WHITELISTED_IPS} /> From 8a4ff629cced16551f140f9d85bd00c104f62246 Mon Sep 17 00:00:00 2001 From: Arash Date: Thu, 17 Jun 2021 11:24:32 -0400 Subject: [PATCH 2/4] spinner --- .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 a2f3145a7888..83e5fc06c5f1 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -49,6 +49,7 @@ import { DatabaseForm, CONFIGURATION_METHOD, } from 'src/views/CRUD/data/database/types'; +import Loading from 'src/components/Loading'; import ExtraOptions from './ExtraOptions'; import SqlAlchemyForm from './SqlAlchemyForm'; import DatabaseConnectionForm from './DatabaseConnectionForm'; @@ -376,7 +377,7 @@ const DatabaseModal: FunctionComponent = ({ ), }); } - + setLoading(true); const result = await updateResource( db.id as number, update as DatabaseObject, @@ -411,7 +412,7 @@ const DatabaseModal: FunctionComponent = ({ ), }); } - + setLoading(true); const dbId = await createResource(update as DatabaseObject); if (dbId) { setHasConnectedDb(true); @@ -425,6 +426,7 @@ const DatabaseModal: FunctionComponent = ({ } } } + setLoading(false); }; const onChange = (type: any, payload: any) => { @@ -593,7 +595,7 @@ const DatabaseModal: FunctionComponent = ({ if (isLoading) { setLoading(false); } - }, [availableDbs, isLoading]); + }, [availableDbs]); const tabChange = (key: string) => { setTabKey(key); @@ -910,6 +912,7 @@ const DatabaseModal: FunctionComponent = ({ ))} )} + {isLoading && } ); }; From 6d942205a1118cb944814ed6a9b155eafbe9bd62 Mon Sep 17 00:00:00 2001 From: Arash Date: Thu, 1 Jul 2021 15:32:47 -0400 Subject: [PATCH 3/4] this will test --- .../src/components/Form/LabeledErrorBoundInput.test.jsx | 2 +- superset-frontend/src/components/InfoTooltip/index.tsx | 5 ++--- .../CRUD/data/database/DatabaseModal/index.test.jsx | 9 +++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx b/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx index 86b6324daed5..ebfd2b30e42b 100644 --- a/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx +++ b/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx @@ -66,7 +66,7 @@ describe('LabeledErrorBoundInput', () => { const label = screen.getByText(/username/i); const textboxInput = screen.getByRole('textbox'); - const tooltipIcon = screen.getByTestId('info-solid-small'); + const tooltipIcon = screen.getByRole('img'); fireEvent.mouseOver(tooltipIcon); diff --git a/superset-frontend/src/components/InfoTooltip/index.tsx b/superset-frontend/src/components/InfoTooltip/index.tsx index 1df2ea893d8d..7aa9afaebd84 100644 --- a/superset-frontend/src/components/InfoTooltip/index.tsx +++ b/superset-frontend/src/components/InfoTooltip/index.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { styled } from '@superset-ui/core'; import { Tooltip } from 'src/components/Tooltip'; -import { Icon } from 'src/common/components'; +import Icons from 'src/components/Icons'; export interface InfoTooltipProps { className?: string; @@ -65,7 +65,6 @@ export default function InfoTooltip({ trigger = 'hover', overlayStyle = defaultOverlayStyle, bgColor = defaultColor, - viewBox = '0 -2 24 24', }: InfoTooltipProps) { return ( - + ); } 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 012368f6b512..2cfcc3d6ef97 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 @@ -538,7 +538,7 @@ describe('DatabaseModal', () => { name: /checkbox-off/i, }); const tooltipIcons = screen.getAllByRole('img', { - name: /info-solid-small/i, + name: /info-solid_small/i, }); const exposeInSQLLabCheckbox = screen.getByRole('checkbox', { name: /expose database in sql lab/i, @@ -556,7 +556,7 @@ describe('DatabaseModal', () => { name: /allow create table as/i, }); const allowCVASText = screen.getByText(/allow create table as/i); - const CTASCVASLabelText = screen.getByText(/ctas & cvas schema/i); + const CTASCVASLabelText = screen.getAllByText(/ctas & cvas schema/i); // This grabs the whole input by placeholder text const CTASCVASInput = screen.getByPlaceholderText( /create or select schema\.\.\./i, @@ -615,7 +615,8 @@ describe('DatabaseModal', () => { exposeInSQLLabText, allowCTASText, allowCVASText, - CTASCVASLabelText, + CTASCVASLabelText[0], + CTASCVASLabelText[1], CTASCVASInput, CTASCVASHelperText, allowDMLText, @@ -641,7 +642,7 @@ describe('DatabaseModal', () => { expect(component).not.toBeVisible(); }); expect(checkboxOffSVGs).toHaveLength(7); - expect(tooltipIcons).toHaveLength(7); + expect(tooltipIcons).toHaveLength(8); }); it('renders the "Advanced" - PERFORMANCE tab correctly', async () => { From 700198e5f838104a2ea3195802c68d592acd31b5 Mon Sep 17 00:00:00 2001 From: Arash Date: Thu, 1 Jul 2021 16:00:01 -0400 Subject: [PATCH 4/4] fixed test --- .../database/DatabaseModal/ExtraOptions.tsx | 23 ------------------- .../database/DatabaseModal/index.test.jsx | 7 +++--- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx index 8a9e52137307..a2a49b2f707b 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx @@ -124,35 +124,12 @@ const ExtraOptions = ({ placeholder={t('Create or select schema...')} onChange={onInputChange} /> -
{t( 'Force all tables and views to be created in this schema when clicking CTAS or CVAS in SQL Lab.', )}
- -
{t('CTAS & CVAS SCHEMA')}
-
- -
-
- {t( - 'When allowing CREATE TABLE AS option in SQL Lab, this option ' + - 'forces the table to be created in this schema.', - )} -
-
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 2cfcc3d6ef97..eb6722f03cc7 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 @@ -556,7 +556,7 @@ describe('DatabaseModal', () => { name: /allow create table as/i, }); const allowCVASText = screen.getByText(/allow create table as/i); - const CTASCVASLabelText = screen.getAllByText(/ctas & cvas schema/i); + const CTASCVASLabelText = screen.getByText(/ctas & cvas schema/i); // This grabs the whole input by placeholder text const CTASCVASInput = screen.getByPlaceholderText( /create or select schema\.\.\./i, @@ -615,8 +615,7 @@ describe('DatabaseModal', () => { exposeInSQLLabText, allowCTASText, allowCVASText, - CTASCVASLabelText[0], - CTASCVASLabelText[1], + CTASCVASLabelText, CTASCVASInput, CTASCVASHelperText, allowDMLText, @@ -642,7 +641,7 @@ describe('DatabaseModal', () => { expect(component).not.toBeVisible(); }); expect(checkboxOffSVGs).toHaveLength(7); - expect(tooltipIcons).toHaveLength(8); + expect(tooltipIcons).toHaveLength(7); }); it('renders the "Advanced" - PERFORMANCE tab correctly', async () => {