Skip to content

Conversation

@Tsukikage7
Copy link
Contributor

refactor(admin): modernize admin module with clean architecture and React frontend

Summary

Modernize the admin module with:

  • Frontend: Vue.js 2 → React 18 + TypeScript + Vite
  • Backend: Clean architecture (handler/store/model separation)
  • CI/CD: GitHub Actions workflows for lint, test, and release

Changes

Frontend (admin/web)

  • Migrate from Vue.js 2 + Element UI to React 18 + Ant Design 5
  • Add TypeScript for type safety
  • Use Vite for faster builds, pnpm for package management
  • Add i18n support (Chinese/English)
  • Add wizard-based configuration editors

Backend (admin/)

  • Restructure with clean architecture (app/internal/pkg layers)
  • Use Google Wire for dependency injection
  • Add RBAC middleware for permission checking

CI/CD

  • admin.yml: Lint and test for frontend (ESLint, TypeScript) and backend (golangci-lint, go test)
  • admin-release.yml: Build and release multi-platform binaries on admin-v* tags
  • Dockerfile: Multi-stage build for containerized deployment

Documentation

  • Update docker-compose.yml for React development
  • Update README with new admin UI port (3000)

Breaking Changes

  • Admin UI port changed from 8080 to 3000
  • API endpoints restructured under /api/ prefix
  • Old Vue.js frontend completely replaced

Checklist

  • Frontend builds and lints pass
  • Backend builds pass
  • CI/CD workflows added
  • Documentation updated

React frontend

- Migrate frontend from Vue.js 2 to React 18 + TypeScript + Vite
- Restructure backend with clean architecture (app/internal/pkg layers)
- Add CI workflow for frontend lint/typecheck and backend lint/test
- Add CD workflow for GitHub Release with multi-platform binaries
- Update docker-compose.yml for React development environment
- Update README documentation for new admin UI port
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
77 Security Hotspots

See analysis details on SonarQube Cloud

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 0% with 1922 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.01%. Comparing base (4d9a422) to head (1a9f677).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
admin/internal/store/mysql.go 0.00% 375 Missing ⚠️
admin/internal/xds/server.go 0.00% 295 Missing ⚠️
admin/internal/store/etcd.go 0.00% 256 Missing ⚠️
admin/internal/handler/config.go 0.00% 246 Missing ⚠️
admin/internal/handler/user.go 0.00% 242 Missing ⚠️
admin/pkg/config/config.go 0.00% 82 Missing ⚠️
admin/internal/handler/router.go 0.00% 72 Missing ⚠️
admin/internal/server/server.go 0.00% 69 Missing ⚠️
admin/internal/handler/auth.go 0.00% 55 Missing ⚠️
admin/internal/handler/instance.go 0.00% 55 Missing ⚠️
... and 9 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #864      +/-   ##
===========================================
+ Coverage    19.69%   20.01%   +0.31%     
===========================================
  Files          255      253       -2     
  Lines        18360    19597    +1237     
===========================================
+ Hits          3616     3922     +306     
- Misses       14377    15289     +912     
- Partials       367      386      +19     
Flag Coverage Δ
admin 0.00% <0.00%> (?)
unittests 20.01% <0.00%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexStocks AlexStocks requested a review from Copilot January 16, 2026 07:48
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 modernizes the admin module by migrating from Vue.js 2 to React 18, restructuring the backend with clean architecture, and adding comprehensive CI/CD workflows.

Changes:

  • Frontend completely rewritten in React 18 + TypeScript with Vite for faster builds
  • Backend refactored with clean architecture (handler/store/model separation) using dependency injection
  • Added GitHub Actions workflows for automated testing and multi-platform releases

Reviewed changes

Copilot reviewed 95 out of 206 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
admin/web/src/components/*.vue Removed legacy Vue.js components (InputGroup, EmptyTip, CustomMenu)
admin/web/src/components/*.tsx Added React TypeScript components (DualModeEditor, ClusterWizard, AuthGuard)
admin/web/src/api/*.ts New TypeScript API client layer with React Query hooks
admin/web/package.json Updated dependencies from Vue.js ecosystem to React ecosystem
admin/web/index.html New Vite-based HTML entry point
admin/internal/* Backend restructured with handler/store/model layers
admin/pkg/config/* New configuration and i18n support
admin/web/public/* Removed legacy static assets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// checkPassword verifies a password against a hash.
// Supports both bcrypt (new) and legacy MD5 hashes for migration.
func checkPassword(password, hash string) bool {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The function checkPassword is defined at line 328 but used at line 167. Consider moving the helper functions (hashPassword, checkPassword, isLegacyMD5Hash, checkLegacyMD5Password) to the top of the file or to a separate helpers section for better code organization.

Copilot uses AI. Check for mistakes.
return result.Error
}
}
// Note: Removed automatic password reset on startup for security
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

This comment references removed code that isn't visible in the diff. While the comment provides context, it may confuse future readers. Consider removing it or clarifying that this is a design decision rather than a reference to deleted code.

Suggested change
// Note: Removed automatic password reset on startup for security
// Note: For security reasons, the admin password is not automatically reset on startup

Copilot uses AI. Check for mistakes.
Comment on lines +109 to +110
// eslint-disable-next-line react-hooks/set-state-in-effect -- resetting error state on prop change
setSyncError(null);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Setting state directly in useEffect based on prop changes can lead to unnecessary re-renders. Consider using a ref or restructuring to avoid the eslint override. If the current approach is intentional, the comment justification is acceptable.

Copilot uses AI. Check for mistakes.
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The eslint config uses tseslint.configs.recommended without importing it from a configs object. Verify this is the correct API for typescript-eslint v8. The typical import is ...tseslint.configs.recommended when extending configs.

Suggested change
tseslint.configs.recommended,
...tseslint.configs.recommended,

Copilot uses AI. Check for mistakes.
@Ray7788
Copy link

Ray7788 commented Jan 16, 2026

@Chen le @ZeRui

Copy link
Contributor

@Alanxtl Alanxtl left a comment

Choose a reason for hiding this comment

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

amazing work

)

const Version = "1.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

pixiu 的 const 里面有 version这个常量

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.

4 participants