Repository navigation
T164 ExcelImport admin UI - #36
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughPR thêm phân quyền admin cho menu và route Import Excel, tạo service ChangesImport Excel end-to-end
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/AppSidebar.vue`:
- Line 19: The Import Excel sidebar item is incorrectly relying on the
employee-management permission helper, so its access control is coupled to the
wrong meaning. Create a dedicated import permission check such as canImportExcel
in permissionService.js, and update AppSidebar.vue to use that new helper for
the Import Excel item instead of canManageEmployees(role). Keep the existing
behavior the same for now, but separate the permission semantics so future role
changes do not leak access unintentionally.
In `@src/services/excelImportService.js`:
- Around line 39-44: The multipart upload request in excelImportService is
setting Content-Type manually, which can break FormData boundaries. Update
createImportSession, validateImportSession, and applyImportSession to stop
overriding the multipart/form-data header in the axios post call, and let
axios/browser generate the Content-Type automatically while keeping the
authorization header intact.
In `@src/views/ImportExcelView.vue`:
- Around line 116-132: The onFileChange handler rejects non-.xlsx files but
leaves the file input value intact, so reselecting the same file path will not
trigger change again. Update onFileChange to clear event.target.value whenever a
file is rejected (and ensure the input is reset before returning), while keeping
the existing selectedFile, fileError, globalError, and globalSuccess behavior
intact.
- Around line 261-273: The fetchErrors handler in ImportExcelView.vue is
swallowing errors and does not treat 401 consistently with the other handlers.
Update fetchErrors to detect unauthorized responses from getSessionErrors and
call router.replace('/login') just like the other flows, while also surfacing a
user-visible error state/message instead of only logging to console. Keep the
loading flag reset in finally and ensure the error handling path is consistent
with the existing session/error pagination logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 38baf3a1-d0d8-4526-9871-89ddab8f1ea3
📒 Files selected for processing (4)
src/components/AppSidebar.vuesrc/router/index.jssrc/services/excelImportService.jssrc/views/ImportExcelView.vue
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/views/ImportExcelView.vue (1)
84-94: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winHiển thị lỗi khi không tải được danh sách kho
src/views/ImportExcelView.vue:84-94
getWarehouses()đã trả về mảng trực tiếp, nên phần shape dữ liệu này ổn. Vấn đề còn lại là khi gọi API lỗi thì chỉconsole.error, dropdown kho trống mà người dùng không biết để thử lại hoặc xử lý tiếp. Thêm một state lỗi/thông báo ngay dưới ô chọn kho.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/views/ImportExcelView.vue` around lines 84 - 94, The fetchWarehouseList flow in ImportExcelView currently only logs API failures, leaving the warehouse dropdown empty without any user-facing feedback. Add an error state/message alongside isLoadingWarehouses and warehouses, set it in the catch block of fetchWarehouseList, clear it on success, and render the message directly under the warehouse selector so users know the load failed and can retry.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/views/ImportExcelView.vue`:
- Around line 84-94: The fetchWarehouseList flow in ImportExcelView currently
only logs API failures, leaving the warehouse dropdown empty without any
user-facing feedback. Add an error state/message alongside isLoadingWarehouses
and warehouses, set it in the catch block of fetchWarehouseList, clear it on
success, and render the message directly under the warehouse selector so users
know the load failed and can retry.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b699aa8d-dbb3-4dc1-853f-9a38fa6ac562
📒 Files selected for processing (2)
src/services/excelImportService.jssrc/views/ImportExcelView.vue
ThienlocTran
left a comment
There was a problem hiding this comment.
đã sửa các lỗi rabbit ai bắt
Scope
Implement the frontend UI and API client wrapper for user story T164 ExcelImport.
Included
excelImportService.jsinsrc/servicescontaining the HTTP API client wrapper.src/router/index.jsto restrict/import-excelaccess to theADMINrole only.'Import Excel'navigation item visibility toADMINonly insrc/components/AppSidebar.vue.ImportExcelView.vuewith a complete step-by-step sequential workflow layout (Steps 1 to 6).Not included
Route/menu added
/import-excel(restricted to roleADMINonly).ADMIN).API endpoints used
GET /api/excel-imports/templatePOST /api/excel-importsPOST /api/excel-imports/{id}/validate-errorsGET /api/excel-imports/{id}/errorsPOST /api/excel-imports/{id}/confirmPOST /api/excel-imports/{id}/applyFile integrity behavior
Fileobject in memory.Validation/error display behavior
Role/access behavior
ADMINrole. Managers and warehouse employees are redirected to the dashboard.Build/lint/typecheck results
npm run buildwhich successfully completed compilation with zero errors.git diff --checkshowing clean diff with zero whitespace issues.Confirmation
Summary by CodeRabbit
New Features
Bug Fixes