restricted to column selection to the first level in nested columns DataContract (#23278)

* restricted to column selection to the first level in nested columns DataContract

* added playwright for it
This commit is contained in:
Ashish Gupta 2025-09-06 18:40:25 +05:30 committed by GitHub
parent 01261f5c48
commit 421985e8ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 69 additions and 0 deletions

View File

@ -1124,6 +1124,66 @@ test.describe('Data Contracts', () => {
} }
}); });
test('Nested Column should not be selectable', async ({ page }) => {
const entityFQN = table.entityResponseData.fullyQualifiedName;
await redirectToHomePage(page);
await table.visitEntityPage(page);
await page.click('[data-testid="contract"]');
await page.getByTestId('add-contract-button').click();
await expect(page.getByTestId('add-contract-card')).toBeVisible();
await page.getByRole('button', { name: 'Schema' }).click();
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
// First level column should be selectable
await page
.locator(
`[data-row-key="${entityFQN}.${table.entityLinkColumnsName[1]}"] .ant-checkbox-input`
)
.click();
await expect(
page.locator(
`[data-row-key="${entityFQN}.${table.entityLinkColumnsName[1]}"] .ant-checkbox-checked`
)
).toBeVisible();
// This Nested column should be closed on initial
for (let i = 3; i <= 6; i++) {
await expect(
page.getByText(table.entityLinkColumnsName[i])
).not.toBeVisible();
}
// Expand the Column and check if they are disabled
await page
.locator(
`[data-row-key="${entityFQN}.${table.entityLinkColumnsName[2]}"] [data-testid="expand-icon"]`
)
.click();
await page
.locator(
`[data-row-key="${entityFQN}.${table.entityLinkColumnsName[4]}"] [data-testid="expand-icon"]`
)
.click();
// This Nested column should be closed on initial
for (let i = 3; i <= 6; i++) {
await expect(page.getByText(table.columnsName[i])).toBeVisible();
await expect(
page.locator(
`[data-row-key="${entityFQN}.${table.entityLinkColumnsName[i]}"] .ant-checkbox-input`
)
).toBeDisabled();
}
});
test('should allow adding a semantic with multiple rules', async ({ test('should allow adding a semantic with multiple rules', async ({
page, page,
}) => { }) => {

View File

@ -37,6 +37,7 @@ import {
getEntityName, getEntityName,
highlightSearchArrayElement, highlightSearchArrayElement,
} from '../../../utils/EntityUtils'; } from '../../../utils/EntityUtils';
import Fqn from '../../../utils/Fqn';
import { pruneEmptyChildren } from '../../../utils/TableUtils'; import { pruneEmptyChildren } from '../../../utils/TableUtils';
import { PagingHandlerParams } from '../../common/NextPrevious/NextPrevious.interface'; import { PagingHandlerParams } from '../../common/NextPrevious/NextPrevious.interface';
import Table from '../../common/Table/Table'; import Table from '../../common/Table/Table';
@ -285,6 +286,13 @@ export const ContractSchemaFormTab: React.FC<{
[tableFqn] [tableFqn]
); );
const tableCheckBoxProps = useCallback(
(record: Column) => ({
disabled: Fqn.split(record.fullyQualifiedName ?? '').length !== 5, // 5 since FQN+Column = 4+1
}),
[]
);
useEffect(() => { useEffect(() => {
setSelectedKeys( setSelectedKeys(
selectedSchema.map((item) => (item as Column).fullyQualifiedName ?? '') selectedSchema.map((item) => (item as Column).fullyQualifiedName ?? '')
@ -317,6 +325,7 @@ export const ContractSchemaFormTab: React.FC<{
selectedRowKeys: selectedKeys, selectedRowKeys: selectedKeys,
onChange: handleChangeTable, onChange: handleChangeTable,
preserveSelectedRowKeys: true, // Preserve selections across page changes preserveSelectedRowKeys: true, // Preserve selections across page changes
getCheckboxProps: tableCheckBoxProps,
}} }}
/> />
</Card> </Card>