-
Notifications
You must be signed in to change notification settings - Fork 2.2k
refactor(entity-rename): replace antd with core-components in EntityNameModal #29783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8be8362
2e97943
e511ad9
53af925
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ import { | |
| Button, | ||
| Col, | ||
| Dropdown, | ||
| Form, | ||
| Row, | ||
| Select, | ||
| TableProps, | ||
|
|
@@ -106,10 +105,7 @@ import Table from '../../common/Table/Table'; | |
| import TestCaseStatusSummaryIndicator from '../../common/TestCaseStatusSummaryIndicator/TestCaseStatusSummaryIndicator.component'; | ||
| import { useGenericContext } from '../../Customization/GenericProvider/GenericContext'; | ||
| import EntityNameModal from '../../Modals/EntityNameModal/EntityNameModal.component'; | ||
| import { | ||
| EntityName, | ||
| EntityNameWithAdditionFields, | ||
| } from '../../Modals/EntityNameModal/EntityNameModal.interface'; | ||
| import { EntityName } from '../../Modals/EntityNameModal/EntityNameModal.interface'; | ||
| import { ColumnFilter } from '../ColumnFilter/ColumnFilter.component'; | ||
| import TableDescription from '../TableDescription/TableDescription.component'; | ||
| import TableTags from '../TableTags/TableTags.component'; | ||
|
|
@@ -169,6 +165,7 @@ const SchemaTable = () => { | |
| } = useFqn({ type: EntityType.TABLE }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The old implementation stored the constraint value inside the antd Form context typed as the |
||
|
|
||
| const [editColumnDisplayName, setEditColumnDisplayName] = useState<Column>(); | ||
| const [editConstraint, setEditConstraint] = useState<string | undefined>(); | ||
|
|
||
| const { | ||
| permissions: tablePermissions, | ||
|
|
@@ -599,10 +596,11 @@ const SchemaTable = () => { | |
|
|
||
| const handleEditDisplayNameClick = useCallback((record: Column) => { | ||
| setEditColumnDisplayName(record); | ||
| setEditConstraint(record.constraint); | ||
| }, []); | ||
|
|
||
| const handleEditColumnData = async (data: EntityName) => { | ||
| const { displayName, constraint } = data as EntityNameWithAdditionFields; | ||
| const { displayName } = data; | ||
| if ( | ||
| !isUndefined(editColumnDisplayName) && | ||
| editColumnDisplayName.fullyQualifiedName | ||
|
|
@@ -612,21 +610,23 @@ const SchemaTable = () => { | |
| editColumnDisplayName.fullyQualifiedName, | ||
| { | ||
| displayName: displayName, | ||
| ...(isEmpty(constraint) | ||
| ...(isEmpty(editConstraint) | ||
| ? { | ||
| removeConstraint: true, | ||
| } | ||
| : { constraint }), | ||
| }, | ||
| : { constraint: editConstraint }), | ||
| } as Partial<Column>, | ||
| 'displayName' | ||
| ); | ||
| } catch (error) { | ||
| showErrorToast(error as AxiosError); | ||
| } finally { | ||
| setEditColumnDisplayName(undefined); | ||
| setEditConstraint(undefined); | ||
| } | ||
| } else { | ||
| setEditColumnDisplayName(undefined); | ||
| setEditConstraint(undefined); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -920,11 +920,12 @@ const SchemaTable = () => { | |
| ); | ||
|
|
||
| const additionalFieldsInEntityNameModal = ( | ||
| <Form.Item | ||
| label={t('label.entity-type-plural', { | ||
| entity: t('label.constraint'), | ||
| })} | ||
| name="constraint"> | ||
| <div className="tw:flex tw:flex-col tw:gap-1.5"> | ||
| <label className="tw:text-sm tw:font-medium tw:text-secondary"> | ||
| {t('label.entity-type-plural', { | ||
| entity: t('label.constraint'), | ||
| })} | ||
| </label> | ||
| <Select | ||
| allowClear | ||
| data-testid="constraint-type-select" | ||
|
|
@@ -934,8 +935,10 @@ const SchemaTable = () => { | |
| entity: t('label.constraint'), | ||
| }), | ||
| })} | ||
| value={editConstraint} | ||
| onChange={(value) => setEditConstraint(value)} | ||
| /> | ||
| </Form.Item> | ||
| </div> | ||
| ); | ||
|
|
||
| const handleEditTable = () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[role="dialog"]may match multiple elements in test contextReplacing
.ant-modal(a CSS class unique to the Ant Design modal) with[role="dialog"]is semantically correct, but the new selector is far more generic — any ARIA dialog rendered on the page matches it. If another dialog (e.g., a confirmation toast or a nested modal from a different component) is visible wheneditDisplayNameFromPanelruns,page.locator('[role="dialog"]')will return multiple elements. Playwright's strict-mode will then throw astrict mode violationerror when the subsequent.locator('#displayName')is called. Consider scoping the locator, e.g.page.locator('[role="dialog"][data-testid="…"]')or usingpage.getByRole('dialog', { name: … })to match by dialog title.