Skip to content

Migrate the remaining antd form controls to core components - #35347

Closed
shah-harshit wants to merge 6 commits into
shah-harshit/antd-forms-settingsfrom
shah-harshit/antd-forms-dq-alerts
Closed

shah-harshit wants to merge 6 commits into
shah-harshit/antd-forms-settingsfrom
shah-harshit/antd-forms-dq-alerts

Conversation

@shah-harshit

@shah-harshit shah-harshit commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Part of open-metadata/openmetadata-collate#6893 (epic open-metadata/openmetadata-collate#6884).

PR 3 of 3 for the Form / Select / Input migration: the remaining antd form controls that no other open PR covers move to @openmetadata/ui-core-components. Once #35190 lands, the legacy antd field renderer in utils/formUtils.tsx loses its last caller and is removed, and Form / Select / Input are frozen in MIGRATED_ANTD_COMPONENTS.

Stacked on #35285. Base is shah-harshit/antd-forms-settings; it will be retargeted once that merges.

Out of scope (already in flight): Data Quality, Observability / Alerts and Profiler forms are migrated by #35190 (OSS) and open-metadata/openmetadata-collate#7276 (Collate), including AddTestSuitePipeline, SliderWithInput, CustomRangeWidget, AsyncSelect in alerts and FQNListSelect. This PR does not touch them.

Type of change:

  • Improvement

High-level design:

Done:

  • TeamTypeSelect → core Select, core Check / XClose icons on its icon-only buttons (now with accessible names).

  • ColorPicker: hex text on core Input, swatch kept as a native colour input (core has no swatch control, and inside a core Input the swatch collapses to a thin stripe); reports a plain string and takes the field label so each theme colour has distinct accessible names. The core COLOR_PICKER field is a fixed palette, so it cannot replace this free-hex picker for theme colours. Its LESS file goes; the unused legacy COLOR_PICKER case in formUtils is dropped.

  • QueryUsedByOtherTable → core DataAssetAsyncSelectList (table index, multiple), reporting entity references; QueryCard no longer maps antd options to references.

  • Classic search settings reuse the AI-mode TermBoostCard in TermBoostList; the antd TermBoost copy, its LESS and the per-caller card width overrides are removed.

