Skip to content

Commit

Permalink
chore: Split Select component into Async and Sync components (#20466)
Browse files Browse the repository at this point in the history
* Created AsyncSelect Component
Changed files to reference AsyncSelect if needed

* modified import of AsyncSelect, removed async tests and prefixes from select tests

* fixed various import and lint warnings

* fixing lint errors

* fixed frontend test errors

* fixed alertreportmodel tests

* removed accidental import

* fixed lint errors

* updated async select
  • Loading branch information
cccs-RyanK authored Jul 7, 2022
1 parent 6132d78 commit 1109fe5
Show file tree
Hide file tree
Showing 14 changed files with 1,519 additions and 390 deletions.
4 changes: 2 additions & 2 deletions superset-frontend/src/addSlice/AddSliceContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React from 'react';
import { ReactWrapper } from 'enzyme';
import Button from 'src/components/Button';
import { Select } from 'src/components';
import { AsyncSelect } from 'src/components';
import AddSliceContainer, {
AddSliceContainerProps,
AddSliceContainerState,
Expand Down Expand Up @@ -72,7 +72,7 @@ async function getWrapper(user = mockUser) {

test('renders a select and a VizTypeControl', async () => {
const wrapper = await getWrapper();
expect(wrapper.find(Select)).toExist();
expect(wrapper.find(AsyncSelect)).toExist();
expect(wrapper.find(VizTypeGallery)).toExist();
});

Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/addSlice/AddSliceContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getUrlParam } from 'src/utils/urlUtils';
import { URL_PARAMS } from 'src/constants';
import { isNullish } from 'src/utils/common';
import Button from 'src/components/Button';
import { Select, Steps } from 'src/components';
import { AsyncSelect, Steps } from 'src/components';
import { Tooltip } from 'src/components/Tooltip';

import VizTypeGallery, {
Expand Down Expand Up @@ -349,7 +349,7 @@ export default class AddSliceContainer extends React.PureComponent<
status={this.state.datasource?.value ? 'finish' : 'process'}
description={
<StyledStepDescription className="dataset">
<Select
<AsyncSelect
autoFocus
ariaLabel={t('Dataset')}
name="select-datasource"
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/components/DatabaseSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React, { ReactNode, useState, useMemo, useEffect } from 'react';
import { styled, SupersetClient, t } from '@superset-ui/core';
import rison from 'rison';
import { Select } from 'src/components';
import { AsyncSelect, Select } from 'src/components';
import Label from 'src/components/Label';
import { FormLabel } from 'src/components/Form';
import RefreshLabel from 'src/components/RefreshLabel';
Expand Down Expand Up @@ -272,7 +272,7 @@ export default function DatabaseSelector({

function renderDatabaseSelect() {
return renderSelectRow(
<Select
<AsyncSelect
ariaLabel={t('Select database or type database name')}
optionFilterProps={['database_name', 'value']}
data-test="select-database"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Alert from 'src/components/Alert';
import Badge from 'src/components/Badge';
import shortid from 'shortid';
import { styled, SupersetClient, t, withTheme } from '@superset-ui/core';
import { Select, Row, Col } from 'src/components';
import { Select, AsyncSelect, Row, Col } from 'src/components';
import { FormLabel } from 'src/components/Form';
import Button from 'src/components/Button';
import Tabs from 'src/components/Tabs';
Expand Down Expand Up @@ -548,7 +548,7 @@ function OwnersSelector({ datasource, onChange }) {
}, []);

return (
<Select
<AsyncSelect
ariaLabel={t('Select owners')}
mode="multiple"
name="owners"
Expand Down
Loading

0 comments on commit 1109fe5

Please sign in to comment.