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,
} 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();
}
};

View File

@ -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 ? (
<Loader />
) : (
<CustomPropertyTable
hasEditAccess
hasPermission
isRenderedInRightPanel
entityType={entityType as keyof ExtentionEntities}
/>
<GenericProvider<Table>
customizedPage={null}
data={
{
extension: extensionObject,
} as Table
}
isVersionView={false}
permissions={DEFAULT_ENTITY_PERMISSION}
type={entityType as CustomizeEntityType}
onUpdate={onExtensionUpdate}>
<CustomPropertyTable
hasEditAccess
hasPermission
isRenderedInRightPanel
entityType={entityType as keyof ExtentionEntities}
/>
</GenericProvider>
)}
</Modal>
);

View File

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

View File

@ -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 (