fixed ANTD deprecated warnings (#9560)

* fixed and deprecate warning

* fixed failing unit test
This commit is contained in:
Shailesh Parmar 2023-01-05 11:32:25 +05:30 committed by GitHub
parent ea84695648
commit 2bc8ca050d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 292 additions and 317 deletions

View File

@ -190,12 +190,12 @@ const ActivityFeedCard: FC<ActivityFeedCardProp> = ({
destroyTooltipOnHide={{ keepParent: false }} destroyTooltipOnHide={{ keepParent: false }}
getPopupContainer={() => containerRef.current || document.body} getPopupContainer={() => containerRef.current || document.body}
key="reaction-options-popover" key="reaction-options-popover"
open={visible && !isEditPost}
overlayClassName="ant-popover-feed" overlayClassName="ant-popover-feed"
placement="topRight" placement="topRight"
trigger="hover" trigger="hover"
visible={visible && !isEditPost}
zIndex={100} zIndex={100}
onVisibleChange={handleVisibleChange}> onOpenChange={handleVisibleChange}>
<Space align="start" className="w-full"> <Space align="start" className="w-full">
<UserPopOverCard userName={feedDetail.from}> <UserPopOverCard userName={feedDetail.from}>
<span className="tw-cursor-pointer" data-testid="authorAvatar"> <span className="tw-cursor-pointer" data-testid="authorAvatar">

View File

@ -161,12 +161,12 @@ const PopoverContent: FC<Props> = ({
align={{ targetOffset: [0, -10] }} align={{ targetOffset: [0, -10] }}
content={reactionList} content={reactionList}
id="reaction-popover" id="reaction-popover"
open={visible}
overlayClassName="ant-popover-feed-reactions" overlayClassName="ant-popover-feed-reactions"
placement="topLeft" placement="topLeft"
trigger="click" trigger="click"
visible={visible}
zIndex={9999} zIndex={9999}
onVisibleChange={handleVisibleChange}> onOpenChange={handleVisibleChange}>
<Button <Button
className="tw-p-0" className="tw-p-0"
data-testid="add-reactions" data-testid="add-reactions"

View File

@ -212,8 +212,8 @@ const EditTestCaseModal: React.FC<EditTestCaseModalProps> = ({
closable={false} closable={false}
confirmLoading={isLoadingOnSave} confirmLoading={isLoadingOnSave}
okText={t('label.submit')} okText={t('label.submit')}
open={visible}
title={`${t('label.edit')} ${testCase?.name}`} title={`${t('label.edit')} ${testCase?.name}`}
visible={visible}
width={600} width={600}
onCancel={onCancel} onCancel={onCancel}
onOk={() => form.submit()}> onOk={() => form.submit()}>

View File

@ -112,9 +112,9 @@ const EdgeInfoDrawer = ({
getContainer={false} getContainer={false}
headerStyle={{ padding: 16 }} headerStyle={{ padding: 16 }}
mask={false} mask={false}
open={visible}
style={{ position: 'absolute' }} style={{ position: 'absolute' }}
title={t('label.edge-information')} title={t('label.edge-information')}>
visible={visible}>
{isLoading ? ( {isLoading ? (
<Loader /> <Loader />
) : ( ) : (

View File

@ -1398,8 +1398,8 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
deletionState.loading, deletionState.loading,
deletionState.status deletionState.status
)} )}
open={showDeleteModal}
title="Remove lineage edge" title="Remove lineage edge"
visible={showDeleteModal}
onCancel={() => { onCancel={() => {
setShowDeleteModal(false); setShowDeleteModal(false);
}} }}

View File

@ -74,10 +74,10 @@ export const AdvancedSearchModal: FunctionComponent<Props> = ({
</Space> </Space>
} }
okText={t('label.submit')} okText={t('label.submit')}
open={visible}
title={t('label.advanced-entity', { title={t('label.advanced-entity', {
entity: t('label.search'), entity: t('label.search'),
})} })}
visible={visible}
width={950}> width={950}>
<Typography.Text data-testid="advanced-search-message"> <Typography.Text data-testid="advanced-search-message">
{t('message.advanced-search-message')} {t('message.advanced-search-message')}

View File

@ -95,6 +95,28 @@ const Explore: React.FC<ExploreProps> = ({
setShowSummaryPanel(false); setShowSummaryPanel(false);
}; };
const tabItems = useMemo(
() =>
Object.entries(tabsInfo).map(([tabSearchIndex, tabDetail]) => ({
key: tabSearchIndex,
label: (
<div data-testid={`${lowerCase(tabDetail.label)}-tab`}>
{tabDetail.label}
<span className="p-l-xs ">
{!isNil(tabCounts)
? getCountBadge(
tabCounts[tabSearchIndex as ExploreSearchIndex],
'',
tabSearchIndex === searchIndex
)
: getCountBadge()}
</span>
</div>
),
})),
[tabsInfo, tabCounts]
);
// get entity active tab by URL params // get entity active tab by URL params
const defaultActiveTab = useMemo(() => { const defaultActiveTab = useMemo(() => {
const entityName = toUpper(ENTITY_PATH[tab] ?? 'table'); const entityName = toUpper(ENTITY_PATH[tab] ?? 'table');
@ -231,6 +253,7 @@ const Explore: React.FC<ExploreProps> = ({
}> }>
<Tabs <Tabs
defaultActiveKey={defaultActiveTab} defaultActiveKey={defaultActiveTab}
items={tabItems}
size="small" size="small"
tabBarExtraContent={ tabBarExtraContent={
<div className="tw-flex"> <div className="tw-flex">
@ -268,27 +291,9 @@ const Explore: React.FC<ExploreProps> = ({
onChange={(tab) => { onChange={(tab) => {
tab && onChangeSearchIndex(tab as ExploreSearchIndex); tab && onChangeSearchIndex(tab as ExploreSearchIndex);
setShowSummaryPanel(false); setShowSummaryPanel(false);
}}> }}
{Object.entries(tabsInfo).map(([tabSearchIndex, tabDetail]) => (
<Tabs.TabPane
key={tabSearchIndex}
tab={
<div data-testid={`${lowerCase(tabDetail.label)}-tab`}>
{tabDetail.label}
<span className="p-l-xs ">
{!isNil(tabCounts)
? getCountBadge(
tabCounts[tabSearchIndex as ExploreSearchIndex],
'',
tabSearchIndex === searchIndex
)
: getCountBadge()}
</span>
</div>
}
/> />
))}
</Tabs>
<Row gutter={[8, 0]} wrap={false}> <Row gutter={[8, 0]} wrap={false}>
<Col className="searched-data-container" flex="auto"> <Col className="searched-data-container" flex="auto">
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>

View File

@ -29,7 +29,7 @@ const mockPorps = {
describe('Test Sorting DropDown Component', () => { describe('Test Sorting DropDown Component', () => {
it('Should render dropdown component', async () => { it('Should render dropdown component', async () => {
await act(async () => { await act(async () => {
const { findByTestId, findAllByTestId } = render( const { findByTestId, findByRole, findAllByTestId } = render(
<SortingDropDown {...mockPorps} /> <SortingDropDown {...mockPorps} />
); );
@ -39,7 +39,7 @@ describe('Test Sorting DropDown Component', () => {
fireEvent.click(dropdownLabel); fireEvent.click(dropdownLabel);
const dropdownMenu = await findByTestId('dropdown-menu'); const dropdownMenu = await findByRole('menu');
expect(dropdownMenu).toBeInTheDocument(); expect(dropdownMenu).toBeInTheDocument();
@ -51,7 +51,7 @@ describe('Test Sorting DropDown Component', () => {
it('Should call onSelect method on onClick option', async () => { it('Should call onSelect method on onClick option', async () => {
await act(async () => { await act(async () => {
const { findByTestId, findAllByTestId } = render( const { findByTestId, findByRole, findAllByTestId } = render(
<SortingDropDown {...mockPorps} /> <SortingDropDown {...mockPorps} />
); );
@ -61,7 +61,7 @@ describe('Test Sorting DropDown Component', () => {
fireEvent.click(dropdownLabel); fireEvent.click(dropdownLabel);
const dropdownMenu = await findByTestId('dropdown-menu'); const dropdownMenu = await findByRole('menu');
expect(dropdownMenu).toBeInTheDocument(); expect(dropdownMenu).toBeInTheDocument();

View File

@ -11,7 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Dropdown, Menu } from 'antd'; import { Dropdown } from 'antd';
import React from 'react'; import React from 'react';
import { normalLink } from '../../utils/styleconstant'; import { normalLink } from '../../utils/styleconstant';
import { dropdownIcon as DropDownIcon } from '../../utils/svgconstant'; import { dropdownIcon as DropDownIcon } from '../../utils/svgconstant';
@ -39,15 +39,15 @@ const SortingDropDown: React.FC<SortingDropdownProps> = ({
'data-testid': 'dropdown-menu-item', 'data-testid': 'dropdown-menu-item',
})); }));
const menu = <Menu data-testid="dropdown-menu" items={items} />;
const label = fieldList.find((field) => field.value === sortField)?.name; const label = fieldList.find((field) => field.value === sortField)?.name;
return ( return (
<Dropdown <Dropdown
className="tw-self-end tw-mr-2 tw-cursor-pointer" className="tw-self-end tw-mr-2 tw-cursor-pointer"
data-testid="dropdown" data-testid="dropdown"
overlay={menu} menu={{
items,
}}
trigger={['click']}> trigger={['click']}>
<div className="tw-text-primary" data-testid="dropdown-label"> <div className="tw-text-primary" data-testid="dropdown-label">
<span className="tw-mr-2">{label}</span> <span className="tw-mr-2">{label}</span>

View File

@ -118,8 +118,8 @@ const GlobalSearchProvider: FC<Props> = ({ children }: Props) => {
}} }}
closeIcon={<></>} closeIcon={<></>}
footer={null} footer={null}
open={visible}
transitionName="" transitionName=""
visible={visible}
width={650} width={650}
onCancel={handleCancel}> onCancel={handleCancel}>
<GlobalSearchSuggestions <GlobalSearchSuggestions

View File

@ -17,7 +17,6 @@ import {
Col, Col,
Dropdown, Dropdown,
Input, Input,
Menu,
Row, Row,
Space, Space,
Tooltip, Tooltip,
@ -295,10 +294,7 @@ const GlossaryV1 = ({
); );
}); });
const manageButtonContent = () => { const manageButtonContent = [
return (
<Menu
items={[
{ {
label: ( label: (
<Space <Space
@ -311,25 +307,19 @@ const GlossaryV1 = ({
}}> }}>
<SVGIcons alt="Delete" icon={Icons.DELETE} /> <SVGIcons alt="Delete" icon={Icons.DELETE} />
<div className="tw-text-left" data-testid="delete-button"> <div className="tw-text-left" data-testid="delete-button">
<p <p className="tw-font-medium" data-testid="delete-button-title">
className="tw-font-medium"
data-testid="delete-button-title">
Delete Delete
</p> </p>
<p className="tw-text-grey-muted tw-text-xs"> <p className="tw-text-grey-muted tw-text-xs">
Deleting this{' '} Deleting this {isGlossaryActive ? 'Glossary' : 'GlossaryTerm'}{' '}
{isGlossaryActive ? 'Glossary' : 'GlossaryTerm'} will will permanently remove its metadata from OpenMetadata.
permanently remove its metadata from OpenMetadata.
</p> </p>
</div> </div>
</Space> </Space>
), ),
key: 'delete-button', key: 'delete-button',
}, },
]} ];
/>
);
};
const fetchLeftPanel = () => { const fetchLeftPanel = () => {
return ( return (
@ -448,12 +438,12 @@ const GlossaryV1 = ({
? !glossaryPermission.Delete ? !glossaryPermission.Delete
: !glossaryTermPermission.Delete : !glossaryTermPermission.Delete
} }
overlay={manageButtonContent()} menu={{ items: manageButtonContent }}
open={showActions}
overlayStyle={{ width: '350px' }} overlayStyle={{ width: '350px' }}
placement="bottomRight" placement="bottomRight"
trigger={['click']} trigger={['click']}
visible={showActions} onOpenChange={setShowActions}>
onVisibleChange={setShowActions}>
<Tooltip <Tooltip
title={ title={
glossaryPermission.Delete || glossaryTermPermission.Delete glossaryPermission.Delete || glossaryTermPermission.Delete

View File

@ -13,24 +13,21 @@
import { Steps } from 'antd'; import { Steps } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import React from 'react'; import React, { useMemo } from 'react';
const { Step } = Steps;
type Props = { type Props = {
steps: Array<{ name: string; step: number }>; steps: Array<{ name: string; step: number }>;
activeStep: number; activeStep: number;
excludeSteps?: Array<number>; excludeSteps?: Array<number>;
}; };
const IngestionStepper = ({ steps, activeStep, excludeSteps = [] }: Props) => { const IngestionStepper = ({ steps, activeStep, excludeSteps = [] }: Props) => {
return ( const items = useMemo(
<div className="tw-px-24" data-testid="stepper-container"> () =>
<Steps current={activeStep} labelPlacement="vertical" size="small"> steps
{steps
.filter((step) => !excludeSteps.includes(step.step)) .filter((step) => !excludeSteps.includes(step.step))
.map((step) => { .map((step) => {
return ( return {
<Step icon: (
icon={
<span <span
className={classNames( className={classNames(
'ingestion-rounder tw-self-center', 'ingestion-rounder tw-self-center',
@ -41,13 +38,22 @@ const IngestionStepper = ({ steps, activeStep, excludeSteps = [] }: Props) => {
)} )}
data-testid={`step-icon-${step.step}`} data-testid={`step-icon-${step.step}`}
/> />
} ),
key={`${step.name}`} key: step.name,
title={step.name} title: step.name,
/> };
}),
[steps, activeStep, excludeSteps]
); );
})}
</Steps> return (
<div className="tw-px-24" data-testid="stepper-container">
<Steps
current={activeStep}
items={items}
labelPlacement="vertical"
size="small"
/>
</div> </div>
); );
}; };

View File

@ -103,8 +103,8 @@ const AddAnnouncementModal: FC<Props> = ({
htmlType: 'submit', htmlType: 'submit',
}} }}
okText="Submit" okText="Submit"
open={open}
title={t('message.make-an-announcement')} title={t('message.make-an-announcement')}
visible={open}
width={720} width={720}
onCancel={onCancel}> onCancel={onCancel}>
<Form <Form

View File

@ -82,8 +82,8 @@ const EditAnnouncementModal: FC<Props> = ({
htmlType: 'submit', htmlType: 'submit',
}} }}
okText={t('label.save')} okText={t('label.save')}
open={open}
title={t('label.edit-an-announcement')} title={t('label.edit-an-announcement')}
visible={open}
width={720} width={720}
onCancel={onCancel}> onCancel={onCancel}>
<Form <Form

View File

@ -40,7 +40,7 @@ const DeployIngestionLoaderModal = ({
closable={false} closable={false}
data-testid="deploy-modal" data-testid="deploy-modal"
footer={null} footer={null}
visible={visible}> open={visible}>
<div className="p-y-lg d-flex flex-col" data-testid="body-text"> <div className="p-y-lg d-flex flex-col" data-testid="body-text">
<div className={classNames('ingestion-content relative', className)}> <div className={classNames('ingestion-content relative', className)}>
<Fragment> <Fragment>

View File

@ -70,6 +70,7 @@ const EntityDeleteModal = ({
</Button> </Button>
</div> </div>
} }
open={visible}
title={ title={
<Typography.Text data-testid="modal-header"> <Typography.Text data-testid="modal-header">
{softDelete ? ( {softDelete ? (
@ -83,7 +84,6 @@ const EntityDeleteModal = ({
)} )}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={600}> width={600}>
<div data-testid="body-text"> <div data-testid="body-text">
<Typography className="mb-2"> <Typography className="mb-2">

View File

@ -61,12 +61,12 @@ const FormModal = ({
</Button> </Button>
</div> </div>
} }
open={visible}
title={ title={
<Typography.Text strong data-testid="header"> <Typography.Text strong data-testid="header">
{header} {header}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={1300} width={1300}
onCancel={onCancel}> onCancel={onCancel}>
<form id="form-modal" onSubmit={onSubmitHandler}> <form id="form-modal" onSubmit={onSubmitHandler}>

View File

@ -123,12 +123,12 @@ const RelatedTermsModal = ({
</Button> </Button>
</div> </div>
} }
open={visible}
title={ title={
<Typography.Text strong data-testid="header"> <Typography.Text strong data-testid="header">
{header} {header}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={800}> width={800}>
<div className="h-full"> <div className="h-full">
<Searchbar <Searchbar

View File

@ -144,12 +144,12 @@ const ReviewerModal = ({
</Button> </Button>
</div> </div>
} }
open={visible}
title={ title={
<Typography.Text strong data-testid="header"> <Typography.Text strong data-testid="header">
{header} {header}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={800}> width={800}>
<> <>
<Searchbar <Searchbar

View File

@ -41,12 +41,12 @@ const SchemaModal: FC<SchemaModalProp> = ({
} }
data-testid="schema-modal" data-testid="schema-modal"
footer={null} footer={null}
open={visible}
title={ title={
<Typography.Text strong data-testid="schema-modal-header"> <Typography.Text strong data-testid="schema-modal-header">
{t('label.json-data')} {t('label.json-data')}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={800}> width={800}>
<div data-testid="schema-modal-body"> <div data-testid="schema-modal-body">
<SchemaEditor <SchemaEditor

View File

@ -31,7 +31,7 @@ const TourEndModal = ({ onSave, visible }: TourEndModalProps) => {
{t('label.explore-now')} {t('label.explore-now')}
</Button> </Button>
} }
visible={visible}> open={visible}>
<Row className="text-center" gutter={[16, 16]}> <Row className="text-center" gutter={[16, 16]}>
<Col className="mt-4" span={24}> <Col className="mt-4" span={24}>
<SVGIcons <SVGIcons

View File

@ -75,12 +75,12 @@ export const WhatsNewModal: FunctionComponent<WhatsNewModalProps> = ({
} }
data-testid="whats-new-dialog" data-testid="whats-new-dialog"
footer={null} footer={null}
open={visible}
title={ title={
<Typography.Text strong data-testid="whats-new-header"> <Typography.Text strong data-testid="whats-new-header">
{header} {header}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={1200}> width={1200}>
<div className="flex w-auto h-full"> <div className="flex w-auto h-full">
<div <div

View File

@ -99,10 +99,10 @@ const Emoji: FC<EmojiProps> = ({
<Popover <Popover
content={popoverContent} content={popoverContent}
key="reaction-detail-popover" key="reaction-detail-popover"
open={visible}
trigger="hover" trigger="hover"
visible={visible}
zIndex={9999} zIndex={9999}
onVisibleChange={setVisible}> onOpenChange={setVisible}>
<Button <Button
className={classNames('ant-btn-reaction tw-mr-1 d-flex', { className={classNames('ant-btn-reaction tw-mr-1 d-flex', {
'ant-btn-isReacted': isReacted, 'ant-btn-isReacted': isReacted,

View File

@ -107,12 +107,12 @@ const Reactions: FC<ReactionsProps> = ({ reactions, onReactionSelect }) => {
<Popover <Popover
align={{ targetOffset: [0, -10] }} align={{ targetOffset: [0, -10] }}
content={reactionList} content={reactionList}
open={visible}
overlayClassName="ant-popover-feed-reactions" overlayClassName="ant-popover-feed-reactions"
placement="topLeft" placement="topLeft"
trigger="click" trigger="click"
visible={visible}
zIndex={9999} zIndex={9999}
onVisibleChange={handleVisibleChange}> onOpenChange={handleVisibleChange}>
<Button <Button
className="ant-btn-reaction ant-btn-add-reactions" className="ant-btn-reaction ant-btn-add-reactions"
data-testid="add-reactions" data-testid="add-reactions"

View File

@ -285,8 +285,8 @@ const ProfilerSettingsModal: React.FC<ProfilerSettingsModalProps> = ({
htmlType: 'submit', htmlType: 'submit',
}} }}
okText={t('label.save')} okText={t('label.save')}
open={visible}
title={t('label.setting-plural')} title={t('label.setting-plural')}
visible={visible}
width={630} width={630}
onCancel={handleCancel}> onCancel={handleCancel}>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>

View File

@ -16,7 +16,6 @@ import {
Button as ButtonAntd, Button as ButtonAntd,
Col, Col,
Dropdown, Dropdown,
Menu,
Modal, Modal,
Row, Row,
Space, Space,
@ -30,7 +29,7 @@ import { ColumnsType } from 'antd/lib/table';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import classNames from 'classnames'; import classNames from 'classnames';
import { compare } from 'fast-json-patch'; import { compare } from 'fast-json-patch';
import { cloneDeep, isEmpty, isUndefined, orderBy } from 'lodash'; import { cloneDeep, isEmpty, isUndefined, orderBy, uniqueId } from 'lodash';
import { ExtraInfo } from 'Models'; import { ExtraInfo } from 'Models';
import React, { Fragment, useEffect, useMemo, useState } from 'react'; import React, { Fragment, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -692,10 +691,6 @@ const TeamDetailsV1 = ({
key: 'deleted-team-dropdown', key: 'deleted-team-dropdown',
}; };
const organizationDropdownContent = (
<Menu items={[DELETED_TOGGLE_MENU_ITEM]} />
);
const extraDropdownContent: ItemType[] = useMemo( const extraDropdownContent: ItemType[] = useMemo(
() => [ () => [
...(!currentTeam.parents?.[0]?.deleted && currentTeam.deleted ...(!currentTeam.parents?.[0]?.deleted && currentTeam.deleted
@ -1102,12 +1097,12 @@ const TeamDetailsV1 = ({
) : ( ) : (
<Dropdown <Dropdown
align={{ targetOffset: [-12, 0] }} align={{ targetOffset: [-12, 0] }}
overlay={organizationDropdownContent} menu={{ items: [DELETED_TOGGLE_MENU_ITEM] }}
open={showActions}
overlayStyle={{ width: '350px' }} overlayStyle={{ width: '350px' }}
placement="bottomRight" placement="bottomRight"
trigger={['click']} trigger={['click']}
visible={showActions} onOpenChange={setShowActions}>
onVisibleChange={setShowActions}>
<ButtonAntd <ButtonAntd
className="rounded-4 w-6 manage-dropdown-button" className="rounded-4 w-6 manage-dropdown-button"
data-testid="teams-dropdown" data-testid="teams-dropdown"
@ -1122,7 +1117,7 @@ const TeamDetailsV1 = ({
</div> </div>
<Space size={0}> <Space size={0}>
{extraInfo.map((info, index) => ( {extraInfo.map((info, index) => (
<> <Fragment key={uniqueId()}>
<EntitySummaryDetails <EntitySummaryDetails
currentOwner={currentTeam.owner} currentOwner={currentTeam.owner}
data={info} data={info}
@ -1148,7 +1143,7 @@ const TeamDetailsV1 = ({
| |
</span> </span>
) : null} ) : null}
</> </Fragment>
))} ))}
</Space> </Space>
<div className="m-b-sm m-t-xs" data-testid="description-container"> <div className="m-b-sm m-t-xs" data-testid="description-container">

View File

@ -177,8 +177,8 @@ const TeamHierarchy: FC<TeamHierarchyProps> = ({
closable={false} closable={false}
data-testid="confirmation-modal" data-testid="confirmation-modal"
okText={t('label.confirm')} okText={t('label.confirm')}
open={isModalOpen}
title={t('label.move-the-team')} title={t('label.move-the-team')}
visible={isModalOpen}
onCancel={() => setIsModalOpen(false)} onCancel={() => setIsModalOpen(false)}
onOk={handleChangeTeam}> onOk={handleChangeTeam}>
<Typography.Text> <Typography.Text>

View File

@ -297,10 +297,10 @@ const UserListV1: FC<UserListV1Props> = ({
closable={false} closable={false}
confirmLoading={isLoading} confirmLoading={isLoading}
okText={t('label.restore')} okText={t('label.restore')}
open={showReactiveModal}
title={t('label.restore-entity', { title={t('label.restore-entity', {
entity: t('label.user'), entity: t('label.user'),
})} })}
visible={showReactiveModal}
onCancel={() => { onCancel={() => {
setShowReactiveModal(false); setShowReactiveModal(false);
setSelectedUser(undefined); setSelectedUser(undefined);

View File

@ -48,10 +48,10 @@ const ChangePasswordForm: React.FC<ChangePasswordForm> = ({
htmlType: 'submit', htmlType: 'submit',
}} }}
okText={t('label.update-password')} okText={t('label.update-password')}
open={visible}
title={t('label.change-entity', { title={t('label.change-entity', {
entity: t('label.password'), entity: t('label.password'),
})} })}
visible={visible}
width={500} width={500}
onCancel={() => { onCancel={() => {
form.resetFields(); form.resetFields();

View File

@ -230,8 +230,8 @@ const DeleteWidgetModal = ({
data-testid="delete-modal" data-testid="delete-modal"
footer={Footer()} footer={Footer()}
okText="Delete" okText="Delete"
open={visible}
title={`Delete ${entityName}`} title={`Delete ${entityName}`}
visible={visible}
onCancel={handleOnEntityDeleteCancel}> onCancel={handleOnEntityDeleteCancel}>
<Radio.Group value={value} onChange={onChange}> <Radio.Group value={value} onChange={onChange}>
{DELETE_OPTION.map( {DELETE_OPTION.map(

View File

@ -157,13 +157,13 @@ const EntitySummaryDetails = ({
<> <>
{t('label.no-entity', { entity: t('label.tier') })} {t('label.no-entity', { entity: t('label.tier') })}
<Dropdown <Dropdown
overlay={ dropdownRender={() => (
<TierCard <TierCard
currentTier={tier?.tagFQN} currentTier={tier?.tagFQN}
removeTier={removeTier} removeTier={removeTier}
updateTier={updateTier} updateTier={updateTier}
/> />
} )}
trigger={['click']}> trigger={['click']}>
<span data-testid={`edit-${data.key}-icon`}> <span data-testid={`edit-${data.key}-icon`}>
{updateTier && !deleted ? <EditIcon /> : null} {updateTier && !deleted ? <EditIcon /> : null}

View File

@ -108,9 +108,9 @@ const AnnouncementDrawer: FC<Props> = ({
<div data-testid="announcement-drawer"> <div data-testid="announcement-drawer">
<Drawer <Drawer
closable={false} closable={false}
open={open}
placement="right" placement="right"
title={title} title={title}
visible={open}
width={576} width={576}
onClose={onClose}> onClose={onClose}>
<div className="tw-flex tw-justify-end"> <div className="tw-flex tw-justify-end">

View File

@ -61,12 +61,12 @@ const FollowersModal = ({
centered centered
destroyOnClose destroyOnClose
data-testid="modal-container" data-testid="modal-container"
open={visible}
title={ title={
<Typography.Text strong data-testid="header"> <Typography.Text strong data-testid="header">
{header} {header}
</Typography.Text> </Typography.Text>
} }
visible={visible}
width={800} width={800}
onCancel={onCancel}> onCancel={onCancel}>
<div> <div>

View File

@ -12,7 +12,7 @@
*/ */
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button, Col, Dropdown, Menu, Row, Tooltip, Typography } from 'antd'; import { Button, Col, Dropdown, Row, Tooltip, Typography } from 'antd';
import { ItemType } from 'antd/lib/menu/hooks/useItems'; import { ItemType } from 'antd/lib/menu/hooks/useItems';
import classNames from 'classnames'; import classNames from 'classnames';
import React, { FC, useState } from 'react'; import React, { FC, useState } from 'react';
@ -64,9 +64,7 @@ const ManageButton: FC<Props> = ({
const [showActions, setShowActions] = useState<boolean>(false); const [showActions, setShowActions] = useState<boolean>(false);
const [isDelete, setIsDelete] = useState<boolean>(false); const [isDelete, setIsDelete] = useState<boolean>(false);
const menu = ( const items = [
<Menu
items={[
{ {
label: ( label: (
<Tooltip title={canDelete ? '' : NO_PERMISSION_FOR_ACTION}> <Tooltip title={canDelete ? '' : NO_PERMISSION_FOR_ACTION}>
@ -125,11 +123,7 @@ const ManageButton: FC<Props> = ({
}}> }}>
<Col span={3}> <Col span={3}>
{' '} {' '}
<SVGIcons <SVGIcons alt="Restore" icon={Icons.RESTORE} width="20px" />
alt="Restore"
icon={Icons.RESTORE}
width="20px"
/>
</Col> </Col>
<Col span={21}> <Col span={21}>
<Row data-testid="restore-button"> <Row data-testid="restore-button">
@ -196,20 +190,18 @@ const ManageButton: FC<Props> = ({
] ]
: []), : []),
...(extraDropdownContent ? extraDropdownContent : []), ...(extraDropdownContent ? extraDropdownContent : []),
]} ];
/>
);
return ( return (
<> <>
<Dropdown <Dropdown
align={{ targetOffset: [-12, 0] }} align={{ targetOffset: [-12, 0] }}
overlay={menu} menu={{ items }}
open={showActions}
overlayStyle={{ width: '350px' }} overlayStyle={{ width: '350px' }}
placement="bottomRight" placement="bottomRight"
trigger={['click']} trigger={['click']}
visible={showActions} onOpenChange={setShowActions}>
onVisibleChange={setShowActions}>
<Button <Button
className={classNames( className={classNames(
'tw-rounded tw-flex tw-justify-center tw-w-6 manage-dropdown-button', 'tw-rounded tw-flex tw-justify-center tw-w-6 manage-dropdown-button',

View File

@ -11,16 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { import { Badge, Dropdown, Image, Input, Select, Space, Tooltip } from 'antd';
Badge,
Dropdown,
Image,
Input,
Menu,
Select,
Space,
Tooltip,
} from 'antd';
import { CookieStorage } from 'cookie-storage'; import { CookieStorage } from 'cookie-storage';
import i18next from 'i18next'; import i18next from 'i18next';
import { debounce, toString } from 'lodash'; import { debounce, toString } from 'lodash';
@ -201,9 +192,7 @@ const NavBar = ({
}; };
}; };
const governanceMenu = ( const governanceMenu = [
<Menu
items={[
{ {
key: 'glossary', key: 'glossary',
label: ( label: (
@ -232,9 +221,7 @@ const NavBar = ({
</NavLink> </NavLink>
), ),
}, },
]} ];
/>
);
useEffect(() => { useEffect(() => {
if (shouldRequestPermission()) { if (shouldRequestPermission()) {
@ -331,7 +318,7 @@ const NavBar = ({
</NavLink> </NavLink>
<Dropdown <Dropdown
className="cursor-pointer" className="cursor-pointer"
overlay={governanceMenu} menu={{ items: governanceMenu }}
trigger={['click']}> trigger={['click']}>
<Space data-testid="governance" size={2}> <Space data-testid="governance" size={2}>
{t('label.govern')} {t('label.govern')}
@ -419,7 +406,7 @@ const NavBar = ({
<button className="focus:tw-no-underline hover:tw-underline tw-flex-shrink-0 "> <button className="focus:tw-no-underline hover:tw-underline tw-flex-shrink-0 ">
<Dropdown <Dropdown
destroyPopupOnHide destroyPopupOnHide
overlay={ dropdownRender={() => (
<NotificationBox <NotificationBox
hasMentionNotification={hasMentionNotification} hasMentionNotification={hasMentionNotification}
hasTaskNotification={hasTaskNotification} hasTaskNotification={hasTaskNotification}
@ -429,7 +416,7 @@ const NavBar = ({
onMarkTaskNotificationRead={handleTaskNotificationRead} onMarkTaskNotificationRead={handleTaskNotificationRead}
onTabChange={handleActiveTab} onTabChange={handleActiveTab}
/> />
} )}
overlayStyle={{ overlayStyle={{
zIndex: 9999, zIndex: 9999,
width: '425px', width: '425px',
@ -437,7 +424,7 @@ const NavBar = ({
}} }}
placement="bottomRight" placement="bottomRight"
trigger={['click']} trigger={['click']}
onVisibleChange={handleBellClick}> onOpenChange={handleBellClick}>
<Badge dot={hasTaskNotification || hasMentionNotification}> <Badge dot={hasTaskNotification || hasMentionNotification}>
<SVGIcons <SVGIcons
alt="Alert bell icon" alt="Alert bell icon"

View File

@ -50,8 +50,8 @@ const ReIndexAllModal = ({
htmlType: 'submit', htmlType: 'submit',
}} }}
okText="Submit" okText="Submit"
open={visible}
title={t('label.re-index-elastic-search')} title={t('label.re-index-elastic-search')}
visible={visible}
width={650} width={650}
onCancel={onCancel}> onCancel={onCancel}>
<Form <Form

View File

@ -313,8 +313,9 @@ const AddKPIPage = () => {
}} }}
max={100} max={100}
min={0} min={0}
tooltipPlacement="bottom" tooltip={{
tooltipVisible={false} open: false,
}}
value={metricValue} value={metricValue}
onChange={(value) => { onChange={(value) => {
setMetricValue(value); setMetricValue(value);

View File

@ -308,8 +308,7 @@ const EditKPIPage = () => {
}} }}
max={100} max={100}
min={0} min={0}
tooltipPlacement="bottom" tooltip={{ open: false }}
tooltipVisible={false}
value={metricValue} value={metricValue}
onChange={(value) => { onChange={(value) => {
setMetricValue(value); setMetricValue(value);

View File

@ -129,6 +129,7 @@ const AddAttributeModal: FC<Props> = ({
confirmLoading={isModalLoading} confirmLoading={isModalLoading}
data-testid="modal-container" data-testid="modal-container"
okText="Submit" okText="Submit"
open={isOpen}
title={ title={
<span data-testid="modal-title"> <span data-testid="modal-title">
{title}{' '} {title}{' '}
@ -137,7 +138,6 @@ const AddAttributeModal: FC<Props> = ({
</span> </span>
</span> </span>
} }
visible={isOpen}
width={750} width={750}
onCancel={onCancel} onCancel={onCancel}
onOk={() => onSave(selectedValues)}> onOk={() => onSave(selectedValues)}>

View File

@ -101,8 +101,8 @@ const AddTeamForm: React.FC<AddTeamFormType> = ({
type: 'primary', type: 'primary',
htmlType: 'submit', htmlType: 'submit',
}} }}
open={visible}
title={t('label.add-entity', { entity: t('label.team') })} title={t('label.add-entity', { entity: t('label.team') })}
visible={visible}
width={750} width={750}
onCancel={onCancel}> onCancel={onCancel}>
<Form <Form

View File

@ -182,8 +182,8 @@ const AddUsersModalV1 = ({
id: 'save-button', id: 'save-button',
}} }}
okText="Save" okText="Save"
open={isVisible}
title={header} title={header}
visible={isVisible}
width={750} width={750}
onCancel={onCancel} onCancel={onCancel}
onOk={handleSave}> onOk={handleSave}>