fixed glossary term broken link (#14460)

This commit is contained in:
Harsh Vador 2023-12-21 14:46:33 +05:30 committed by GitHub
parent 417e352358
commit 7f0f8c54bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 6 deletions

View File

@ -15,6 +15,7 @@ import { DefaultOptionType } from 'antd/lib/select';
import { PagingResponse } from 'Models';
import { Tag } from '../../generated/entity/classification/tag';
import { GlossaryTerm } from '../../generated/entity/data/glossaryTerm';
import { TagSource } from '../../generated/type/tagLabel';
export type SelectOption = {
label: string;
@ -29,6 +30,7 @@ export interface AsyncSelectListProps {
debounceTimeout?: number;
defaultValue?: string[];
value?: string[];
tagType?: TagSource;
initialOptions?: SelectOption[];
filterOptions?: string[]; // array of fqn
onChange?: (option: DefaultOptionType | DefaultOptionType[]) => void;

View File

@ -47,6 +47,7 @@ const AsyncSelectList: FC<AsyncSelectListProps> = ({
initialOptions,
filterOptions = [],
className,
tagType,
...props
}) => {
const [isLoading, setIsLoading] = useState(false);
@ -222,6 +223,7 @@ const AsyncSelectList: FC<AsyncSelectListProps> = ({
startWith={TAG_START_WITH.SOURCE_ICON}
tag={tag}
tagProps={tagProps}
tagType={tagType}
tooltipOverride={
isDerived ? t('message.derived-tag-warning') : undefined
}

View File

@ -23,7 +23,11 @@ import { ReactComponent as EditIcon } from '../../../assets/svg/edit-new.svg';
import { ReactComponent as IconRequest } from '../../../assets/svg/request-icon.svg';
import { TableTagsProps } from '../../../components/TableTags/TableTags.interface';
import { DE_ACTIVE_COLOR } from '../../../constants/constants';
import { TAG_CONSTANT, TAG_START_WITH } from '../../../constants/Tag.constants';
import {
GLOSSARY_CONSTANT,
TAG_CONSTANT,
TAG_START_WITH,
} from '../../../constants/Tag.constants';
import { LabelType } from '../../../generated/entity/data/table';
import { TagSource } from '../../../generated/type/tagLabel';
import { getEntityFeedLink } from '../../../utils/EntityUtils';
@ -152,7 +156,11 @@ const TagsContainerV2 = ({
() =>
showAddTagButton ? (
<Col className="m-t-xss" onClick={handleAddClick}>
<TagsV1 startWith={TAG_START_WITH.PLUS} tag={TAG_CONSTANT} />
<TagsV1
startWith={TAG_START_WITH.PLUS}
tag={isGlossaryType ? GLOSSARY_CONSTANT : TAG_CONSTANT}
tagType={tagType}
/>
</Col>
) : null,
[showAddTagButton]
@ -164,6 +172,7 @@ const TagsContainerV2 = ({
<TagsViewer
displayType={displayType}
showNoDataPlaceholder={showNoDataPlaceholder}
tagType={tagType}
tags={tags?.[tagType] ?? []}
/>
</Col>
@ -178,6 +187,7 @@ const TagsContainerV2 = ({
fetchApi={fetchAPI}
placeholder={getTagPlaceholder(isGlossaryType)}
tagData={initialOptions}
tagType={tagType}
onCancel={handleCancel}
onSubmit={handleSave}
/>
@ -316,7 +326,11 @@ const TagsContainerV2 = ({
<Space>
{showAddTagButton ? (
<div onClick={handleAddClick}>
<TagsV1 startWith={TAG_START_WITH.PLUS} tag={TAG_CONSTANT} />
<TagsV1
startWith={TAG_START_WITH.PLUS}
tag={isGlossaryType ? GLOSSARY_CONSTANT : TAG_CONSTANT}
tagType={tagType}
/>
</div>
) : null}
<TagsViewer

View File

@ -25,6 +25,7 @@ const TagSelectForm = ({
onSubmit,
onCancel,
tagData,
tagType,
}: TagsSelectFormProps) => {
const [form] = useForm();
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
@ -69,6 +70,7 @@ const TagSelectForm = ({
initialOptions={tagData}
mode="multiple"
placeholder={placeholder}
tagType={tagType}
/>
</Form.Item>
</Col>

View File

@ -14,6 +14,7 @@
import { DefaultOptionType } from 'antd/lib/select';
import { SelectOption } from '../../../components/AsyncSelectList/AsyncSelectList.interface';
import { Paging } from '../../../generated/type/paging';
import { TagSource } from '../../../generated/type/tagLabel';
export type TagsSelectFormProps = {
placeholder: string;
@ -22,6 +23,7 @@ export type TagsSelectFormProps = {
onChange?: (value: string[]) => void;
onSubmit: (option: DefaultOptionType | DefaultOptionType[]) => Promise<void>;
onCancel: () => void;
tagType?: TagSource;
fetchApi: (
search: string,
page: number

View File

@ -38,6 +38,7 @@ const TagsV1 = ({
isVersionPage = false,
tagProps,
tooltipOverride,
tagType,
}: TagsV1Props) => {
const history = useHistory();
const color = useMemo(
@ -88,12 +89,12 @@ const TagsV1 = ({
const redirectLink = useCallback(
() =>
tag.source === TagSource.Glossary
(tagType ?? tag.source) === TagSource.Glossary
? history.push(`${ROUTES.GLOSSARY}/${getEncodedFqn(tag.tagFQN)}`)
: history.push(
`${ROUTES.TAGS}/${getEncodedFqn(Fqn.split(tag.tagFQN)[0])}`
),
[tag.source, tag.tagFQN]
[tagType, tag.source, tag.tagFQN]
);
const tagColorBar = useMemo(

View File

@ -13,7 +13,7 @@
import { TagProps } from 'antd';
import { TAG_START_WITH } from '../../../constants/Tag.constants';
import { TagLabel } from '../../../generated/type/tagLabel';
import { TagLabel, TagSource } from '../../../generated/type/tagLabel';
import { HighlightedTagLabel } from '../../../utils/EntitySummaryPanelUtils';
export type TagsV1Props = {
@ -25,4 +25,5 @@ export type TagsV1Props = {
tagProps?: TagProps;
disabled?: boolean;
tooltipOverride?: string;
tagType?: TagSource;
};

View File

@ -12,12 +12,14 @@
*/
import { EntityTags } from 'Models';
import { TagSource } from '../../../generated/type/tagLabel';
export interface TagsViewerProps {
tags: EntityTags[];
sizeCap?: number;
displayType?: DisplayType;
showNoDataPlaceholder?: boolean;
tagType?: TagSource;
}
export enum DisplayType {

View File

@ -21,6 +21,13 @@ export const TAG_CONSTANT = {
tagFQN: t('label.add'),
};
export const GLOSSARY_CONSTANT = {
labelType: LabelType.Manual,
source: TagSource.Glossary,
state: State.Confirmed,
tagFQN: t('label.add'),
};
export enum TAG_START_WITH {
PLUS = '+',
SOURCE_ICON = 'source_icon',