Repository navigation
Fixes #6884: migrate selection and numeric forms to core - #35262
shah-harshit merged 7 commits into
Conversation
| options.map((option) => ({ | ||
| id: String(option.value), | ||
| value: String(option.value), | ||
| // Core uses string values; preserve numeric enums for the schema payload. | ||
| data: option.value, | ||
| label: option.label ?? option.title ?? String(option.value), | ||
| parentId, |
There was a problem hiding this comment.
💡 Bug: getTreeSelectValues returns stringified ids, so numeric enum values become strings
toTreeSelectNodes stores the original option value in data and says this is to "preserve numeric enums for the schema payload". getTreeSelectValue reads data when it rebuilds the selection. But getTreeSelectValues, which builds the outgoing payload, returns node.value ?? node.id, and both were set with String(option.value). So when the user picks a numeric enum option in TreeSelectWidget, RJSF's onChange receives a string like '1' instead of the number 1. That value fails a numeric items.enum and differs from the stored value it was loaded from. The widget's non-expandAllValue path, which persists values as-is, is where this shows up. Return node.data when it is set, so the round-trip keeps the original type.
Prefer the preserved original value when serializing the selection.:
return nodes
.filter((node) => !node.parentId || !selectedIds.has(node.parentId))
.map(
(node) =>
(node.data as string | number | undefined) ?? node.value ?? node.id
);
Was this helpful? React with 👍 / 👎
|
❌ SSO Login Nightly — FAILED View workflow run · Commit
Totals: 93 passed · 1 failed · 0 flaky · 0 skipped · duration 19m 42s |
11dec04 to
7220b68
Compare
22aaf7c to
3eb490a
Compare
11cb9a1 to
c302948
Compare
c648675 to
2defee0
Compare
…n migrated profiler and contract tests
Code Review 👍 Approved with suggestions 0 closed / 2 findings🔴 High risk · Migrating policy-rule resource and operation selectors changes inputs used for access-control rules, potentially saving unintended permissions or denials. Migrates selection, upload, numeric, autocomplete, and time controls to core components, and moves several forms to React Hook Form. Consider two follow-ups: 💡 Bug: getTreeSelectValues returns stringified ids, so numeric enum values become strings📄 openmetadata-ui/src/main/resources/ui/src/utils/TreeSelect.utils.ts:27-33 📄 openmetadata-ui/src/main/resources/ui/src/utils/TreeSelect.utils.ts:66-75 📄 openmetadata-ui/src/main/resources/ui/src/components/common/Form/JSONSchema/JsonSchemaWidgets/TreeSelectWidget.tsx:65-76
Prefer the preserved original value when serializing the selection.💡 Bug: Pending tree focus outlives empty results and steals focus while typing📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/tree-select/tree-select.tsx:977-991 📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/tree-select/tree-select.tsx:1035-1038 📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/tree-select/tree-select.tsx:1281-1294 If ArrowDown is pressed while the dropdown shows the no-data branch (lines 1035-1038 render no Drop the pending request when no row exists after loading, and on any search edit🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledOptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes open-metadata/openmetadata-collate#7302
Fixes open-metadata/openmetadata-collate#7303
Part of open-metadata/openmetadata-collate#6884.
Depends on #35253; this draft is based on its branch to keep the overlapping form, profiler, and search changes in sequence.
Migrate the remaining selection, upload, numeric, autocomplete, and time controls to core components. Move the parent profiler, KPI, policy, lineage, login, user-creation, and SLA forms to React Hook Form where they contain these controls. Remove the unused legacy ParameterForm and its test.
Type of change:
High-level design:
Use core components directly. Add canonical NumberInput behavior for nullable numeric values, decimal edits, relative arrow stepping, and bounds on commit. TreeSelect adds visible-chip limits, parent display condensation, loading, and focus callbacks. Tree utilities preserve schema values and expand synthetic All selections; SLA serialization retains wall-clock HH:mm and distinguishes zero from a cleared duration.
Nested forms receive their form instance explicitly. Profiler field arrays retain stable row IDs and unwrap partition rows to the API's string arrays. KPI date normalization clears an incompatible loaded end date instead of restoring it. The controls adopt core styling, including file drop zones and view-switch buttons.
All eight migrated components reach zero root, subpath, and type imports and are frozen in ESLint. The suppression count falls from 615 to 536. ADR:2026-10-12-numeric-fields-preserve-edits-and-api-values records the numeric and serialization contract.
The independent Modal/Button migrations remain separate. Provider/package removal in open-metadata/openmetadata-collate#7304 must wait for the remaining Modal, Button, Input, Select, and Form consumers.
Visual follow-ups also restore the name-column row header in learning resources, constrain KPI numeric fields so their sliders remain visible, and keep async permission-search options open while loading.
Tests:
Use cases covered
Unit tests
cc33564c31b: 1,924 suites / 22,212 tests; the one failing suite (EntityImport, upload input moved to core) is fixed and passes 45/45.test:eslint-rules(pinned suppression counts), and the productionvitebuild pass.tscreports only pre-existing diagnostics (stale generated types and the existingonPress-on-ButtonUtilitypattern), none new in the changed files' migration code.ContractViewSwitchTab(ButtonGroup selection),CustomRangeWidget/ProfilerSettings(NumberInput suffix, native rangemin),EntityImport(core file input).Backend integration tests
Not applicable: no backend or API changes.
Ingestion integration tests
Not applicable: no ingestion changes.
Playwright (UI) tests
Not run for this revision: local Playwright was deferred at the author's request. The earlier partial chromium run (before the sidebar fix) had 100 passed / 16 failed; the sidebar, notification, and pipeline tree-view failures were fixed and their focused reruns pass. CI Playwright covers the remaining specs.
Manual testing performed
Compared main
0f7fdbf8704against the complete stacked branch (display/navigation + controls/forms) on an isolated local backend. Attached 52 scene comparisons / 208 PNGs, covering main and branch in both light and dark. The archives include an HTML index for full-size browsing. Gallery navigation uses two repository images supplied as fixture metadata; isolated error, progress, and image-fallback screenshots mount the real migrated components with fixture values.Visual verification found and fixed keyboard navigation/labels in TreeSelect, a missing learning-resource table row header, KPI slider width, and permission-search popup dismissal while async results arrive. Local browser reruns confirm those states.
Display/navigation comparisons — 30 scenes · Controls/forms comparisons — 22 scenes
Sidebar refresh (latest fix): collapsed group triggers and links now share core icon size and row height; hover menus stay interactive. Rows: expanded · collapsed · collapsed + hover menu; columns: main/branch × light/dark.
UI screen recording:
Not applicable: component/form refactor. Before/after screenshots are attached above; local Playwright validation follows.
Checklist: