mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-29 10:55:09 +00:00
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:
parent
01261f5c48
commit
421985e8ce
@ -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 ({
|
||||
page,
|
||||
}) => {
|
||||
|
@ -37,6 +37,7 @@ import {
|
||||
getEntityName,
|
||||
highlightSearchArrayElement,
|
||||
} from '../../../utils/EntityUtils';
|
||||
import Fqn from '../../../utils/Fqn';
|
||||
import { pruneEmptyChildren } from '../../../utils/TableUtils';
|
||||
import { PagingHandlerParams } from '../../common/NextPrevious/NextPrevious.interface';
|
||||
import Table from '../../common/Table/Table';
|
||||
@ -285,6 +286,13 @@ export const ContractSchemaFormTab: React.FC<{
|
||||
[tableFqn]
|
||||
);
|
||||
|
||||
const tableCheckBoxProps = useCallback(
|
||||
(record: Column) => ({
|
||||
disabled: Fqn.split(record.fullyQualifiedName ?? '').length !== 5, // 5 since FQN+Column = 4+1
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedKeys(
|
||||
selectedSchema.map((item) => (item as Column).fullyQualifiedName ?? '')
|
||||
@ -317,6 +325,7 @@ export const ContractSchemaFormTab: React.FC<{
|
||||
selectedRowKeys: selectedKeys,
|
||||
onChange: handleChangeTable,
|
||||
preserveSelectedRowKeys: true, // Preserve selections across page changes
|
||||
getCheckboxProps: tableCheckBoxProps,
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
|
Loading…
x
Reference in New Issue
Block a user