#19432: fix the description renderer in glossary import (#19450)

* fix the description renderer in glossary import

* added test for the same
This commit is contained in:
Ashish Gupta 2025-01-22 16:22:44 +05:30 committed by GitHub
parent 68c324679a
commit c406cceb9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 8 deletions

View File

@ -51,7 +51,10 @@ export const fillDescriptionDetails = async (
await page.fill(descriptionBox, description);
await page.click('[data-testid="save"]');
await page.click('.InovuaReactDataGrid__cell--cell-active');
await expect(
page.locator('.InovuaReactDataGrid__cell--cell-active')
).not.toContainText('<p>');
};
export const fillOwnerDetails = async (page: Page, owners: string[]) => {

View File

@ -23,6 +23,7 @@ import React from 'react';
import { ReactComponent as SuccessBadgeIcon } from '../..//assets/svg/success-badge.svg';
import { ReactComponent as FailBadgeIcon } from '../../assets/svg/fail-badge.svg';
import { TableTypePropertyValueType } from '../../components/common/CustomPropertyTable/CustomPropertyTable.interface';
import RichTextEditorPreviewerV1 from '../../components/common/RichTextEditor/RichTextEditorPreviewerV1';
import {
ExtensionDataProps,
ExtensionDataTypes,
@ -55,12 +56,7 @@ export const COLUMNS_WIDTH: Record<string, number> = {
status: 70,
};
const statusRenderer = ({
value,
}: {
value: Status;
data: { details: string };
}) => {
const statusRenderer = (value: Status) => {
return value === Status.Failure ? (
<FailBadgeIcon
className="m-t-xss"
@ -78,6 +74,31 @@ const statusRenderer = ({
);
};
const renderColumnDataEditor = (
column: string,
recordData: {
value: string;
data: { details: string };
}
) => {
const { value } = recordData;
switch (column) {
case 'status':
return statusRenderer(value as Status);
case 'description':
return (
<RichTextEditorPreviewerV1
enableSeeMoreVariant={false}
markdown={value}
reducePreviewLineClass="max-one-line"
/>
);
default:
return value;
}
};
export const getColumnConfig = (
column: string,
entityType: EntityType
@ -91,7 +112,7 @@ export const getColumnConfig = (
sortable: false,
renderEditor: csvUtilsClassBase.getEditor(colType, entityType),
minWidth: COLUMNS_WIDTH[colType] ?? 180,
render: column === 'status' ? statusRenderer : undefined,
render: (recordData) => renderColumnDataEditor(column, recordData),
} as TypeColumn;
};