From b963624e1298a48631a46997b1e0bf5f64db96e3 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Thu, 22 Apr 2021 23:57:17 -0400 Subject: [PATCH] refactor: Boostrap to AntD - Row/Col (#14100) --- .../spec/javascripts/profile/App_spec.tsx | 2 +- .../src/SqlLab/components/SaveQuery.tsx | 9 +++--- .../SqlLab/components/ScheduleQueryButton.tsx | 11 +++---- .../src/components/FormRow/FormRow.test.jsx | 2 +- .../src/components/FormRow/index.jsx | 18 +++++++----- .../components/PropertiesModal/index.jsx | 29 ++++++++++--------- .../components/PropertiesModal/index.tsx | 15 ++++------ .../components/controls/BoundsControl.jsx | 9 +++--- .../components/controls/SpatialControl.jsx | 24 ++++++++------- .../TimeSeriesColumnControl/index.jsx | 9 ++++-- .../components/controls/VizTypeControl.jsx | 25 ++++++---------- .../src/profile/components/App.tsx | 12 ++++---- 12 files changed, 84 insertions(+), 81 deletions(-) diff --git a/superset-frontend/spec/javascripts/profile/App_spec.tsx b/superset-frontend/spec/javascripts/profile/App_spec.tsx index e45b1999be..50ca563f96 100644 --- a/superset-frontend/spec/javascripts/profile/App_spec.tsx +++ b/superset-frontend/spec/javascripts/profile/App_spec.tsx @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { Col, Row } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; import { shallow } from 'enzyme'; import App from 'src/profile/components/App'; import Tabs from 'src/common/components/Tabs'; diff --git a/superset-frontend/src/SqlLab/components/SaveQuery.tsx b/superset-frontend/src/SqlLab/components/SaveQuery.tsx index 4b8e7a0b9d..7c9edf1539 100644 --- a/superset-frontend/src/SqlLab/components/SaveQuery.tsx +++ b/superset-frontend/src/SqlLab/components/SaveQuery.tsx @@ -17,7 +17,8 @@ * under the License. */ import React, { useState } from 'react'; -import { FormControl, FormGroup, Row, Col } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; +import { FormControl, FormGroup } from 'react-bootstrap'; import { t, supersetTheme, styled } from '@superset-ui/core'; import Button from 'src/components/Button'; @@ -114,7 +115,7 @@ export default function SaveQuery({ const renderModalBody = () => ( - + {t('Name')} @@ -123,7 +124,7 @@ export default function SaveQuery({
- + {t('Description')} @@ -140,7 +141,7 @@ export default function SaveQuery({
- + {saveQueryWarning} diff --git a/superset-frontend/src/SqlLab/components/ScheduleQueryButton.tsx b/superset-frontend/src/SqlLab/components/ScheduleQueryButton.tsx index f26d3341eb..24e13cdc9f 100644 --- a/superset-frontend/src/SqlLab/components/ScheduleQueryButton.tsx +++ b/superset-frontend/src/SqlLab/components/ScheduleQueryButton.tsx @@ -18,7 +18,8 @@ */ import React, { FunctionComponent, useState } from 'react'; import Form, { FormProps, FormValidation } from 'react-jsonschema-form'; -import { Col, FormControl, FormGroup, Row } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; +import { FormControl, FormGroup } from 'react-bootstrap'; import { t, styled } from '@superset-ui/core'; import * as chrono from 'chrono-node'; import ModalTrigger from 'src/components/ModalTrigger'; @@ -140,7 +141,7 @@ const ScheduleQueryButton: FunctionComponent = ({ const renderModalBody = () => ( - + {t('Label')} @@ -153,7 +154,7 @@ const ScheduleQueryButton: FunctionComponent = ({ - + {t('Description')} @@ -166,7 +167,7 @@ const ScheduleQueryButton: FunctionComponent = ({ - +
= ({ {scheduleQueryWarning && ( - + {scheduleQueryWarning} diff --git a/superset-frontend/src/components/FormRow/FormRow.test.jsx b/superset-frontend/src/components/FormRow/FormRow.test.jsx index 0dfda25bc0..57f1d6500a 100644 --- a/superset-frontend/src/components/FormRow/FormRow.test.jsx +++ b/superset-frontend/src/components/FormRow/FormRow.test.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import { Col, Row } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; import TextControl from 'src/explore/components/controls/TextControl'; import FormRow from 'src/components/FormRow'; diff --git a/superset-frontend/src/components/FormRow/index.jsx b/superset-frontend/src/components/FormRow/index.jsx index dde1b42b9c..6dd5027b08 100644 --- a/superset-frontend/src/components/FormRow/index.jsx +++ b/superset-frontend/src/components/FormRow/index.jsx @@ -18,7 +18,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import { Row, Col } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; @@ -52,20 +52,24 @@ export default function FormRow({ label, tooltip, control, isCheckbox }) { ); if (isCheckbox) { return ( - - + + {control} - {labelAndTooltip} + + {labelAndTooltip} + ); } return ( - - + + {labelAndTooltip} - {control} + + {control} + ); } diff --git a/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx b/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx index ccf4b6c82b..5cc1209ef4 100644 --- a/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx +++ b/superset-frontend/src/dashboard/components/PropertiesModal/index.jsx @@ -18,7 +18,8 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import { Row, Col, FormControl } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; +import { FormControl } from 'react-bootstrap'; import jsonStringify from 'json-stringify-pretty-compact'; import Button from 'src/components/Button'; import { AsyncSelect } from 'src/components/Select'; @@ -323,8 +324,8 @@ class PropertiesModal extends React.PureComponent { getRowsWithoutRoles() { const { values, isDashboardLoaded } = this.state; return ( - - + +

{t('Access')}

{t('Owners')} - +

{t('Colors')}

- +

{t('Access')}

- - + + {t('Owners')} - + {t('Roles')} - + - +

{t('Basic information')}

- - + + {t('Title')} - + {t('URL slug')} - +

); diff --git a/superset-frontend/src/profile/components/App.tsx b/superset-frontend/src/profile/components/App.tsx index ec6cec80be..6cf388540f 100644 --- a/superset-frontend/src/profile/components/App.tsx +++ b/superset-frontend/src/profile/components/App.tsx @@ -17,16 +17,16 @@ * under the License. */ import React from 'react'; -import { Col, Row, Panel } from 'react-bootstrap'; +import { Row, Col } from 'src/common/components'; +import { Panel } from 'react-bootstrap'; import Tabs from 'src/common/components/Tabs'; import { t } from '@superset-ui/core'; - +import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import Favorites from './Favorites'; import UserInfo from './UserInfo'; import Security from './Security'; import RecentActivity from './RecentActivity'; import CreatedContent from './CreatedContent'; -import { UserWithPermissionsAndRoles } from '../../types/bootstrapTypes'; interface AppProps { user: UserWithPermissionsAndRoles; @@ -35,11 +35,11 @@ interface AppProps { export default function App({ user }: AppProps) { return (
- - + + - +