Skip to content

Conversation

@yomybaby
Copy link
Member

@yomybaby yomybaby commented Dec 19, 2025

Resolves #4862 (FR-1804)

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 Details

Changed API

Before:

extraColumns?: BAIColumnType<UserNodeInList>[]

After:

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

Usage Example

<UserNodes
  usersFrgmt={users}
  customizeColumns={(baseColumns) => [
    baseColumns[0],          // Keep email column first
    controlColumn,           // Insert control column
    ...baseColumns.slice(1)  // Rest of base columns
  ]}
/>

Changes

  • New UserNodes.tsx component with fragment-based GraphQL pattern
  • Function-based customizeColumns prop for flexible composition
  • Updated UserManagement.tsx to use new composition pattern
  • Added translations for 21 languages
  • Removed UserNodeList.tsx (replaced by UserNodes)

Test Plan

Checklist:

  • Verify user list displays correctly with all columns
  • Check control column is inserted at correct position (after email)
  • Test column sorting functionality
  • Verify status filter (active/inactive) works
  • Test search and filtering
  • Confirm user actions (edit, enable/disable) work correctly
  • Check all 21 language translations display properly

Copy link
Member Author

yomybaby commented Dec 19, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

Coverage report for ./packages/backend.ai-ui

St.
Category Percentage Covered / Total
🟡 Statements 60.7% 227/374
🔴 Branches 33.33% 104/312
🔴 Functions 48.31% 43/89
🟡 Lines 62.42% 206/330

Test suite run success

146 tests passing in 8 suites.

Report generated by 🧪jest coverage report action from bc71618

@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
4.23% (+0% 🔼)
496/11724
🔴 Branches 3.65% 298/8159
🔴 Functions
2.55% (+0.01% 🔼)
92/3604
🔴 Lines
4.2% (+0% 🔼)
482/11466
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🔴
... / UserManagement.tsx
0% 0% 0% 0%

Test suite run success

144 tests passing in 13 suites.

Report generated by 🧪jest coverage report action from bc71618

@yomybaby yomybaby requested a review from ironAiken2 December 22, 2025 07:38
@yomybaby yomybaby marked this pull request as ready for review December 22, 2025 07:38
@yomybaby yomybaby force-pushed the feat/FR-1788-add-more-fields-user-list branch from f8c5eb7 to 9f7bd5d Compare December 22, 2025 07:38
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch from 6d4a523 to a250d0d Compare December 22, 2025 07:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the user management table to introduce a flexible column composition pattern, improving architectural separation and maintainability. The changes replace UserNodeList with two components: UserManagement (query orchestrator) and UserNodes (fragment-based presentation), moving from array-based (extraColumns) to function-based (customizeColumns) column composition.

