mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-13 09:48:19 +00:00
parent
0ee2c48cf2
commit
c50f71b478
@ -21,6 +21,7 @@ import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||
import appState from '../../AppState';
|
||||
import { useAuthContext } from '../../auth-provider/AuthProvider';
|
||||
import { getCategory } from '../../axiosAPIs/tagAPI';
|
||||
import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants';
|
||||
import { Operation } from '../../generated/entity/policies/accessControl/rule';
|
||||
import { useAuth } from '../../hooks/authHooks';
|
||||
import { getUserTeams } from '../../utils/CommonUtils';
|
||||
@ -193,7 +194,7 @@ const ManageTab: FunctionComponent<Props> = ({
|
||||
if (res.data) {
|
||||
const tierData = res.data.children.map(
|
||||
(tier: { name: string; description: string }) => ({
|
||||
id: `Tier.${tier.name}`,
|
||||
id: `Tier${FQN_SEPARATOR_CHAR}${tier.name}`,
|
||||
title: tier.name,
|
||||
description: tier.description.substring(
|
||||
0,
|
||||
|
@ -45,15 +45,15 @@ jest.mock('../../hooks/authHooks', () => ({
|
||||
const mockTierData = {
|
||||
children: [
|
||||
{
|
||||
fullyQualifiedName: 'Tier.Tier1',
|
||||
fullyQualifiedName: 'Tier:Tier1',
|
||||
description: 'description for card 1',
|
||||
},
|
||||
{
|
||||
fullyQualifiedName: 'Tier.Tier2',
|
||||
fullyQualifiedName: 'Tier:Tier2',
|
||||
description: 'description for card 2',
|
||||
},
|
||||
{
|
||||
fullyQualifiedName: 'Tier.Tier3',
|
||||
fullyQualifiedName: 'Tier:Tier3',
|
||||
description: 'description for card 3',
|
||||
},
|
||||
],
|
||||
|
@ -35,7 +35,7 @@ const followHandler = jest.fn();
|
||||
const versionHandler = jest.fn();
|
||||
const onThreadLinkSelect = jest.fn();
|
||||
const mockTier = {
|
||||
tagFQN: 'Tier.Tier1',
|
||||
tagFQN: 'Tier:Tier1',
|
||||
description: '',
|
||||
source: 'Tag',
|
||||
labelType: 'Manual',
|
||||
|
@ -27,7 +27,7 @@ const FilterContainer: FunctionComponent<FilterContainerProp> = ({
|
||||
isDisabled = false,
|
||||
}: FilterContainerProp) => {
|
||||
const getFilterName = (name = '') => {
|
||||
const formattedName = name.startsWith('Tier.Tier')
|
||||
const formattedName = name.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`)
|
||||
? name.split(FQN_SEPARATOR_CHAR)[1]
|
||||
: name;
|
||||
|
||||
|
@ -34,13 +34,13 @@ const TableDataCardBody: FunctionComponent<Props> = ({
|
||||
}: Props) => {
|
||||
const getTagValue = (tag: string | TagLabel): string | TagLabel => {
|
||||
if (isString(tag)) {
|
||||
return tag.startsWith('Tier.Tier')
|
||||
return tag.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`)
|
||||
? tag.split(FQN_SEPARATOR_CHAR)[1]
|
||||
: tag;
|
||||
} else {
|
||||
return {
|
||||
...tag,
|
||||
tagFQN: tag.tagFQN.startsWith('Tier.Tier')
|
||||
tagFQN: tag.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`)
|
||||
? tag.tagFQN.split(FQN_SEPARATOR_CHAR)[1]
|
||||
: tag.tagFQN,
|
||||
};
|
||||
|
@ -28,10 +28,10 @@ const tagList = [
|
||||
];
|
||||
|
||||
const tagListWithTier = [
|
||||
{ fqn: 'Tier.Tier1', source: 'Tag' },
|
||||
{ fqn: 'Data.Tier1Data', source: 'Tag' },
|
||||
{ fqn: 'Tier.Tier2', source: 'Glossary' },
|
||||
{ fqn: 'Count.Tier2Count', source: 'Glossary' },
|
||||
{ fqn: 'Tier:Tier1', source: 'Tag' },
|
||||
{ fqn: 'Data:Tier1Data', source: 'Tag' },
|
||||
{ fqn: 'Tier:Tier2', source: 'Glossary' },
|
||||
{ fqn: 'Count:Tier2Count', source: 'Glossary' },
|
||||
];
|
||||
const onCancel = jest.fn();
|
||||
const onSelectionChange = jest.fn();
|
||||
|
@ -16,6 +16,7 @@ import classNames from 'classnames';
|
||||
import { isNull } from 'lodash';
|
||||
import { EntityTags, TagOption } from 'Models';
|
||||
import React, { FunctionComponent, useEffect, useRef, useState } from 'react';
|
||||
import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants';
|
||||
import { Source } from '../../generated/type/tagLabel';
|
||||
import { withLoader } from '../../hoc/withLoader';
|
||||
import { Button } from '../buttons/Button/Button';
|
||||
@ -76,7 +77,7 @@ const TagsContainer: FunctionComponent<TagsContainerProps> = ({
|
||||
.filter((tag) => {
|
||||
return !tags.some((selectedTag) => selectedTag.tagFQN === tag.fqn);
|
||||
})
|
||||
.filter((tag) => !tag.fqn?.startsWith('Tier.Tier')) // To filter out Tier tags
|
||||
.filter((tag) => !tag.fqn?.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`)) // To filter out Tier tags
|
||||
.map((tag) => {
|
||||
return {
|
||||
name: tag.fqn,
|
||||
|
@ -11,6 +11,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FQN_SEPARATOR_CHAR } from './char.constants';
|
||||
|
||||
export const FOLLOWERS_VIEW_CAP = 20;
|
||||
export const JSON_TAB_SIZE = 2;
|
||||
export const PAGE_SIZE = 10;
|
||||
@ -59,11 +61,11 @@ export const ONLY_NUMBER_REGEX = /^[0-9\b]+$/;
|
||||
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
export const tiers = [
|
||||
{ key: 'Tier.Tier1', doc_count: 0 },
|
||||
{ key: 'Tier.Tier2', doc_count: 0 },
|
||||
{ key: 'Tier.Tier3', doc_count: 0 },
|
||||
{ key: 'Tier.Tier4', doc_count: 0 },
|
||||
{ key: 'Tier.Tier5', doc_count: 0 },
|
||||
{ key: `Tier${FQN_SEPARATOR_CHAR}Tier1`, doc_count: 0 },
|
||||
{ key: `Tier${FQN_SEPARATOR_CHAR}Tier2`, doc_count: 0 },
|
||||
{ key: `Tier${FQN_SEPARATOR_CHAR}Tier3`, doc_count: 0 },
|
||||
{ key: `Tier${FQN_SEPARATOR_CHAR}Tier4`, doc_count: 0 },
|
||||
{ key: `Tier${FQN_SEPARATOR_CHAR}Tier5`, doc_count: 0 },
|
||||
];
|
||||
|
||||
export const versionTypes = [
|
||||
|
@ -11,6 +11,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FQN_SEPARATOR_CHAR } from './char.constants';
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const mockFeedData = [
|
||||
@ -3746,7 +3748,7 @@ export const mockSearchData = {
|
||||
'User.CreditCardNumber',
|
||||
],
|
||||
fqdn: 'bigquery.shopify.fact_sale',
|
||||
tier: 'Tier.Tier1',
|
||||
tier: `Tier${FQN_SEPARATOR_CHAR}Tier1`,
|
||||
schema_description: null,
|
||||
owner: '',
|
||||
followers: [],
|
||||
@ -3787,7 +3789,7 @@ export const mockSearchData = {
|
||||
sum_other_doc_count: 0,
|
||||
buckets: [
|
||||
{
|
||||
key: 'Tier.Tier1',
|
||||
key: `Tier${FQN_SEPARATOR_CHAR}Tier1`,
|
||||
doc_count: 1,
|
||||
},
|
||||
],
|
||||
@ -3894,7 +3896,7 @@ export const mockSearchData = {
|
||||
sum_other_doc_count: 0,
|
||||
buckets: [
|
||||
{
|
||||
key: 'Tier.Tier1',
|
||||
key: `Tier${FQN_SEPARATOR_CHAR}Tier1`,
|
||||
doc_count: 1,
|
||||
},
|
||||
],
|
||||
@ -4001,7 +4003,7 @@ export const mockSearchData = {
|
||||
sum_other_doc_count: 0,
|
||||
buckets: [
|
||||
{
|
||||
key: 'Tier.Tier1',
|
||||
key: `Tier${FQN_SEPARATOR_CHAR}Tier1`,
|
||||
doc_count: 1,
|
||||
},
|
||||
],
|
||||
@ -4108,7 +4110,7 @@ export const mockSearchData = {
|
||||
sum_other_doc_count: 0,
|
||||
buckets: [
|
||||
{
|
||||
key: 'Tier.Tier1',
|
||||
key: `Tier${FQN_SEPARATOR_CHAR}Tier1`,
|
||||
doc_count: 1,
|
||||
},
|
||||
],
|
||||
|
@ -662,7 +662,9 @@ const DatabaseDetails: FunctionComponent = () => {
|
||||
sizeCap={-1}
|
||||
tags={(table.tags || []).map((tag) => ({
|
||||
...tag,
|
||||
tagFQN: tag.tagFQN?.startsWith('Tier.Tier')
|
||||
tagFQN: tag.tagFQN?.startsWith(
|
||||
`Tier${FQN_SEPARATOR_CHAR}Tier`
|
||||
)
|
||||
? tag.tagFQN.split(FQN_SEPARATOR_CHAR)[1]
|
||||
: tag.tagFQN,
|
||||
}))}
|
||||
|
@ -127,7 +127,7 @@ const createGlossaryTermNode = (
|
||||
leafFqn: string,
|
||||
name: string
|
||||
): GlossaryTermTreeNode => {
|
||||
const arrFQN = leafFqn.split(`${name}.`);
|
||||
const arrFQN = leafFqn.split(`${name}${FQN_SEPARATOR_CHAR}`);
|
||||
const childName = arrFQN[1]?.split(FQN_SEPARATOR_CHAR)[0];
|
||||
|
||||
return !childName
|
||||
@ -239,7 +239,9 @@ export const getActionsList = () => {
|
||||
*/
|
||||
export const getHierarchicalKeysByFQN = (fqn: string) => {
|
||||
const keys = fqn.split(FQN_SEPARATOR_CHAR).reduce((prev, curr) => {
|
||||
const currFqn = prev.length ? `${prev[prev.length - 1]}.${curr}` : curr;
|
||||
const currFqn = prev.length
|
||||
? `${prev[prev.length - 1]}${FQN_SEPARATOR_CHAR}${curr}`
|
||||
: curr;
|
||||
|
||||
return [...prev, currFqn];
|
||||
}, [] as string[]);
|
||||
|
@ -18,6 +18,7 @@ import { EntityTags, TableDetail } from 'Models';
|
||||
import React, { Fragment } from 'react';
|
||||
import AppState from '../AppState';
|
||||
import PopOver from '../components/common/popover/PopOver';
|
||||
import { FQN_SEPARATOR_CHAR } from '../constants/char.constants';
|
||||
import {
|
||||
getDashboardDetailsPath,
|
||||
getDatabaseDetailsPath,
|
||||
@ -74,7 +75,7 @@ export const getTierFromTableTags = (
|
||||
): EntityTags['tagFQN'] => {
|
||||
const tierTag = tags.find(
|
||||
(item) =>
|
||||
item.tagFQN.startsWith('Tier.Tier') &&
|
||||
item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) &&
|
||||
!isNaN(parseInt(item.tagFQN.substring(9).trim()))
|
||||
);
|
||||
|
||||
@ -84,7 +85,7 @@ export const getTierFromTableTags = (
|
||||
export const getTierTags = (tags: Array<TagLabel>) => {
|
||||
const tierTag = tags.find(
|
||||
(item) =>
|
||||
item.tagFQN.startsWith('Tier.Tier') &&
|
||||
item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) &&
|
||||
!isNaN(parseInt(item.tagFQN.substring(9).trim()))
|
||||
);
|
||||
|
||||
@ -96,7 +97,7 @@ export const getTagsWithoutTier = (
|
||||
): Array<EntityTags> => {
|
||||
return tags.filter(
|
||||
(item) =>
|
||||
!item.tagFQN.startsWith('Tier.Tier') ||
|
||||
!item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) ||
|
||||
isNaN(parseInt(item.tagFQN.substring(9).trim()))
|
||||
);
|
||||
};
|
||||
@ -104,7 +105,8 @@ export const getTagsWithoutTier = (
|
||||
export const getTierFromSearchTableTags = (tags: Array<string>): string => {
|
||||
const tierTag = tags.find(
|
||||
(item) =>
|
||||
item.startsWith('Tier.Tier') && !isNaN(parseInt(item.substring(9).trim()))
|
||||
item.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) &&
|
||||
!isNaN(parseInt(item.substring(9).trim()))
|
||||
);
|
||||
|
||||
return tierTag || '';
|
||||
@ -115,7 +117,8 @@ export const getSearchTableTagsWithoutTier = (
|
||||
): Array<string> => {
|
||||
return tags.filter(
|
||||
(item) =>
|
||||
!item.startsWith('Tier.Tier') || isNaN(parseInt(item.substring(9).trim()))
|
||||
!item.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) ||
|
||||
isNaN(parseInt(item.substring(9).trim()))
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user