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
This commit is contained in:
Ashish Gupta 2025-04-11 23:51:30 +05:30 committed by GitHub
parent c1d7414578
commit e80d385fd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 11 deletions

View File

@ -17,7 +17,7 @@ import {
FIELD_VALUES_CUSTOM_PROPERTIES, FIELD_VALUES_CUSTOM_PROPERTIES,
} from '../constant/glossaryImportExport'; } from '../constant/glossaryImportExport';
import { GlobalSettingOptions } from '../constant/settings'; import { GlobalSettingOptions } from '../constant/settings';
import { descriptionBox, uuid } from './common'; import { descriptionBox, descriptionBoxReadOnly, uuid } from './common';
import { import {
addCustomPropertiesForEntity, addCustomPropertiesForEntity,
fillTableColumnInputDetails, fillTableColumnInputDetails,
@ -170,6 +170,10 @@ const editGlossaryCustomProperty = async (
.getByTestId('value-input') .getByTestId('value-input')
.fill(FIELD_VALUES_CUSTOM_PROPERTIES.STRING); .fill(FIELD_VALUES_CUSTOM_PROPERTIES.STRING);
await page.getByTestId('inline-save-btn').click(); 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) { if (type === CUSTOM_PROPERTIES_TYPES.MARKDOWN) {
@ -184,6 +188,10 @@ const editGlossaryCustomProperty = async (
await page.waitForSelector(descriptionBox, { await page.waitForSelector(descriptionBox, {
state: 'detached', state: 'detached',
}); });
await expect(
page.getByTestId(propertyName).locator(descriptionBoxReadOnly)
).toContainText('### Overview');
} }
if (type === CUSTOM_PROPERTIES_TYPES.SQL_QUERY) { if (type === CUSTOM_PROPERTIES_TYPES.SQL_QUERY) {
@ -193,6 +201,10 @@ const editGlossaryCustomProperty = async (
.fill(FIELD_VALUES_CUSTOM_PROPERTIES.SQL_QUERY); .fill(FIELD_VALUES_CUSTOM_PROPERTIES.SQL_QUERY);
await page.getByTestId('inline-save-btn').click(); 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) { if (type === CUSTOM_PROPERTIES_TYPES.TABLE) {
@ -206,6 +218,14 @@ const editGlossaryCustomProperty = async (
await fillTableColumnInputDetails(page, values[1], columns[1]); await fillTableColumnInputDetails(page, values[1], columns[1]);
await page.locator('[data-testid="update-table-type-property"]').click(); 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();
} }
}; };

View File

@ -15,16 +15,20 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { CustomizeEntityType } from '../../../constants/Customize.constants';
import { Table } from '../../../generated/entity/data/table';
import { Type } from '../../../generated/entity/type'; import { Type } from '../../../generated/entity/type';
import { getTypeByFQN } from '../../../rest/metadataTypeAPI'; import { getTypeByFQN } from '../../../rest/metadataTypeAPI';
import { import {
convertCustomPropertyStringToEntityExtension, convertCustomPropertyStringToEntityExtension,
convertEntityExtensionToCustomPropertyString, convertEntityExtensionToCustomPropertyString,
} from '../../../utils/CSV/CSV.utils'; } from '../../../utils/CSV/CSV.utils';
import { DEFAULT_ENTITY_PERMISSION } from '../../../utils/PermissionsUtils';
import { showErrorToast } from '../../../utils/ToastUtils'; import { showErrorToast } from '../../../utils/ToastUtils';
import { CustomPropertyTable } from '../../common/CustomPropertyTable/CustomPropertyTable'; import { CustomPropertyTable } from '../../common/CustomPropertyTable/CustomPropertyTable';
import { ExtentionEntities } from '../../common/CustomPropertyTable/CustomPropertyTable.interface'; import { ExtentionEntities } from '../../common/CustomPropertyTable/CustomPropertyTable.interface';
import Loader from '../../common/Loader/Loader'; import Loader from '../../common/Loader/Loader';
import { GenericProvider } from '../../Customization/GenericProvider/GenericProvider';
import { import {
ExtensionDataProps, ExtensionDataProps,
ModalWithCustomPropertyEditorProps, ModalWithCustomPropertyEditorProps,
@ -74,6 +78,12 @@ export const ModalWithCustomPropertyEditor = ({
setIsSaveLoading(false); setIsSaveLoading(false);
}; };
const onExtensionUpdate = async (
data: ExtentionEntities[keyof ExtentionEntities]
) => {
setExtensionObject(data.extension);
};
useEffect(() => { useEffect(() => {
fetchTypeDetail(); fetchTypeDetail();
}, []); }, []);
@ -111,12 +121,24 @@ export const ModalWithCustomPropertyEditor = ({
{isLoading ? ( {isLoading ? (
<Loader /> <Loader />
) : ( ) : (
<GenericProvider<Table>
customizedPage={null}
data={
{
extension: extensionObject,
} as Table
}
isVersionView={false}
permissions={DEFAULT_ENTITY_PERMISSION}
type={entityType as CustomizeEntityType}
onUpdate={onExtensionUpdate}>
<CustomPropertyTable <CustomPropertyTable
hasEditAccess hasEditAccess
hasPermission hasPermission
isRenderedInRightPanel isRenderedInRightPanel
entityType={entityType as keyof ExtentionEntities} entityType={entityType as keyof ExtentionEntities}
/> />
</GenericProvider>
)} )}
</Modal> </Modal>
); );

View File

@ -69,7 +69,6 @@ export const CustomPropertyTable = <T extends ExtentionEntitiesKeys>({
onUpdate, onUpdate,
filterWidgets, filterWidgets,
} = useGenericContext<ExtentionEntities[T]>(); } = useGenericContext<ExtentionEntities[T]>();
const [entityTypeDetail, setEntityTypeDetail] = useState<Type>({} as Type); const [entityTypeDetail, setEntityTypeDetail] = useState<Type>({} as Type);
const [entityTypeDetailLoading, setEntityTypeDetailLoading] = const [entityTypeDetailLoading, setEntityTypeDetailLoading] =
useState<boolean>(true); useState<boolean>(true);

View File

@ -43,9 +43,11 @@ class CSVUtilsClassBase {
'extension', 'extension',
'synonyms', 'synonyms',
'description', 'description',
'tags',
'glossaryTerms', 'glossaryTerms',
'relatedTerms', 'relatedTerms',
'column.description', 'column.description',
'column.tags',
'column.glossaryTerms', 'column.glossaryTerms',
]; ];
} }
@ -136,9 +138,7 @@ class CSVUtilsClassBase {
: undefined; : undefined;
const handleChange = (tags: TagLabel[]) => { const handleChange = (tags: TagLabel[]) => {
props.onChange( props.onChange(tags.map((tag) => tag.tagFQN).join(';'));
tags.map((tag) => tag.tagFQN.replaceAll('"', '""')).join(';')
);
}; };
return ( return (