Giao diện
@digiforce-nc/plugin-action-export-pro
Plugin xuất Excel nâng cao (async export) - mở rộng plugin-action-export bằng async job cho dữ liệu lớn, kèm khả năng xuất file đính kèm thành archive ZIP.
Plugin này làm gì?
Hãy hình dung bạn xuất 100.000 bản ghi - export đồng bộ sẽ timeout hoặc block server. plugin-action-export-pro giải quyết bằng cách chuyển export sang background job. Khi dữ liệu vượt ngưỡng (cấu hình qua biến môi trường), hệ thống tự động chuyển sang chế độ async - user nhận thông báo khi file sẵn sàng. Ngoài ra plugin bổ sung action exportAttachments để xuất file đính kèm thành ZIP.
Ba nhiệm vụ chính
| # | Nhiệm vụ | Chi tiết |
|---|---|---|
| 1 | Async export | Override handler export với chế độ sync/async tự động theo ngưỡng EXPORT_AUTO_MODE_THRESHOLD |
| 2 | Export attachments | Action exportAttachments xuất tất cả file đính kèm thành archive ZIP |
| 3 | Task management | Tích hợp async-task-manager để theo dõi tiến trình, thông báo, tải file kết quả |
Kiến trúc
Tổng quan
Plugin extends plugin-action-export - override handler export và bổ sung action mới. Yêu cầu plugin-async-task-manager để quản lý background job.
| Tầng | Vai trò | Thành phần |
|---|---|---|
| Client UI | Nút export + hiển thị kết quả async | ExportProPluginProvider, ExportAttachmentActionWidget |
| Server Handler | Override export, thêm exportAttachments | Export handler, exportAttachments handler |
| Job Worker | Xử lý export trong background | exportXlsxPro, exportAttachments workers |
| Task Manager | Quản lý job, notification, download | plugin-async-task-manager |
Yêu cầu plugin
| Plugin bắt buộc | Vai trò |
|---|---|
plugin-action-export | Plugin export cơ bản (được mở rộng) |
plugin-async-task-manager | Quản lý async job, notification, file storage |
Biến môi trường
| Biến | Mặc định | Mô tả |
|---|---|---|
EXPORT_AUTO_MODE_THRESHOLD | (hệ thống) | Ngưỡng số bản ghi để tự chuyển sang async mode |
API endpoints
| Endpoint | Method | Mô tả |
|---|---|---|
{collection}:export | POST | Export XLSX (override - tự chọn sync/async) |
{collection}:exportAttachments | POST | Export tất cả attachments thành ZIP (luôn async) |
asyncTasks:fetchFile/{taskId} | GET | Tải file kết quả từ async task |
Job topics
| Topic | Mô tả |
|---|---|
exportXlsxPro | Job xuất dữ liệu ra file XLSX |
exportAttachments | Job xuất file đính kèm ra ZIP |
CLI commands
| Command | Mô tả |
|---|---|
export-xlsx-command | Chạy export XLSX từ command line |
export-attachment-command | Chạy export attachments từ command line |
Luồng hoạt động
Export XLSX (async mode)
Export Attachments (ZIP)
Thành phần client
| Thành phần | Mô tả |
|---|---|
ExportProPluginProvider | Provider override export UI bằng phiên bản hỗ trợ async |
ExportAttachmentActionWidget | Nút action xuất attachments (ZIP) |
ExportTaskResultRenderer | Hiển thị kết quả export trong async task manager UI |
AsyncExportButton | Nút tải file kết quả sau khi async job hoàn tất |
Dependencies
| Package | Vai trò |
|---|---|
@digiforce-nc/plugin-action-export | Plugin export cơ bản (peer) |
@digiforce-nc/plugin-async-task-manager | Async task manager (peer) |
@digiforce-nc/client | Client framework (peer) |
@digiforce-nc/server | Server framework (peer) |