Key Changes:

  • Introduces flexible function-based column composition API for better control over column positioning
  • Separates data fetching concerns (UserManagement) from presentation logic (UserNodes)
  • Adds comprehensive translations for comp:UserNodes across 21 languages
  • Migrates from use-query-params to modern nuqs library for better query parameter handling
  • Adds user-friendly button titles for improved accessibility

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
react/src/pages/UserCredentialsPage.tsx Updates import from UserNodeList to UserManagement component
react/src/components/UserNodeList.tsx Deleted legacy component with monolithic query+presentation logic
react/src/components/UserManagement.tsx New query orchestrator component that manages data fetching and passes fragment data to UserNodes via customizeColumns pattern
packages/backend.ai-ui/src/components/UserNodes.tsx New fragment-based presentation component with customizable column composition API
packages/backend.ai-ui/src/components/index.ts Exports new UserNodes component and related types
packages/backend.ai-ui/src/locale/*.json (21 files) Adds comp:UserNodes translation keys across all supported languages
packages/backend.ai-ui/src/components/Table/BAITableSettingModal.tsx Adds requiredMark={false} for cleaner UI in table settings modal

@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch from a250d0d to ecaa4c3 Compare December 23, 2025 02:33
@yomybaby yomybaby force-pushed the feat/FR-1788-add-more-fields-user-list branch 2 times, most recently from 9310377 to e541dde Compare December 23, 2025 02:53
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch 3 times, most recently from fd2ce6c to 49fc675 Compare December 23, 2025 03:11
@github-actions github-actions bot added area:ux UI / UX issue. area:i18n Localization labels Dec 23, 2025
@yomybaby yomybaby force-pushed the feat/FR-1788-add-more-fields-user-list branch from 8d8f0ae to e2c26aa Compare December 23, 2025 03:28
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch from 49fc675 to 99d7387 Compare December 23, 2025 03:28
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch 2 times, most recently from 6f5f969 to 7a76095 Compare December 23, 2025 10:22
@yomybaby yomybaby requested a review from nowgnuesLee December 23, 2025 11:53
Copy link
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorting by created_at isn't working.

@yomybaby yomybaby force-pushed the feat/FR-1788-add-more-fields-user-list branch from e2c26aa to dcd45f1 Compare December 24, 2025 01:34
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch 2 times, most recently from cacaf68 to 842515c Compare December 24, 2025 01:38
@yomybaby yomybaby requested a review from nowgnuesLee December 24, 2025 01:38
Copy link
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch from 842515c to b185122 Compare December 24, 2025 02:57
@yomybaby yomybaby force-pushed the feat/FR-1788-add-more-fields-user-list branch from dcd45f1 to eb24ea2 Compare December 24, 2025 02:57
@github-actions github-actions bot added the area:lib Library and SDK related issue. label Dec 24, 2025
Copy link
Contributor

@ironAiken2 ironAiken2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is not a change in this PR, the i18n translation text used in InfoModal should also be changed to true or false.
image.png

@nowgnuesLee nowgnuesLee force-pushed the feat/FR-1804-flexible-column-composition branch from b185122 to f45d1dd Compare December 24, 2025 04:18
@nowgnuesLee nowgnuesLee force-pushed the feat/FR-1788-add-more-fields-user-list branch from eb24ea2 to 562b663 Compare December 24, 2025 04:18
@yomybaby yomybaby force-pushed the feat/FR-1804-flexible-column-composition branch from f45d1dd to 7b90a82 Compare December 24, 2025 04:25
@yomybaby yomybaby requested a review from ironAiken2 December 24, 2025 04:25
Copy link
Contributor

@ironAiken2 ironAiken2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@graphite-app
Copy link

graphite-app bot commented Dec 24, 2025

Merge activity

…position (#4863)

Resolves #4862 ([FR-1804](https://lablup.atlassian.net/browse/FR-1804))

## 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 Details

### Changed API

**Before:**
```typescript
extraColumns?: BAIColumnType<UserNodeInList>[]
```

**After:**
```typescript
customizeColumns?: (baseColumns: BAIColumnType<UserNodeInList>[]) => BAIColumnType<UserNodeInList>[]
```

### Usage Example

```typescript
<UserNodes
  usersFrgmt={users}
  customizeColumns={(baseColumns) => [
    baseColumns[0],          // Keep email column first
    controlColumn,           // Insert control column
    ...baseColumns.slice(1)  // Rest of base columns
  ]}
/>
```

## Changes

- New `UserNodes.tsx` component with fragment-based GraphQL pattern
- Function-based `customizeColumns` prop for flexible composition
- Updated `UserManagement.tsx` to use new composition pattern
- Added translations for 21 languages
- Removed `UserNodeList.tsx` (replaced by UserNodes)

## Test Plan

**Checklist:**

- [ ] Verify user list displays correctly with all columns
- [ ] Check control column is inserted at correct position (after email)
- [ ] Test column sorting functionality
- [ ] Verify status filter (active/inactive) works
- [ ] Test search and filtering
- [ ] Confirm user actions (edit, enable/disable) work correctly
- [ ] Check all 21 language translations display properly

[FR-1804]: https://lablup.atlassian.net/browse/FR-1804?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
@graphite-app graphite-app bot force-pushed the feat/FR-1788-add-more-fields-user-list branch from 562b663 to a70f8f8 Compare December 24, 2025 04:48
@graphite-app graphite-app bot force-pushed the feat/FR-1804-flexible-column-composition branch from 7b90a82 to bc71618 Compare December 24, 2025 04:49
Base automatically changed from feat/FR-1788-add-more-fields-user-list to main December 24, 2025 04:50
@graphite-app graphite-app bot merged commit bc71618 into main Dec 24, 2025
9 checks passed
@graphite-app graphite-app bot deleted the feat/FR-1804-flexible-column-composition branch December 24, 2025 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n Localization area:lib Library and SDK related issue. area:ux UI / UX issue. size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance User Management Table with Flexible Column Composition

4 participants