mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-15 02:13:44 +00:00
GEN-2031: fix Add profiler configuration button in Data Quality tab (#18798)
This commit is contained in:
parent
490bbf6241
commit
de3d7c40db
@ -11,11 +11,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { DownOutlined } from '@ant-design/icons';
|
import { DownOutlined } from '@ant-design/icons';
|
||||||
import { Button, Col, Dropdown, Form, Row, Select, Space, Tabs } from 'antd';
|
import {
|
||||||
|
Button,
|
||||||
|
Col,
|
||||||
|
Dropdown,
|
||||||
|
Form,
|
||||||
|
Row,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Tabs,
|
||||||
|
Tooltip,
|
||||||
|
} from 'antd';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import { ReactComponent as SettingIcon } from '../../../../../assets/svg/ic-settings-primery.svg';
|
||||||
import {
|
import {
|
||||||
getEntityDetailsPath,
|
getEntityDetailsPath,
|
||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
@ -64,6 +75,7 @@ export const QualityTab = () => {
|
|||||||
testCasePaging,
|
testCasePaging,
|
||||||
table,
|
table,
|
||||||
testCaseSummary,
|
testCaseSummary,
|
||||||
|
onSettingButtonClick,
|
||||||
} = useTableProfiler();
|
} = useTableProfiler();
|
||||||
const { getResourceLimit } = useLimitStore();
|
const { getResourceLimit } = useLimitStore();
|
||||||
|
|
||||||
@ -76,7 +88,12 @@ export const QualityTab = () => {
|
|||||||
showPagination,
|
showPagination,
|
||||||
} = testCasePaging;
|
} = testCasePaging;
|
||||||
|
|
||||||
const editTest = permissions.EditAll || permissions.EditTests;
|
const { editTest, editDataProfile } = useMemo(() => {
|
||||||
|
return {
|
||||||
|
editTest: permissions?.EditAll || permissions?.EditTests,
|
||||||
|
editDataProfile: permissions?.EditAll || permissions?.EditDataProfile,
|
||||||
|
};
|
||||||
|
}, [permissions]);
|
||||||
const { fqn: datasetFQN } = useFqn();
|
const { fqn: datasetFQN } = useFqn();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -293,6 +310,19 @@ export const QualityTab = () => {
|
|||||||
</LimitWrapper>
|
</LimitWrapper>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{editDataProfile && (
|
||||||
|
<Tooltip
|
||||||
|
placement="topRight"
|
||||||
|
title={t('label.setting-plural')}>
|
||||||
|
<Button
|
||||||
|
className="flex-center"
|
||||||
|
data-testid="profiler-setting-btn"
|
||||||
|
onClick={onSettingButtonClick}>
|
||||||
|
<SettingIcon />
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
</Form>
|
</Form>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@ -35,6 +35,7 @@ const mockTable = {
|
|||||||
const mockPush = jest.fn();
|
const mockPush = jest.fn();
|
||||||
const mockUseTableProfiler = {
|
const mockUseTableProfiler = {
|
||||||
tableProfiler: MOCK_TABLE,
|
tableProfiler: MOCK_TABLE,
|
||||||
|
onSettingButtonClick: jest.fn(),
|
||||||
permissions: {
|
permissions: {
|
||||||
EditAll: true,
|
EditAll: true,
|
||||||
EditDataProfile: true,
|
EditDataProfile: true,
|
||||||
@ -136,6 +137,9 @@ describe('QualityTab', () => {
|
|||||||
'message.page-sub-header-for-data-quality'
|
'message.page-sub-header-for-data-quality'
|
||||||
);
|
);
|
||||||
expect(await screen.findByTestId('mock-searchbar')).toBeInTheDocument();
|
expect(await screen.findByTestId('mock-searchbar')).toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
await screen.findByTestId('profiler-setting-btn')
|
||||||
|
).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('label.test-case-plural')
|
await screen.findByText('label.test-case-plural')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -262,4 +266,20 @@ describe('QualityTab', () => {
|
|||||||
expect(await screen.findByText('label.success')).toBeInTheDocument();
|
expect(await screen.findByText('label.success')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('label.aborted')).toBeInTheDocument();
|
expect(await screen.findByText('label.aborted')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call onSettingButtonClick', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
render(<QualityTab />);
|
||||||
|
});
|
||||||
|
|
||||||
|
const profilerSettingBtn = await screen.findByTestId(
|
||||||
|
'profiler-setting-btn'
|
||||||
|
);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
fireEvent.click(profilerSettingBtn);
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mockUseTableProfiler.onSettingButtonClick).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user