Skip to content

Commit

Permalink
fix description data in enumWithDescription one
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish8689 committed Sep 29, 2024
1 parent 4f4e26e commit 94b8515
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSV.utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import {
ExtensionDataProps,
ExtensionDataTypes,
} from '../../components/Modals/ModalWithCustomProperty/ModalWithMarkdownEditor.interface';
import { NO_DATA_PLACEHOLDER } from '../../constants/constants';
import { SEMICOLON_SPLITTER } from '../../constants/regex.constants';
import { EntityType } from '../../enums/entity.enum';
import {
CustomProperty,
EntityReference,
EnumConfig,
Type,
ValueClass,
} from '../../generated/entity/type';
Expand Down Expand Up @@ -159,7 +161,7 @@ export const getCSVStringFromColumnsAndDataSource = (

const convertCustomPropertyStringToValueExtensionBasedOnType = (
value: string,
customProperty: CustomProperty
customProperty?: CustomProperty
) => {
switch (customProperty?.propertyType.name) {
case 'entityReference': {
Expand Down Expand Up @@ -193,11 +195,20 @@ const convertCustomPropertyStringToValueExtensionBasedOnType = (
}
}

case 'enumWithDescriptions':
case 'enumWithDescriptions': {
const propertyEnumValues =
((customProperty?.customPropertyConfig?.config as EnumConfig)
.values as ValueClass[]) ?? [];

const keyAndValue: Record<string, ValueClass> = {};

propertyEnumValues.forEach((cp) => (keyAndValue[cp.key] = cp));

return value.split('|').map((item) => ({
key: item,
description: item,
description: keyAndValue[item].description ?? NO_DATA_PLACEHOLDER,
}));
}

case 'timeInterval': {
const [start, end] = value.split(':');
Expand Down

0 comments on commit 94b8515

Please sign in to comment.