UI :- Placeholder fixes in Webhook (#7308)

* Placeholder fixes in Webhook

* added switch button on placeholder screen in bot

* change placeholder in dataquality table and tooltip placement in webhook table
This commit is contained in:
Ashish Gupta 2022-09-07 23:04:18 +05:30 committed by GitHub
parent 9e0203e21b
commit 6d3c0de512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 68 deletions

View File

@ -173,12 +173,27 @@ const BotListV1 = ({
}, [showDeleted]); }, [showDeleted]);
return handleErrorPlaceholder ? ( return handleErrorPlaceholder ? (
<Row>
<Col className="w-full tw-flex tw-justify-end">
<Space align="end" size={5}>
<Switch
checked={showDeleted}
id="switch-deleted"
size="small"
onClick={handleShowDeleted}
/>
<label htmlFor="switch-deleted">Show deleted</label>
</Space>
</Col>
<Col className="w-full">
<ErrorPlaceHolder <ErrorPlaceHolder
buttons={ buttons={
<div className="tw-text-lg tw-text-center"> <div className="tw-text-lg tw-text-center">
<Tooltip <Tooltip
placement="left"
title={createPermission ? 'Add Bot' : NO_PERMISSION_FOR_ACTION}> title={createPermission ? 'Add Bot' : NO_PERMISSION_FOR_ACTION}>
<Button <Button
ghost
disabled={!createPermission} disabled={!createPermission}
type="primary" type="primary"
onClick={handleAddBotClick}> onClick={handleAddBotClick}>
@ -191,6 +206,8 @@ const BotListV1 = ({
heading="Bot" heading="Bot"
type="ADD_DATA" type="ADD_DATA"
/> />
</Col>
</Row>
) : ( ) : (
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
<Col flex={1} /> <Col flex={1} />

View File

@ -11,7 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Col, Empty, Row, Select, Space, Typography } from 'antd'; import { Col, Row, Select, Space, Typography } from 'antd';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import moment from 'moment'; import moment from 'moment';
@ -40,6 +40,7 @@ import {
} from '../../../generated/tests/tableTest'; } from '../../../generated/tests/tableTest';
import { TestCaseParameterValue } from '../../../generated/tests/testCase'; import { TestCaseParameterValue } from '../../../generated/tests/testCase';
import { showErrorToast } from '../../../utils/ToastUtils'; import { showErrorToast } from '../../../utils/ToastUtils';
import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder';
import RichTextEditorPreviewer from '../../common/rich-text-editor/RichTextEditorPreviewer'; import RichTextEditorPreviewer from '../../common/rich-text-editor/RichTextEditorPreviewer';
import Loader from '../../Loader/Loader'; import Loader from '../../Loader/Loader';
import SchemaEditor from '../../schema-editor/SchemaEditor'; import SchemaEditor from '../../schema-editor/SchemaEditor';
@ -234,7 +235,9 @@ const TestSummary: React.FC<TestSummaryProps> = ({ data }) => {
</ResponsiveContainer> </ResponsiveContainer>
</div> </div>
) : ( ) : (
<Empty description="No Result Available" /> <ErrorPlaceHolder classes="tw-mt-0">
<Typography.Text>No Result Available</Typography.Text>
</ErrorPlaceHolder>
)} )}
</Col> </Col>
<Col span={10}> <Col span={10}>

View File

@ -142,7 +142,6 @@ const WebhookTable: FC<Props> = ({ onEdit, webhookList, onDelete }) => {
return ( return (
<Space size={4}> <Space size={4}>
<Tooltip <Tooltip
placement="left"
title={deletePermission ? 'Delete' : NO_PERMISSION_FOR_ACTION}> title={deletePermission ? 'Delete' : NO_PERMISSION_FOR_ACTION}>
<Button <Button
data-testid={`delete-action-${getEntityName(record)}`} data-testid={`delete-action-${getEntityName(record)}`}
@ -155,7 +154,6 @@ const WebhookTable: FC<Props> = ({ onEdit, webhookList, onDelete }) => {
/> />
</Tooltip> </Tooltip>
<Tooltip <Tooltip
placement="left"
title={ title={
createPermission || editPermission createPermission || editPermission
? 'Edit' ? 'Edit'

View File

@ -26,6 +26,7 @@ type Props = {
buttons?: React.ReactNode; buttons?: React.ReactNode;
buttonId?: string; buttonId?: string;
description?: React.ReactNode; description?: React.ReactNode;
classes?: string;
}; };
const ErrorPlaceHolder = ({ const ErrorPlaceHolder = ({
@ -35,6 +36,7 @@ const ErrorPlaceHolder = ({
heading, heading,
buttons, buttons,
description, description,
classes,
}: Props) => { }: Props) => {
const { Paragraph, Link } = Typography; const { Paragraph, Link } = Typography;
@ -68,7 +70,7 @@ const ErrorPlaceHolder = ({
</div> </div>
</> </>
) : ( ) : (
<div className="flex-center flex-col tw-mt-24 w-full"> <div className={`${classes} flex-center flex-col mt-24 w-full`}>
<div data-testid="error"> <div data-testid="error">
<img <img
data-testid="no-data-image" data-testid="no-data-image"
@ -77,7 +79,7 @@ const ErrorPlaceHolder = ({
/> />
</div> </div>
{children ? ( {children ? (
<div className="tw-flex tw-flex-col tw-items-center tw-mt-8 tw-text-base tw-font-medium"> <div className="tw-flex tw-flex-col tw-items-center tw-mt-5 tw-text-base tw-font-medium">
{children} {children}
</div> </div>
) : ( ) : (

View File

@ -15,7 +15,6 @@ import { AxiosError } from 'axios';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { getWebhooks } from '../../axiosAPIs/webhookAPI'; import { getWebhooks } from '../../axiosAPIs/webhookAPI';
import PageContainerV1 from '../../components/containers/PageContainerV1';
import Loader from '../../components/Loader/Loader'; import Loader from '../../components/Loader/Loader';
import WebhooksV1 from '../../components/Webhooks/WebhooksV1'; import WebhooksV1 from '../../components/Webhooks/WebhooksV1';
import { import {
@ -96,9 +95,7 @@ const MsTeamsPage = () => {
fetchData(); fetchData();
}, []); }, []);
return ( return !isLoading ? (
<PageContainerV1>
{!isLoading ? (
<WebhooksV1 <WebhooksV1
currentPage={currentPage} currentPage={currentPage}
data={data} data={data}
@ -112,8 +109,6 @@ const MsTeamsPage = () => {
/> />
) : ( ) : (
<Loader /> <Loader />
)}
</PageContainerV1>
); );
}; };

View File

@ -11,7 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { findByTestId, findByText, render } from '@testing-library/react'; import { findByText, render } from '@testing-library/react';
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import { getWebhooks } from '../../axiosAPIs/webhookAPI'; import { getWebhooks } from '../../axiosAPIs/webhookAPI';
@ -38,10 +38,8 @@ describe('Test MS Teams page Component', () => {
const { container } = render(<MsTeamsPage />, { const { container } = render(<MsTeamsPage />, {
wrapper: MemoryRouter, wrapper: MemoryRouter,
}); });
const PageContainerV1 = await findByTestId(container, 'PageContainerV1');
const webhookComponent = await findByText(container, /testWebhookV1/); const webhookComponent = await findByText(container, /testWebhookV1/);
expect(PageContainerV1).toBeInTheDocument();
expect(webhookComponent).toBeInTheDocument(); expect(webhookComponent).toBeInTheDocument();
expect(getWebhooks).toBeCalledTimes(1); expect(getWebhooks).toBeCalledTimes(1);
}); });

View File

@ -15,7 +15,6 @@ import { AxiosError } from 'axios';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { getWebhooks } from '../../axiosAPIs/webhookAPI'; import { getWebhooks } from '../../axiosAPIs/webhookAPI';
import PageContainerV1 from '../../components/containers/PageContainerV1';
import Loader from '../../components/Loader/Loader'; import Loader from '../../components/Loader/Loader';
import WebhooksV1 from '../../components/Webhooks/WebhooksV1'; import WebhooksV1 from '../../components/Webhooks/WebhooksV1';
import { import {
@ -94,9 +93,7 @@ export const SlackSettingsPage = () => {
fetchData(); fetchData();
}, []); }, []);
return ( return !isLoading ? (
<PageContainerV1>
{!isLoading ? (
<WebhooksV1 <WebhooksV1
currentPage={currentPage} currentPage={currentPage}
data={data} data={data}
@ -110,8 +107,6 @@ export const SlackSettingsPage = () => {
/> />
) : ( ) : (
<Loader /> <Loader />
)}
</PageContainerV1>
); );
}; };

View File

@ -11,7 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { findByTestId, findByText, render } from '@testing-library/react'; import { findByText, render } from '@testing-library/react';
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import { getWebhooks } from '../../axiosAPIs/webhookAPI'; import { getWebhooks } from '../../axiosAPIs/webhookAPI';
@ -38,10 +38,8 @@ describe('Test SlackSettings page Component', () => {
const { container } = render(<SlackSettingsPage />, { const { container } = render(<SlackSettingsPage />, {
wrapper: MemoryRouter, wrapper: MemoryRouter,
}); });
const PageContainerV1 = await findByTestId(container, 'PageContainerV1');
const webhookComponent = await findByText(container, /testWebhookV1/); const webhookComponent = await findByText(container, /testWebhookV1/);
expect(PageContainerV1).toBeInTheDocument();
expect(webhookComponent).toBeInTheDocument(); expect(webhookComponent).toBeInTheDocument();
expect(getWebhooks).toBeCalledTimes(1); expect(getWebhooks).toBeCalledTimes(1);
}); });

View File

@ -55,3 +55,11 @@
border-left: 2px solid @primary; border-left: 2px solid @primary;
background: @primary-light; background: @primary-light;
} }
.mt-0 {
margin-top: 0;
}
.mt-24 {
margin-top: 6rem;
}