Skip to content

feat(admin): optimize batch operations and enhance admin panel UX#41

Merged
KerwinTsaiii merged 4 commits intodevelopfrom
fix/batch-operations-performance
Mar 10, 2026
Merged

feat(admin): optimize batch operations and enhance admin panel UX#41
KerwinTsaiii merged 4 commits intodevelopfrom
fix/batch-operations-performance

Conversation

@MioYuuIH
Copy link
Contributor

@MioYuuIH MioYuuIH commented Mar 9, 2026

Summary

Optimize batch user/quota operations and enhance admin panel UX with better error handling, safety guards, and new batch capabilities.

Batch Operation Performance

  • Use parallel ThreadPoolExecutor for bcrypt hashing in batch_set_passwords (bcrypt releases GIL)
  • Single DB transaction with per-user SQLAlchemy savepoints (session.begin_nested()) in both batch_set_passwords and batch_set_quota for partial-success error isolation
  • One user failing does not roll back the entire batch

Create User Improvements

  • Detect and report duplicate (already-existing) users instead of silently overwriting
  • Existing users are skipped — no password or quota changes applied to them
  • Handle JupyterHub API 409 (all users exist) gracefully
  • Show detailed per-user status: New / Skipped / PW failed badges
  • CSV export includes status column

Admin Protection

  • Prevent accidental deletion of admin users and the currently logged-in user
  • Multi-layer protection: UI filtering (deletableSelected) + execution-time safety checks
  • Delete button count and confirmation modal reflect only deletable users
  • Checkboxes remain enabled for protected users (needed for Set Quota and other operations)

Batch Password Reset

  • New BatchPasswordModal component for resetting passwords of selected users
  • Support random passwords (unique per user) or shared password
  • "Force password change on next login" option
  • Results table with Copy and CSV export
  • Only available for native (non-GitHub OAuth) users

UX Enhancements

  • Redesigned Create User modal with step-by-step progress indicator
  • Inline password display toggle (show/hide) per user
  • Collapsible advanced options (quota, force password change)
  • Password generation button with configurable length
  • Native user filtering via isNativeUser() utility

Test plan

  • Create users with mix of new and existing usernames — verify existing users are skipped
  • Create users when ALL usernames already exist — verify 409 handled gracefully
  • Select admin + non-admin users, verify delete button count excludes admin/self
  • Attempt single delete on admin user — verify safety check blocks it
  • Select native users, use batch Reset PW — verify passwords set and exportable
  • Select GitHub OAuth users — verify Reset PW button is disabled
  • Verify partial failure: if one user's password/quota fails, others still succeed
  • Test CSV export includes correct status for each user

…user UX

- Replace sequential per-user API calls with batch endpoints for user
  creation, password setting, and quota operations
- Add batch set-password API endpoint with parallel bcrypt hashing via
  ThreadPoolExecutor for significant speedup
- Optimize backend batch_set_quota to use single DB transaction instead
  of N separate sessions
- Support unlimited quota in batch quota API
- Add batch delete for selected users with confirmation modal
- Add quick username generator (prefix + start number + count)
- Add initial quota setting in create user modal with default from config
- Add CSV export for created user credentials
- Expose default_quota in quota rates API
@MioYuuIH MioYuuIH requested a review from KerwinTsaiii as a code owner March 9, 2026 06:01
@MioYuuIH MioYuuIH changed the title Optimize batch user/quota operations and enhance create user UX feat(admin): batch operations optimization and create user enhancements Mar 9, 2026
MioYuuIH added 2 commits March 9, 2026 17:06
… feedback

- Track per-user status (created/existed/failed) through the pipeline
- Handle JupyterHub 409 (all users exist) gracefully instead of failing
- Detect silently skipped existing users by comparing request vs response
- Each step (create/password/quota) has independent error handling
- Result page shows detailed status badges and warnings per user
- CSV export includes status column
- Clipboard copy only includes users with successful passwords
…d DB savepoints

- Add BatchPasswordModal for batch password reset of selected users
  with random/shared password options and CSV export
- Protect admin users and current user from accidental deletion
  (UI filtering + execution-time safety checks)
- Skip existing users during batch create (no password/quota changes)
- Add per-user SQLAlchemy savepoints (begin_nested) in batch_set_passwords
  and batch_set_quota for partial-success error isolation
- Show proper status badges (New/Skipped) and detailed feedback
@MioYuuIH MioYuuIH changed the title feat(admin): batch operations optimization and create user enhancements feat(admin): optimize batch operations and enhance admin panel UX Mar 9, 2026
@KerwinTsaiii KerwinTsaiii merged commit 85489e6 into develop Mar 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants