Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 ({
Expand All @@ -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 ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getCurrentMillis,
getEpochMillisForPastDays,
} from '../../utils/date-time/DateTimeUtils';
import EntityLink from '../../utils/EntityLink';
import {
DRAWER_NAVIGATION_OPTIONS,
getEntityOverview,
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ const DescriptionSection: React.FC<DescriptionSectionProps> = ({
);

const metadataRow = (
<DescriptionSourceBadge changeSummaryEntry={changeSummaryEntry} />
<DescriptionSourceBadge
changeSummaryEntry={changeSummaryEntry}
showBadge={false}
/>
);

if (!description?.trim()) {
Expand Down
Loading