refactor(Switch): Upgrade Switch to Ant Design 5 (#30731)

This commit is contained in:
alexandrusoare
2024-10-30 20:18:49 +02:00
committed by GitHub
parent 9bb69ab311
commit bc5da631c8
10 changed files with 64 additions and 22 deletions

View File

@@ -17,7 +17,7 @@
* under the License.
*/
import { SupersetTheme, t } from '@superset-ui/core';
import { AntdSwitch } from 'src/components';
import { Switch } from 'src/components/Switch';
import InfoTooltip from 'src/components/InfoTooltip';
import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput';
import { FieldPropTypes } from '../../types';
@@ -296,7 +296,7 @@ export const forceSSLField = ({
sslForced,
}: FieldPropTypes) => (
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
<AntdSwitch
<Switch
disabled={sslForced && !isEditMode}
checked={db?.parameters?.encryption || sslForced}
onChange={changed => {

View File

@@ -26,8 +26,8 @@ jest.mock('@superset-ui/core', () => ({
isFeatureEnabled: jest.fn().mockReturnValue(true),
}));
jest.mock('src/components', () => ({
AntdSwitch: ({
jest.mock('src/components/Switch', () => ({
Switch: ({
checked,
onChange,
}: {

View File

@@ -23,7 +23,7 @@ import {
isFeatureEnabled,
FeatureFlag,
} from '@superset-ui/core';
import { AntdSwitch } from 'src/components';
import { Switch } from 'src/components/Switch';
import InfoTooltip from 'src/components/InfoTooltip';
import { isEmpty } from 'lodash';
import { infoTooltip, toggleStyle } from './styles';
@@ -80,7 +80,7 @@ const SSHTunnelSwitch = ({
return isSSHTunnelEnabled ? (
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
<AntdSwitch
<Switch
checked={isChecked}
onChange={handleOnChange}
data-test="ssh-tunnel-switch"