mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
refactor: icon to icons in DatasourceEditor (#15240)
* intial commit * lint * fix test * fix lint * remove console. * Removing pixel placement override. Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
parent
58cc78d2c1
commit
c211f7df8e
@ -27,6 +27,7 @@ import { render, screen } from 'spec/helpers/testing-library';
|
||||
import { Radio } from 'src/components/Radio';
|
||||
|
||||
import Icon from 'src/components/Icon';
|
||||
import Icons from 'src/components/Icons';
|
||||
import Tabs from 'src/components/Tabs';
|
||||
import DatasourceEditor from 'src/datasource/DatasourceEditor';
|
||||
import Field from 'src/CRUD/Field';
|
||||
@ -174,8 +175,8 @@ describe('DatasourceEditor', () => {
|
||||
const sourceTab = wrapper.find(Tabs.TabPane).first();
|
||||
expect(sourceTab.find(Radio).first().prop('disabled')).toBe(false);
|
||||
|
||||
const icon = sourceTab.find(Icon);
|
||||
expect(icon.prop('name')).toBe('lock-unlocked');
|
||||
const icon = wrapper.find(Icons.LockUnlocked);
|
||||
expect(icon).toExist();
|
||||
|
||||
const tableSelector = sourceTab.find(Field).shallow().find(TableSelector);
|
||||
expect(tableSelector.length).toBe(1);
|
||||
@ -187,8 +188,8 @@ describe('DatasourceEditor', () => {
|
||||
expect(sourceTab.find(Radio).length).toBe(2);
|
||||
expect(sourceTab.find(Radio).first().prop('disabled')).toBe(true);
|
||||
|
||||
const icon = sourceTab.find(Icon);
|
||||
expect(icon.prop('name')).toBe('lock-locked');
|
||||
const icon = wrapper.find(Icons.LockLocked);
|
||||
expect(icon).toExist();
|
||||
icon.parent().simulate('click');
|
||||
expect(wrapper.state('isEditMode')).toBe(true);
|
||||
|
||||
|
@ -30,7 +30,6 @@ import Tabs from 'src/components/Tabs';
|
||||
import CertifiedIcon from 'src/components/CertifiedIcon';
|
||||
import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip';
|
||||
import DatabaseSelector from 'src/components/DatabaseSelector';
|
||||
import Icon from 'src/components/Icon';
|
||||
import Label from 'src/components/Label';
|
||||
import Loading from 'src/components/Loading';
|
||||
import TableSelector from 'src/components/TableSelector';
|
||||
@ -51,6 +50,7 @@ import Field from 'src/CRUD/Field';
|
||||
|
||||
import withToasts from 'src/messageToasts/enhancers/withToasts';
|
||||
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
|
||||
import Icons from 'src/components/Icons';
|
||||
|
||||
const DatasourceContainer = styled.div`
|
||||
.change-warning {
|
||||
@ -842,10 +842,15 @@ class DatasourceEditor extends React.PureComponent {
|
||||
{this.allowEditSource && (
|
||||
<EditLockContainer>
|
||||
<span role="button" tabIndex={0} onClick={this.onChangeEditMode}>
|
||||
<Icon
|
||||
color={supersetTheme.colors.grayscale.base}
|
||||
name={this.state.isEditMode ? 'lock-unlocked' : 'lock-locked'}
|
||||
{this.state.isEditMode ? (
|
||||
<Icons.LockUnlocked
|
||||
iconColor={supersetTheme.colors.grayscale.base}
|
||||
/>
|
||||
) : (
|
||||
<Icons.LockLocked
|
||||
iconColor={supersetTheme.colors.grayscale.base}
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
{!this.state.isEditMode && (
|
||||
<div>{t('Click the lock to make changes.')}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user