diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
index b4b72a32c46..ced955ebeeb 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
@@ -17,6 +17,7 @@ import { ReactComponent as EditIcon } from 'assets/svg/edit-new.svg';
import { AxiosError } from 'axios';
import { ActivityFilters } from 'components/ActivityFeed/ActivityFeedList/ActivityFeedList.interface';
import ErrorPlaceHolder from 'components/common/error-with-placeholder/ErrorPlaceHolder';
+import { EntityName } from 'components/Modals/EntityNameModal/EntityNameModal.interface';
import { ENTITY_CARD_CLASS } from 'constants/entity.constants';
import { compare } from 'fast-json-patch';
import { isEmpty, isUndefined } from 'lodash';
@@ -87,9 +88,6 @@ const DashboardDetails = ({
activeTab,
setActiveTabHandler,
dashboardDetails,
- descriptionUpdateHandler,
- settingsUpdateHandler,
- tagUpdateHandler,
charts,
chartDescriptionUpdateHandler,
chartTagUpdateHandler,
@@ -106,7 +104,7 @@ const DashboardDetails = ({
fetchFeedHandler,
updateThreadHandler,
entityFieldTaskCount,
- onExtensionUpdate,
+ onDashboardUpdate,
}: DashboardDetailsProps) => {
const { t } = useTranslation();
const [isEdit, setIsEdit] = useState(false);
@@ -312,12 +310,12 @@ const DashboardDetails = ({
const onDescriptionUpdate = async (updatedHTML: string) => {
if (description !== updatedHTML) {
- const updatedDashboardDetails = {
+ const updatedDashboard = {
...dashboardDetails,
description: updatedHTML,
};
try {
- await descriptionUpdateHandler(updatedDashboardDetails);
+ await onDashboardUpdate(updatedDashboard, 'description');
} catch (error) {
showErrorToast(error as AxiosError);
} finally {
@@ -330,11 +328,11 @@ const DashboardDetails = ({
const onOwnerUpdate = useCallback(
(newOwner?: Dashboard['owner']) => {
- const updatedDashboardDetails = {
+ const updatedDashboard = {
...dashboardDetails,
owner: newOwner ? { ...owner, ...newOwner } : undefined,
};
- settingsUpdateHandler(updatedDashboardDetails);
+ onDashboardUpdate(updatedDashboard, 'owner');
},
[owner]
);
@@ -351,21 +349,21 @@ const DashboardDetails = ({
},
]
: dashboardDetails.tags;
- const updatedDashboardDetails = {
+ const updatedDashboard = {
...dashboardDetails,
tags: tierTag,
};
- settingsUpdateHandler(updatedDashboardDetails);
+ onDashboardUpdate(updatedDashboard, 'tags');
}
};
const onRemoveTier = () => {
if (dashboardDetails) {
- const updatedDashboardDetails = {
+ const updatedDashboard = {
...dashboardDetails,
tags: getTagsWithoutTier(dashboardDetails.tags ?? []),
};
- settingsUpdateHandler(updatedDashboardDetails);
+ onDashboardUpdate(updatedDashboard, 'tags');
}
};
@@ -373,10 +371,21 @@ const DashboardDetails = ({
if (selectedTags) {
const updatedTags = [...(tier ? [tier] : []), ...selectedTags];
const updatedDashboard = { ...dashboardDetails, tags: updatedTags };
- tagUpdateHandler(updatedDashboard);
+ onDashboardUpdate(updatedDashboard, 'tags');
}
};
+ const onUpdateDisplayName = async (data: EntityName) => {
+ const updatedData = {
+ ...dashboardDetails,
+ displayName: data.displayName,
+ };
+ await onDashboardUpdate(updatedData, 'displayName');
+ };
+ const onExtensionUpdate = async (updatedData: Dashboard) => {
+ await onDashboardUpdate(updatedData, 'extension');
+ };
+
const handleRestoreDashboard = async () => {
try {
await restoreDashboard(dashboardDetails.id);
@@ -734,7 +743,7 @@ const DashboardDetails = ({
)}
entityFqn={dashboardFQN}
entityId={dashboardDetails.id}
- entityName={entityName}
+ entityName={dashboardDetails.name}
entityType={EntityType.DASHBOARD}
extraInfo={extraInfo}
followHandler={followDashboard}
@@ -766,6 +775,7 @@ const DashboardDetails = ({
versionHandler={versionHandler}
onRestoreEntity={handleRestoreDashboard}
onThreadLinkSelect={onThreadLinkSelect}
+ onUpdateDisplayName={onUpdateDisplayName}
/>
void;
followDashboardHandler: () => void;
unfollowDashboardHandler: () => void;
- settingsUpdateHandler: (updatedDashboard: Dashboard) => Promise;
- descriptionUpdateHandler: (updatedDashboard: Dashboard) => Promise;
chartDescriptionUpdateHandler: (
index: number,
chartId: string,
@@ -66,7 +64,6 @@ export interface DashboardDetailsProps {
chartId: string,
patch: Array
) => void;
- tagUpdateHandler: (updatedDashboard: Dashboard) => void;
versionHandler: () => void;
postFeedHandler: (value: string, id: string) => void;
deletePostHandler: (
@@ -75,5 +72,8 @@ export interface DashboardDetailsProps {
isThread: boolean
) => void;
updateThreadHandler: ThreadUpdatedFunc;
- onExtensionUpdate: (updatedDashboard: Dashboard) => Promise;
+ onDashboardUpdate: (
+ updatedDashboard: Dashboard,
+ key: keyof Dashboard
+ ) => Promise;
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.test.tsx
index a8a5a3f5a99..04d25ed50f9 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.test.tsx
@@ -27,17 +27,11 @@ import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { Dashboard } from '../../generated/entity/data/dashboard';
import { GlossaryTerm } from '../../generated/entity/data/glossaryTerm';
-import { EntityLineage } from '../../generated/type/entityLineage';
-import { EntityReference } from '../../generated/type/entityReference';
import { Paging } from '../../generated/type/paging';
-import { TagLabel } from '../../generated/type/tagLabel';
import { fetchGlossaryTerms } from '../../utils/GlossaryUtils';
import { getClassifications } from '../../utils/TagsUtils';
-import {
- LeafNodes,
- LoadingNodeState,
-} from '../EntityLineage/EntityLineage.interface';
import DashboardDetails from './DashboardDetails.component';
+import { DashboardDetailsProps } from './DashboardDetails.interface';
const mockUserTeam = [
{
@@ -58,7 +52,7 @@ const mockUserTeam = [
},
];
-const DashboardDetailsProps = {
+const dashboardDetailsProps: DashboardDetailsProps = {
charts: [
{
chartUrl: 'http://localhost',
@@ -70,36 +64,16 @@ const DashboardDetailsProps = {
service: { id: '', type: '' },
},
],
- serviceType: '',
- dashboardUrl: '',
- tagList: [],
- users: [],
dashboardDetails: {} as Dashboard,
- entityLineage: {} as EntityLineage,
- entityName: '',
activeTab: 1,
- owner: {} as EntityReference,
- description: '',
- tier: {} as TagLabel,
- followers: [],
- dashboardTags: [],
slashedDashboardName: [],
setActiveTabHandler: jest.fn(),
followDashboardHandler: jest.fn(),
unfollowDashboardHandler: jest.fn(),
- settingsUpdateHandler: jest.fn(),
- descriptionUpdateHandler: jest.fn(),
chartDescriptionUpdateHandler: jest.fn(),
chartTagUpdateHandler: jest.fn(),
- tagUpdateHandler: jest.fn(),
- loadNodeHandler: jest.fn(),
- lineageLeafNodes: {} as LeafNodes,
- isNodeLoading: {} as LoadingNodeState,
- version: '',
+ onDashboardUpdate: jest.fn(),
versionHandler: jest.fn(),
- addLineageHandler: jest.fn(),
- removeLineageHandler: jest.fn(),
- entityLineageHandler: jest.fn(),
entityThread: [],
isEntityThreadLoading: false,
postFeedHandler: jest.fn(),
@@ -112,7 +86,6 @@ const DashboardDetailsProps = {
paging: {} as Paging,
fetchFeedHandler: jest.fn(),
updateThreadHandler: jest.fn(),
- onExtensionUpdate: jest.fn(),
};
const mockEntityPermissions = {
@@ -146,8 +119,8 @@ jest.mock('components/Tag/TagsContainer/tags-container', () => {
return jest.fn().mockImplementation(({ tagList }) => {
return (
<>
- {tagList.map((tag: TagOption, idx: number) => (
- {tag.fqn}
+ {tagList.map((tag: TagOption) => (
+ {tag.fqn}
))}
>
);
@@ -221,7 +194,7 @@ jest.mock('../../utils/TagsUtils', () => ({
describe('Test DashboardDetails component', () => {
it('Checks if the DashboardDetails component has all the proper components rendered', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -246,7 +219,7 @@ describe('Test DashboardDetails component', () => {
it('Check if active tab is details', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -258,7 +231,7 @@ describe('Test DashboardDetails component', () => {
it('Check if active tab is activity feed', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -270,7 +243,7 @@ describe('Test DashboardDetails component', () => {
it('Check if active tab is lineage', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -282,7 +255,7 @@ describe('Test DashboardDetails component', () => {
it('Check if active tab is custom properties', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -297,7 +270,7 @@ describe('Test DashboardDetails component', () => {
it('Should create an observer if IntersectionObserver is available', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -310,7 +283,7 @@ describe('Test DashboardDetails component', () => {
it('Check if tags and glossary-terms are present', async () => {
await act(async () => {
- render(, {
+ render(, {
wrapper: MemoryRouter,
});
});
@@ -332,7 +305,7 @@ describe('Test DashboardDetails component', () => {
Promise.reject()
);
await act(async () => {
- render(, {
+ render(, {
wrapper: MemoryRouter,
});
});
@@ -354,7 +327,7 @@ describe('Test DashboardDetails component', () => {
Promise.reject()
);
await act(async () => {
- render(, {
+ render(, {
wrapper: MemoryRouter,
});
});
@@ -381,7 +354,7 @@ describe('Test DashboardDetails component', () => {
Promise.reject()
);
const { getByTestId, queryByText } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx
index 174bb17f39f..31524975a39 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx
@@ -115,7 +115,6 @@ const DatasetDetails: React.FC = ({
deletePostHandler,
paging,
fetchFeedHandler,
- handleExtensionUpdate,
updateThreadHandler,
entityFieldTaskCount,
isTableProfileLoading,
@@ -151,7 +150,6 @@ const DatasetDetails: React.FC = ({
usageSummary,
joins,
entityName,
- displayName,
} = useMemo(() => {
const { tags } = tableDetails;
@@ -159,7 +157,7 @@ const DatasetDetails: React.FC = ({
...tableDetails,
tier: getTierTags(tags ?? []),
tableTags: getTagsWithoutTier(tags || []),
- entityName: tableDetails.name,
+ entityName: getEntityName(tableDetails),
};
}, [tableDetails]);
const isTourPage = location.pathname.includes(ROUTES.TOUR);
@@ -574,6 +572,9 @@ const DatasetDetails: React.FC = ({
const updatedTable = { ...tableDetails, displayName: data.displayName };
await onTableUpdate(updatedTable, 'displayName');
};
+ const onExtensionUpdate = async (updatedData: Table) => {
+ await onTableUpdate(updatedData, 'extension');
+ };
const followTable = () => {
isFollowing ? unfollowTableHandler() : followTableHandler();
@@ -652,7 +653,7 @@ const DatasetDetails: React.FC = ({
canDelete={tablePermissions.Delete}
currentOwner={tableDetails.owner}
deleted={deleted}
- displayName={displayName}
+ displayName={tableDetails.displayName}
entityFieldTasks={getEntityFieldThreadCounts(
EntityField.TAGS,
entityFieldTaskCount
@@ -663,7 +664,7 @@ const DatasetDetails: React.FC = ({
)}
entityFqn={datasetFQN}
entityId={tableDetails.id}
- entityName={entityName}
+ entityName={tableDetails.name}
entityType={EntityType.TABLE}
extraInfo={extraInfo}
followHandler={followTable}
@@ -849,7 +850,7 @@ const DatasetDetails: React.FC = ({
tableDetails as CustomPropertyProps['entityDetails']
}
entityType={EntityType.TABLE}
- handleExtensionUpdate={handleExtensionUpdate}
+ handleExtensionUpdate={onExtensionUpdate}
hasEditAccess={
tablePermissions.EditAll || tablePermissions.EditCustomFields
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.interface.ts
index 0d9282b6e7a..d3facaea385 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.interface.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.interface.ts
@@ -55,7 +55,6 @@ export interface DatasetDetailsProps {
feedType?: FeedFilter,
threadType?: ThreadType
) => void;
- handleExtensionUpdate: (updatedTable: Table) => Promise;
updateThreadHandler: ThreadUpdatedFunc;
onTableUpdate: (updatedTable: Table, key: keyof Table) => Promise;
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.test.tsx
index d9e1830f5a9..6cc133a9f41 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.test.tsx
@@ -110,7 +110,6 @@ const datasetDetailsProps: DatasetDetailsProps = {
createThread: jest.fn(),
deletePostHandler: jest.fn(),
fetchFeedHandler: jest.fn(),
- handleExtensionUpdate: jest.fn(),
updateThreadHandler: jest.fn(),
onTableUpdate: jest.fn(),
};
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx
index 63548e67ab4..0bcae804fba 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx
@@ -451,6 +451,9 @@ const GlossaryHeader = ({
setIsNameEditing(false)}
onSave={onNameSave}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.component.tsx
index a653d6ee3fe..1103c8cc051 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.component.tsx
@@ -20,6 +20,7 @@ const EntityNameModal: React.FC = ({
entity,
onCancel,
onSave,
+ title,
// re-name will update actual name of the entity, it will impact across application
// By default its disabled, send allowRename true to get the functionality
allowRename = false,
@@ -61,9 +62,7 @@ const EntityNameModal: React.FC = ({
open={visible}
title={
- {t('label.edit-entity', {
- entity: allowRename ? t('label.name') : t('label.display-name'),
- })}
+ {title}
}
onCancel={onCancel}>
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.interface.ts
index 3761e6e8a4c..46098fdeb5c 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.interface.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityNameModal/EntityNameModal.interface.ts
@@ -18,4 +18,5 @@ export interface EntityNameModalProps {
onCancel: () => void;
onSave: (obj: EntityName) => void;
entity: Partial;
+ title: string;
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.component.tsx
index 4418d2aae13..ffbbd56b659 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.component.tsx
@@ -14,6 +14,7 @@
import { Card } from 'antd';
import { AxiosError } from 'axios';
import { ActivityFilters } from 'components/ActivityFeed/ActivityFeedList/ActivityFeedList.interface';
+import { EntityName } from 'components/Modals/EntityNameModal/EntityNameModal.interface';
import { ENTITY_CARD_CLASS } from 'constants/entity.constants';
import { EntityTags, ExtraInfo } from 'Models';
import React, {
@@ -72,11 +73,8 @@ const TopicDetails: React.FC = ({
activeTab,
slashedTopicName,
setActiveTabHandler,
- settingsUpdateHandler,
followTopicHandler,
unfollowTopicHandler,
- descriptionUpdateHandler,
- tagUpdateHandler,
versionHandler,
entityThread,
isEntityThreadLoading,
@@ -90,7 +88,7 @@ const TopicDetails: React.FC = ({
fetchFeedHandler,
updateThreadHandler,
entityFieldTaskCount,
- onExtensionUpdate,
+ onTopicUpdate,
}: TopicDetailsProps) => {
const { t } = useTranslation();
const [isEdit, setIsEdit] = useState(false);
@@ -284,7 +282,7 @@ const TopicDetails: React.FC = ({
description: updatedHTML,
};
try {
- await descriptionUpdateHandler(updatedTopicDetails);
+ await onTopicUpdate(updatedTopicDetails, 'description');
} catch (error) {
showErrorToast(error as AxiosError);
} finally {
@@ -305,7 +303,7 @@ const TopicDetails: React.FC = ({
}
: undefined,
};
- settingsUpdateHandler(updatedTopicDetails);
+ onTopicUpdate(updatedTopicDetails, 'owner');
},
[owner]
);
@@ -316,7 +314,7 @@ const TopicDetails: React.FC = ({
...topicDetails,
tags: getTagsWithoutTier(topicDetails.tags ?? []),
};
- settingsUpdateHandler(updatedTopicDetails);
+ onTopicUpdate(updatedTopicDetails, 'tags');
}
};
@@ -337,7 +335,7 @@ const TopicDetails: React.FC = ({
tags: tierTag,
};
- return settingsUpdateHandler(updatedTopicDetails);
+ return onTopicUpdate(updatedTopicDetails, 'tags');
} else {
return Promise.reject();
}
@@ -371,10 +369,21 @@ const TopicDetails: React.FC = ({
if (selectedTags) {
const updatedTags = [...(tier ? [tier] : []), ...selectedTags];
const updatedTopic = { ...topicDetails, tags: updatedTags };
- tagUpdateHandler(updatedTopic);
+ onTopicUpdate(updatedTopic, 'tags');
}
};
+ const handleUpdateDisplayName = async (data: EntityName) => {
+ const updatedData = {
+ ...topicDetails,
+ displayName: data.displayName,
+ };
+ await onTopicUpdate(updatedData, 'displayName');
+ };
+ const onExtensionUpdate = async (updatedData: Topic) => {
+ await onTopicUpdate(updatedData, 'extension');
+ };
+
const onThreadLinkSelect = (link: string, threadType?: ThreadType) => {
setThreadLink(link);
if (threadType) {
@@ -408,10 +417,13 @@ const TopicDetails: React.FC = ({
updatedMessageSchema: Topic['messageSchema']
) => {
try {
- await settingsUpdateHandler({
- ...topicDetails,
- messageSchema: updatedMessageSchema,
- });
+ await onTopicUpdate(
+ {
+ ...topicDetails,
+ messageSchema: updatedMessageSchema,
+ },
+ 'messageSchema'
+ );
} catch (error) {
showErrorToast(error as AxiosError);
}
@@ -447,7 +459,7 @@ const TopicDetails: React.FC = ({
)}
entityFqn={topicFQN}
entityId={topicDetails.id}
- entityName={entityName}
+ entityName={topicDetails.name}
entityType={EntityType.TOPIC}
extraInfo={extraInfo}
followHandler={followTopic}
@@ -479,6 +491,7 @@ const TopicDetails: React.FC = ({
versionHandler={versionHandler}
onRestoreEntity={handleRestoreTopic}
onThreadLinkSelect={onThreadLinkSelect}
+ onUpdateDisplayName={handleUpdateDisplayName}
/>
void;
followTopicHandler: () => void;
unfollowTopicHandler: () => void;
- settingsUpdateHandler: (updatedTopic: Topic) => Promise;
- descriptionUpdateHandler: (updatedTopic: Topic) => Promise;
- tagUpdateHandler: (updatedTopic: Topic) => void;
versionHandler: () => void;
postFeedHandler: (value: string, id: string) => void;
deletePostHandler: (
@@ -55,7 +52,7 @@ export interface TopicDetailsProps {
isThread: boolean
) => void;
updateThreadHandler: ThreadUpdatedFunc;
- onExtensionUpdate: (updatedTopic: Topic) => Promise;
+ onTopicUpdate: (updatedData: Topic, key: keyof Topic) => Promise;
}
export interface TopicConfigObjectInterface {
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.test.tsx
index d2dd0c7658c..97e073cfcc0 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicDetails.test.tsx
@@ -19,14 +19,9 @@ import {
} from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
-import { EntityReference } from '../../generated/type/entityReference';
import { Paging } from '../../generated/type/paging';
-import { TagLabel } from '../../generated/type/tagLabel';
-import {
- LeafNodes,
- LoadingNodeState,
-} from '../EntityLineage/EntityLineage.interface';
import TopicDetails from './TopicDetails.component';
+import { TopicDetailsProps } from './TopicDetails.interface';
import { TOPIC_DETAILS } from './TopicDetails.mock';
jest.mock('../common/EntitySummaryDetails/EntitySummaryDetails', () => {
@@ -53,37 +48,15 @@ const mockUserTeam = [
},
];
-const TopicDetailsProps = {
- partitions: 0,
- cleanupPolicies: [],
- maximumMessageSize: 0,
- replicationFactor: 0,
- retentionSize: 0,
- serviceType: '',
- users: [],
+const topicDetailsProps: TopicDetailsProps = {
topicDetails: TOPIC_DETAILS,
- entityName: '',
activeTab: 1,
- owner: {} as EntityReference,
- description: '',
- tier: {} as TagLabel,
- followers: [],
- topicTags: [],
slashedTopicName: [],
setActiveTabHandler: jest.fn(),
followTopicHandler: jest.fn(),
unfollowTopicHandler: jest.fn(),
- settingsUpdateHandler: jest.fn(),
- descriptionUpdateHandler: jest.fn(),
- tagUpdateHandler: jest.fn(),
- loadNodeHandler: jest.fn(),
- lineageLeafNodes: {} as LeafNodes,
- isNodeLoading: {} as LoadingNodeState,
- version: '',
+ onTopicUpdate: jest.fn(),
versionHandler: jest.fn(),
- addLineageHandler: jest.fn(),
- removeLineageHandler: jest.fn(),
- entityLineageHandler: jest.fn(),
entityThread: [],
isEntityThreadLoading: false,
postFeedHandler: jest.fn(),
@@ -96,17 +69,6 @@ const TopicDetailsProps = {
paging: {} as Paging,
fetchFeedHandler: jest.fn(),
updateThreadHandler: jest.fn(),
- lineageTabData: {
- loadNodeHandler: jest.fn(),
- addLineageHandler: jest.fn(),
- removeLineageHandler: jest.fn(),
- entityLineageHandler: jest.fn(),
- isLineageLoading: false,
- entityLineage: { entity: { id: 'test', type: 'topic' } },
- lineageLeafNodes: {} as LeafNodes,
- isNodeLoading: { id: undefined, state: false },
- },
- onExtensionUpdate: jest.fn(),
};
jest.mock('../EntityLineage/EntityLineage.component', () => {
@@ -174,7 +136,7 @@ jest.mock('../../utils/CommonUtils', () => ({
describe('Test TopicDetails component', () => {
it('Checks if the TopicDetails component has all the proper components rendered', async () => {
- const { container } = render(, {
+ const { container } = render(, {
wrapper: MemoryRouter,
});
const EntityPageInfo = await findByText(container, /EntityPageInfo/i);
@@ -196,7 +158,7 @@ describe('Test TopicDetails component', () => {
});
it('Check if active tab is schema', async () => {
- const { container } = render(, {
+ const { container } = render(, {
wrapper: MemoryRouter,
});
const schema = await findByTestId(container, 'label.schema');
@@ -208,7 +170,7 @@ describe('Test TopicDetails component', () => {
it('Check if active tab is activity feed', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -220,7 +182,7 @@ describe('Test TopicDetails component', () => {
it('Check if active tab is sample data', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -232,7 +194,7 @@ describe('Test TopicDetails component', () => {
it('Check if active tab is config', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -244,7 +206,7 @@ describe('Test TopicDetails component', () => {
it('Should render lineage tab', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -257,7 +219,7 @@ describe('Test TopicDetails component', () => {
it('Check if active tab is custom properties', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
@@ -272,7 +234,7 @@ describe('Test TopicDetails component', () => {
it('Should create an observer if IntersectionObserver is available', async () => {
const { container } = render(
- ,
+ ,
{
wrapper: MemoryRouter,
}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.test.tsx
index 2d9dab32aa3..9534bb40f47 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.test.tsx
@@ -54,7 +54,7 @@ const mockProps = {
entityFQN: 'string',
entityName: 'string',
onClose: jest.fn(),
- createAnnouncementPermission: true,
+ createPermission: true,
};
describe('Test Announcement drawer component', () => {
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.tsx
index f01d06e79e8..aed1338792a 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/AnnouncementDrawer/AnnouncementDrawer.tsx
@@ -38,7 +38,7 @@ interface Props {
entityFQN: string;
entityName: string;
onClose: () => void;
- createAnnouncementPermission?: boolean;
+ createPermission?: boolean;
}
const AnnouncementDrawer: FC = ({
@@ -47,7 +47,7 @@ const AnnouncementDrawer: FC = ({
entityFQN,
entityType,
entityName,
- createAnnouncementPermission,
+ createPermission,
}) => {
const { t } = useTranslation();
const [isAnnouncement, setIsAnnouncement] = useState(false);
@@ -119,13 +119,10 @@ const AnnouncementDrawer: FC = ({
onClose={onClose}>
+ title={!createPermission && t('message.no-permission-to-view')}>