Prasad P. Pawar created ATLAS-5369:
--------------------------------------

             Summary: ATLAS UI: Fix Business Metadata enum attributes rendering 
as search/text input instead of dropdown in Atlas React UI
                 Key: ATLAS-5369
                 URL: https://issues.apache.org/jira/browse/ATLAS-5369
             Project: Atlas
          Issue Type: Task
          Components: atlas-webui
    Affects Versions: 3.0.0
            Reporter: Prasad P. Pawar
            Assignee: Prasad P. Pawar


In the Atlas React dashboard, Business Metadata attributes with enum typedefs 
are not consistently rendered as dropdown controls on the entity detail page 
edit form. Instead, its seen as a search-style Autocomplete (with free-text 
entry) or a plain text input, even when a valid enum definition exists in Atlas.
The backend and enum typedef are valid, but the UI does not render 
enum-specific controls and falls back to generic input fields.
Scope of this ticket: Business Metadata edit flow in the React dashboard 
({{{}BMAttributesFields{}}}). The legacy entity create/edit enum issue is a 
separate enhancement.


h2. Root Cause

Enum handling in {{BMAttributesFields.tsx}} was incomplete:
 # Enum options were not built reliably for multi-valued enums
Options were only loaded when {{{}!isMultiValued || typeName === 
"array<boolean>"{}}}, so types like {{array<adls_gen2_replication>}} often had 
no enum options from Redux {{{}enumDefs{}}}.

 # Array enum attributes used searchable Autocomplete with {{freeSolo}}
Generic array handling allowed arbitrary text entry. Array enum attributes went 
through this path, so they appeared as a search input instead of a constrained 
dropdown.

 # Enum type detection logic was incorrect
The condition to distinguish enum vs non-enum types was too broad and did not 
reliably route enum attributes to dropdown controls.

 # Default fallback is a plain {{TextField}}
Any attribute that is not recognized as an enum falls through to a standard 
text input with no UI-level enum validation.

Atlas backend/REST behavior is unaffected. This is a UI rendering limitation 
only.


||Scenario||Current Behavior||
|Single enum (e.g. {{{}adls_gen2_replication{}}})|Falls back to plain 
{{TextField}} if enum is not detected|
|Multi enum (e.g. {{{}array<adls_gen2_replication>{}}})|Renders as 
{{Autocomplete}} with {{freeSolo}} — search-style input, not a strict dropdown|
|{{enumDefs}} not loaded from Redux|Enum not recognized → {{TextField}} 
fallback|
|Unknown / undefined enum typedef|No matching definition → {{TextField}} 
fallback (expected)|
|Non-enum arrays ({{{}array<string>{}}}, {{{}array<int>{}}}, 
etc.)|Intentionally remain free-text searchable Autocomplete|

 
h2. Fix
h3. 1. New utility: {{bmAttributesEnumUtils.ts}}

Centralized enum logic:
 * {{isEnumTypeName()}} — matches type against loaded {{enumDefs}}
 * {{buildEnumOptionsForTypeName()}} — builds options from enum {{elementDefs}}
 * {{normalizeMultiEnumValue()}} — normalizes stored values for multi-select
 * {{areEnumOptionsEqual()}} / {{getEnumOptionLabel()}} — Autocomplete helpers

h3. 2. Updated {{BMAttributesFields.tsx}}
||Attribute Type||Control After Fix||
|Single enum ({{{}EnumName{}}})|MUI {{Select}} dropdown|
|Multi enum ({{{}array<EnumName>{}}})|MUI {{Autocomplete}} multi-select, 
{{freeSolo}} disabled|
|Non-enum arrays|Unchanged — searchable Autocomplete with free text|
|Unknown enum / missing {{enumDefs}}|Fallback to {{TextField}}|

h3. 3. Updated {{BMAttributes.tsx}}
 * Submit handling supports both string and {{{ label, value }}} formats for 
array enum values
 * Layout/styling updates for BM attribute rows

h2. Test Plan
h3. Automated Tests — 11/11 passing

{{bmAttributesEnumUtils.test.ts}} (7 tests)
 * Detects array enum type names
 * Extracts inner enum type from {{array<EnumName>}}
 * Builds enum options for single and multi-value enums
 * Distinguishes enum vs non-enum types
 * Normalizes stored string values to enum option objects
 * Handles missing/invalid multi enum values
 * Compares enum options for Autocomplete selection



||Test||Case||Expected Result||
|Single-value enum|Positive|Renders MUI {{Select}} dropdown|
|{{array<adls_gen2_replication>}}|Positive|Multi-select dropdown; shows LRS, 
ZRS, GRS|
|{{array<string>}}|Negative|Keeps free-text searchable Autocomplete|
|{{array<unknown_enum>}}|Negative|Falls back to plain {{TextField}}|

 
h3. Manual Verification
 # Open entity detail → Business Metadata → Edit
 # Single enum attribute → verify {{Select}} dropdown with enum values
 # Multi enum attribute → verify multi-select dropdown, no free-text entry
 # Save → confirm values persist and display correctly in read mode
 # Non-enum {{array<string>}} → verify free-text entry still works
 # Unknown enum type → verify graceful fallback to text input




h2. Acceptance Criteria
 *  Single enum BM attributes render as {{Select}} dropdown
 *  Multi enum BM attributes render as constrained multi-select (no 
{{{}freeSolo{}}})
 *  Options populated from Redux {{enumDefs}} / {{elementDefs}}
 *  Non-enum arrays unchanged
 *  Unknown enums fall back to text input
 *  Save/submit persists values correctly
 *  All 11 unit tests pass



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to