diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ContainerVersion/ContainerVersion.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ContainerVersion/ContainerVersion.component.tsx index 92f9fc80669..113979b4886 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ContainerVersion/ContainerVersion.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ContainerVersion/ContainerVersion.component.tsx @@ -19,7 +19,7 @@ import DescriptionV1 from 'components/common/description/DescriptionV1'; import ErrorPlaceHolder from 'components/common/error-with-placeholder/ErrorPlaceHolder'; import DataAssetsVersionHeader from 'components/DataAssets/DataAssetsVersionHeader/DataAssetsVersionHeader'; import TabsLabel from 'components/TabsLabel/TabsLabel.component'; -import TagsContainerV1 from 'components/Tag/TagsContainerV1/TagsContainerV1'; +import TagsContainerV2 from 'components/Tag/TagsContainerV2/TagsContainerV2'; import { getVersionPathWithTab } from 'constants/constants'; import { EntityField } from 'constants/Feeds.constants'; import { ERROR_PLACEHOLDER_TYPE } from 'enums/common.enum'; @@ -153,9 +153,7 @@ const ContainerVersion: React.FC = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - = ({ - + {`${t('label.glossary-term-plural')} :`} @@ -293,7 +293,7 @@ const MlModelVersion: FC = ({ - + {`${t('label.tag-plural')} :`} @@ -358,9 +358,7 @@ const MlModelVersion: FC = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - = ({ flex="220px"> {Object.keys(TagSource).map((tagType) => ( - Promise; } - -export type TagDetails = { - isLoading: boolean; - options: TagsDetailsProps[]; - isError: boolean; -}; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainer/tags-container.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainer/tags-container.tsx index 06b5e5a4d83..dfa5d117c45 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainer/tags-container.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainer/tags-container.tsx @@ -204,7 +204,6 @@ const TagsContainer: FunctionComponent = ({ () => showLimited ? ( { - const [tags, setTags] = useState(); - - const isGlossaryType = useMemo( - () => tagType === TagSource.Glossary, - [tagType] - ); - - const showAddTagButton = useMemo( - () => permission && isEmpty(tags?.[tagType]), - [permission, tags?.[tagType]] - ); - - const selectedTagsInternal = useMemo( - () => tags?.[tagType].map(({ tagFQN }) => tagFQN as string), - [tags, tagType] - ); - - const showNoDataPlaceholder = useMemo( - () => !showAddTagButton && isEmpty(tags?.[tagType]), - [showAddTagButton, tags?.[tagType]] - ); - - const getUpdatedTags = (selectedTag: string[]): EntityTags[] => { - const updatedTags = selectedTag.map((t) => ({ - tagFQN: t, - source: isGlossaryType ? TagSource.Glossary : TagSource.Classification, - })); - - return updatedTags; - }; - - const handleSave = useCallback( - (selectedTag: string[]) => { - const updatedTags = getUpdatedTags(selectedTag); - onSelectionChange([ - ...updatedTags, - ...((isGlossaryType - ? tags?.[TagSource.Classification] - : tags?.[TagSource.Glossary]) ?? []), - ]); - }, - [isGlossaryType, tags, getUpdatedTags] - ); - - const editTagButton = useMemo( - () => - !isEmpty(tags?.[tagType]) && showEditButton ? ( - - - ) : null; - }, [tags?.[tagType], handleUpdateTags, handleRequestTags]); - - const conversationThreadElement = useMemo( - () => ( - - - - ), - [ - entityType, - entityFqn, - entityThreadLink, - getEntityFeedLink, - onThreadLinkSelect, - ] - ); - - useEffect(() => { - setTags(getFilterTags(selectedTags)); - }, [selectedTags]); - - return ( -
-
-
- - {isGlossaryType ? t('label.glossary-term') : t('label.tag-plural')} - - {permission && !isEmpty(tags?.[tagType]) && ( -
- {permission && !isVersionView && ( - - {tagType === TagSource.Classification && requestTagElement} - {conversationThreadElement} - - )} -
- - {!isEditTags && ( - - {addTagButton} - {renderTags} - - )} - {isEditTags && tagsSelectContainer} -
- ); -}; - -export default TagsContainerV1; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.interface.ts index 5b4ec3f39e4..1bec7509650 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.interface.ts @@ -18,6 +18,7 @@ import { ReactElement } from 'react'; export type TagsContainerV2Props = { permission: boolean; + isVersionView?: boolean; selectedTags: EntityTags[]; entityType?: string; entityThreadLink?: string; @@ -27,6 +28,6 @@ export type TagsContainerV2Props = { showBottomEditButton?: boolean; showInlineEditButton?: boolean; children?: ReactElement; - onSelectionChange: (selectedTags: EntityTags[]) => Promise; + onSelectionChange?: (selectedTags: EntityTags[]) => Promise; onThreadLinkSelect?: (value: string, threadType?: ThreadType) => void; }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.tsx index 305423a3af0..1db56a72f73 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsContainerV2/TagsContainerV2.tsx @@ -44,6 +44,7 @@ import { TagsContainerV2Props } from './TagsContainerV2.interface'; const TagsContainerV2 = ({ permission, + isVersionView, selectedTags, entityType, entityThreadLink, @@ -134,12 +135,15 @@ const TagsContainerV2 = ({ source: tagType, })); - await onSelectionChange([ - ...updatedTags, - ...((isGlossaryType - ? tags?.[TagSource.Classification] - : tags?.[TagSource.Glossary]) ?? []), - ]); + if (onSelectionChange) { + await onSelectionChange([ + ...updatedTags, + ...((isGlossaryType + ? tags?.[TagSource.Classification] + : tags?.[TagSource.Glossary]) ?? []), + ]); + } + form.resetFields(); setIsEditTags(false); }; @@ -166,7 +170,6 @@ const TagsContainerV2 = ({ const renderTags = useMemo( () => ( )} - {tagType === TagSource.Classification && requestTagElement} - {onThreadLinkSelect && conversationThreadElement} + {permission && !isVersionView && ( + + {tagType === TagSource.Classification && requestTagElement} + {onThreadLinkSelect && conversationThreadElement} + + )}
)}
@@ -302,6 +309,7 @@ const TagsContainerV2 = ({ showHeader, isEditTags, permission, + isVersionView, isGlossaryType, requestTagElement, conversationThreadElement, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsTree/TagsTreeForm.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsTree/TagsTreeForm.component.tsx deleted file mode 100644 index 11de0692a6d..00000000000 --- a/openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsTree/TagsTreeForm.component.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2023 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. - */ -import { CheckOutlined, CloseOutlined } from '@ant-design/icons'; -import { Button, Col, Form, Row, Space, TreeSelect } from 'antd'; -import { useForm } from 'antd/lib/form/Form'; -import classNames from 'classnames'; -import React from 'react'; -import { TagsTreeComponentProps } from '../TagsContainerV1/TagsContainerV1.interface'; - -const TagTree = ({ - defaultValue, - placeholder, - treeData, - onSubmit, - onCancel, -}: TagsTreeComponentProps) => { - const [form] = useForm(); - - return ( -
onSubmit(data.tags)}> - - - -