mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 02:16:18 +00:00
* activity feed ui improvements * fix mysql icon not showing in feed card * fix comments not showing in right panel card * remove unused code and added utils test * supported playwright test for feed replies * changes as per comments
This commit is contained in:
parent
6e99fe7bda
commit
e66aa5363b
@ -17,6 +17,7 @@ import {
|
|||||||
createNewPage,
|
createNewPage,
|
||||||
redirectToHomePage,
|
redirectToHomePage,
|
||||||
toastNotification,
|
toastNotification,
|
||||||
|
visitUserProfilePage,
|
||||||
} from '../../utils/common';
|
} from '../../utils/common';
|
||||||
import { clickOnLogo } from '../../utils/sidebar';
|
import { clickOnLogo } from '../../utils/sidebar';
|
||||||
import {
|
import {
|
||||||
@ -43,7 +44,6 @@ test.describe('Activity feed', () => {
|
|||||||
|
|
||||||
test.beforeEach('Visit on landing page', async ({ page }) => {
|
test.beforeEach('Visit on landing page', async ({ page }) => {
|
||||||
await redirectToHomePage(page);
|
await redirectToHomePage(page);
|
||||||
await entity.visitEntityPage(page);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll('Cleanup', async ({ browser }) => {
|
test.afterAll('Cleanup', async ({ browser }) => {
|
||||||
@ -59,6 +59,7 @@ test.describe('Activity feed', () => {
|
|||||||
term: entity.entity.name,
|
term: entity.entity.name,
|
||||||
assignee: `${user.data.firstName}.${user.data.lastName}`,
|
assignee: `${user.data.firstName}.${user.data.lastName}`,
|
||||||
};
|
};
|
||||||
|
await entity.visitEntityPage(page);
|
||||||
|
|
||||||
await page.getByTestId('request-description').click();
|
await page.getByTestId('request-description').click();
|
||||||
|
|
||||||
@ -126,4 +127,58 @@ test.describe('Activity feed', () => {
|
|||||||
|
|
||||||
expect(closedTask).toContain('2 Closed');
|
expect(closedTask).toContain('2 Closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('User should be able to reply on feeds in ActivityFeed', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await visitUserProfilePage(page);
|
||||||
|
|
||||||
|
const secondFeedConversation = page
|
||||||
|
.locator('#center-container [data-testid="message-container"]')
|
||||||
|
.nth(1);
|
||||||
|
|
||||||
|
await secondFeedConversation.locator('.feed-card-v2-sidebar').click();
|
||||||
|
|
||||||
|
await page.waitForSelector('#feed-panel', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
|
||||||
|
// Compare the text of the second feed in the center container with the right panel feed
|
||||||
|
const secondFeedText = await secondFeedConversation
|
||||||
|
.locator('[data-testid="headerText"]')
|
||||||
|
.innerText();
|
||||||
|
|
||||||
|
const rightPanelFeedText = await page
|
||||||
|
.locator(
|
||||||
|
'.right-container [data-testid="message-container"] [data-testid="headerText"]'
|
||||||
|
)
|
||||||
|
.innerText();
|
||||||
|
|
||||||
|
expect(secondFeedText).toBe(rightPanelFeedText);
|
||||||
|
|
||||||
|
for (let i = 1; i <= 3; i++) {
|
||||||
|
await page.fill(
|
||||||
|
'[data-testid="editor-wrapper"] .ql-editor',
|
||||||
|
`Reply message ${i}`
|
||||||
|
);
|
||||||
|
const sendReply = page.waitForResponse('/api/v1/feed/*/posts');
|
||||||
|
await page.getByTestId('send-button').click();
|
||||||
|
await sendReply;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare after adding some feeds in the right panel
|
||||||
|
const rightPanelFeedTextCurrent = await page
|
||||||
|
.locator(
|
||||||
|
'.right-container [data-testid="message-container"] [data-testid="headerText"]'
|
||||||
|
)
|
||||||
|
.innerText();
|
||||||
|
|
||||||
|
expect(secondFeedText).toBe(rightPanelFeedTextCurrent);
|
||||||
|
|
||||||
|
for (let i = 1; i <= 3; i++) {
|
||||||
|
await expect(
|
||||||
|
page.locator('.right-container [data-testid="feed-replies"]')
|
||||||
|
).toContainText(`Reply message ${i}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -147,3 +147,16 @@ export const clickOutside = async (page: Page) => {
|
|||||||
}); // with this action left menu bar is getting opened
|
}); // with this action left menu bar is getting opened
|
||||||
await page.mouse.move(1280, 0); // moving out side left menu bar to avoid random failure due to left menu bar
|
await page.mouse.move(1280, 0); // moving out side left menu bar to avoid random failure due to left menu bar
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const visitUserProfilePage = async (page: Page) => {
|
||||||
|
await page.getByTestId('dropdown-profile').click();
|
||||||
|
await page.waitForSelector('.profile-dropdown', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
const userResponse = page.waitForResponse(
|
||||||
|
'/api/v1/users/name/*?fields=*&include=all'
|
||||||
|
);
|
||||||
|
await page.getByTestId('user-name').click({ force: true });
|
||||||
|
await userResponse;
|
||||||
|
await clickOutside(page);
|
||||||
|
};
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
import { Col, Row } from 'antd';
|
import { Col, Row } from 'antd';
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { EntityField } from '../../../../../constants/Feeds.constants';
|
import { EntityField } from '../../../../../constants/Feeds.constants';
|
||||||
import { getTextDiff } from '../../../../../utils/EntityVersionUtils';
|
|
||||||
import {
|
import {
|
||||||
getFeedChangeFieldLabel,
|
getFeedChangeFieldLabel,
|
||||||
getFieldOperationIcon,
|
getFieldOperationIcon,
|
||||||
@ -25,13 +24,10 @@ import { DescriptionFeedProps } from './DescriptionFeed.interface';
|
|||||||
|
|
||||||
function DescriptionFeed({ feed }: Readonly<DescriptionFeedProps>) {
|
function DescriptionFeed({ feed }: Readonly<DescriptionFeedProps>) {
|
||||||
const { message, fieldOperation } = useMemo(() => {
|
const { message, fieldOperation } = useMemo(() => {
|
||||||
const diffText = getTextDiff(
|
|
||||||
feed.feedInfo?.entitySpecificInfo?.previousDescription ?? '',
|
|
||||||
feed.feedInfo?.entitySpecificInfo?.newDescription ?? ''
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message: diffText,
|
message: (feed.feedInfo?.entitySpecificInfo?.diffMessage ?? '').split(
|
||||||
|
':'
|
||||||
|
)[1],
|
||||||
fieldOperation: feed.fieldOperation,
|
fieldOperation: feed.fieldOperation,
|
||||||
fieldChanged: getFeedChangeFieldLabel(
|
fieldChanged: getFeedChangeFieldLabel(
|
||||||
feed.feedInfo?.fieldName as EntityField
|
feed.feedInfo?.fieldName as EntityField
|
||||||
|
@ -44,7 +44,11 @@ const FeedPanelHeader: FC<FeedPanelHeaderProp> = ({
|
|||||||
const entityField = getEntityField(entityLink);
|
const entityField = getEntityField(entityLink);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className={classNames('d-flex justify-between p-y-md', className)}>
|
<header
|
||||||
|
className={classNames(
|
||||||
|
'd-flex justify-between items-center p-y-md',
|
||||||
|
className
|
||||||
|
)}>
|
||||||
<p data-testid="header-title">
|
<p data-testid="header-title">
|
||||||
<span data-testid="header-noun">
|
<span data-testid="header-noun">
|
||||||
{noun ? noun : getFeedPanelHeaderText(threadType)}{' '}
|
{noun ? noun : getFeedPanelHeaderText(threadType)}{' '}
|
||||||
|
@ -218,16 +218,6 @@ const ActivityFeedProvider = ({ children, user }: Props) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await postFeedById(id, data);
|
const res = await postFeedById(id, data);
|
||||||
const { id: responseId, posts } = res;
|
|
||||||
setEntityThread((pre) => {
|
|
||||||
return pre.map((thread) => {
|
|
||||||
if (thread.id === responseId) {
|
|
||||||
return { ...res, posts: posts?.slice(-3) };
|
|
||||||
} else {
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
setActiveThread(res);
|
setActiveThread(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -69,12 +69,13 @@ const TagsViewer: FunctionComponent<TagsViewerProps> = ({
|
|||||||
const readMoreRenderElement = useMemo(
|
const readMoreRenderElement = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<div data-testid="read-more-element">
|
<div data-testid="read-more-element">
|
||||||
{isOpen &&
|
{isOpen && (
|
||||||
sortedTagsBySource.slice(sizeCap).map((tag) => (
|
<div className="m-t-xs d-flex flex-wrap gap-2">
|
||||||
<p className="text-left" key={tag}>
|
{sortedTagsBySource
|
||||||
{getTagsElement(tag)}
|
.slice(sizeCap)
|
||||||
</p>
|
.map((tag) => getTagsElement(tag))}
|
||||||
))}
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{hasMoreElement && (
|
{hasMoreElement && (
|
||||||
<Button
|
<Button
|
||||||
@ -94,18 +95,16 @@ const TagsViewer: FunctionComponent<TagsViewerProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const popoverRenderElement = useMemo(
|
const popoverRenderElement = useMemo(
|
||||||
() => (
|
() =>
|
||||||
|
sortedTagsBySource.slice(sizeCap).length > 0 && (
|
||||||
<div className="m-t-xs" data-testid="popover-element">
|
<div className="m-t-xs" data-testid="popover-element">
|
||||||
{sortedTagsBySource.slice(sizeCap).length > 0 && (
|
|
||||||
<Popover
|
<Popover
|
||||||
content={
|
content={
|
||||||
<>
|
<div className="d-flex flex-column flex-wrap gap-2">
|
||||||
{sortedTagsBySource.slice(sizeCap).map((tag) => (
|
{sortedTagsBySource
|
||||||
<p className="text-left" key={tag}>
|
.slice(sizeCap)
|
||||||
{getTagsElement(tag)}
|
.map((tag) => getTagsElement(tag))}
|
||||||
</p>
|
</div>
|
||||||
))}
|
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
overlayClassName="tag-popover-container"
|
overlayClassName="tag-popover-container"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
@ -116,7 +115,6 @@ const TagsViewer: FunctionComponent<TagsViewerProps> = ({
|
|||||||
sortedTagsBySource.length - (sizeCap ?? 0)
|
sortedTagsBySource.length - (sizeCap ?? 0)
|
||||||
} more`}</Tag>
|
} more`}</Tag>
|
||||||
</Popover>
|
</Popover>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
||||||
"feed-filter-following": "Feeds for all the data assets that you follow",
|
"feed-filter-following": "Feeds for all the data assets that you follow",
|
||||||
"feed-filter-owner": "Feeds for all the data assets that you own",
|
"feed-filter-owner": "Feeds for all the data assets that you own",
|
||||||
|
@ -1565,7 +1565,7 @@
|
|||||||
"minute": "Minute",
|
"minute": "Minute",
|
||||||
"modify-hierarchy-entity-description": "Modify the hierarchy by changing the Parent {{entity}}.",
|
"modify-hierarchy-entity-description": "Modify the hierarchy by changing the Parent {{entity}}.",
|
||||||
"most-active-users": "Displays the most active users on the platform based on Page Views.",
|
"most-active-users": "Displays the most active users on the platform based on Page Views.",
|
||||||
"most-viewed-data-assets": "Displays the most viewed data assets.",
|
"most-viewed-data-assets": "Displays the most viewed feed-field-action-entity-headerdata assets.",
|
||||||
"mutually-exclusive-alert": "If you enable 'Mutually Exclusive' for a {{entity}}, users will be restricted to using only one {{child-entity}} to apply to a data asset. Once this option is activated, it cannot be deactivated.",
|
"mutually-exclusive-alert": "If you enable 'Mutually Exclusive' for a {{entity}}, users will be restricted to using only one {{child-entity}} to apply to a data asset. Once this option is activated, it cannot be deactivated.",
|
||||||
"name-of-the-bucket-dbt-files-stored": "Name of the bucket where the dbt files are stored.",
|
"name-of-the-bucket-dbt-files-stored": "Name of the bucket where the dbt files are stored.",
|
||||||
"new-conversation": "You are starting a new conversation",
|
"new-conversation": "You are starting a new conversation",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds para todos los activos de datos que posee y sigue",
|
"feed-filter-all": "Feeds para todos los activos de datos que posee y sigue",
|
||||||
"feed-filter-following": "Feeds para todos los activos de datos que sigue",
|
"feed-filter-following": "Feeds para todos los activos de datos que sigue",
|
||||||
"feed-filter-owner": "Feeds para todos los activos de datos que posee",
|
"feed-filter-owner": "Feeds para todos los activos de datos que posee",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "a mis à jour la propriété personnalisée le",
|
"feed-custom-property-header": "a mis à jour la propriété personnalisée le",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Flux de tous les actifs de données dont vous êtes propriétaire et que vous suivez",
|
"feed-filter-all": "Flux de tous les actifs de données dont vous êtes propriétaire et que vous suivez",
|
||||||
"feed-filter-following": "Flux de tous les actifs de données que vous suivez",
|
"feed-filter-following": "Flux de tous les actifs de données que vous suivez",
|
||||||
"feed-filter-owner": "Flux de tous les actifs de données dont vous êtes propriétaire",
|
"feed-filter-owner": "Flux de tous les actifs de données dont vous êtes propriétaire",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "פידים עבור כל הנכסים שאתה בעל ועוקב אחריהם",
|
"feed-filter-all": "פידים עבור כל הנכסים שאתה בעל ועוקב אחריהם",
|
||||||
"feed-filter-following": "פידים עבור כל הנכסים שאתה עוקב אחריהם",
|
"feed-filter-following": "פידים עבור כל הנכסים שאתה עוקב אחריהם",
|
||||||
"feed-filter-owner": "פידים עבור כל הנכסים שאתה בעל שלהם",
|
"feed-filter-owner": "פידים עבור כל הנכסים שאתה בעל שלהם",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
||||||
"feed-filter-following": "Feeds for all the data assets that you follow",
|
"feed-filter-following": "Feeds for all the data assets that you follow",
|
||||||
"feed-filter-owner": "Feeds for all the data assets that you own",
|
"feed-filter-owner": "Feeds for all the data assets that you own",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0>",
|
||||||
"feed-filter-all": "Feeds voor alle data-assets waar je eigenaar van bent en volgt",
|
"feed-filter-all": "Feeds voor alle data-assets waar je eigenaar van bent en volgt",
|
||||||
"feed-filter-following": "Feeds voor alle data-assets die je volgt",
|
"feed-filter-following": "Feeds voor alle data-assets die je volgt",
|
||||||
"feed-filter-owner": "Feeds voor alle data-assets waar je eigenaar van bent",
|
"feed-filter-owner": "Feeds voor alle data-assets waar je eigenaar van bent",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds para todos os ativos de dados que você possui e segue",
|
"feed-filter-all": "Feeds para todos os ativos de dados que você possui e segue",
|
||||||
"feed-filter-following": "Feeds para todos os ativos de dados que você segue",
|
"feed-filter-following": "Feeds para todos os ativos de dados que você segue",
|
||||||
"feed-filter-owner": "Feeds para todos os ativos de dados que você possui",
|
"feed-filter-owner": "Feeds para todos os ativos de dados que você possui",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
||||||
"feed-filter-following": "Feeds for all the data assets that you follow",
|
"feed-filter-following": "Feeds for all the data assets that you follow",
|
||||||
"feed-filter-owner": "Feeds for all the data assets that you own",
|
"feed-filter-owner": "Feeds for all the data assets that you own",
|
||||||
|
@ -1480,7 +1480,7 @@
|
|||||||
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
"feed-asset-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-custom-property-header": "updated Custom Properties on",
|
"feed-custom-property-header": "updated Custom Properties on",
|
||||||
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
"feed-entity-action-header": "{{action}} <0>data asset</0>",
|
||||||
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for {{entity}}",
|
"feed-field-action-entity-header": "{{action}} <0>{{field}}</0> for",
|
||||||
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
"feed-filter-all": "Feeds for all the data assets that you own and follow",
|
||||||
"feed-filter-following": "Feeds for all the data assets that you follow",
|
"feed-filter-following": "Feeds for all the data assets that you follow",
|
||||||
"feed-filter-owner": "Feeds for all the data assets that you own",
|
"feed-filter-owner": "Feeds for all the data assets that you own",
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
getEntityFQN,
|
getEntityFQN,
|
||||||
getEntityType,
|
getEntityType,
|
||||||
getFeedHeaderTextFromCardStyle,
|
getFeedHeaderTextFromCardStyle,
|
||||||
|
getFieldOperationIcon,
|
||||||
suggestions,
|
suggestions,
|
||||||
} from './FeedUtils';
|
} from './FeedUtils';
|
||||||
|
|
||||||
@ -274,3 +275,27 @@ describe('getFeedHeaderTextFromCardStyle', () => {
|
|||||||
expect(stringResult).toContain('label.updated-lowercase');
|
expect(stringResult).toContain('label.updated-lowercase');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getFieldOperationIcon', () => {
|
||||||
|
it('should not return icon in case of operation updated', () => {
|
||||||
|
const result = getFieldOperationIcon(FieldOperation.Updated);
|
||||||
|
|
||||||
|
expect(result).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return icon in case of operation added', () => {
|
||||||
|
const result = getFieldOperationIcon(FieldOperation.Added);
|
||||||
|
|
||||||
|
const stringResult = JSON.stringify(result);
|
||||||
|
|
||||||
|
expect(stringResult).toContain(FieldOperation.Added);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return icon in case of operation deleted', () => {
|
||||||
|
const result = getFieldOperationIcon(FieldOperation.Deleted);
|
||||||
|
|
||||||
|
const stringResult = JSON.stringify(result);
|
||||||
|
|
||||||
|
expect(stringResult).toContain(FieldOperation.Deleted);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { RightOutlined } from '@ant-design/icons';
|
import { RightOutlined } from '@ant-design/icons';
|
||||||
|
import Icon from '@ant-design/icons/lib/components/Icon';
|
||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
@ -640,21 +641,24 @@ export const getFeedChangeFieldLabel = (fieldName?: EntityField) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getFieldOperationIcon = (fieldOperation?: FieldOperation) => {
|
export const getFieldOperationIcon = (fieldOperation?: FieldOperation) => {
|
||||||
let Icon = UpdatedIcon;
|
let icon;
|
||||||
|
|
||||||
switch (fieldOperation) {
|
switch (fieldOperation) {
|
||||||
case FieldOperation.Added:
|
case FieldOperation.Added:
|
||||||
Icon = AddIcon;
|
icon = AddIcon;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FieldOperation.Updated:
|
|
||||||
case FieldOperation.Deleted:
|
case FieldOperation.Deleted:
|
||||||
Icon = UpdatedIcon;
|
icon = UpdatedIcon;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Icon height={16} width={16} />;
|
return (
|
||||||
|
icon && (
|
||||||
|
<Icon component={icon} height={16} name={fieldOperation} width={16} />
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTestCaseNameListForResult = (
|
export const getTestCaseNameListForResult = (
|
||||||
|
@ -202,6 +202,7 @@ export const getEntityIcon = (
|
|||||||
const entityIconMapping: Record<string, SvgComponent> = {
|
const entityIconMapping: Record<string, SvgComponent> = {
|
||||||
[SearchIndex.DATABASE]: DatabaseIcon,
|
[SearchIndex.DATABASE]: DatabaseIcon,
|
||||||
[EntityType.DATABASE]: DatabaseIcon,
|
[EntityType.DATABASE]: DatabaseIcon,
|
||||||
|
[EntityType.DATABASE_SERVICE]: DatabaseIcon,
|
||||||
[SearchIndex.DATABASE_SCHEMA]: SchemaIcon,
|
[SearchIndex.DATABASE_SCHEMA]: SchemaIcon,
|
||||||
[EntityType.DATABASE_SCHEMA]: SchemaIcon,
|
[EntityType.DATABASE_SCHEMA]: SchemaIcon,
|
||||||
[SearchIndex.TOPIC]: TopicIcon,
|
[SearchIndex.TOPIC]: TopicIcon,
|
||||||
@ -252,16 +253,18 @@ export const getEntityIcon = (
|
|||||||
[EntityType.ROLE]: RoleIcon,
|
[EntityType.ROLE]: RoleIcon,
|
||||||
[EntityType.POLICY]: PolicyIcon,
|
[EntityType.POLICY]: PolicyIcon,
|
||||||
[EntityType.EVENT_SUBSCRIPTION]: AlertIcon,
|
[EntityType.EVENT_SUBSCRIPTION]: AlertIcon,
|
||||||
|
[EntityType.USER]: UserIcon,
|
||||||
|
[SearchIndex.USER]: UserIcon,
|
||||||
|
[EntityType.INGESTION_PIPELINE]: PipelineIcon,
|
||||||
|
[SearchIndex.INGESTION_PIPELINE]: PipelineIcon,
|
||||||
|
[EntityType.ALERT]: AlertIcon,
|
||||||
['tagCategory']: ClassificationIcon,
|
['tagCategory']: ClassificationIcon,
|
||||||
['ingestionPipeline']: PipelineIcon,
|
|
||||||
['alert']: AlertIcon,
|
|
||||||
['announcement']: AnnouncementIcon,
|
['announcement']: AnnouncementIcon,
|
||||||
['conversation']: ConversationIcon,
|
['conversation']: ConversationIcon,
|
||||||
['task']: TaskIcon,
|
['task']: TaskIcon,
|
||||||
['dataQuality']: DataQualityIcon,
|
['dataQuality']: DataQualityIcon,
|
||||||
['services']: ServicesIcon,
|
['services']: ServicesIcon,
|
||||||
['automator']: AutomatorBotIcon,
|
['automator']: AutomatorBotIcon,
|
||||||
['user']: UserIcon,
|
|
||||||
['notification']: NotificationIcon,
|
['notification']: NotificationIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user