Skip to content

Enhance User Management Table with Flexible Column Composition #4862

@yomybaby

Description

@yomybaby

Background

The current user management table implementation uses a fixed array-based approach for column composition (extraColumns?: BAIColumnType[]). This approach has limitations:

  1. Limited Flexibility: Can only prepend or append columns, cannot insert at specific positions
  2. Tight Coupling: Query logic and presentation are coupled in a single component
  3. Difficult Maintenance: Changes to column ordering require modifying the base component

Purpose

This enhancement introduces a function-based column composition pattern to address these limitations:

  1. Architectural Separation: Separate data fetching (query orchestrator) from presentation (fragment-based table component)
  2. Flexible Composition: Enable inserting, filtering, reordering columns at any position
  3. Better Developer Experience: Provide render-props pattern for maximum control over column composition
  4. Maintainability: Allow parent components to customize columns without modifying base component

Benefits

  • Flexibility: Insert control columns at specific positions (e.g., after email column)
  • Reusability: Base table component can be reused with different column compositions
  • Type Safety: TypeScript ensures column customization is type-safe
  • Clean Architecture: Follows separation of concerns principle (data fetching vs presentation)

Implementation Approach

Changed from:

extraColumns?: BAIColumnType<UserNodeInList>[]

To:

customizeColumns?: (baseColumns: BAIColumnType<UserNodeInList>[]) => BAIColumnType<UserNodeInList>[]

This allows flexible column manipulation:

customizeColumns={(baseColumns) => [
  baseColumns[0],          // Keep first column
  customControlColumn,     // Insert custom column
  ...baseColumns.slice(1)  // Rest of columns
]}

Scope

  • New UserNodes.tsx component with fragment-based pattern
  • Function-based customizeColumns prop for flexible composition
  • Translations for 21 languages
  • Updated UserManagement.tsx to use new pattern

JIRA Issue: FR-1804

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions