From e80d385fd6b434e39102414df20341811af81bd9 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 11 Apr 2025 23:51:30 +0530 Subject: [PATCH] FIX: parsing error in case of special character in tag for BulkEdit/Import case (#20776) * fix parsing error in case of special character in tag for BulkEdit/Import case * change the behaviour to generic one and fix sonar issue * re-added the minor miss * changes as per comments --- .../ui/playwright/utils/importUtils.ts | 22 +++++++++++- ...odalWithCustomPropertyEditor.component.tsx | 34 +++++++++++++++---- .../CustomPropertyTable.tsx | 1 - .../ui/src/utils/CSV/CSVUtilsClassBase.tsx | 6 ++-- 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts index c090c8eb600..e7f22a2393b 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/importUtils.ts @@ -17,7 +17,7 @@ import { FIELD_VALUES_CUSTOM_PROPERTIES, } from '../constant/glossaryImportExport'; import { GlobalSettingOptions } from '../constant/settings'; -import { descriptionBox, uuid } from './common'; +import { descriptionBox, descriptionBoxReadOnly, uuid } from './common'; import { addCustomPropertiesForEntity, fillTableColumnInputDetails, @@ -170,6 +170,10 @@ const editGlossaryCustomProperty = async ( .getByTestId('value-input') .fill(FIELD_VALUES_CUSTOM_PROPERTIES.STRING); await page.getByTestId('inline-save-btn').click(); + + await expect( + page.getByTestId(propertyName).getByTestId('value') + ).toHaveText(FIELD_VALUES_CUSTOM_PROPERTIES.STRING); } if (type === CUSTOM_PROPERTIES_TYPES.MARKDOWN) { @@ -184,6 +188,10 @@ const editGlossaryCustomProperty = async ( await page.waitForSelector(descriptionBox, { state: 'detached', }); + + await expect( + page.getByTestId(propertyName).locator(descriptionBoxReadOnly) + ).toContainText('### Overview'); } if (type === CUSTOM_PROPERTIES_TYPES.SQL_QUERY) { @@ -193,6 +201,10 @@ const editGlossaryCustomProperty = async ( .fill(FIELD_VALUES_CUSTOM_PROPERTIES.SQL_QUERY); await page.getByTestId('inline-save-btn').click(); + + await expect( + page.getByTestId(propertyName).locator('.CodeMirror-lines') + ).toContainText(FIELD_VALUES_CUSTOM_PROPERTIES.SQL_QUERY); } if (type === CUSTOM_PROPERTIES_TYPES.TABLE) { @@ -206,6 +218,14 @@ const editGlossaryCustomProperty = async ( await fillTableColumnInputDetails(page, values[1], columns[1]); await page.locator('[data-testid="update-table-type-property"]').click(); + + await expect( + page.getByTestId(propertyName).getByRole('cell', { name: columns[0] }) + ).toBeVisible(); + + await expect( + page.getByTestId(propertyName).getByRole('cell', { name: values[0] }) + ).toBeVisible(); } }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/ModalWithCustomProperty/ModalWithCustomPropertyEditor.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/ModalWithCustomProperty/ModalWithCustomPropertyEditor.component.tsx index 9b9d2d181b1..2a2b3f00a80 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/ModalWithCustomProperty/ModalWithCustomPropertyEditor.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/ModalWithCustomProperty/ModalWithCustomPropertyEditor.component.tsx @@ -15,16 +15,20 @@ import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { AxiosError } from 'axios'; +import { CustomizeEntityType } from '../../../constants/Customize.constants'; +import { Table } from '../../../generated/entity/data/table'; import { Type } from '../../../generated/entity/type'; import { getTypeByFQN } from '../../../rest/metadataTypeAPI'; import { convertCustomPropertyStringToEntityExtension, convertEntityExtensionToCustomPropertyString, } from '../../../utils/CSV/CSV.utils'; +import { DEFAULT_ENTITY_PERMISSION } from '../../../utils/PermissionsUtils'; import { showErrorToast } from '../../../utils/ToastUtils'; import { CustomPropertyTable } from '../../common/CustomPropertyTable/CustomPropertyTable'; import { ExtentionEntities } from '../../common/CustomPropertyTable/CustomPropertyTable.interface'; import Loader from '../../common/Loader/Loader'; +import { GenericProvider } from '../../Customization/GenericProvider/GenericProvider'; import { ExtensionDataProps, ModalWithCustomPropertyEditorProps, @@ -74,6 +78,12 @@ export const ModalWithCustomPropertyEditor = ({ setIsSaveLoading(false); }; + const onExtensionUpdate = async ( + data: ExtentionEntities[keyof ExtentionEntities] + ) => { + setExtensionObject(data.extension); + }; + useEffect(() => { fetchTypeDetail(); }, []); @@ -111,12 +121,24 @@ export const ModalWithCustomPropertyEditor = ({ {isLoading ? ( ) : ( - + + customizedPage={null} + data={ + { + extension: extensionObject, + } as Table + } + isVersionView={false} + permissions={DEFAULT_ENTITY_PERMISSION} + type={entityType as CustomizeEntityType} + onUpdate={onExtensionUpdate}> + + )} ); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/CustomPropertyTable.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/CustomPropertyTable.tsx index 6dc87b87c29..305b5386a36 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/CustomPropertyTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/CustomPropertyTable/CustomPropertyTable.tsx @@ -69,7 +69,6 @@ export const CustomPropertyTable = ({ onUpdate, filterWidgets, } = useGenericContext(); - const [entityTypeDetail, setEntityTypeDetail] = useState({} as Type); const [entityTypeDetailLoading, setEntityTypeDetailLoading] = useState(true); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSVUtilsClassBase.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSVUtilsClassBase.tsx index 63e7627c25a..4cdb0dda04f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSVUtilsClassBase.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CSV/CSVUtilsClassBase.tsx @@ -43,9 +43,11 @@ class CSVUtilsClassBase { 'extension', 'synonyms', 'description', + 'tags', 'glossaryTerms', 'relatedTerms', 'column.description', + 'column.tags', 'column.glossaryTerms', ]; } @@ -136,9 +138,7 @@ class CSVUtilsClassBase { : undefined; const handleChange = (tags: TagLabel[]) => { - props.onChange( - tags.map((tag) => tag.tagFQN.replaceAll('"', '""')).join(';') - ); + props.onChange(tags.map((tag) => tag.tagFQN).join(';')); }; return (