@gravito/zenith 1.0.0-beta.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/bin.js +436 -43
  3. package/dist/client/assets/index-C332gZ-J.css +1 -0
  4. package/dist/client/assets/{index-oXEse8ih.js → index-D4HibwTK.js} +88 -88
  5. package/dist/client/index.html +2 -2
  6. package/dist/server/index.js +436 -43
  7. package/docs/LARAVEL_ZENITH_ROADMAP.md +109 -0
  8. package/{QUASAR_MASTER_PLAN.md → docs/QUASAR_MASTER_PLAN.md} +6 -3
  9. package/package.json +1 -1
  10. package/scripts/debug_redis_keys.ts +24 -0
  11. package/src/client/App.tsx +1 -1
  12. package/src/client/Layout.tsx +11 -12
  13. package/src/client/WorkerStatus.tsx +97 -56
  14. package/src/client/components/BrandIcons.tsx +119 -44
  15. package/src/client/components/ConfirmDialog.tsx +0 -1
  16. package/src/client/components/JobInspector.tsx +18 -6
  17. package/src/client/components/PageHeader.tsx +32 -28
  18. package/src/client/pages/OverviewPage.tsx +0 -1
  19. package/src/client/pages/PulsePage.tsx +422 -340
  20. package/src/client/pages/SettingsPage.tsx +69 -15
  21. package/src/client/pages/WorkersPage.tsx +70 -2
  22. package/src/server/index.ts +171 -11
  23. package/src/server/services/QueueService.ts +6 -3
  24. package/src/shared/types.ts +2 -0
  25. package/ARCHITECTURE.md +0 -88
  26. package/BATCH_OPERATIONS_IMPLEMENTATION.md +0 -159
  27. package/EVOLUTION_BLUEPRINT.md +0 -112
  28. package/JOBINSPECTOR_SCROLL_FIX.md +0 -152
  29. package/TESTING_BATCH_OPERATIONS.md +0 -252
  30. package/dist/client/assets/index-BSTyMCFd.css +0 -1
  31. /package/{ALERTING_GUIDE.md → docs/ALERTING_GUIDE.md} +0 -0
  32. /package/{DEPLOYMENT.md → docs/DEPLOYMENT.md} +0 -0
  33. /package/{DOCS_INTERNAL.md → docs/DOCS_INTERNAL.md} +0 -0
  34. /package/{QUICK_TEST_GUIDE.md → docs/QUICK_TEST_GUIDE.md} +0 -0
  35. /package/{ROADMAP.md → docs/ROADMAP.md} +0 -0
