Skip to content

commit: T188 mark viewed processed UI - #50

Merged
ThienlocTran merged 4 commits into
devfrom
feature/T188-mark-viewed-processed-ui
Jul 29, 2026
Merged

ThienlocTran merged 4 commits into
devfrom
feature/T188-mark-viewed-processed-ui

Conversation

@25ThienNgoc

@25ThienNgoc 25ThienNgoc commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

check và merge code giúp tui

Summary by CodeRabbit

  • Tính năng mới
    • Thay màn hình chờ bằng trang quản lý cảnh báo tồn kho lấy từ hệ thống.
    • Hỗ trợ tìm kiếm, tải lại và phân trang.
    • Cho phép “Đã xem” và “Đã xử lý” với hộp xác nhận, cập nhật danh sách ngay sau khi thành công.
    • Hiển thị trạng thái, thời gian cập nhật và thao tác trong bảng.
  • Cải tiến
    • Chuẩn hoá hiển thị lỗi; tự động chuyển sang trang đăng nhập khi phiên hết hạn.
    • Vô hiệu hoá nút thao tác khi gặp lỗi để tránh bấm lặp.

@coderabbitai

coderabbitai Bot commented Jul 21, 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: a3d1b1fb-8cf4-4c33-a56f-a2df2acdd885

📥 Commits

Reviewing files that changed from the base of the PR and between 560430e and 1206287.

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

📝 Walkthrough

Walkthrough

PR thay thế màn hình chờ bằng trang quản lý cảnh báo tồn kho, thêm client API, tìm kiếm, phân trang, xác nhận thao tác và xử lý lỗi 401.

Changes

Quản lý cảnh báo

Layer / File(s) Summary
Client API và chuẩn hóa lỗi
src/services/alertService.js
Thêm axios client, API lấy danh sách, cập nhật trạng thái và chuẩn hóa lỗi phản hồi.
Tải dữ liệu và điều khiển danh sách
src/views/AlertsView.vue
Thêm state, tìm kiếm, loading, xử lý lỗi, hiển thị bảng cảnh báo và phân trang.
Xác nhận và cập nhật trạng thái
src/views/AlertsView.vue
Thêm ConfirmDialog, gọi API cập nhật, làm mới danh sách và vô hiệu hóa thao tác lỗi.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

Suggested reviewers: thienloctran

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Tiêu đề liên quan trực tiếp đến trang cảnh báo với hành động đã xem/đã xử lý, phù hợp với thay đổi chính của PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/T188-mark-viewed-processed-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: 2

🤖 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/alertService.js`:
- Around line 6-11: Thêm cấu hình timeout hợp lý vào axios client alertClient
trong alertService, giữ nguyên baseURL và headers hiện có để các request không
chờ vô hạn khi server treo hoặc phản hồi chậm.

In `@src/views/AlertsView.vue`:
- Around line 209-215: Update the Tìm and Xóa buttons and the pagination
controls in AlertsView to bind their disabled state to isLoading, preventing
searchAlerts, clearSearch, and page changes from triggering while fetchAlerts is
in progress. Preserve the existing behavior once loading completes.
🪄 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: f2c16bca-f909-45f2-9eaa-0aa7de0ceb13

📥 Commits

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

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

Comment thread src/services/alertService.js Outdated
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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
src/services/alertService.js (1)

57-69: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Giữ lại HTTP status khi response không có body.

Nếu backend trả 401 hoặc 500 với body rỗng, điều kiện hiện tại bị bỏ qua và hàm trả status: 0 như lỗi mạng. Với 401, clearAuth() vẫn chạy nhưng AlertsView có thể không chuyển đến /login vì không còn nhận được status 401.

Hãy kiểm tra error.response thay vì error.response?.data, rồi dùng payload rỗng khi response không có data.

Đề xuất sửa
-  if (error.response?.data) {
+  if (error.response) {
+    const data = error.response.data || {}
     return {
       status: error.response.status,
-      message: error.response.data.message || fallbackMessage,
-      errors: error.response.data.errors || {},
+      message: data.message || fallbackMessage,
+      errors: data.errors || {},
     }
   }

As per path instructions: “src/services/**: Kiểm tra loading/timeout/network error/HTTP error”.

🤖 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/services/alertService.js` around lines 57 - 69, Update the response-error
handling in alertService to check for error.response rather than
error.response.data, preserving the HTTP status even when the response body is
empty. Use an empty payload/default message and errors object when no response
data exists, while retaining the existing payload fields when data is present.

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.

Inline comments:
In `@src/views/AlertsView.vue`:
- Around line 209-220: Update the search and pagination controls in AlertsView,
including the buttons around searchAlerts and the controls at the referenced
later locations, to disable when either isLoading or actionState.loading is
true. Preserve the existing isLoading behavior while preventing list
interactions during handleMarkSeen/handleResolve updates.

---

Outside diff comments:
In `@src/services/alertService.js`:
- Around line 57-69: Update the response-error handling in alertService to check
for error.response rather than error.response.data, preserving the HTTP status
even when the response body is empty. Use an empty payload/default message and
errors object when no response data exists, while retaining the existing payload
fields when data is present.
🪄 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: f184a233-145a-4112-8dca-13164b62b85e

📥 Commits

Reviewing files that changed from the base of the PR and between f28dadd and 560430e.

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

Comment thread 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 conflict resolution. Dropped /api/alerts service usage because backend exposes /api/inventory/low-stock for this screen.

@ThienlocTran
ThienlocTran merged commit 8c04b92 into dev Jul 29, 2026
1 check passed
@ThienlocTran
ThienlocTran deleted the feature/T188-mark-viewed-processed-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