[issues-5697] made All Entities as the default visible option and mi… (#5699)

* [issues-5697] made All Entities as the default visible option and minor css fix

* file added.

* test fix

* unit test fixed.
This commit is contained in:
yug-shah0106 2022-06-28 18:05:57 +05:30 committed by GitHub
parent 4473280e63
commit 408dd02be9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 13 deletions

View File

@ -121,9 +121,13 @@ const ActivityFeedCard: FC<ActivityFeedCardProp> = ({
return (
<div
className={classNames(className, 'hover:tw-bg-gray-100', {
'tw-bg-gray-100': visible,
})}>
className={classNames(
className,
'hover:tw-bg-gray-100 tw-p-2 tw-pb-1 tw-mb-1',
{
'tw-bg-gray-100': visible,
}
)}>
<Popover
destroyTooltipOnHide
align={{ targetOffset: [0, -35] }}

View File

@ -199,13 +199,15 @@ describe('Test AddWebhook component', () => {
expect(
await findByText(container, 'Webhook endpoint is required.')
).toBeInTheDocument();
expect(
await findByText(container, 'Webhook event filters are required.')
).toBeInTheDocument();
// default value is prefilled , use below condition when value is empty
// expect(
// await findByText(container, 'Webhook event filters are required.')
// ).toBeInTheDocument();
expect(active).toHaveClass('open');
expect(entityCreatedCheckbox).not.toBeChecked();
expect(entityUpdatedCheckbox).not.toBeChecked();
expect(entityDeletedCheckbox).not.toBeChecked();
// default value is prefilled , use below condition when value is empty
// expect(entityCreatedCheckbox).not.toBeChecked();
// expect(entityUpdatedCheckbox).not.toBeChecked();
// expect(entityDeletedCheckbox).not.toBeChecked();
fireEvent.change(nameField, {
target: {

View File

@ -43,6 +43,11 @@ import DropDown from '../dropdown/DropDown';
import Loader from '../Loader/Loader';
import ConfirmationModal from '../Modals/ConfirmationModal/ConfirmationModal';
import { AddWebhookProps } from './AddWebhook.interface';
import {
CREATE_EVENTS_DEFAULT_VALUE,
DELETE_EVENTS_DEFAULT_VALUE,
UPDATE_EVENTS_DEFAULT_VALUE,
} from './WebhookConstants';
const Field = ({ children }: { children: React.ReactNode }) => {
return <div className="tw-mt-4">{children}</div>;
@ -135,17 +140,17 @@ const AddWebhook: FunctionComponent<AddWebhookProps> = ({
const [createEvents, setCreateEvents] = useState<EventFilter>(
data
? getEventFilterByType(data.eventFilters, EventType.EntityCreated)
: ({} as EventFilter)
: (CREATE_EVENTS_DEFAULT_VALUE as EventFilter)
);
const [updateEvents, setUpdateEvents] = useState<EventFilter>(
data
? getEventFilterByType(data.eventFilters, EventType.EntityUpdated)
: ({} as EventFilter)
: (UPDATE_EVENTS_DEFAULT_VALUE as EventFilter)
);
const [deleteEvents, setDeleteEvents] = useState<EventFilter>(
data
? getEventFilterByType(data.eventFilters, EventType.EntityDeleted)
: ({} as EventFilter)
: (DELETE_EVENTS_DEFAULT_VALUE as EventFilter)
);
const [secretKey, setSecretKey] = useState<string>(data?.secretKey || '');
const [batchSize, setBatchSize] = useState<number | undefined>(

View File

@ -0,0 +1,27 @@
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const CREATE_EVENTS_DEFAULT_VALUE = {
eventType: 'entityCreated',
entities: ['*', 'table', 'topic', 'dashboard', 'pipeline'],
};
export const UPDATE_EVENTS_DEFAULT_VALUE = {
eventType: 'entityUpdated',
entities: ['*', 'table', 'topic', 'dashboard', 'pipeline'],
};
export const DELETE_EVENTS_DEFAULT_VALUE = {
eventType: '"entityDeleted"',
entities: ['*', 'table', 'topic', 'dashboard', 'pipeline'],
};

View File

@ -108,8 +108,9 @@ const Reactions = ({ reactions, onReactionSelect }) => {
<SVGIcons
alt="add-reaction"
icon={Icons.ADD_REACTION}
style={{ verticalAlign: 'text-bottom' }}
title="Add reactions"
width="16px"
width="18px"
/>
</Button>
</Popover>