mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 03:29:03 +00:00
fixed glossary term broken link (#14460)
This commit is contained in:
parent
417e352358
commit
7f0f8c54bc
@ -15,6 +15,7 @@ import { DefaultOptionType } from 'antd/lib/select';
|
|||||||
import { PagingResponse } from 'Models';
|
import { PagingResponse } from 'Models';
|
||||||
import { Tag } from '../../generated/entity/classification/tag';
|
import { Tag } from '../../generated/entity/classification/tag';
|
||||||
import { GlossaryTerm } from '../../generated/entity/data/glossaryTerm';
|
import { GlossaryTerm } from '../../generated/entity/data/glossaryTerm';
|
||||||
|
import { TagSource } from '../../generated/type/tagLabel';
|
||||||
|
|
||||||
export type SelectOption = {
|
export type SelectOption = {
|
||||||
label: string;
|
label: string;
|
||||||
@ -29,6 +30,7 @@ export interface AsyncSelectListProps {
|
|||||||
debounceTimeout?: number;
|
debounceTimeout?: number;
|
||||||
defaultValue?: string[];
|
defaultValue?: string[];
|
||||||
value?: string[];
|
value?: string[];
|
||||||
|
tagType?: TagSource;
|
||||||
initialOptions?: SelectOption[];
|
initialOptions?: SelectOption[];
|
||||||
filterOptions?: string[]; // array of fqn
|
filterOptions?: string[]; // array of fqn
|
||||||
onChange?: (option: DefaultOptionType | DefaultOptionType[]) => void;
|
onChange?: (option: DefaultOptionType | DefaultOptionType[]) => void;
|
||||||
|
|||||||
@ -47,6 +47,7 @@ const AsyncSelectList: FC<AsyncSelectListProps> = ({
|
|||||||
initialOptions,
|
initialOptions,
|
||||||
filterOptions = [],
|
filterOptions = [],
|
||||||
className,
|
className,
|
||||||
|
tagType,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@ -222,6 +223,7 @@ const AsyncSelectList: FC<AsyncSelectListProps> = ({
|
|||||||
startWith={TAG_START_WITH.SOURCE_ICON}
|
startWith={TAG_START_WITH.SOURCE_ICON}
|
||||||
tag={tag}
|
tag={tag}
|
||||||
tagProps={tagProps}
|
tagProps={tagProps}
|
||||||
|
tagType={tagType}
|
||||||
tooltipOverride={
|
tooltipOverride={
|
||||||
isDerived ? t('message.derived-tag-warning') : undefined
|
isDerived ? t('message.derived-tag-warning') : undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 { ReactComponent as IconRequest } from '../../../assets/svg/request-icon.svg';
|
||||||
import { TableTagsProps } from '../../../components/TableTags/TableTags.interface';
|
import { TableTagsProps } from '../../../components/TableTags/TableTags.interface';
|
||||||
import { DE_ACTIVE_COLOR } from '../../../constants/constants';
|
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 { LabelType } from '../../../generated/entity/data/table';
|
||||||
import { TagSource } from '../../../generated/type/tagLabel';
|
import { TagSource } from '../../../generated/type/tagLabel';
|
||||||
import { getEntityFeedLink } from '../../../utils/EntityUtils';
|
import { getEntityFeedLink } from '../../../utils/EntityUtils';
|
||||||
@ -152,7 +156,11 @@ const TagsContainerV2 = ({
|
|||||||
() =>
|
() =>
|
||||||
showAddTagButton ? (
|
showAddTagButton ? (
|
||||||
<Col className="m-t-xss" onClick={handleAddClick}>
|
<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>
|
</Col>
|
||||||
) : null,
|
) : null,
|
||||||
[showAddTagButton]
|
[showAddTagButton]
|
||||||
@ -164,6 +172,7 @@ const TagsContainerV2 = ({
|
|||||||
<TagsViewer
|
<TagsViewer
|
||||||
displayType={displayType}
|
displayType={displayType}
|
||||||
showNoDataPlaceholder={showNoDataPlaceholder}
|
showNoDataPlaceholder={showNoDataPlaceholder}
|
||||||
|
tagType={tagType}
|
||||||
tags={tags?.[tagType] ?? []}
|
tags={tags?.[tagType] ?? []}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
@ -178,6 +187,7 @@ const TagsContainerV2 = ({
|
|||||||
fetchApi={fetchAPI}
|
fetchApi={fetchAPI}
|
||||||
placeholder={getTagPlaceholder(isGlossaryType)}
|
placeholder={getTagPlaceholder(isGlossaryType)}
|
||||||
tagData={initialOptions}
|
tagData={initialOptions}
|
||||||
|
tagType={tagType}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onSubmit={handleSave}
|
onSubmit={handleSave}
|
||||||
/>
|
/>
|
||||||
@ -316,7 +326,11 @@ const TagsContainerV2 = ({
|
|||||||
<Space>
|
<Space>
|
||||||
{showAddTagButton ? (
|
{showAddTagButton ? (
|
||||||
<div onClick={handleAddClick}>
|
<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>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
<TagsViewer
|
<TagsViewer
|
||||||
|
|||||||
@ -25,6 +25,7 @@ const TagSelectForm = ({
|
|||||||
onSubmit,
|
onSubmit,
|
||||||
onCancel,
|
onCancel,
|
||||||
tagData,
|
tagData,
|
||||||
|
tagType,
|
||||||
}: TagsSelectFormProps) => {
|
}: TagsSelectFormProps) => {
|
||||||
const [form] = useForm();
|
const [form] = useForm();
|
||||||
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
|
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
|
||||||
@ -69,6 +70,7 @@ const TagSelectForm = ({
|
|||||||
initialOptions={tagData}
|
initialOptions={tagData}
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
tagType={tagType}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
import { DefaultOptionType } from 'antd/lib/select';
|
import { DefaultOptionType } from 'antd/lib/select';
|
||||||
import { SelectOption } from '../../../components/AsyncSelectList/AsyncSelectList.interface';
|
import { SelectOption } from '../../../components/AsyncSelectList/AsyncSelectList.interface';
|
||||||
import { Paging } from '../../../generated/type/paging';
|
import { Paging } from '../../../generated/type/paging';
|
||||||
|
import { TagSource } from '../../../generated/type/tagLabel';
|
||||||
|
|
||||||
export type TagsSelectFormProps = {
|
export type TagsSelectFormProps = {
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
@ -22,6 +23,7 @@ export type TagsSelectFormProps = {
|
|||||||
onChange?: (value: string[]) => void;
|
onChange?: (value: string[]) => void;
|
||||||
onSubmit: (option: DefaultOptionType | DefaultOptionType[]) => Promise<void>;
|
onSubmit: (option: DefaultOptionType | DefaultOptionType[]) => Promise<void>;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
|
tagType?: TagSource;
|
||||||
fetchApi: (
|
fetchApi: (
|
||||||
search: string,
|
search: string,
|
||||||
page: number
|
page: number
|
||||||
|
|||||||
@ -38,6 +38,7 @@ const TagsV1 = ({
|
|||||||
isVersionPage = false,
|
isVersionPage = false,
|
||||||
tagProps,
|
tagProps,
|
||||||
tooltipOverride,
|
tooltipOverride,
|
||||||
|
tagType,
|
||||||
}: TagsV1Props) => {
|
}: TagsV1Props) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const color = useMemo(
|
const color = useMemo(
|
||||||
@ -88,12 +89,12 @@ const TagsV1 = ({
|
|||||||
|
|
||||||
const redirectLink = useCallback(
|
const redirectLink = useCallback(
|
||||||
() =>
|
() =>
|
||||||
tag.source === TagSource.Glossary
|
(tagType ?? tag.source) === TagSource.Glossary
|
||||||
? history.push(`${ROUTES.GLOSSARY}/${getEncodedFqn(tag.tagFQN)}`)
|
? history.push(`${ROUTES.GLOSSARY}/${getEncodedFqn(tag.tagFQN)}`)
|
||||||
: history.push(
|
: history.push(
|
||||||
`${ROUTES.TAGS}/${getEncodedFqn(Fqn.split(tag.tagFQN)[0])}`
|
`${ROUTES.TAGS}/${getEncodedFqn(Fqn.split(tag.tagFQN)[0])}`
|
||||||
),
|
),
|
||||||
[tag.source, tag.tagFQN]
|
[tagType, tag.source, tag.tagFQN]
|
||||||
);
|
);
|
||||||
|
|
||||||
const tagColorBar = useMemo(
|
const tagColorBar = useMemo(
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import { TagProps } from 'antd';
|
import { TagProps } from 'antd';
|
||||||
import { TAG_START_WITH } from '../../../constants/Tag.constants';
|
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';
|
import { HighlightedTagLabel } from '../../../utils/EntitySummaryPanelUtils';
|
||||||
|
|
||||||
export type TagsV1Props = {
|
export type TagsV1Props = {
|
||||||
@ -25,4 +25,5 @@ export type TagsV1Props = {
|
|||||||
tagProps?: TagProps;
|
tagProps?: TagProps;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltipOverride?: string;
|
tooltipOverride?: string;
|
||||||
|
tagType?: TagSource;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,12 +12,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
|
import { TagSource } from '../../../generated/type/tagLabel';
|
||||||
|
|
||||||
export interface TagsViewerProps {
|
export interface TagsViewerProps {
|
||||||
tags: EntityTags[];
|
tags: EntityTags[];
|
||||||
sizeCap?: number;
|
sizeCap?: number;
|
||||||
displayType?: DisplayType;
|
displayType?: DisplayType;
|
||||||
showNoDataPlaceholder?: boolean;
|
showNoDataPlaceholder?: boolean;
|
||||||
|
tagType?: TagSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DisplayType {
|
export enum DisplayType {
|
||||||
|
|||||||
@ -21,6 +21,13 @@ export const TAG_CONSTANT = {
|
|||||||
tagFQN: t('label.add'),
|
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 {
|
export enum TAG_START_WITH {
|
||||||
PLUS = '+',
|
PLUS = '+',
|
||||||
SOURCE_ICON = 'source_icon',
|
SOURCE_ICON = 'source_icon',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user