Remaining (waits on #35190, which adds the core NumberInput and moves the last AsyncSelect / legacy-field callers):

  • EntitySearchSettings: its two antd InputNumbers → core NumberInput
  • AsyncSelect removal once alerts no longer use it
  • remove the legacy getField / generateFormFields and the wrappers only it uses (SanitizedInput, FilterPattern, UserTeamSelectableListSearchInput, legacy FormItemLabel, FormUtils.interface), then freeze Form / Select / Input

Behaviour changes:

  • Query "used by other tables" options show the entity type under the name instead of the table FQN (the shared core DataAssetAsyncSelectList layout). Picks now persist across re-renders of the query card.
  • Classic term boost cards use the AI-mode card at its fixed width instead of stretching to the panel.
  • Team type cancel / save are core xs icon buttons with accessible names.

Screenshots (light, classic mode — before = main, after = this branch):

Control Before (main) After
Theme colours (ColorPicker) appearance-colors-before appearance-colors-after
Team type select team-type-select-before team-type-select-after
Query used by other tables query-used-in-before query-used-in-after
Classic term boost term-boost-before term-boost-after

Testing:

  • TeamTypeSelect.test.tsx: fixed the mock to return team types as the util does; added "saves the picked type" and "hides Group" cases
  • ColorPicker.test.tsx: added "reports a typed hex as a plain string"; Appearance page and formUtils suites pass (30 tests)
  • yarn lint:src:suppressions (antd baseline 357 → 346), yarn test:eslint-rules, ui-checkstyle-changed: pass
  • Review fixes: picker selection kept in local state with a re-render regression test; ColorPicker accessible-name test
  • QueryUsedByOtherTable.test.tsx: replaced the loader/initial-fetch cases with "searches tables and preselects the current ones" and "reports picked tables as entity references"; TableQueries + SearchSettings suites pass (64 tests)
  • Playwright against this branch: SearchSettings.spec.ts passes; QueryEntity.spec.ts timed out on the table-search wait added here, which was too strict — loosened in 0952b50, not re-run (E2E not run for this round)
  • tsc: no new errors

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.

@shah-harshit shah-harshit added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Oct 13, 2026
@shah-harshit shah-harshit self-assigned this Oct 13, 2026
TeamTypeSelect uses the core Select and core icons. ColorPicker keeps its
free-hex swatch + text pair on core Input and reports a plain string; the
core COLOR_PICKER field is a fixed palette, so it cannot replace it for theme
colours.
@shah-harshit
shah-harshit force-pushed the shah-harshit/antd-forms-dq-alerts branch from 6039fe0 to cde5e2f Compare October 13, 2026 11:27
@shah-harshit shah-harshit changed the title Migrate Data Quality, Alerts and Profiler forms from antd Form to core HookForm Migrate the remaining antd form controls to core components Oct 13, 2026
QueryUsedByOtherTable picks tables with the core DataAssetAsyncSelectList
and reports entity references, so QueryCard no longer maps antd options.
The classic search settings reuse the AI-mode TermBoostCard instead of the
antd TermBoost copy.
The query table picker is controlled, so it now follows the user's picks
instead of being reset to the saved tables on every parent re-render.
ColorPicker takes the field label, so the hex box and the swatch of each
theme colour get their own accessible names.
@shah-harshit
shah-harshit marked this pull request as ready for review October 13, 2026 11:57
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 922 → 915
- 1 added, 8 removed, 6 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/FieldValueBoostDialog.tsx

Removed source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageConfigModal.tsx
  openmetadata-ui/src/main/resources/ui/src/components/Modals/ModalWithFunctionEditor/ModalWithFunctionEditor.tsx
  openmetadata-ui/src/main/resources/ui/src/components/SearchSettings/FieldValueBoostModal/FieldValueBoostModal.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/Configuration/EditUrlConfiguration/EditUrlConfigurationPage.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/KPIPage/AddKPIPage.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/KPIPage/EditKPIPage.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/RuleForm/RuleForm.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/TeamsPage/AddTeamForm.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/src/components/Settings/Email/EmailConfigForm/EmailConfigForm.component.tsx
  openmetadata-ui/src/main/resources/ui/src/components/Settings/Users/CreateUser/CreateUser.component.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/LearningResourcesPage/LearningResourceForm.component.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/LineageConfigPage/LineageConfigPage.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/AddPolicyPage/AddPolicyPage.tsx
  openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/AddRolePage/AddRolePage.tsx

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@gitar-bot

gitar-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🟡 Medium risk · Replacing query table selection with the core picker changes how table references are selected and saved, potentially associating queries with unintended tables.

Migrates the remaining antd form controls (TeamTypeSelect, ColorPicker, the query table picker and classic term boost) to core components. Resolved: each theme colour input now has a distinct accessible name instead of all sharing "Color", and the query-used-in picker keeps picks across re-renders instead of resetting to saved tables after each pick. No open issues found.

✅ 2 closed
✅ Quality: Every theme colour input gets the same accessible name "Color"

📄 openmetadata-ui/src/main/resources/ui/src/components/common/ColorPicker/ColorPicker.component.tsx:16-21 📄 openmetadata-ui/src/main/resources/ui/src/components/common/ColorPicker/ColorPicker.component.tsx:36 📄 openmetadata-ui/src/main/resources/ui/src/components/common/ColorPicker/ColorPicker.component.tsx:46 📄 openmetadata-ui/src/main/resources/ui/src/pages/AppearanceConfigSettingsPage/AppearanceConfigSettingsPage.tsx:353-356
ColorPicker hardcodes aria-label={t('label.color')} on both the swatch and the hex text input. On the Appearance page, FormItemLabel (the primary, info, success, error… label) has no htmlFor link to the input, so every theme field ends up as a pair of controls named only "Color". A screen-reader user can't tell the fields apart, or tell the swatch from the hex box, which breaks the frontend-a11y rule that every control needs a distinct, meaningful name. Fix: add a label prop and use it in both names, e.g. ${label} for the hex input and ${label} ${t('label.color')} for the swatch. The page would pass label={field.label}. Linking the visible label to the hex input with htmlFor={id} also works.

✅ Bug: Query-used-in picker resets to saved tables after each pick

📄 openmetadata-ui/src/main/resources/ui/src/components/Database/TableQueries/QueryUsedByOtherTable/QueryUsedByOtherTable.component.tsx:124-138 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/TableQueries/QueryCard.tsx:321-325
selectList lists onChange as a memo dependency, and QueryCard passes an inline (value) => setSelectedTables(value). So every pick re-renders QueryCard, which creates a new onChange, which rebuilds initialOptions and value from the saved query.queryUsedIn. DataAssetAsyncSelectList's [value, initialOptions] effect then resets its internal selected back to the saved tables. The user's pick disappears from the field, and the next insert or clear starts from that reset list. Picking two tables keeps only the last one, and a removed table comes back on the next action, so the wrong queryUsedIn gets saved. The single-pick e2e test passes anyway. To fix it, keep the selection in local state seeded from query.queryUsedIn and pass that as value, or pass value only once on mount, and remove onChange from the memo dependencies (or have QueryCard pass the stable setSelectedTables).

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@shah-harshit

Copy link
Copy Markdown
Contributor Author

Combined into #35280 to go through the merge queue once. All commits, review fixes, screenshots and test results from this PR are carried over there.

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 77%
77.44% (124182/160346) 63.71% (77553/121716) 65.11% (26002/39933)

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant