This is an automated email from the ASF dual-hosted git repository.
pkdotson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new c211f7d refactor: icon to icons in DatasourceEditor (#15240)
c211f7d is described below
commit c211f7df8e5d3ebe0d0424016354f27aef5882aa
Author: Phillip Kelley-Dotson <[email protected]>
AuthorDate: Tue Jun 22 15:07:09 2021 -0700
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 <[email protected]>
---
.../spec/javascripts/datasource/DatasourceEditor_spec.jsx | 9 +++++----
superset-frontend/src/datasource/DatasourceEditor.jsx | 15 ++++++++++-----
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git
a/superset-frontend/spec/javascripts/datasource/DatasourceEditor_spec.jsx
b/superset-frontend/spec/javascripts/datasource/DatasourceEditor_spec.jsx
index 96d23eb..e430b92 100644
--- a/superset-frontend/spec/javascripts/datasource/DatasourceEditor_spec.jsx
+++ b/superset-frontend/spec/javascripts/datasource/DatasourceEditor_spec.jsx
@@ -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);
diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx
b/superset-frontend/src/datasource/DatasourceEditor.jsx
index c1ad426..48cda77 100644
--- a/superset-frontend/src/datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/datasource/DatasourceEditor.jsx
@@ -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>