ui: UI to use Tier TAG displayName if provided #12899 (#13105)

* ui: UI to use Tier TAG displayName if provided #12899

* updated tier label with displayName
This commit is contained in:
Shailesh Parmar 2023-10-04 01:26:14 +05:30 committed by GitHub
parent b5aff6bbc3
commit efa0802995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 236 additions and 269 deletions

View File

@ -43,6 +43,7 @@ import {
PRIMERY_COLOR, PRIMERY_COLOR,
} from '../../constants/constants'; } from '../../constants/constants';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { Tag } from '../../generated/entity/classification/tag';
import { Dashboard } from '../../generated/entity/data/dashboard'; import { Dashboard } from '../../generated/entity/data/dashboard';
import { DataProduct } from '../../generated/entity/domains/dataProduct'; import { DataProduct } from '../../generated/entity/domains/dataProduct';
import { ThreadType } from '../../generated/entity/feed/thread'; import { ThreadType } from '../../generated/entity/feed/thread';
@ -62,6 +63,7 @@ import {
searchTagInData, searchTagInData,
} from '../../utils/TableTags/TableTags.utils'; } from '../../utils/TableTags/TableTags.utils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel'; import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable'; import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable';
@ -259,17 +261,8 @@ const DashboardDetails = ({
[owner] [owner]
); );
const onTierUpdate = async (newTier?: string) => { const onTierUpdate = async (newTier?: Tag) => {
const tierTag: Dashboard['tags'] = newTier const tierTag = updateTierTag(dashboardDetails?.tags ?? [], newTier);
? [
...getTagsWithoutTier(dashboardDetails.tags as Array<EntityTags>),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(dashboardDetails.tags ?? []);
const updatedDashboard = { const updatedDashboard = {
...dashboardDetails, ...dashboardDetails,
tags: tierTag, tags: tierTag,

View File

@ -37,7 +37,6 @@ import EntityHeaderTitle from '../../../components/Entity/EntityHeaderTitle/Enti
import { useTourProvider } from '../../../components/TourProvider/TourProvider'; import { useTourProvider } from '../../../components/TourProvider/TourProvider';
import Voting from '../../../components/Voting/Voting.component'; import Voting from '../../../components/Voting/Voting.component';
import { VotingDataProps } from '../../../components/Voting/voting.interface'; import { VotingDataProps } from '../../../components/Voting/voting.interface';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { DE_ACTIVE_COLOR } from '../../../constants/constants'; import { DE_ACTIVE_COLOR } from '../../../constants/constants';
import { SERVICE_TYPES } from '../../../constants/Services.constant'; import { SERVICE_TYPES } from '../../../constants/Services.constant';
import { EntityTabs, EntityType } from '../../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../../enums/entity.enum';
@ -374,7 +373,7 @@ export const DataAssetsHeader = ({
<Space> <Space>
{tier ? ( {tier ? (
<span className="font-medium text-xs" data-testid="Tier"> <span className="font-medium text-xs" data-testid="Tier">
{tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1]} {getEntityName(tier)}
</span> </span>
) : ( ) : (
<span className="font-medium text-xs" data-testid="Tier"> <span className="font-medium text-xs" data-testid="Tier">

View File

@ -16,6 +16,7 @@ import { EntityName } from '../../../components/Modals/EntityNameModal/EntityNam
import { OperationPermission } from '../../../components/PermissionProvider/PermissionProvider.interface'; import { OperationPermission } from '../../../components/PermissionProvider/PermissionProvider.interface';
import { QueryVote } from '../../../components/TableQueries/TableQueries.interface'; import { QueryVote } from '../../../components/TableQueries/TableQueries.interface';
import { EntityType } from '../../../enums/entity.enum'; import { EntityType } from '../../../enums/entity.enum';
import { Tag } from '../../../generated/entity/classification/tag';
import { Container } from '../../../generated/entity/data/container'; import { Container } from '../../../generated/entity/data/container';
import { Dashboard } from '../../../generated/entity/data/dashboard'; import { Dashboard } from '../../../generated/entity/data/dashboard';
import { DashboardDataModel } from '../../../generated/entity/data/dashboardDataModel'; import { DashboardDataModel } from '../../../generated/entity/data/dashboardDataModel';
@ -91,7 +92,7 @@ export type DataAssetsHeaderProps = {
isRecursiveDelete?: boolean; isRecursiveDelete?: boolean;
afterDomainUpdateAction?: (asset: DataAssetWithDomains) => void; afterDomainUpdateAction?: (asset: DataAssetWithDomains) => void;
afterDeleteAction?: (isSoftDelete?: boolean) => void; afterDeleteAction?: (isSoftDelete?: boolean) => void;
onTierUpdate: (tier?: string) => Promise<void>; onTierUpdate: (tier?: Tag) => Promise<void>;
onOwnerUpdate: (owner?: EntityReference) => Promise<void>; onOwnerUpdate: (owner?: EntityReference) => Promise<void>;
onVersionClick?: () => void; onVersionClick?: () => void;
onFollowClick?: () => Promise<void>; onFollowClick?: () => Promise<void>;

View File

@ -13,7 +13,7 @@
import { Card, Col, Row } from 'antd'; import { Card, Col, Row } from 'antd';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { isEmpty, round, uniqueId } from 'lodash'; import { isEmpty, round } from 'lodash';
import React, { FC, useEffect, useMemo, useState } from 'react'; import React, { FC, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
@ -36,7 +36,6 @@ import {
import { import {
BAR_CHART_MARGIN, BAR_CHART_MARGIN,
DI_STRUCTURE, DI_STRUCTURE,
TIER_DATA,
TOTAL_ENTITY_CHART_COLOR, TOTAL_ENTITY_CHART_COLOR,
} from '../../constants/DataInsight.constants'; } from '../../constants/DataInsight.constants';
import { DataReportIndex } from '../../generated/dataInsight/dataInsightChart'; import { DataReportIndex } from '../../generated/dataInsight/dataInsightChart';
@ -44,6 +43,7 @@ import {
DataInsightChartResult, DataInsightChartResult,
DataInsightChartType, DataInsightChartType,
} from '../../generated/dataInsight/dataInsightChartResult'; } from '../../generated/dataInsight/dataInsightChartResult';
import { Tag } from '../../generated/entity/classification/tag';
import { ChartFilter } from '../../interface/data-insight.interface'; import { ChartFilter } from '../../interface/data-insight.interface';
import { getAggregateChartData } from '../../rest/DataInsightAPI'; import { getAggregateChartData } from '../../rest/DataInsightAPI';
import { import {
@ -55,6 +55,7 @@ import {
getGraphDataByTierType, getGraphDataByTierType,
renderLegend, renderLegend,
} from '../../utils/DataInsightUtils'; } from '../../utils/DataInsightUtils';
import { getEntityName } from '../../utils/EntityUtils';
import { showErrorToast } from '../../utils/ToastUtils'; import { showErrorToast } from '../../utils/ToastUtils';
import './DataInsightDetail.less'; import './DataInsightDetail.less';
import DataInsightProgressBar from './DataInsightProgressBar'; import DataInsightProgressBar from './DataInsightProgressBar';
@ -64,13 +65,14 @@ import EntitySummaryProgressBar from './EntitySummaryProgressBar.component';
interface Props { interface Props {
chartFilter: ChartFilter; chartFilter: ChartFilter;
selectedDays: number; selectedDays: number;
tierTags: { tags: Tag[]; isLoading: boolean };
} }
const TierInsight: FC<Props> = ({ chartFilter, selectedDays }) => { const TierInsight: FC<Props> = ({ chartFilter, selectedDays, tierTags }) => {
const [totalEntitiesByTier, setTotalEntitiesByTier] = const [totalEntitiesByTier, setTotalEntitiesByTier] =
useState<DataInsightChartResult>(); useState<DataInsightChartResult>();
const [isLoading, setIsLoading] = useState<boolean>(false); const [isLoading, setIsLoading] = useState<boolean>(true);
const [activeKeys, setActiveKeys] = useState<string[]>([]); const [activeKeys, setActiveKeys] = useState<string[]>([]);
const [activeMouseHoverKey, setActiveMouseHoverKey] = useState(''); const [activeMouseHoverKey, setActiveMouseHoverKey] = useState('');
@ -89,8 +91,17 @@ const TierInsight: FC<Props> = ({ chartFilter, selectedDays }) => {
dataReportIndex: DataReportIndex.EntityReportDataIndex, dataReportIndex: DataReportIndex.EntityReportDataIndex,
}; };
const response = await getAggregateChartData(params); const response = await getAggregateChartData(params);
const updatedRes = response.data?.map((data) => {
const currentTier = tierTags.tags.find(
(value) => value.fullyQualifiedName === data.entityTier
);
setTotalEntitiesByTier(response); return {
...data,
entityTier: getEntityName(currentTier) || data.entityTier,
};
});
setTotalEntitiesByTier({ ...response, data: updatedRes });
} catch (error) { } catch (error) {
showErrorToast(error as AxiosError); showErrorToast(error as AxiosError);
} finally { } finally {
@ -111,8 +122,10 @@ const TierInsight: FC<Props> = ({ chartFilter, selectedDays }) => {
}; };
useEffect(() => { useEffect(() => {
fetchTotalEntitiesByTier(); if (!tierTags.isLoading) {
}, [chartFilter]); fetchTotalEntitiesByTier();
}
}, [chartFilter, tierTags]);
return ( return (
<Card <Card
@ -150,7 +163,7 @@ const TierInsight: FC<Props> = ({ chartFilter, selectedDays }) => {
<Legend <Legend
align="left" align="left"
content={(props) => content={(props) =>
renderLegend(props as LegendProps, activeKeys, true) renderLegend(props as LegendProps, activeKeys)
} }
layout="horizontal" layout="horizontal"
verticalAlign="top" verticalAlign="top"
@ -197,9 +210,9 @@ const TierInsight: FC<Props> = ({ chartFilter, selectedDays }) => {
</Col> </Col>
{tiers.map((tiers, i) => { {tiers.map((tiers, i) => {
return ( return (
<Col key={uniqueId()} span={24}> <Col key={tiers} span={24}>
<EntitySummaryProgressBar <EntitySummaryProgressBar
entity={TIER_DATA[tiers as keyof typeof TIER_DATA]} entity={tiers}
label={round(latestData[tiers] || 0, 2) + '%'} label={round(latestData[tiers] || 0, 2) + '%'}
latestData={latestData} latestData={latestData}
pluralize={false} pluralize={false}

View File

@ -16,6 +16,7 @@ import { DataAssetWithDomains } from '../../components/DataAssets/DataAssetsHead
import { OperationPermission } from '../../components/PermissionProvider/PermissionProvider.interface'; import { OperationPermission } from '../../components/PermissionProvider/PermissionProvider.interface';
import { QueryVote } from '../../components/TableQueries/TableQueries.interface'; import { QueryVote } from '../../components/TableQueries/TableQueries.interface';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel'; import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel';
import { Column } from '../../generated/entity/data/table'; import { Column } from '../../generated/entity/data/table';
import { EntityReference } from '../../generated/entity/type'; import { EntityReference } from '../../generated/entity/type';
@ -29,7 +30,7 @@ export interface DataModelDetailsProps {
handleFollowDataModel: () => Promise<void>; handleFollowDataModel: () => Promise<void>;
handleUpdateTags: (selectedTags?: EntityTags[]) => void; handleUpdateTags: (selectedTags?: EntityTags[]) => void;
handleUpdateOwner: (owner?: EntityReference) => Promise<void>; handleUpdateOwner: (owner?: EntityReference) => Promise<void>;
handleUpdateTier: (tier?: string) => Promise<void>; handleUpdateTier: (tier?: Tag) => Promise<void>;
handleUpdateDescription: (value: string) => Promise<void>; handleUpdateDescription: (value: string) => Promise<void>;
handleColumnUpdateDataModel: (updatedDataModel: Column[]) => Promise<void>; handleColumnUpdateDataModel: (updatedDataModel: Column[]) => Promise<void>;
onUpdateVote: (data: QueryVote, id: string) => Promise<void>; onUpdateVote: (data: QueryVote, id: string) => Promise<void>;

View File

@ -13,20 +13,22 @@
import { Space } from 'antd'; import { Space } from 'antd';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { isEqual, isString, uniqWith } from 'lodash'; import { isEqual, isString, isUndefined, uniqWith } from 'lodash';
import { Bucket } from 'Models'; import { Bucket } from 'Models';
import Qs from 'qs'; import Qs from 'qs';
import React, { FC, useCallback, useMemo, useState } from 'react'; import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { import {
MISC_FIELDS, MISC_FIELDS,
OWNER_QUICK_FILTER_DEFAULT_OPTIONS_KEY, OWNER_QUICK_FILTER_DEFAULT_OPTIONS_KEY,
} from '../../constants/AdvancedSearch.constants'; } from '../../constants/AdvancedSearch.constants';
import { TIER_FQN_KEY } from '../../constants/explore.constants';
import { SearchIndex } from '../../enums/search.enum'; import { SearchIndex } from '../../enums/search.enum';
import { QueryFilterInterface } from '../../pages/explore/ExplorePage.interface'; import { QueryFilterInterface } from '../../pages/explore/ExplorePage.interface';
import { getAggregateFieldOptions } from '../../rest/miscAPI'; import { getAggregateFieldOptions } from '../../rest/miscAPI';
import { getTags } from '../../rest/tagAPI'; import { getTags } from '../../rest/tagAPI';
import { getOptionsFromAggregationBucket } from '../../utils/AdvancedSearchUtils'; import { getOptionsFromAggregationBucket } from '../../utils/AdvancedSearchUtils';
import { getEntityName } from '../../utils/EntityUtils';
import { getCombinedQueryFilterObject } from '../../utils/ExplorePage/ExplorePageUtils'; import { getCombinedQueryFilterObject } from '../../utils/ExplorePage/ExplorePageUtils';
import { showErrorToast } from '../../utils/ToastUtils'; import { showErrorToast } from '../../utils/ToastUtils';
import SearchDropdown from '../SearchDropdown/SearchDropdown'; import SearchDropdown from '../SearchDropdown/SearchDropdown';
@ -81,7 +83,7 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
) => { ) => {
let buckets: Bucket[] = []; let buckets: Bucket[] = [];
if (aggregations?.[key] && key !== 'tier.tagFQN') { if (aggregations?.[key] && key !== TIER_FQN_KEY) {
buckets = aggregations[key].buckets; buckets = aggregations[key].buckets;
} else { } else {
const [res, tierTags] = await Promise.all([ const [res, tierTags] = await Promise.all([
@ -91,14 +93,14 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
'', '',
JSON.stringify(combinedQueryFilter) JSON.stringify(combinedQueryFilter)
), ),
key === 'tier.tagFQN' key === TIER_FQN_KEY
? getTags({ parent: 'Tier' }) ? getTags({ parent: 'Tier' })
: Promise.resolve(null), : Promise.resolve(null),
]); ]);
buckets = res.data.aggregations[`sterms#${key}`].buckets; buckets = res.data.aggregations[`sterms#${key}`].buckets;
if (key === 'tier.tagFQN' && tierTags) { if (key === TIER_FQN_KEY && tierTags) {
const options = tierTags.data.map((option) => { const options = tierTags.data.map((option) => {
const bucketItem = buckets.find( const bucketItem = buckets.find(
(item) => item.key === option.fullyQualifiedName (item) => item.key === option.fullyQualifiedName
@ -106,7 +108,7 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
return { return {
key: option.fullyQualifiedName ?? '', key: option.fullyQualifiedName ?? '',
label: option.name, label: getEntityName(option),
count: bucketItem?.doc_count ?? 0, count: bucketItem?.doc_count ?? 0,
}; };
}); });
@ -148,7 +150,7 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
return; return;
} }
if (aggregations?.[key] && key !== 'tier.tagFQN') { if (aggregations?.[key] && key !== TIER_FQN_KEY) {
const res = await getAggregateFieldOptions( const res = await getAggregateFieldOptions(
index, index,
key, key,
@ -158,7 +160,7 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
const buckets = res.data.aggregations[`sterms#${key}`].buckets; const buckets = res.data.aggregations[`sterms#${key}`].buckets;
setOptions(uniqWith(getOptionsFromAggregationBucket(buckets), isEqual)); setOptions(uniqWith(getOptionsFromAggregationBucket(buckets), isEqual));
} else if (key === 'tier.tagFQN') { } else if (key === TIER_FQN_KEY) {
const filteredOptions = tierOptions?.filter((option) => { const filteredOptions = tierOptions?.filter((option) => {
return option.label.toLowerCase().includes(value.toLowerCase()); return option.label.toLowerCase().includes(value.toLowerCase());
}); });
@ -171,25 +173,43 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
} }
}; };
useEffect(() => {
const tierField = fields.find((value) => value.key === TIER_FQN_KEY);
if (tierField?.value?.length && isUndefined(tierOptions)) {
fetchDefaultOptions(index, TIER_FQN_KEY);
}
}, [fields]);
return ( return (
<Space wrap className="explore-quick-filters-container" size={[4, 0]}> <Space wrap className="explore-quick-filters-container" size={[4, 0]}>
{fields.map((field) => ( {fields.map((field) => {
<SearchDropdown const selectedKeys =
highlight field.key === TIER_FQN_KEY && options?.length
fixedOrderOptions={field.key === 'tier.tagFQN'} ? field.value?.map((value) => {
isSuggestionsLoading={isOptionsLoading} return (
key={field.key} options?.find((option) => option.key === value.key) ?? value
label={field.label} );
options={options || []} })
searchKey={field.key} : field.value;
selectedKeys={field.value || []}
onChange={(updatedValues) => { return (
onFieldValueSelect({ ...field, value: updatedValues }); <SearchDropdown
}} highlight
onGetInitialOptions={getInitialOptions} fixedOrderOptions={field.key === TIER_FQN_KEY}
onSearch={getFilterOptions} isSuggestionsLoading={isOptionsLoading}
/> key={field.key}
))} label={field.label}
options={options ?? []}
searchKey={field.key}
selectedKeys={selectedKeys ?? []}
onChange={(updatedValues) => {
onFieldValueSelect({ ...field, value: updatedValues });
}}
onGetInitialOptions={getInitialOptions}
onSearch={getFilterOptions}
/>
);
})}
</Space> </Space>
); );
}; };

View File

@ -17,7 +17,6 @@ import { ExtraInfo } from 'Models';
import React, { forwardRef, useMemo } from 'react'; import React, { forwardRef, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link, useParams } from 'react-router-dom'; import { Link, useParams } from 'react-router-dom';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { EntityType } from '../../../enums/entity.enum'; import { EntityType } from '../../../enums/entity.enum';
import { OwnerType } from '../../../enums/user.enum'; import { OwnerType } from '../../../enums/user.enum';
import { EntityReference } from '../../../generated/entity/type'; import { EntityReference } from '../../../generated/entity/type';
@ -62,7 +61,7 @@ const ExploreSearchCard: React.FC<ExploreSearchCardProps> = forwardRef<
const otherDetails = useMemo(() => { const otherDetails = useMemo(() => {
const tierValue = isString(source.tier) const tierValue = isString(source.tier)
? source.tier ? source.tier
: source.tier?.tagFQN?.split(FQN_SEPARATOR_CHAR)?.[1] ?? ''; : getEntityName(source.tier);
const profileName = const profileName =
source.owner?.type === OwnerType.USER ? source.owner?.name : undefined; source.owner?.type === OwnerType.USER ? source.owner?.name : undefined;

View File

@ -34,6 +34,7 @@ import { DisplayType } from '../../components/Tag/TagsViewer/TagsViewer.interfac
import { getMlModelDetailsPath } from '../../constants/constants'; import { getMlModelDetailsPath } from '../../constants/constants';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { MlHyperParameter } from '../../generated/api/data/createMlModel'; import { MlHyperParameter } from '../../generated/api/data/createMlModel';
import { Tag } from '../../generated/entity/classification/tag';
import { Mlmodel, MlStore } from '../../generated/entity/data/mlmodel'; import { Mlmodel, MlStore } from '../../generated/entity/data/mlmodel';
import { ThreadType } from '../../generated/entity/feed/thread'; import { ThreadType } from '../../generated/entity/feed/thread';
import { TagLabel, TagSource } from '../../generated/type/schema'; import { TagLabel, TagSource } from '../../generated/type/schema';
@ -45,6 +46,7 @@ import { getEntityFieldThreadCounts } from '../../utils/FeedUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel'; import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable'; import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable';
@ -185,17 +187,8 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
[mlModelDetail, mlModelDetail.owner] [mlModelDetail, mlModelDetail.owner]
); );
const onTierUpdate = async (newTier?: string) => { const onTierUpdate = async (newTier?: Tag) => {
const tierTag: Mlmodel['tags'] = newTier const tierTag = updateTierTag(mlModelDetail?.tags ?? [], newTier);
? [
...mlModelTags,
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(mlModelDetail.tags ?? []);
const updatedMlModelDetails = { const updatedMlModelDetails = {
...mlModelDetail, ...mlModelDetail,
tags: tierTag, tags: tierTag,

View File

@ -47,6 +47,7 @@ import {
import { PIPELINE_TASK_TABS } from '../../constants/pipeline.constants'; import { PIPELINE_TASK_TABS } from '../../constants/pipeline.constants';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { import {
Pipeline, Pipeline,
PipelineStatus, PipelineStatus,
@ -68,6 +69,7 @@ import {
searchTagInData, searchTagInData,
} from '../../utils/TableTags/TableTags.utils'; } from '../../utils/TableTags/TableTags.utils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel'; import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
import { ModalWithMarkdownEditor } from '../Modals/ModalWithMarkdownEditor/ModalWithMarkdownEditor'; import { ModalWithMarkdownEditor } from '../Modals/ModalWithMarkdownEditor/ModalWithMarkdownEditor';
@ -225,17 +227,8 @@ const PipelineDetails = ({
[owner] [owner]
); );
const onTierUpdate = async (newTier?: string) => { const onTierUpdate = async (newTier?: Tag) => {
const tierTag: Pipeline['tags'] = newTier const tierTag = updateTierTag(pipelineDetails?.tags ?? [], newTier);
? [
...getTagsWithoutTier(pipelineDetails.tags as Array<EntityTags>),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(pipelineDetails.tags ?? []);
const updatedPipelineDetails = { const updatedPipelineDetails = {
...pipelineDetails, ...pipelineDetails,
tags: tierTag, tags: tierTag,

View File

@ -24,6 +24,7 @@ import { ReactComponent as IconTag } from '../../../assets/svg/classification.sv
import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg'; import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg';
import { TAG_START_WITH } from '../../../constants/Tag.constants'; import { TAG_START_WITH } from '../../../constants/Tag.constants';
import { reduceColorOpacity } from '../../../utils/CommonUtils'; import { reduceColorOpacity } from '../../../utils/CommonUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import Fqn from '../../../utils/Fqn'; import Fqn from '../../../utils/Fqn';
import { getEncodedFqn } from '../../../utils/StringsUtils'; import { getEncodedFqn } from '../../../utils/StringsUtils';
import { TagsV1Props } from './TagsV1.interface'; import { TagsV1Props } from './TagsV1.interface';
@ -68,12 +69,15 @@ const TagsV1 = ({
const tagName = useMemo( const tagName = useMemo(
() => () =>
showOnlyName getEntityName(tag) ||
? tag.tagFQN getTagDisplay(
.split(FQN_SEPARATOR_CHAR) showOnlyName
.slice(-2) ? tag.tagFQN
.join(FQN_SEPARATOR_CHAR) .split(FQN_SEPARATOR_CHAR)
: tag.tagFQN, .slice(-2)
.join(FQN_SEPARATOR_CHAR)
: tag.tagFQN
),
[showOnlyName, tag.tagFQN] [showOnlyName, tag.tagFQN]
); );
@ -105,7 +109,7 @@ const TagsV1 = ({
ellipsis ellipsis
className="m-0 tags-label" className="m-0 tags-label"
data-testid={`tag-${tag.tagFQN}`}> data-testid={`tag-${tag.tagFQN}`}>
{getTagDisplay(tagName)} {tagName}
</Typography.Paragraph> </Typography.Paragraph>
</div> </div>
</div> </div>

View File

@ -35,6 +35,7 @@ import { DisplayType } from '../../components/Tag/TagsViewer/TagsViewer.interfac
import { getTopicDetailsPath } from '../../constants/constants'; import { getTopicDetailsPath } from '../../constants/constants';
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum'; import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { Tag } from '../../generated/entity/classification/tag';
import { Topic } from '../../generated/entity/data/topic'; import { Topic } from '../../generated/entity/data/topic';
import { DataProduct } from '../../generated/entity/domains/dataProduct'; import { DataProduct } from '../../generated/entity/domains/dataProduct';
import { ThreadType } from '../../generated/entity/feed/thread'; import { ThreadType } from '../../generated/entity/feed/thread';
@ -48,6 +49,7 @@ import {
} from '../../utils/EntityUtils'; } from '../../utils/EntityUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel'; import ActivityThreadPanel from '../ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable'; import { CustomPropertyTable } from '../common/CustomPropertyTable/CustomPropertyTable';
@ -213,17 +215,8 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
[owner] [owner]
); );
const onTierUpdate = (newTier?: string) => { const onTierUpdate = (newTier?: Tag) => {
const tierTag: Topic['tags'] = newTier const tierTag = updateTierTag(topicDetails?.tags ?? [], newTier);
? [
...getTagsWithoutTier(topicDetails.tags as Array<EntityTags>),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(topicDetails.tags ?? []);
const updatedTopicDetails = { const updatedTopicDetails = {
...topicDetails, ...topicDetails,
tags: tierTag, tags: tierTag,

View File

@ -22,6 +22,7 @@ import { ReactComponent as EditIcon } from '../../../assets/svg/edit-new.svg';
import { ReactComponent as IconExternalLink } from '../../../assets/svg/external-links.svg'; import { ReactComponent as IconExternalLink } from '../../../assets/svg/external-links.svg';
import { ReactComponent as IconTeamsGrey } from '../../../assets/svg/teams-grey.svg'; import { ReactComponent as IconTeamsGrey } from '../../../assets/svg/teams-grey.svg';
import { DE_ACTIVE_COLOR } from '../../../constants/constants'; import { DE_ACTIVE_COLOR } from '../../../constants/constants';
import { Tag } from '../../../generated/entity/classification/tag';
import { Dashboard } from '../../../generated/entity/data/dashboard'; import { Dashboard } from '../../../generated/entity/data/dashboard';
import { Table } from '../../../generated/entity/data/table'; import { Table } from '../../../generated/entity/data/table';
import { TagLabel } from '../../../generated/type/tagLabel'; import { TagLabel } from '../../../generated/type/tagLabel';
@ -38,7 +39,7 @@ export interface GetInfoElementsProps {
updateOwner?: (value: Table['owner']) => void; updateOwner?: (value: Table['owner']) => void;
tier?: TagLabel; tier?: TagLabel;
currentTier?: string; currentTier?: string;
updateTier?: (value?: string) => void; updateTier?: (value?: Tag) => void;
currentOwner?: Dashboard['owner']; currentOwner?: Dashboard['owner'];
deleted?: boolean; deleted?: boolean;
allowTeamOwner?: boolean; allowTeamOwner?: boolean;

View File

@ -12,6 +12,7 @@
*/ */
import { TableDetail } from 'Models'; import { TableDetail } from 'Models';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
import { Tag } from '../../../generated/entity/classification/tag';
import { EntityReference } from '../../../generated/type/entityReference'; import { EntityReference } from '../../../generated/type/entityReference';
export type CardWithListItems = { export type CardWithListItems = {
@ -23,7 +24,7 @@ export type CardWithListItems = {
export interface TierCardProps { export interface TierCardProps {
currentTier?: string; currentTier?: string;
updateTier?: (value?: string) => void; updateTier?: (value?: Tag) => void;
onSave?: ( onSave?: (
owner?: EntityReference, owner?: EntityReference,
tier?: TableDetail['tier'], tier?: TableDetail['tier'],

View File

@ -24,7 +24,9 @@ import { AxiosError } from 'axios';
import { t } from 'i18next'; import { t } from 'i18next';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants'; import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { Tag } from '../../../generated/entity/classification/tag';
import { getTags } from '../../../rest/tagAPI'; import { getTags } from '../../../rest/tagAPI';
import { getEntityName } from '../../../utils/EntityUtils';
import { showErrorToast } from '../../../utils/ToastUtils'; import { showErrorToast } from '../../../utils/ToastUtils';
import Loader from '../../Loader/Loader'; import Loader from '../../Loader/Loader';
import RichTextEditorPreviewer from '../rich-text-editor/RichTextEditorPreviewer'; import RichTextEditorPreviewer from '../rich-text-editor/RichTextEditorPreviewer';
@ -33,7 +35,10 @@ import { CardWithListItems, TierCardProps } from './TierCard.interface';
const { Panel } = Collapse; const { Panel } = Collapse;
const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => { const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
const [tierData, setTierData] = useState<Array<CardWithListItems>>([]); const [tiers, setTiers] = useState<Array<Tag>>([]);
const [tierCardData, setTierCardData] = useState<Array<CardWithListItems>>(
[]
);
const [isLoadingTierData, setIsLoadingTierData] = useState<boolean>(false); const [isLoadingTierData, setIsLoadingTierData] = useState<boolean>(false);
const getTierData = async () => { const getTierData = async () => {
@ -47,7 +52,7 @@ const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
const tierData: CardWithListItems[] = const tierData: CardWithListItems[] =
data.map((tier: { name: string; description: string }) => ({ data.map((tier: { name: string; description: string }) => ({
id: `Tier${FQN_SEPARATOR_CHAR}${tier.name}`, id: `Tier${FQN_SEPARATOR_CHAR}${tier.name}`,
title: tier.name, title: getEntityName(tier),
description: tier.description.substring( description: tier.description.substring(
0, 0,
tier.description.indexOf('\n\n') tier.description.indexOf('\n\n')
@ -56,9 +61,10 @@ const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
tier.description.indexOf('\n\n') + 1 tier.description.indexOf('\n\n') + 1
), ),
})) ?? []; })) ?? [];
setTierData(tierData); setTierCardData(tierData);
setTiers(data);
} else { } else {
setTierData([]); setTierCardData([]);
} }
} catch (err) { } catch (err) {
showErrorToast( showErrorToast(
@ -73,7 +79,8 @@ const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
}; };
const handleTierSelection = ({ target: { value } }: RadioChangeEvent) => { const handleTierSelection = ({ target: { value } }: RadioChangeEvent) => {
updateTier?.(value as string); const tier = tiers.find((tier) => tier.fullyQualifiedName === value);
updateTier?.(tier);
}; };
const clearTierSelection = () => { const clearTierSelection = () => {
@ -107,7 +114,7 @@ const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
collapsible="icon" collapsible="icon"
defaultActiveKey={currentTier} defaultActiveKey={currentTier}
expandIconPosition="end"> expandIconPosition="end">
{tierData.map((card) => ( {tierCardData.map((card) => (
<Panel <Panel
data-testid="card-list" data-testid="card-list"
header={ header={
@ -144,7 +151,9 @@ const TierCard = ({ currentTier, updateTier, children }: TierCardProps) => {
placement="bottomRight" placement="bottomRight"
showArrow={false} showArrow={false}
trigger="click" trigger="click"
onOpenChange={(visible) => visible && !tierData.length && getTierData()}> onOpenChange={(visible) =>
visible && !tierCardData.length && getTierData()
}>
{children} {children}
</Popover> </Popover>
); );

View File

@ -18,7 +18,6 @@ import { ExtraInfo } from 'Models';
import React, { forwardRef, useMemo } from 'react'; import React, { forwardRef, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { EntityType } from '../../../enums/entity.enum'; import { EntityType } from '../../../enums/entity.enum';
import { OwnerType } from '../../../enums/user.enum'; import { OwnerType } from '../../../enums/user.enum';
import { EntityReference } from '../../../generated/entity/type'; import { EntityReference } from '../../../generated/entity/type';
@ -106,7 +105,7 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = forwardRef<
value: source.tier value: source.tier
? isString(source.tier) ? isString(source.tier)
? source.tier ? source.tier
: source.tier?.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : getEntityName(source.tier)
: '', : '',
}); });
} }

View File

@ -77,8 +77,8 @@ export type SourceType = (
> >
) & { ) & {
id: string; id: string;
tier?: string | Pick<TagLabel, 'tagFQN'>; tier?: string | TagLabel;
tags?: string[] | TagLabel[]; tags?: TagLabel[];
entityType?: string; entityType?: string;
service?: EntityReference; service?: EntityReference;
owner?: Partial< owner?: Partial<

View File

@ -41,6 +41,7 @@ const mockData: SearchedDataProps['data'] = [
{ ...TAG_CONSTANT, tagFQN: 'tags3' }, { ...TAG_CONSTANT, tagFQN: 'tags3' },
], ],
tier: { tier: {
...TAG_CONSTANT,
tagFQN: 'tier1', tagFQN: 'tier1',
}, },
}, },
@ -62,7 +63,7 @@ const mockData: SearchedDataProps['data'] = [
{ ...TAG_CONSTANT, tagFQN: 'tags2' }, { ...TAG_CONSTANT, tagFQN: 'tags2' },
{ ...TAG_CONSTANT, tagFQN: 'tags3' }, { ...TAG_CONSTANT, tagFQN: 'tags3' },
], ],
tier: { tagFQN: 'tier2' }, tier: { ...TAG_CONSTANT, tagFQN: 'tier2' },
}, },
}, },
{ {
@ -78,7 +79,7 @@ const mockData: SearchedDataProps['data'] = [
{ ...TAG_CONSTANT, tagFQN: 'tags2' }, { ...TAG_CONSTANT, tagFQN: 'tags2' },
{ ...TAG_CONSTANT, tagFQN: 'tags3' }, { ...TAG_CONSTANT, tagFQN: 'tags3' },
], ],
tier: { tagFQN: 'tier3' }, tier: { ...TAG_CONSTANT, tagFQN: 'tier3' },
}, },
}, },
]; ];

View File

@ -54,40 +54,6 @@ export const DATA_INSIGHT_GRAPH_COLORS = [
export const BAR_SIZE = 15; export const BAR_SIZE = 15;
export const TIER_FILTER = {
[i18n.t('label.tier-number', { tier: 1 })]: {
key: 'Tier.Tier1',
label: 'Tier1',
},
[i18n.t('label.tier-number', { tier: 2 })]: {
key: 'Tier.Tier2',
label: 'Tier2',
},
[i18n.t('label.tier-number', { tier: 3 })]: {
key: 'Tier.Tier3',
label: 'Tier3',
},
[i18n.t('label.tier-number', { tier: 4 })]: {
key: 'Tier.Tier4',
label: 'Tier4',
},
[i18n.t('label.tier-number', { tier: 5 })]: {
key: 'Tier.Tier5',
label: 'Tier5',
},
};
export const TIER_DATA = {
'Tier.Tier1': i18n.t('label.tier-number', { tier: 1 }),
'Tier.Tier2': i18n.t('label.tier-number', { tier: 2 }),
'Tier.Tier3': i18n.t('label.tier-number', { tier: 3 }),
'Tier.Tier4': i18n.t('label.tier-number', { tier: 4 }),
'Tier.Tier5': i18n.t('label.tier-number', { tier: 5 }),
NoTier: i18n.t('label.no-entity', {
entity: i18n.t('label.tier'),
}),
};
export const INITIAL_CHART_FILTER: ChartFilter = { export const INITIAL_CHART_FILTER: ChartFilter = {
startTs: getEpochMillisForPastDays(DEFAULT_SELECTED_RANGE.days), startTs: getEpochMillisForPastDays(DEFAULT_SELECTED_RANGE.days),
endTs: getCurrentMillis(), endTs: getCurrentMillis(),

View File

@ -19,6 +19,7 @@ import { Icons } from '../utils/SvgUtils';
export const INITIAL_SORT_FIELD = 'updatedAt'; export const INITIAL_SORT_FIELD = 'updatedAt';
export const INITIAL_SORT_ORDER = 'desc'; export const INITIAL_SORT_ORDER = 'desc';
export const TIER_FQN_KEY = 'tier.tagFQN';
export const initialFilterQS = 'initialFilter'; export const initialFilterQS = 'initialFilter';
export const searchFilterQS = 'searchFilter'; export const searchFilterQS = 'searchFilter';

View File

@ -49,11 +49,10 @@ import {
} from '../../constants/constants'; } from '../../constants/constants';
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum'; import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { import { CreateThread } from '../../generated/api/feed/createThread';
CreateThread, import { Tag } from '../../generated/entity/classification/tag';
ThreadType,
} from '../../generated/api/feed/createThread';
import { Container } from '../../generated/entity/data/container'; import { Container } from '../../generated/entity/data/container';
import { ThreadType } from '../../generated/entity/feed/thread';
import { Include } from '../../generated/type/include'; import { Include } from '../../generated/type/include';
import { import {
LabelType, LabelType,
@ -82,6 +81,7 @@ import { getEntityFieldThreadCounts } from '../../utils/FeedUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
const ContainerPage = () => { const ContainerPage = () => {
@ -351,23 +351,12 @@ const ContainerPage = () => {
[containerData, containerData?.owner] [containerData, containerData?.owner]
); );
const handleUpdateTier = async (updatedTier?: string) => { const handleUpdateTier = async (updatedTier?: Tag) => {
try { try {
const tierTag = updateTierTag(containerData?.tags ?? [], updatedTier);
const { tags: newTags, version } = await handleUpdateContainerData({ const { tags: newTags, version } = await handleUpdateContainerData({
...(containerData as Container), ...(containerData as Container),
tags: [ tags: tierTag,
...getTagsWithoutTier(containerData?.tags ?? []),
...(updatedTier
? [
{
tagFQN: updatedTier,
labelType: LabelType.Manual,
state: State.Confirmed,
source: TagSource.Classification,
},
]
: []),
],
}); });
setContainerData((prev) => ({ setContainerData((prev) => ({

View File

@ -40,7 +40,6 @@ import { PAGE_SIZE, ROUTES } from '../../constants/constants';
import { import {
ENTITIES_CHARTS, ENTITIES_CHARTS,
INITIAL_CHART_FILTER, INITIAL_CHART_FILTER,
TIER_FILTER,
} from '../../constants/DataInsight.constants'; } from '../../constants/DataInsight.constants';
import { import {
DEFAULT_RANGE_DATA, DEFAULT_RANGE_DATA,
@ -51,6 +50,7 @@ import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { SearchIndex } from '../../enums/search.enum'; import { SearchIndex } from '../../enums/search.enum';
import { DataInsightChartType } from '../../generated/dataInsight/dataInsightChartResult'; import { DataInsightChartType } from '../../generated/dataInsight/dataInsightChartResult';
import { Kpi } from '../../generated/dataInsight/kpi/kpi'; import { Kpi } from '../../generated/dataInsight/kpi/kpi';
import { Tag } from '../../generated/entity/classification/tag';
import { Operation } from '../../generated/entity/policies/policy'; import { Operation } from '../../generated/entity/policies/policy';
import { import {
ChartFilter, ChartFilter,
@ -58,11 +58,13 @@ import {
} from '../../interface/data-insight.interface'; } from '../../interface/data-insight.interface';
import { getListKPIs } from '../../rest/KpiAPI'; import { getListKPIs } from '../../rest/KpiAPI';
import { searchQuery } from '../../rest/searchAPI'; import { searchQuery } from '../../rest/searchAPI';
import { getTags } from '../../rest/tagAPI';
import { import {
getDataInsightPathWithFqn, getDataInsightPathWithFqn,
getTeamFilter, getTeamFilter,
} from '../../utils/DataInsightUtils'; } from '../../utils/DataInsightUtils';
import { formatDate } from '../../utils/date-time/DateTimeUtils'; import { formatDate } from '../../utils/date-time/DateTimeUtils';
import { getEntityName } from '../../utils/EntityUtils';
import { checkPermission } from '../../utils/PermissionsUtils'; import { checkPermission } from '../../utils/PermissionsUtils';
import { TeamStateType, TierStateType } from './DataInsight.interface'; import { TeamStateType, TierStateType } from './DataInsight.interface';
import './DataInsight.less'; import './DataInsight.less';
@ -121,12 +123,19 @@ const DataInsightPage = () => {
); );
const [dateRangeObject, setDateRangeObject] = const [dateRangeObject, setDateRangeObject] =
useState<DateRangeObject>(DEFAULT_RANGE_DATA); useState<DateRangeObject>(DEFAULT_RANGE_DATA);
const [tier, setTier] = useState<{ tags: Tag[]; isLoading: boolean }>({
tags: [],
isLoading: true,
});
const [selectedChart, setSelectedChart] = useState<DataInsightChartType>(); const [selectedChart, setSelectedChart] = useState<DataInsightChartType>();
const defaultTierOptions = useMemo(() => { const defaultTierOptions = useMemo(() => {
return Object.keys(TIER_FILTER); return tier.tags.map((op) => ({
}, []); key: op.fullyQualifiedName ?? op.name,
label: getEntityName(op),
}));
}, [tier]);
const { descriptionKpi, ownerKpi } = useMemo(() => { const { descriptionKpi, ownerKpi } = useMemo(() => {
return { return {
@ -147,9 +156,7 @@ const DataInsightPage = () => {
setTierOptions((prev) => ({ ...prev, selectedOptions: tiers })); setTierOptions((prev) => ({ ...prev, selectedOptions: tiers }));
setChartFilter((previous) => ({ setChartFilter((previous) => ({
...previous, ...previous,
tier: tiers.length tier: tiers.length ? tiers.map((tier) => tier.key).join(',') : undefined,
? tiers.map((tier) => TIER_FILTER[tier.key].key).join(',')
: undefined,
})); }));
}; };
@ -202,14 +209,18 @@ const DataInsightPage = () => {
if (query) { if (query) {
setTierOptions((prev) => ({ setTierOptions((prev) => ({
...prev, ...prev,
options: prev.options.filter((value) => options: prev.options.filter(
value.key.toLocaleLowerCase().includes(query.toLocaleLowerCase()) (value) =>
value.label
.toLocaleLowerCase()
.includes(query.toLocaleLowerCase()) ||
value.key.toLocaleLowerCase().includes(query.toLocaleLowerCase())
), ),
})); }));
} else { } else {
setTierOptions((prev) => ({ setTierOptions((prev) => ({
...prev, ...prev,
options: defaultTierOptions.map((op) => ({ key: op, label: op })), options: defaultTierOptions,
})); }));
} }
}; };
@ -246,10 +257,32 @@ const DataInsightPage = () => {
} }
}; };
const getTierTag = async () => {
setTier((prev) => ({ ...prev, isLoading: true }));
try {
const { data } = await getTags({
parent: 'Tier',
});
setTier((prev) => ({ ...prev, tags: data }));
setTierOptions((prev) => ({
...prev,
options: data.map((op) => ({
key: op.fullyQualifiedName ?? op.name,
label: getEntityName(op),
})),
}));
} catch (error) {
// error
} finally {
setTier((prev) => ({ ...prev, isLoading: false }));
}
};
const fetchDefaultTierOptions = () => { const fetchDefaultTierOptions = () => {
setTierOptions((prev) => ({ setTierOptions((prev) => ({
...prev, ...prev,
options: defaultTierOptions.map((op) => ({ key: op, label: op })), options: defaultTierOptions,
})); }));
}; };
@ -289,6 +322,7 @@ const DataInsightPage = () => {
}, [selectedChart]); }, [selectedChart]);
useEffect(() => { useEffect(() => {
getTierTag();
fetchDefaultTeamOptions(); fetchDefaultTeamOptions();
fetchKpiList(); fetchKpiList();
}, []); }, []);
@ -475,6 +509,7 @@ const DataInsightPage = () => {
<TierInsight <TierInsight
chartFilter={chartFilter} chartFilter={chartFilter}
selectedDays={selectedDaysFilter} selectedDays={selectedDaysFilter}
tierTags={tier}
/> />
</Col> </Col>
</> </>

View File

@ -37,9 +37,9 @@ import {
import { QueryVote } from '../../components/TableQueries/TableQueries.interface'; import { QueryVote } from '../../components/TableQueries/TableQueries.interface';
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum'; import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel'; import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel';
import { Include } from '../../generated/type/include'; import { Include } from '../../generated/type/include';
import { LabelType, State, TagSource } from '../../generated/type/tagLabel';
import { import {
addDataModelFollower, addDataModelFollower,
getDataModelsByName, getDataModelsByName,
@ -54,7 +54,8 @@ import {
} from '../../utils/CommonUtils'; } from '../../utils/CommonUtils';
import { getSortedDataModelColumnTags } from '../../utils/DataModelsUtils'; import { getSortedDataModelColumnTags } from '../../utils/DataModelsUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast } from '../../utils/ToastUtils'; import { showErrorToast } from '../../utils/ToastUtils';
const DataModelsPage = () => { const DataModelsPage = () => {
@ -230,23 +231,12 @@ const DataModelsPage = () => {
[dataModelData, dataModelData?.owner] [dataModelData, dataModelData?.owner]
); );
const handleUpdateTier = async (updatedTier?: string) => { const handleUpdateTier = async (updatedTier?: Tag) => {
try { try {
const tags = updateTierTag(dataModelData?.tags ?? [], updatedTier);
const { tags: newTags, version } = await handleUpdateDataModelData({ const { tags: newTags, version } = await handleUpdateDataModelData({
...(dataModelData as DashboardDataModel), ...(dataModelData as DashboardDataModel),
tags: [ tags,
...getTagsWithoutTier(dataModelData?.tags ?? []),
...(updatedTier
? [
{
tagFQN: updatedTier,
labelType: LabelType.Manual,
state: State.Confirmed,
source: TagSource.Classification,
},
]
: []),
],
}); });
setDataModelData((prev) => ({ setDataModelData((prev) => ({

View File

@ -66,6 +66,7 @@ import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { SearchIndex } from '../../enums/search.enum'; import { SearchIndex } from '../../enums/search.enum';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { Database } from '../../generated/entity/data/database'; import { Database } from '../../generated/entity/data/database';
import { DatabaseSchema } from '../../generated/entity/data/databaseSchema'; import { DatabaseSchema } from '../../generated/entity/data/databaseSchema';
import { LabelType } from '../../generated/entity/data/table'; import { LabelType } from '../../generated/entity/data/table';
@ -88,6 +89,7 @@ import { getEntityFeedLink, getEntityName } from '../../utils/EntityUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
const DatabaseDetails: FunctionComponent = () => { const DatabaseDetails: FunctionComponent = () => {
@ -438,17 +440,8 @@ const DatabaseDetails: FunctionComponent = () => {
}, []); }, []);
const handleUpdateTier = useCallback( const handleUpdateTier = useCallback(
(newTier?: string) => { (newTier?: Tag) => {
const tierTag = newTier const tierTag = updateTierTag(database?.tags ?? [], newTier);
? [
...getTagsWithoutTier(database?.tags ?? []),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(database?.tags ?? []);
const updatedTableDetails = { const updatedTableDetails = {
...database, ...database,
tags: tierTag, tags: tierTag,

View File

@ -59,6 +59,7 @@ import {
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum'; import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { EntityTabs, EntityType } from '../../enums/entity.enum'; import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { DatabaseSchema } from '../../generated/entity/data/databaseSchema'; import { DatabaseSchema } from '../../generated/entity/data/databaseSchema';
import { Table } from '../../generated/entity/data/table'; import { Table } from '../../generated/entity/data/table';
import { ThreadType } from '../../generated/entity/feed/thread'; import { ThreadType } from '../../generated/entity/feed/thread';
@ -87,6 +88,7 @@ import { getEntityFeedLink, getEntityName } from '../../utils/EntityUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import { StoredProcedureData } from './DatabaseSchemaPage.interface'; import { StoredProcedureData } from './DatabaseSchemaPage.interface';
import SchemaTablesTab from './SchemaTablesTab'; import SchemaTablesTab from './SchemaTablesTab';
@ -397,17 +399,8 @@ const DatabaseSchemaPage: FunctionComponent = () => {
}; };
const handleUpdateTier = useCallback( const handleUpdateTier = useCallback(
async (newTier?: string) => { async (newTier?: Tag) => {
const tierTag = newTier const tierTag = updateTierTag(databaseSchema?.tags ?? [], newTier);
? [
...getTagsWithoutTier(databaseSchema?.tags ?? []),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(databaseSchema?.tags ?? []);
const updatedSchemaDetails = { const updatedSchemaDetails = {
...databaseSchema, ...databaseSchema,
tags: tierTag, tags: tierTag,

View File

@ -50,6 +50,7 @@ import {
CreateThread, CreateThread,
ThreadType, ThreadType,
} from '../../generated/api/feed/createThread'; } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { SearchIndex, TagLabel } from '../../generated/entity/data/searchIndex'; import { SearchIndex, TagLabel } from '../../generated/entity/data/searchIndex';
import { LabelType, State, TagSource } from '../../generated/type/tagLabel'; import { LabelType, State, TagSource } from '../../generated/type/tagLabel';
import { postThread } from '../../rest/feedsAPI'; import { postThread } from '../../rest/feedsAPI';
@ -73,6 +74,7 @@ import {
getSearchIndexTabPath, getSearchIndexTabPath,
} from '../../utils/SearchIndexUtils'; } from '../../utils/SearchIndexUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import SearchIndexFieldsTab from './SearchIndexFieldsTab/SearchIndexFieldsTab'; import SearchIndexFieldsTab from './SearchIndexFieldsTab/SearchIndexFieldsTab';
@ -532,18 +534,12 @@ function SearchIndexDetailsPage() {
]); ]);
const onTierUpdate = useCallback( const onTierUpdate = useCallback(
async (newTier?: string) => { async (newTier?: Tag) => {
if (searchIndexDetails) { if (searchIndexDetails) {
const tierTag: SearchIndex['tags'] = newTier const tierTag: SearchIndex['tags'] = updateTierTag(
? [ searchIndexTags,
...getTagsWithoutTier(searchIndexTags ?? []), newTier
{ );
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(searchIndexTags ?? []);
const updatedSearchIndexDetails = { const updatedSearchIndexDetails = {
...searchIndexDetails, ...searchIndexDetails,
tags: tierTag, tags: tierTag,

View File

@ -64,6 +64,7 @@ import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { EntityTabs } from '../../enums/entity.enum'; import { EntityTabs } from '../../enums/entity.enum';
import { ServiceCategory } from '../../enums/service.enum'; import { ServiceCategory } from '../../enums/service.enum';
import { PipelineType } from '../../generated/api/services/ingestionPipelines/createIngestionPipeline'; import { PipelineType } from '../../generated/api/services/ingestionPipelines/createIngestionPipeline';
import { Tag } from '../../generated/entity/classification/tag';
import { Container } from '../../generated/entity/data/container'; import { Container } from '../../generated/entity/data/container';
import { Dashboard } from '../../generated/entity/data/dashboard'; import { Dashboard } from '../../generated/entity/data/dashboard';
import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel'; import { DashboardDataModel } from '../../generated/entity/data/dashboardDataModel';
@ -78,7 +79,6 @@ import { DatabaseService } from '../../generated/entity/services/databaseService
import { IngestionPipeline } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline'; import { IngestionPipeline } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline';
import { Include } from '../../generated/type/include'; import { Include } from '../../generated/type/include';
import { Paging } from '../../generated/type/paging'; import { Paging } from '../../generated/type/paging';
import { LabelType, State } from '../../generated/type/tagLabel';
import { useAuth } from '../../hooks/authHooks'; import { useAuth } from '../../hooks/authHooks';
import { useAirflowStatus } from '../../hooks/useAirflowStatus'; import { useAirflowStatus } from '../../hooks/useAirflowStatus';
import { ConfigData, ServicesType } from '../../interface/service.interface'; import { ConfigData, ServicesType } from '../../interface/service.interface';
@ -116,7 +116,7 @@ import {
shouldTestConnection, shouldTestConnection,
} from '../../utils/ServiceUtils'; } from '../../utils/ServiceUtils';
import { getDecodedFqn } from '../../utils/StringsUtils'; import { getDecodedFqn } from '../../utils/StringsUtils';
import { getTagsWithoutTier } from '../../utils/TableUtils'; import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast } from '../../utils/ToastUtils'; import { showErrorToast } from '../../utils/ToastUtils';
import ServiceMainTabContent from './ServiceMainTabContent'; import ServiceMainTabContent from './ServiceMainTabContent';
@ -750,17 +750,8 @@ const ServiceDetailsPage: FunctionComponent = () => {
); );
const handleUpdateTier = useCallback( const handleUpdateTier = useCallback(
async (newTier?: string) => { async (newTier?: Tag) => {
const tierTag = newTier const tierTag = updateTierTag(serviceDetails?.tags ?? [], newTier);
? [
...getTagsWithoutTier(serviceDetails?.tags ?? []),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(serviceDetails?.tags ?? []);
const updatedServiceDetails = { const updatedServiceDetails = {
...serviceDetails, ...serviceDetails,
tags: tierTag, tags: tierTag,

View File

@ -51,6 +51,7 @@ import {
CreateThread, CreateThread,
ThreadType, ThreadType,
} from '../../generated/api/feed/createThread'; } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { import {
StoredProcedure, StoredProcedure,
StoredProcedureCodeObject, StoredProcedureCodeObject,
@ -80,6 +81,7 @@ import { getEntityName } from '../../utils/EntityUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { STORED_PROCEDURE_DEFAULT_FIELDS } from '../../utils/StoredProceduresUtils'; import { STORED_PROCEDURE_DEFAULT_FIELDS } from '../../utils/StoredProceduresUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
const StoredProcedurePage = () => { const StoredProcedurePage = () => {
@ -358,18 +360,9 @@ const StoredProcedurePage = () => {
}; };
const onTierUpdate = useCallback( const onTierUpdate = useCallback(
async (newTier?: string) => { async (newTier?: Tag) => {
if (storedProcedure) { if (storedProcedure) {
const tierTag: StoredProcedure['tags'] = newTier const tierTag: StoredProcedure['tags'] = updateTierTag(tags, newTier);
? [
...getTagsWithoutTier(tags ?? []),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(tags ?? []);
const updatedDetails = { const updatedDetails = {
...storedProcedure, ...storedProcedure,
tags: tierTag, tags: tierTag,

View File

@ -59,6 +59,7 @@ import {
TabSpecificField, TabSpecificField,
} from '../../enums/entity.enum'; } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread'; import { CreateThread } from '../../generated/api/feed/createThread';
import { Tag } from '../../generated/entity/classification/tag';
import { JoinedWith, Table } from '../../generated/entity/data/table'; import { JoinedWith, Table } from '../../generated/entity/data/table';
import { DataProduct } from '../../generated/entity/domains/dataProduct'; import { DataProduct } from '../../generated/entity/domains/dataProduct';
import { ThreadType } from '../../generated/entity/feed/thread'; import { ThreadType } from '../../generated/entity/feed/thread';
@ -93,6 +94,7 @@ import {
} from '../../utils/EntityUtils'; } from '../../utils/EntityUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils'; import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils'; import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
import { updateTierTag } from '../../utils/TagsUtils';
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
import { FrequentlyJoinedTables } from './FrequentlyJoinedTables/FrequentlyJoinedTables.component'; import { FrequentlyJoinedTables } from './FrequentlyJoinedTables/FrequentlyJoinedTables.component';
import './table-details-page-v1.less'; import './table-details-page-v1.less';
@ -731,18 +733,9 @@ const TableDetailsPageV1 = () => {
]); ]);
const onTierUpdate = useCallback( const onTierUpdate = useCallback(
async (newTier?: string) => { async (newTier?: Tag) => {
if (tableDetails) { if (tableDetails) {
const tierTag: Table['tags'] = newTier const tierTag: Table['tags'] = updateTierTag(tableTags, newTier);
? [
...getTagsWithoutTier(tableTags ?? []),
{
tagFQN: newTier,
labelType: LabelType.Manual,
state: State.Confirmed,
},
]
: getTagsWithoutTier(tableTags ?? []);
const updatedTableDetails = { const updatedTableDetails = {
...tableDetails, ...tableDetails,
tags: tierTag, tags: tierTag,

View File

@ -40,7 +40,6 @@ import {
} from '../constants/constants'; } from '../constants/constants';
import { import {
ENTITIES_SUMMARY_LIST, ENTITIES_SUMMARY_LIST,
TIER_DATA,
WEB_SUMMARY_LIST, WEB_SUMMARY_LIST,
} from '../constants/DataInsight.constants'; } from '../constants/DataInsight.constants';
import { KpiTargetType } from '../generated/api/dataInsight/kpi/createKpiRequest'; import { KpiTargetType } from '../generated/api/dataInsight/kpi/createKpiRequest';
@ -68,8 +67,7 @@ const checkIsPercentageGraph = (dataInsightChartType: DataInsightChartType) =>
export const renderLegend = ( export const renderLegend = (
legendData: LegendProps, legendData: LegendProps,
activeKeys = [] as string[], activeKeys = [] as string[]
isTier = false
) => { ) => {
const { payload = [] } = legendData; const { payload = [] } = legendData;
@ -103,9 +101,7 @@ export const renderLegend = (
/> />
</Surface> </Surface>
<span style={{ color: isActive ? 'inherit' : GRAYED_OUT_COLOR }}> <span style={{ color: isActive ? 'inherit' : GRAYED_OUT_COLOR }}>
{isTier {entry.value}
? TIER_DATA[entry.value as keyof typeof TIER_DATA]
: entry.value}
</span> </span>
</li> </li>
); );
@ -150,13 +146,7 @@ const getEntryFormattedValue = (
}; };
export const CustomTooltip = (props: DataInsightChartTooltipProps) => { export const CustomTooltip = (props: DataInsightChartTooltipProps) => {
const { const { active, payload = [], isPercentage, kpiTooltipRecord } = props;
active,
payload = [],
isPercentage,
kpiTooltipRecord,
isTier,
} = props;
if (active && payload && payload.length) { if (active && payload && payload.length) {
const timestamp = formatDate(payload[0].payload.timestampValue || 0); const timestamp = formatDate(payload[0].payload.timestampValue || 0);
@ -173,9 +163,7 @@ export const CustomTooltip = (props: DataInsightChartTooltipProps) => {
<Surface className="mr-2" height={12} version="1.1" width={12}> <Surface className="mr-2" height={12} version="1.1" width={12}>
<rect fill={entry.color} height="14" rx="2" width="14" /> <rect fill={entry.color} height="14" rx="2" width="14" />
</Surface> </Surface>
{isTier {entry.dataKey}
? TIER_DATA[entry.dataKey as keyof typeof TIER_DATA]
: entry.dataKey}
</span> </span>
<span className="font-medium"> <span className="font-medium">
{getEntryFormattedValue( {getEntryFormattedValue(

View File

@ -30,6 +30,7 @@ import { Classification } from '../generated/entity/classification/classificatio
import { Tag } from '../generated/entity/classification/tag'; import { Tag } from '../generated/entity/classification/tag';
import { Column } from '../generated/entity/data/table'; import { Column } from '../generated/entity/data/table';
import { Paging } from '../generated/type/paging'; import { Paging } from '../generated/type/paging';
import { LabelType, State, TagLabel } from '../generated/type/tagLabel';
import { searchQuery } from '../rest/searchAPI'; import { searchQuery } from '../rest/searchAPI';
import { import {
getAllClassifications, getAllClassifications,
@ -38,6 +39,7 @@ import {
} from '../rest/tagAPI'; } from '../rest/tagAPI';
import { formatSearchTagsResponse } from './APIUtils'; import { formatSearchTagsResponse } from './APIUtils';
import { fetchGlossaryTerms, getGlossaryTermlist } from './GlossaryUtils'; import { fetchGlossaryTerms, getGlossaryTermlist } from './GlossaryUtils';
import { getTagsWithoutTier } from './TableUtils';
export const getClassifications = async ( export const getClassifications = async (
fields?: Array<string> | string, fields?: Array<string> | string,
@ -322,3 +324,20 @@ export const fetchTagsElasticSearch = async (
}, },
}; };
}; };
export const createTierTag = (tag: Tag) => {
return {
displayName: tag.displayName,
name: tag.name,
description: tag.description,
tagFQN: tag.fullyQualifiedName,
labelType: LabelType.Manual,
state: State.Confirmed,
};
};
export const updateTierTag = (oldTags: Tag[] | TagLabel[], newTier?: Tag) => {
return newTier
? [...getTagsWithoutTier(oldTags), createTierTag(newTier)]
: getTagsWithoutTier(oldTags);
};