diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ChangeSummaryBadge.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ChangeSummaryBadge.spec.ts index 74de3c722e30..1e178ed9b46e 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ChangeSummaryBadge.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ChangeSummaryBadge.spec.ts @@ -17,6 +17,7 @@ import { TableClass } from '../../support/entity/TableClass'; import { performAdminLogin } from '../../utils/admin'; import { redirectToHomePage } from '../../utils/common'; import { waitForAllLoadersToDisappear } from '../../utils/entity'; +import { navigateToExploreAndSelectEntity } from '../../utils/explore'; import { test } from '../fixtures/pages'; const table = new TableClass(); @@ -115,6 +116,28 @@ test.describe( await expect(tooltip).toBeVisible(); }); + + await test.step('Verify AI badge on table description in Explore summary panel', async () => { + const changeSummaryResponse = page.waitForResponse((response) => + response.url().includes('/api/v1/changeSummary/table/') + ); + + await navigateToExploreAndSelectEntity({ + page, + entityName: table.entity.name, + fullyQualifiedName: table.entityResponseData?.fullyQualifiedName, + }); + + await changeSummaryResponse; + await waitForAllLoadersToDisappear(page); + + const badge = page + .locator('.entity-summary-panel-container') + .getByTestId('ai-suggested-badge') + .first(); + + await expect(badge).toBeVisible(); + }); }); test('AI badge should appear on column description with Suggested source', async ({ @@ -137,6 +160,34 @@ test.describe( await expect(descriptionCells.first()).toBeVisible(); }); + + await test.step('Verify AI badge on column description in Explore summary panel', async () => { + const column = table.entityResponseData?.columns?.[0]; + + const changeSummaryResponse = page.waitForResponse((response) => + response.url().includes('/api/v1/changeSummary/table/') + ); + + await navigateToExploreAndSelectEntity({ + page, + entityName: column?.name ?? '', + exploreTab: 'Column', + }); + + await page + .getByTestId(`table-data-card_${column?.fullyQualifiedName}`) + .click(); + + await changeSummaryResponse; + await waitForAllLoadersToDisappear(page); + + const badge = page + .locator('.entity-summary-panel-container') + .getByTestId('ai-suggested-badge') + .first(); + + await expect(badge).toBeVisible(); + }); }); test('Automated badge should appear on entity description with Automated source', async ({ diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataAssetSummaryPanelV1/DataAssetSummaryPanelV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataAssetSummaryPanelV1/DataAssetSummaryPanelV1.tsx index 77ed70bebf4f..3a30eca1f29a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataAssetSummaryPanelV1/DataAssetSummaryPanelV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataAssetSummaryPanelV1/DataAssetSummaryPanelV1.tsx @@ -23,6 +23,7 @@ import { getCurrentMillis, getEpochMillisForPastDays, } from '../../utils/date-time/DateTimeUtils'; +import EntityLink from '../../utils/EntityLink'; import { DRAWER_NAVIGATION_OPTIONS, getEntityOverview, @@ -174,10 +175,43 @@ export const DataAssetSummaryPanelV1 = ({ [entityType] ); - const { changeSummary } = useChangeSummary(entityType, dataAsset.id ?? '', { - fieldPrefix: 'description', - limit: 1, - }); + const isColumnEntity = entityType === EntityType.TABLE_COLUMN; + + const { + changeSummaryEntityType, + changeSummaryEntityId, + changeSummaryParams, + } = useMemo(() => { + if (!isColumnEntity) { + return { + changeSummaryEntityType: entityType, + changeSummaryEntityId: dataAsset.id ?? '', + changeSummaryParams: { fieldPrefix: 'description', limit: 1 }, + }; + } + const columnData = dataAsset as typeof dataAsset & { + table?: { id?: string }; + }; + const columnName = EntityLink.getTableColumnNameFromColumnFqn( + dataAsset.fullyQualifiedName ?? '', + false + ); + + return { + changeSummaryEntityType: EntityType.TABLE, + changeSummaryEntityId: columnData.table?.id ?? '', + changeSummaryParams: { + fieldPrefix: `columns.${columnName}.description`, + limit: 1, + }, + }; + }, [isColumnEntity, entityType, dataAsset.id, dataAsset.fullyQualifiedName]); + + const { changeSummary } = useChangeSummary( + changeSummaryEntityType, + changeSummaryEntityId, + changeSummaryParams + ); const fetchIncidentCount = useCallback(async () => { if ( @@ -267,7 +301,6 @@ export const DataAssetSummaryPanelV1 = ({ }; // Columns inherit owners, domains, tier, and data products from their parent table // These fields should not be editable on columns - const isColumnEntity = entityType === EntityType.TABLE_COLUMN; const { editDomainPermission, @@ -374,7 +407,9 @@ export const DataAssetSummaryPanelV1 = ({ }, [entityPermissions, dataAsset?.fullyQualifiedName]); const commonEntitySummaryInfo = useMemo(() => { - const descriptionChangeSummaryEntry = changeSummary?.description; + const descriptionChangeSummaryEntry = isColumnEntity + ? changeSummary?.[changeSummaryParams.fieldPrefix] + : changeSummary?.description; switch (entityType) { case EntityType.API_COLLECTION: diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DescriptionSection/DescriptionSection.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DescriptionSection/DescriptionSection.tsx index 17543fcf5311..46ece0a8ee65 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DescriptionSection/DescriptionSection.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DescriptionSection/DescriptionSection.tsx @@ -146,7 +146,10 @@ const DescriptionSection: React.FC = ({ ); const metadataRow = ( - + ); if (!description?.trim()) {