From 4b969710e44dc233b96ebdeafb51d1aeec8a407b Mon Sep 17 00:00:00 2001 From: Geido <60598000+geido@users.noreply.github.com> Date: Fri, 10 Dec 2021 20:45:53 +0200 Subject: [PATCH] Rename CertifiedIcon to CertifiedBadge (#17715) --- .../CertifiedBadge.stories.tsx} | 8 ++++---- .../CertifiedBadge.test.tsx} | 10 +++++----- .../{CertifiedIcon => CertifiedBadge}/index.tsx | 8 ++++---- .../src/components/Datasource/DatasourceEditor.jsx | 8 ++++---- .../src/components/EditableTitle/index.tsx | 6 +++--- .../src/components/ListViewCard/index.tsx | 4 ++-- .../src/components/TableSelector/index.tsx | 4 ++-- .../explore/components/ExploreChartHeader/index.jsx | 4 ++-- superset-frontend/src/views/CRUD/chart/ChartList.tsx | 4 ++-- .../src/views/CRUD/dashboard/DashboardList.tsx | 4 ++-- .../src/views/CRUD/data/dataset/DatasetList.tsx | 4 ++-- 11 files changed, 32 insertions(+), 32 deletions(-) rename superset-frontend/src/components/{CertifiedIcon/CertifiedIcon.stories.tsx => CertifiedBadge/CertifiedBadge.stories.tsx} (84%) rename superset-frontend/src/components/{CertifiedIcon/CertifiedIcon.test.tsx => CertifiedBadge/CertifiedBadge.test.tsx} (88%) rename superset-frontend/src/components/{CertifiedIcon => CertifiedBadge}/index.tsx (92%) diff --git a/superset-frontend/src/components/CertifiedIcon/CertifiedIcon.stories.tsx b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx similarity index 84% rename from superset-frontend/src/components/CertifiedIcon/CertifiedIcon.stories.tsx rename to superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx index 0bafe583a6..bd2e39287f 100644 --- a/superset-frontend/src/components/CertifiedIcon/CertifiedIcon.stories.tsx +++ b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx @@ -17,14 +17,14 @@ * under the License. */ import React from 'react'; -import CertifiedIcon, { CertifiedIconProps } from '.'; +import CertifiedBadge, { CertifiedBadgeProps } from '.'; export default { - title: 'CertifiedIconWithTooltip', + title: 'CertifiedBadgeWithTooltip', }; -export const InteractiveIcon = (args: CertifiedIconProps) => ( - +export const InteractiveIcon = (args: CertifiedBadgeProps) => ( + ); InteractiveIcon.args = { diff --git a/superset-frontend/src/components/CertifiedIcon/CertifiedIcon.test.tsx b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx similarity index 88% rename from superset-frontend/src/components/CertifiedIcon/CertifiedIcon.test.tsx rename to superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx index 3bdb36d80c..dd7ebb8bf9 100644 --- a/superset-frontend/src/components/CertifiedIcon/CertifiedIcon.test.tsx +++ b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx @@ -19,29 +19,29 @@ import React from 'react'; import { render, screen } from 'spec/helpers/testing-library'; import userEvent from '@testing-library/user-event'; -import CertifiedIcon from 'src/components/CertifiedIcon'; +import CertifiedBadge from 'src/components/CertifiedBadge'; test('renders with default props', () => { - render(); + render(); expect(screen.getByRole('img')).toBeInTheDocument(); }); test('renders a tooltip when hovered', async () => { - render(); + render(); userEvent.hover(screen.getByRole('img')); expect(await screen.findByRole('tooltip')).toBeInTheDocument(); }); test('renders with certified by', async () => { const certifiedBy = 'Trusted Authority'; - render(); + render(); userEvent.hover(screen.getByRole('img')); expect(await screen.findByRole('tooltip')).toHaveTextContent(certifiedBy); }); test('renders with details', async () => { const details = 'All requirements have been met.'; - render(); + render(); userEvent.hover(screen.getByRole('img')); expect(await screen.findByRole('tooltip')).toHaveTextContent(details); }); diff --git a/superset-frontend/src/components/CertifiedIcon/index.tsx b/superset-frontend/src/components/CertifiedBadge/index.tsx similarity index 92% rename from superset-frontend/src/components/CertifiedIcon/index.tsx rename to superset-frontend/src/components/CertifiedBadge/index.tsx index 4aa0dad236..6ad82fb1c8 100644 --- a/superset-frontend/src/components/CertifiedIcon/index.tsx +++ b/superset-frontend/src/components/CertifiedBadge/index.tsx @@ -21,17 +21,17 @@ import { t, supersetTheme } from '@superset-ui/core'; import Icons, { IconType } from 'src/components/Icons'; import { Tooltip } from 'src/components/Tooltip'; -export interface CertifiedIconProps { +export interface CertifiedBadgeProps { certifiedBy?: string; details?: string; size?: IconType['iconSize']; } -function CertifiedIcon({ +function CertifiedBadge({ certifiedBy, details, size = 'l', -}: CertifiedIconProps) { +}: CertifiedBadgeProps) { return ( {record.is_certified && ( - @@ -302,7 +302,7 @@ function ColumnCollectionTable({ ) : ( {record.is_certified && ( - @@ -1113,7 +1113,7 @@ class DatasourceEditor extends React.PureComponent { metric_name: (v, onChange, _, record) => ( {record.is_certified && ( - diff --git a/superset-frontend/src/components/EditableTitle/index.tsx b/superset-frontend/src/components/EditableTitle/index.tsx index c5350416ca..b0d1f7abcd 100644 --- a/superset-frontend/src/components/EditableTitle/index.tsx +++ b/superset-frontend/src/components/EditableTitle/index.tsx @@ -20,7 +20,7 @@ import React, { useEffect, useState, useRef } from 'react'; import cx from 'classnames'; import { styled, t } from '@superset-ui/core'; import { Tooltip } from 'src/components/Tooltip'; -import CertifiedIcon from '../CertifiedIcon'; +import CertifiedBadge from '../CertifiedBadge'; export interface EditableTitleProps { canEdit?: boolean; @@ -39,7 +39,7 @@ export interface EditableTitleProps { certificationDetails?: string; } -const StyledCertifiedIcon = styled(CertifiedIcon)` +const StyledCertifiedBadge = styled(CertifiedBadge)` vertical-align: middle; `; @@ -233,7 +233,7 @@ export default function EditableTitle({ > {certifiedBy && ( <> - {' '} diff --git a/superset-frontend/src/components/ListViewCard/index.tsx b/superset-frontend/src/components/ListViewCard/index.tsx index f40cead9c8..6f0e822069 100644 --- a/superset-frontend/src/components/ListViewCard/index.tsx +++ b/superset-frontend/src/components/ListViewCard/index.tsx @@ -21,7 +21,7 @@ import { styled, useTheme } from '@superset-ui/core'; import { AntdCard, Skeleton, ThinSkeleton } from 'src/common/components'; import { Tooltip } from 'src/components/Tooltip'; import ImageLoader, { BackgroundPosition } from './ImageLoader'; -import CertifiedIcon from '../CertifiedIcon'; +import CertifiedBadge from '../CertifiedBadge'; const ActionsWrapper = styled.div` width: 64px; @@ -257,7 +257,7 @@ function ListViewCard({ {certifiedBy && ( <> - {' '} diff --git a/superset-frontend/src/components/TableSelector/index.tsx b/superset-frontend/src/components/TableSelector/index.tsx index 952cf124bd..171c817eed 100644 --- a/superset-frontend/src/components/TableSelector/index.tsx +++ b/superset-frontend/src/components/TableSelector/index.tsx @@ -31,7 +31,7 @@ import DatabaseSelector, { DatabaseObject, } from 'src/components/DatabaseSelector'; import RefreshLabel from 'src/components/RefreshLabel'; -import CertifiedIcon from 'src/components/CertifiedIcon'; +import CertifiedBadge from 'src/components/CertifiedBadge'; import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip'; const TableSelectorWrapper = styled.div` @@ -123,7 +123,7 @@ const TableOption = ({ table }: { table: Table }) => { )} {extra?.certification && ( - {slice?.certified_by && ( <> - {' '} diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 6982f784bb..33236591b0 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -58,7 +58,7 @@ import { Tooltip } from 'src/components/Tooltip'; import Icons from 'src/components/Icons'; import { nativeFilterGate } from 'src/dashboard/components/nativeFilters/utils'; import setupPlugins from 'src/setup/setupPlugins'; -import CertifiedIcon from 'src/components/CertifiedIcon'; +import CertifiedBadge from 'src/components/CertifiedBadge'; import ChartCard from './ChartCard'; const PAGE_SIZE = 25; @@ -249,7 +249,7 @@ function ChartList(props: ChartListProps) { {certifiedBy && ( <> - {' '} diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 6d4ba8b484..075af9fd7b 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -49,7 +49,7 @@ import ImportModelsModal from 'src/components/ImportModal/index'; import OmniContainer from 'src/components/OmniContainer'; import Dashboard from 'src/dashboard/containers/Dashboard'; -import CertifiedIcon from 'src/components/CertifiedIcon'; +import CertifiedBadge from 'src/components/CertifiedBadge'; import DashboardCard from './DashboardCard'; import { DashboardStatus } from './types'; @@ -266,7 +266,7 @@ function DashboardList(props: DashboardListProps) { {certifiedBy && ( <> - {' '} diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx index ea3048cf57..39f8ba0e02 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx @@ -51,7 +51,7 @@ import withToasts from 'src/components/MessageToasts/withToasts'; import { Tooltip } from 'src/components/Tooltip'; import Icons from 'src/components/Icons'; import FacePile from 'src/components/FacePile'; -import CertifiedIcon from 'src/components/CertifiedIcon'; +import CertifiedBadge from 'src/components/CertifiedBadge'; import InfoTooltip from 'src/components/InfoTooltip'; import ImportModelsModal from 'src/components/ImportModal/index'; import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; @@ -254,7 +254,7 @@ const DatasetList: FunctionComponent = ({ return ( {parsedExtra?.certification && ( -