Skip to content

Commit

Permalink
#19432: fix the description renderer in glossary import (#19450)
Browse files Browse the repository at this point in the history
* fix the description renderer in glossary import

* added test for the same
  • Loading branch information
Ashish8689 authored Jan 22, 2025
1 parent 68c3246 commit c406cce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) => {
Expand Down
35 changes: 28 additions & 7 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 @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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;
};

Expand Down

0 comments on commit c406cce

Please sign in to comment.