Skip to content

commit: T190 reoder recommendation ui - #52

Merged
ThienlocTran merged 4 commits into
devfrom
feature/T190-reorder-recommendation-ui
Jul 29, 2026
Merged

ThienlocTran merged 4 commits into
devfrom
feature/T190-reorder-recommendation-ui

Conversation

@25ThienNgoc

@25ThienNgoc 25ThienNgoc commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

check và merge code giúp tui

Summary by CodeRabbit

  • Tính năng mới
    • Thay thế màn hình cảnh báo tạm thời bằng danh sách gợi ý nhập hàng dựa trên cảnh báo tồn kho từ hệ thống.
    • Bổ sung giao diện tìm kiếm theo từ khóa và lọc theo kho, kèm hiển thị bảng sản phẩm và kho.
    • Hỗ trợ phân trang, trạng thái đang tải và hiển thị khi không có dữ liệu; có nút xóa bộ lọc.
  • Cải thiện
    • Khi phiên xác thực hết hạn, tự động chuyển sang trang đăng nhập và hiển thị thông báo lỗi phù hợp cho các trường hợp còn lại.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ce1b5263-f85b-4ae9-bdff-bd6eb2c0a29f

📥 Commits

Reviewing files that changed from the base of the PR and between 694fbfb and 5992d65.

📒 Files selected for processing (1)
  • src/views/AlertsView.vue

📝 Walkthrough

Walkthrough

Thêm service gọi API gợi ý nhập hàng và thay thế AlertsView bằng danh sách có lọc kho, trạng thái tải/lỗi, phân trang và xử lý xác thực.

Changes

Tích hợp gợi ý nhập hàng

Layer / File(s) Summary
Service gọi API
src/services/replenishmentService.js
Tạo Axios client, gọi API gợi ý nhập hàng với tham số lọc/phân trang và chuẩn hóa lỗi phản hồi.
Điều phối dữ liệu và trạng thái view
src/views/AlertsView.vue
Quản lý dữ liệu kho, gợi ý nhập hàng, bộ lọc, phân trang, loading, lỗi và chuyển hướng khi nhận lỗi 401.
Hiển thị bảng và điều khiển
src/views/AlertsView.vue
Thay thế FeaturePending bằng bộ lọc, bảng dữ liệu, trạng thái rỗng, thông báo lỗi và thanh phân trang responsive.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: thienloctran

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Tiêu đề có liên quan trực tiếp đến thay đổi UI gợi ý nhập hàng, dù còn typo và chưa nêu rõ phần alerts/service.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/T190-reorder-recommendation-ui

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/services/replenishmentService.js`:
- Around line 6-11: Configure a finite timeout on the axios instance created by
replenishmentClient, alongside baseURL and headers, using the project’s
established timeout configuration or a suitable request limit. Ensure timed-out
requests reject so callers such as AlertsView can stop loading instead of
waiting indefinitely.
- Around line 31-49: Update normalizeReplenishmentError to preserve
error.response.status even when error.response.data is missing or empty. Keep
the existing response-data message and errors handling when available, but
return status 401 for bodyless unauthorized responses so the caller can redirect
correctly; retain the existing fallback only when no response status exists.

In `@src/views/AlertsView.vue`:
- Around line 38-57: Update the onMounted flow and loadDropdowns so
fetchSuggestions runs only when dropdown loading succeeds. Return an explicit
success/failure result from loadDropdowns, preserve non-401 errorMessage values,
and stop immediately after handling a 401 redirect so no additional request is
made.
- Around line 59-97: Ngăn các lần gọi fetchSuggestions chồng lấn để giữ state
phân trang nhất quán khi người dùng gửi applySearch hoặc applyFilter liên tục.
Thêm guard async ngay trong fetchSuggestions, sử dụng isLoading hoặc cơ chế
tương đương để bỏ qua yêu cầu mới khi request hiện tại chưa hoàn tất; bảo đảm cờ
vẫn được reset trong finally và giữ nguyên hành vi cập nhật dữ liệu, lỗi, lọc,
và chuyển hướng đăng nhập.
🪄 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: a5b974fd-cf69-48f7-8513-45ea726d5292

📥 Commits

Reviewing files that changed from the base of the PR and between 64a3093 and 98d4c0f.

📒 Files selected for processing (2)
  • src/services/replenishmentService.js
  • src/views/AlertsView.vue

Comment thread src/services/replenishmentService.js
Comment thread src/services/replenishmentService.js
Comment thread src/views/AlertsView.vue
Comment thread src/views/AlertsView.vue Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/views/AlertsView.vue (1)

67-90: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Không bỏ qua request mới sau khi state đã đổi.

Dòng 68 trả về khi đang loading, nhưng các hàm ở dòng 94-120 đã đổi page hoặc filter trước đó. Kết quả: response cũ có thể hiển thị dưới bộ lọc/trang mới. Hãy hủy request cũ hoặc dùng request id để chỉ áp dụng response mới nhất.

Theo path instructions, cần ưu tiên “async flow, state consistency”.

🤖 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/AlertsView.vue` around lines 67 - 90, Update fetchSuggestions so
changing page or filters does not cause a newer request to be ignored while an
older request is loading. Remove the isLoading early-return behavior and use
request cancellation or a monotonically increasing request identifier to ensure
only the latest getReplenishmentSuggestions response updates suggestions,
pagination totals, and error state; preserve the existing loading cleanup and
401 redirect behavior.

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/AlertsView.vue`:
- Around line 67-90: Update fetchSuggestions so changing page or filters does
not cause a newer request to be ignored while an older request is loading.
Remove the isLoading early-return behavior and use request cancellation or a
monotonically increasing request identifier to ensure only the latest
getReplenishmentSuggestions response updates suggestions, pagination totals, and
error state; preserve the existing loading cleanup and 401 redirect behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 17056b58-04c1-484f-a752-edfa2e80577a

📥 Commits

Reviewing files that changed from the base of the PR and between 98d4c0f and 694fbfb.

📒 Files selected for processing (2)
  • src/services/replenishmentService.js
  • src/views/AlertsView.vue

@ThienlocTran ThienlocTran left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed. Kept current low-stock AlertsView to avoid route regression; preserved replenishment service for the existing backend endpoint.

@ThienlocTran
ThienlocTran merged commit 05da7ea into dev Jul 29, 2026
1 check passed
@ThienlocTran
ThienlocTran deleted the feature/T190-reorder-recommendation-ui branch July 31, 2026 11:37
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