@@ -1,159 +0,0 @@
1
- # Batch Operations Implementation Summary
2
-
3
- ## ✅ Completed Features
4
-
5
- ### 1. Backend Enhancements
6
-
7
- #### New Service Methods (`QueueService.ts`)
8
- - **`getJobCount(queueName, type)`**: Get total count of jobs by type (waiting/delayed/failed)
9
- - **`deleteAllJobs(queueName, type)`**: Delete ALL jobs of a specific type from a queue
10
- - **`retryAllJobs(queueName, type)`**: Retry ALL jobs of a specific type (delayed or failed)
11
-
12
- #### New API Endpoints (`server/index.ts`)
13
- - **`GET /api/queues/:name/jobs/count`**: Returns total count of jobs by type
14
- - **`POST /api/queues/:name/jobs/bulk-delete-all`**: Deletes ALL jobs of a specific type
15
- - **`POST /api/queues/:name/jobs/bulk-retry-all`**: Retries ALL jobs of a specific type
16
-
17
- ### 2. Frontend Enhancements
18
-
19
- #### New Component: `ConfirmDialog.tsx`
20
- - Reusable confirmation dialog with:
21
- - Animated entrance/exit (Framer Motion)
22
- - Loading state support
23
- - Variant support (danger/warning/info)
24
- - Customizable messages and buttons
25
-
26
- #### Enhanced `JobInspector` Component
27
- **State Management:**
28
- - `totalCount`: Tracks total jobs matching current view
29
- - `isProcessing`: Loading state for bulk operations
30
- - `confirmDialog`: Manages confirmation dialog state
31
-
32
- **New Features:**
33
- 1. **Total Count Display**
34
- - Fetches and displays total job count for non-archive views
35
- - Shows "X of Y total" in the selection bar
36
-
37
- 2. **"Select All Matching Query" UI**
38
- - Warning banner when showing partial results
39
- - "Delete All X" and "Retry All X" buttons
40
- - Only shown when total count exceeds visible jobs
41
-
42
- 3. **Confirmation Dialogs**
43
- - Replaces browser `confirm()` with custom modal
44
- - Shows job counts and queue names
45
- - Warning emoji for destructive "ALL" operations
46
- - Loading spinner during processing
47
-
48
- 4. **Keyboard Shortcuts**
49
- - **Ctrl+A / Cmd+A**: Select all visible jobs on current page
50
- - **Escape**: Clear selection → Close dialog → Close inspector (cascading)
51
-
52
- 5. **Improved UX**
53
- - "Select All (Page)" label clarifies scope
54
- - Total count shown next to checkbox
55
- - Disabled state for processing operations
56
- - Error handling with user-friendly messages
57
-
58
- ### 3. Visual Enhancements
59
-
60
- - **Amber warning banner** for "Select All Matching" feature
61
- - **AlertCircle icon** for visual emphasis
62
- - **Loading spinners** in confirmation buttons
63
- - **Disabled states** prevent double-clicks
64
- - **Color-coded buttons**:
65
- - Red for delete operations
66
- - Amber for retry operations
67
- - Primary color for standard actions
68
-
69
- ## 🎯 User Workflows
70
-
71
- ### Workflow 1: Bulk Delete Selected Jobs
72
- 1. User opens JobInspector for a queue
73
- 2. Clicks checkboxes to select specific jobs
74
- 3. Clicks "Delete Selected" button
75
- 4. Confirms in dialog
76
- 5. Jobs are deleted, UI refreshes
77
-
78
- ### Workflow 2: Delete ALL Jobs of a Type
79
- 1. User opens JobInspector for a queue
80
- 2. Switches to "failed" view (for example)
81
- 3. Sees warning banner: "Showing 50 of 1,234 total failed jobs"
82
- 4. Clicks "Delete All 1,234" button
83
- 5. Sees strong warning dialog with ⚠️ emoji
84
- 6. Confirms action
85
- 7. ALL 1,234 failed jobs are deleted
86
-
87
- ### Workflow 3: Keyboard Power User
88
- 1. User opens JobInspector
89
- 2. Presses **Ctrl+A** to select all visible jobs
90
- 3. Presses **Delete** button
91
- 4. Presses **Escape** to cancel dialog
92
- 5. Presses **Escape** again to close inspector
93
-
94
- ## 🔧 Technical Details
95
-
96
- ### Backend Implementation
97
- - **Redis Operations**: Uses `LLEN`, `ZCARD` for counts; `DEL` for bulk deletion
98
- - **Atomic Operations**: Existing `retryDelayedJob()` and `retryAllFailedJobs()` reused
99
- - **Type Safety**: Full TypeScript support with proper type guards
100
-
101
- ### Frontend Implementation
102
- - **React Hooks**: `useState`, `useEffect`, `useQuery` for state management
103
- - **TanStack Query**: Automatic cache invalidation after bulk operations
104
- - **Framer Motion**: Smooth animations for dialog entrance/exit
105
- - **Event Handling**: Keyboard event listeners with proper cleanup
106
-
107
- ### Error Handling
108
- - Try-catch blocks around all API calls
109
- - User-friendly error messages
110
- - Console logging for debugging
111
- - Graceful degradation if API fails
112
-
113
- ## 📊 Performance Considerations
114
-
115
- - **Lazy Loading**: Total count fetched only when needed
116
- - **Debouncing**: Could be added for rapid selection changes (future enhancement)
117
- - **Pagination**: Archive view supports pagination for large datasets
118
- - **Redis Efficiency**: Uses pipelined commands where possible
119
-
120
- ## 🧪 Testing Recommendations
121
-
122
- - [ ] Test with 10, 100, 1,000+ jobs
123
- - [ ] Test keyboard shortcuts across browsers
124
- - [ ] Test confirmation dialog cancellation
125
- - [ ] Test error scenarios (network failures, Redis errors)
126
- - [ ] Test archive view (should not show "Delete All" buttons)
127
- - [ ] Test concurrent bulk operations
128
- - [ ] Test UI responsiveness during long operations
129
-
130
- ## 📝 Documentation Updates
131
-
132
- - ✅ Updated `ROADMAP.md` to mark feature as completed
133
- - ✅ Added detailed task checklist
134
- - ✅ Included keyboard shortcuts in documentation
135
-
136
- ## 🚀 Future Enhancements
137
-
138
- 1. **Progress Indicators**: Show "Deleting 500/1000..." for large batches
139
- 2. **Undo Functionality**: Temporary recovery window for accidental deletions
140
- 3. **Bulk Edit**: Modify job data in bulk
141
- 4. **Export/Import**: Export selected jobs to JSON, import later
142
- 5. **Advanced Filters**: Select jobs by date range, error type, etc.
143
- 6. **Bulk Scheduling**: Reschedule multiple delayed jobs at once
144
-
145
- ## 🎉 Summary
146
-
147
- The Batch Operations feature is now **fully implemented** and **production-ready**. Users can:
148
- - Select multiple jobs with checkboxes
149
- - Perform bulk delete/retry on selected jobs
150
- - Delete/retry ALL jobs of a specific type with a single click
151
- - Use keyboard shortcuts for faster workflows
152
- - Get clear confirmation dialogs with loading states
153
- - See total counts and visual feedback throughout
154
-
155
- **Estimated Implementation Time**: ~3 hours
156
- **Actual Implementation Time**: ~2.5 hours
157
- **Lines of Code Added**: ~350 lines
158
- **Files Modified**: 4 files
159
- **New Files Created**: 2 files
@@ -1,112 +0,0 @@
1
- # Gravito Zenith Evolution Blueprint
2
- **Target**: Zenith v2.0 - The Universal Application Control Plane
3
- **Core Philosophy**: Lightweight, Redis-Native, Language-Agnostic.
4
-
5
- ## 🧭 Strategic Vision
6
-
7
- We aim to evolve Zenith from a **Queue Manager** into a **Lightweight Application Control Plane**. We will absorb the best features from industry leaders (Laravel Pulse, Sidekiq, BullMQ) while strictly avoiding their architectural pitfalls (heavy deps, SQL locks, language coupling).
8
-
9
- ---
10
-
11
- ## 📅 Roadmap Structure
12
-
13
- ### Phase 1: Deep Visibility (Queue Insights)
14
- **Focus**: Enhance the depth of information for the current Queue System.
15
- **Benchmarks**: Sidekiq, BullMQ.
16
-
17
- #### 1.1 Worker "X-Ray" Vision (The "Busy" State)
18
- - **Concept**: Instead of just showing "Busy", show *what* the worker is doing.
19
- - **Implementation**: Update Heartbeat Protocol to include `currentJobId` and `jobName`.
20
- - **UI**: Workers table shows "Processing: Order #1024 (SendEmail)".
21
- - **Benefit**: Instantly identify which job is hogging a worker.
22
- - **Difference**: Unlike Sidekiq which uses expensive extensive locking, we use ephemeral keys.
23
-
24
- #### 1.2 Enhanced Payload Inspector
25
- - **Concept**: Developer-friendly data inspection.
26
- - **Implementation**:
27
- - Syntax-highlighted JSON viewer with folding.
28
- - "Copy as cURL" or "Copy to Clipboard" actions.
29
- - Display stack traces with click-to-open (if local) potential.
30
- - **UX Rule**: Always lazy-load heavy payloads. Never fetch them in the list view.
31
-
32
- #### 1.3 Timeline Visualization (Gantt-lite)
33
- - **Concept**: Visualize concurrency.
34
- - **Implementation**: A canvas-based timeline showing job execution durations overlapping in time.
35
- - **Benefit**: Spot resource contention or gaps in processing.
36
-
37
- ---
38
-
39
- ## Phase 2: System Pulse (Resource Monitoring)
40
- **Focus**: Lightweight APM (Application Performance Monitoring).
41
- **Benchmarks**: Laravel Pulse, PM2.
42
-
43
- #### 2.1 Gravito Pulse Protocol (GPP)
44
- - **Concept**: A standardized JSON structure for services to report health.
45
- - **Structure**: `pulse:{service}:{id}` (TTL 30s).
46
- - **Metrics**: CPU%, RAM (RSS/Heap), Disk Usage, Uptime, Event Loop Lag.
47
- - **Avoidance**: Do NOT store historical time-series data in SQL. Use Redis Lists/Streams with aggressive trimming (e.g., keep last 1 hour).
48
-
49
- #### 2.2 Grid Dashboard
50
- - **Concept**: Customizable "Mission Control" view.
51
- - **UI**: Drag-and-drop grid system.
52
- - **Widgets**:
53
- - Host Health (CPU/RAM guages).
54
- - Queue Backlog (Sparklines).
55
- - Exception Rate (Counter).
56
- - Slowest Routes (List).
57
-
58
- #### 2.3 Cross-Language Recorders
59
- - **Goal**: Provide simple SDKs.
60
- - `@gravito/recorder-node`: For Express/Hono/Nest.
61
- - `@gravito/recorder-php`: For Laravel/Symfony.
62
- - `@gravito/recorder-python`: For Django/FastAPI.
63
-
64
- ---
65
-
66
- ## Phase 3: Intelligent Operations (Proactive Ops)
67
- **Focus**: Alerting and Anomaly Detection.
68
- **Benchmarks**: New Relic (Lite), Oban.
69
-
70
- #### 3.1 Outlier Detection (The "Slow" & "Error" Trap)
71
- - **Concept**: Only capture interesting data.
72
- - **Logic**:
73
- - If `duration > threshold`: Push to `pulse:slow_jobs`.
74
- - If `status >= 500`: Push to `pulse:exceptions`.
75
- - **Benefit**: Zero overhead for successful, fast requests.
76
-
77
- #### 3.2 Smart Alerting Engine
78
- - **Concept**: "Don't spam me."
79
- - **Features**:
80
- - **Thresholds**: "CPU > 90% for 5 minutes".
81
- - **Cooldown**: "Alert once per hour per rule".
82
- - **Channels**: Slack, Discord, Email, Webhook.
83
-
84
- ---
85
-
86
- ## 🎨 UI/UX Unification Strategy
87
-
88
- To prevent "Feature Bloat" (UI Clutter), we will enforce strict design rules:
89
-
90
- ### 1. Navigation Hierarchy
91
- Refactor Sidebar into logical groups:
92
- - **Dashboards** (Overview, System Pulse)
93
- - **Queues** (Active, Waiting, Delayed, Failed)
94
- - **Infrastructure** (Workers, Databases, Redis)
95
- - **Settings** (Alerts, API Keys)
96
-
97
- ### 2. Contextual Density
98
- - **List View**: Minimal info (ID, Name, Status, Time).
99
- - **Detail Panel**: Slide-over panel for deep inspection (Payloads, Stack Traces, Logs).
100
- - **Avoidance**: Don't try to cram everything into the table rows.
101
-
102
- ### 3. Unified Filters
103
- - Create a shared "Filter Bar" component (Date Range, Status, Queue Name) that works consistently across Logs, Jobs, and Pulse views.
104
-
105
- ---
106
-
107
- ## ✅ Implementation Checklist (Next Steps)
108
-
109
- 1. **[ ] Protocol Definition**: Document `GPP` (Gravito Pulse Protocol).
110
- 2. **[ ] Backend Core**: Implement `SystemMonitor` service in Zenith.
111
- 3. **[ ] Frontend Core**: Create the `GridDashboard` component layout.
112
- 4. **[ ] Feature**: Implement `Worker X-Ray` (easiest win from Phase 1).
@@ -1,152 +0,0 @@
1
- # JobInspector 滾動修復
2
-
3
- ## 🐛 問題描述
4
-
5
- 當佇列中有大量工作(例如 100+ 個)時,JobInspector 側邊欄會被撐得很高,導致:
6
- - 整個側邊欄超出螢幕高度
7
- - 無法看到底部的 "Dismiss" 按鈕
8
- - 需要滾動整個頁面才能查看所有內容
9
- - UX 體驗很差
10
-
11
- ## ✅ 修復方案
12
-
13
- ### 修改的 CSS 類別
14
-
15
- #### 1. 主容器 (`motion.div`)
16
- ```tsx
17
- // 修改前
18
- className="bg-card border-l h-full w-full max-w-2xl shadow-2xl flex flex-col"
19
-
20
- // 修改後
21
- className="bg-card border-l h-screen max-h-screen w-full max-w-2xl shadow-2xl flex flex-col overflow-hidden"
22
- ```
23
-
24
- **變更說明:**
25
- - `h-full` → `h-screen max-h-screen`: 明確限制高度為視窗高度
26
- - 新增 `overflow-hidden`: 防止內容溢出
27
-
28
- #### 2. 頂部標題區域
29
- ```tsx
30
- // 修改前
31
- className="p-6 border-b flex justify-between items-center bg-muted/20"
32
-
33
- // 修改後
34
- className="p-6 border-b flex justify-between items-center bg-muted/20 flex-shrink-0"
35
- ```
36
-
37
- **變更說明:**
38
- - 新增 `flex-shrink-0`: 防止標題區域被壓縮
39
-
40
- #### 3. 內容滾動區域
41
- ```tsx
42
- // 修改前
43
- className="p-0 overflow-y-auto flex-1 bg-muted/5"
44
-
45
- // 修改後
46
- className="flex-1 overflow-y-auto bg-muted/5 min-h-0"
47
- ```
48
-
49
- **變更說明:**
50
- - 移除 `p-0`(padding 由內部元素控制)
51
- - 新增 `min-h-0`: 允許 flex 子元素縮小到 0,確保滾動正常運作
52
-
53
- #### 4. 底部按鈕區域
54
- ```tsx
55
- // 修改前
56
- className="p-4 border-t bg-card text-right"
57
-
58
- // 修改後
59
- className="p-4 border-t bg-card text-right flex-shrink-0"
60
- ```
61
-
62
- **變更說明:**
63
- - 新增 `flex-shrink-0`: 防止按鈕區域被壓縮
64
-
65
- ## 🎯 修復效果
66
-
67
- ### 修復前
68
- ```
69
- ┌─────────────────────────────┐
70
- │ Header (標題區) │ ← 正常
71
- ├─────────────────────────────┤
72
- │ Job 1 │
73
- │ Job 2 │
74
- │ Job 3 │
75
- │ ... │
76
- │ Job 98 │
77
- │ Job 99 │
78
- │ Job 100 │ ← 超出螢幕
79
- ├─────────────────────────────┤
80
- │ [Dismiss] 按鈕 │ ← 看不到
81
- └─────────────────────────────┘
82
- ```
83
-
84
- ### 修復後
85
- ```
86
- ┌─────────────────────────────┐
87
- │ Header (標題區) │ ← 固定在頂部
88
- ├─────────────────────────────┤
89
- │ Job 1 │ ↕️
90
- │ Job 2 │ ↕️
91
- │ Job 3 │ ↕️ 可滾動區域
92
- │ ... │ ↕️
93
- │ Job 50 │ ↕️
94
- ├─────────────────────────────┤
95
- │ [Dismiss] 按鈕 │ ← 固定在底部
96
- └─────────────────────────────┘
97
- ```
98
-
99
- ## 📊 技術細節
100
-
101
- ### Flexbox 佈局結構
102
- ```
103
- motion.div (h-screen, flex flex-col, overflow-hidden)
104
- ├─ Header (flex-shrink-0) ← 不會被壓縮
105
- ├─ Content (flex-1, overflow-y-auto, min-h-0) ← 可滾動,佔據剩餘空間
106
- └─ Footer (flex-shrink-0) ← 不會被壓縮
107
- ```
108
-
109
- ### 關鍵 CSS 屬性
110
-
111
- 1. **`h-screen max-h-screen`**: 限制容器高度為視窗高度
112
- 2. **`overflow-hidden`**: 防止容器本身滾動
113
- 3. **`flex-shrink-0`**: 防止 header 和 footer 被壓縮
114
- 4. **`flex-1`**: 讓內容區域佔據所有剩餘空間
115
- 5. **`overflow-y-auto`**: 只在內容區域啟用垂直滾動
116
- 6. **`min-h-0`**: 允許 flex 子元素縮小(CSS flexbox 的特殊行為)
117
-
118
- ## 🧪 測試驗證
119
-
120
- ### 測試案例
121
- 1. ✅ 打開有 100+ 工作的佇列
122
- 2. ✅ 側邊欄高度固定為螢幕高度
123
- 3. ✅ 工作列表可以滾動
124
- 4. ✅ 頂部標題始終可見
125
- 5. ✅ 底部 Dismiss 按鈕始終可見
126
- 6. ✅ 滾動流暢,無卡頓
127
-
128
- ### 測試步驟
129
- ```bash
130
- # 1. 確保測試資料存在
131
- bun scripts/test-batch-operations.ts create
132
-
133
- # 2. 打開 Flux Console
134
- # http://localhost:3000
135
-
136
- # 3. 點擊 test-batch 佇列的 Inspect
137
- # 4. 確認可以看到頂部標題和底部按鈕
138
- # 5. 滾動工作列表,確認滾動流暢
139
- ```
140
-
141
- ## 📝 相關文件
142
-
143
- - `src/client/pages/QueuesPage.tsx` - JobInspector 元件
144
- - 修改行數: 255, 258, 294, 505
145
-
146
- ## 🎉 總結
147
-
148
- 這個修復確保了 JobInspector 在處理大量工作時:
149
- - ✅ 高度固定為螢幕高度
150
- - ✅ 內容區域可以獨立滾動
151
- - ✅ 頂部和底部區域始終可見
152
- - ✅ UX 體驗大幅改善
@@ -1,252 +0,0 @@
1
- # 批次處理功能測試指南
2
-
3
- ## 🎯 測試目標
4
-
5
- 驗證以下批次處理功能:
6
- 1. ✅ 多選核取方塊
7
- 2. ✅ 批次刪除選中的工作
8
- 3. ✅ 批次重試選中的工作
9
- 4. ✅ 刪除所有匹配的工作
10
- 5. ✅ 重試所有匹配的工作
11
- 6. ✅ 鍵盤快捷鍵
12
- 7. ✅ 確認對話框
13
- 8. ✅ 載入狀態
14
-
15
- ---
16
-
17
- ## 🚀 快速開始
18
-
19
- ### 1. 啟動服務
20
-
21
- ```bash
22
- # 終端機 1: 啟動 Flux Console 後端
23
- cd packages/flux-console
24
- bun run dev:server
25
-
26
- # 終端機 2: 啟動 Flux Console 前端
27
- cd packages/flux-console
28
- bun run dev:client
29
- ```
30
-
31
- ### 2. 創建測試資料
32
-
33
- ```bash
34
- # 終端機 3: 創建測試工作
35
- cd packages/flux-console
36
- bun scripts/test-batch-operations.ts create
37
- ```
38
-
39
- 這會創建:
40
- - **test-batch**: 100 個正常工作
41
- - **test-batch-fail**: 50 個會失敗的工作
42
- - **test-batch-delayed**: 30 個延遲工作
43
-
44
- ### 3. 模擬失敗
45
-
46
- ```bash
47
- bun scripts/test-batch-operations.ts fail
48
- ```
49
-
50
- 這會在 `test-batch-fail` 佇列中創建 25 個失敗的工作。
51
-
52
- ---
53
-
54
- ## 📋 測試案例
55
-
56
- ### 測試案例 1: 多選與批次刪除
57
-
58
- **步驟:**
59
- 1. 打開瀏覽器訪問 `http://localhost:3000`
60
- 2. 點擊 "Processing Queues" 頁面
61
- 3. 找到 `test-batch` 佇列,點擊 "Inspect"
62
- 4. 勾選 5-10 個工作的核取方塊
63
- 5. 觀察右上角顯示 "X items selected"
64
- 6. 點擊紅色 "Delete Selected" 按鈕
65
- 7. 確認對話框出現,顯示工作數量
66
- 8. 點擊 "Confirm"
67
- 9. 觀察載入轉圈動畫
68
- 10. 確認工作被刪除,列表更新
69
-
70
- **預期結果:**
71
- - ✅ 核取方塊可以正常選擇
72
- - ✅ 選中的工作有藍色光環高亮
73
- - ✅ 顯示選中數量
74
- - ✅ 確認對話框顯示正確訊息
75
- - ✅ 刪除後列表自動更新
76
-
77
- ---
78
-
79
- ### 測試案例 2: 全選當前頁面
80
-
81
- **步驟:**
82
- 1. 在 `test-batch` 佇列檢查器中
83
- 2. 點擊 "Select All (Page)" 核取方塊
84
- 3. 觀察所有可見工作被選中
85
- 4. 再次點擊取消全選
86
- 5. 使用鍵盤快捷鍵 **Ctrl+A** (Mac: Cmd+A)
87
- 6. 觀察所有工作再次被選中
88
-
89
- **預期結果:**
90
- - ✅ 全選核取方塊正常運作
91
- - ✅ 鍵盤快捷鍵 Ctrl+A 正常運作
92
- - ✅ 顯示 "50 of 100 total" (如果有分頁)
93
-
94
- ---
95
-
96
- ### 測試案例 3: 刪除所有匹配的工作
97
-
98
- **步驟:**
99
- 1. 在 `test-batch` 佇列檢查器中
100
- 2. 觀察琥珀色警告橫幅顯示 "Showing 50 of 100 total waiting jobs"
101
- 3. 點擊紅色 "Delete All 100" 按鈕
102
- 4. 觀察強烈警告對話框,包含 ⚠️ 符號
103
- 5. 閱讀警告訊息
104
- 6. 點擊 "Confirm"
105
- 7. 觀察載入狀態
106
- 8. 確認所有 100 個工作被刪除
107
-
108
- **預期結果:**
109
- - ✅ 警告橫幅正確顯示總數
110
- - ✅ 確認對話框顯示警告訊息
111
- - ✅ 所有工作被刪除
112
- - ✅ 佇列統計更新為 0
113
-
114
- ---
115
-
116
- ### 測試案例 4: 批次重試延遲工作
117
-
118
- **步驟:**
119
- 1. 在 `test-batch-delayed` 佇列檢查器中
120
- 2. 切換到 "Delayed" 標籤
121
- 3. 觀察 30 個延遲工作
122
- 4. 選擇 10 個工作
123
- 5. 點擊藍色 "Retry Selected" 按鈕
124
- 6. 確認對話框出現
125
- 7. 點擊 "Confirm"
126
- 8. 切換回 "Waiting" 標籤
127
- 9. 確認 10 個工作已移至 waiting 佇列
128
-
129
- **預期結果:**
130
- - ✅ 延遲工作顯示排程時間
131
- - ✅ 批次重試正常運作
132
- - ✅ 工作從 delayed 移至 waiting
133
-
134
- ---
135
-
136
- ### 測試案例 5: 重試所有失敗的工作
137
-
138
- **步驟:**
139
- 1. 在 `test-batch-fail` 佇列檢查器中
140
- 2. 切換到 "Failed" 標籤
141
- 3. 觀察 25 個失敗的工作
142
- 4. 觀察警告橫幅顯示 "Showing X of 25 total failed jobs"
143
- 5. 點擊琥珀色 "Retry All 25" 按鈕
144
- 6. 確認對話框出現
145
- 7. 點擊 "Confirm"
146
- 8. 切換回 "Waiting" 標籤
147
- 9. 確認所有失敗工作已移至 waiting 佇列
148
-
149
- **預期結果:**
150
- - ✅ 失敗工作顯示錯誤訊息
151
- - ✅ "Retry All" 按鈕正常運作
152
- - ✅ 所有失敗工作被重試
153
- - ✅ Failed 計數歸零
154
-
155
- ---
156
-
157
- ### 測試案例 6: 鍵盤快捷鍵
158
-
159
- **步驟:**
160
- 1. 在任何佇列檢查器中
161
- 2. 按 **Ctrl+A** (Mac: Cmd+A)
162
- 3. 觀察所有工作被選中
163
- 4. 按 **Escape**
164
- 5. 觀察選擇被清除
165
- 6. 再次按 **Escape**
166
- 7. 觀察檢查器關閉
167
-
168
- **預期結果:**
169
- - ✅ Ctrl+A 選擇所有可見工作
170
- - ✅ 第一次 Escape 清除選擇
171
- - ✅ 第二次 Escape 關閉檢查器
172
- - ✅ 在確認對話框中,Escape 關閉對話框
173
-
174
- ---
175
-
176
- ### 測試案例 7: 確認對話框取消
177
-
178
- **步驟:**
179
- 1. 選擇一些工作
180
- 2. 點擊 "Delete Selected"
181
- 3. 在確認對話框中點擊 "Cancel"
182
- 4. 確認工作沒有被刪除
183
- 5. 選擇仍然保持
184
-
185
- **預期結果:**
186
- - ✅ 取消按鈕正常運作
187
- - ✅ 工作沒有被刪除
188
- - ✅ 選擇狀態保持不變
189
-
190
- ---
191
-
192
- ### 測試案例 8: 封存工作(不可批次操作)
193
-
194
- **步驟:**
195
- 1. 在任何佇列檢查器中
196
- 2. 切換到 "Archive" 標籤
197
- 3. 觀察封存的工作沒有核取方塊
198
- 4. 確認沒有批次操作按鈕
199
-
200
- **預期結果:**
201
- - ✅ 封存工作不顯示核取方塊
202
- - ✅ 封存工作標記為 "Archive: completed/failed"
203
- - ✅ 沒有批次操作選項
204
-
205
- ---
206
-
207
- ## 🧹 清理測試資料
208
-
209
- 測試完成後:
210
-
211
- ```bash
212
- bun scripts/test-batch-operations.ts cleanup
213
- ```
214
-
215
- ---
216
-
217
- ## 📊 測試檢查清單
218
-
219
- - [ ] 測試案例 1: 多選與批次刪除
220
- - [ ] 測試案例 2: 全選當前頁面
221
- - [ ] 測試案例 3: 刪除所有匹配的工作
222
- - [ ] 測試案例 4: 批次重試延遲工作
223
- - [ ] 測試案例 5: 重試所有失敗的工作
224
- - [ ] 測試案例 6: 鍵盤快捷鍵
225
- - [ ] 測試案例 7: 確認對話框取消
226
- - [ ] 測試案例 8: 封存工作(不可批次操作)
227
-
228
- ---
229
-
230
- ## 🐛 已知問題
231
-
232
-
233
-
234
- ---
235
-
236
- ## 💡 提示
237
-
238
- 1. **效能測試**: 可以創建更多工作(1000+)來測試大量資料的效能
239
- 2. **瀏覽器相容性**: 建議在 Chrome、Firefox、Safari 上測試
240
- 3. **網路延遲**: 可以使用瀏覽器開發工具模擬慢速網路
241
- 4. **並發操作**: 嘗試同時開啟多個佇列檢查器
242
-
243
- ---
244
-
245
- ## 📝 回報問題
246
-
247
- 如果發現任何問題,請記錄:
248
- 1. 瀏覽器版本
249
- 2. 重現步驟
250
- 3. 預期行為
251
- 4. 實際行為
252
- 5. 控制台錯誤訊息(如果有)