討論 #1423
是由 陳國瑋 於 28 天 前更新
## 背景
A17 Dashboard 主需求為 #1422。
「Connector 即時狀態」區塊必須適應不同案場規模。案場可能只有 0、1、2 個 Connector,也可能有 20、30 個或更多;若單純把所有 Connector 卡片無上限展開,Dashboard 高度與資訊密度會隨案場規模失控。
本票用於確認 UI 彈性顯示規則。**目前是 Proposed Design,尚未納入最終 v1.0 需求文件,也不代表已進入開發。**
## 建議原則
Dashboard 的 Connector 區塊定位為:
> 固定資訊層級的狀態摘要 + 優先項目預覽 + 查看全部
不是完整 Connector inventory。完整搜尋、篩選與大量清單由 Drawer 或 Connector 管理頁處理。
## Proposed Display Rules
| Connector 總數 | Dashboard 顯示方式 |
|---:|---|
| 0 | Empty state,顯示尚未建立 Connector 與管理頁連結 |
| 1 | 顯示 1 張完整卡片;Desktop 最大寬度約 360px,不拉滿區塊 |
| 2 | 顯示 2 張卡片;Desktop 雙欄、Mobile 單欄,卡片左對齊 |
| 3 - 8 | 全部顯示,使用 responsive card grid |
| 9 - 30 | Desktop 顯示優先排序後 8 張,Mobile 顯示 4 張;提供「查看全部 N 個」 |
| 30 以上 | 維持 8/4 張預覽;完整資料進 Drawer 或 Connector 管理頁 |
| 100 以上 | 完整清單視量測結果導入 server pagination/virtualization;Dashboard preview 規則不變 |
## 區塊結構
1. Header
- Connector 即時狀態
- Connector 總數
- 最後更新時間
- freshness/stale
- Refresh
2. Status summary
- Faulted
- OCPP Offline
- Unavailable
- Charging
- Preparing/Waiting
- Available
3. Search/Filters
- 1 - 8 個時隱藏
- 9 個以上顯示
- 可依 Connector ID、Charge Point ID、車位、Charge Group、status 搜尋/篩選
4. Preview grid
- Desktop 最多 8 張
- Mobile 最多 4 張
- 卡片不可因數量少而無限制拉寬
5. Footer
- 「查看全部 N 個 Connector」
- 若異常超過預覽上限,顯示「另有 N 個異常 Connector」
## Preview Sorting
預覽不是單純依 Connector ID 排序,建議依處理優先度:
1. Connector `FAULTED`
2. Charge Point `OFFLINE`
3. Heartbeat/MeterValue/Status stale
4. Queue `BLOCKED` 或等待超時
5. `UNAVAILABLE`
6. `SUSPENDED_EVSE`/`SUSPENDED_EV`
7. `CHARGING`
8. `PREPARING`/Waiting
9. `AVAILABLE`
規則:
- 所有異常項目優先進入 preview。
- 異常不足 preview limit 時,再以 Charging、Waiting、Available 補滿。
- 異常超過 limit 時,Footer 必須顯示剩餘異常數量。
- OCPP connection、Connector runtime、queue status 必須分層顯示,不得合併為單一 status。
## Card Minimum Content
- Connector ID/車位
- Charge Point connection badge
- Connector runtime status
- 目前功率;未知為 `null`/「無資料」,不可顯示為 0
- Active session 或 queue status
- last updated/stale
- 點擊開啟 detail drawer
## Responsive
### Desktop >= 1240px
- 卡片寬度約 240 - 320px
- 自動換欄、左對齊
- 最多顯示 8 張 preview
### Tablet 640 - 1239px
- 2 - 3 欄
- Filter 可收合
- 最多顯示 6 - 8 張,最終上限待確認
### Mobile < 640px
- 單欄
- 顯示前 4 張 preview
- 「查看全部」進全螢幕 Drawer/頁面
- 不使用頁面級水平捲軸
## Full List 建議
優先方案:
- Desktop:大型右側 Drawer,約 70 - 80vw
- Mobile:全螢幕
- 提供搜尋、status、Charge Group filters、排序與 Grid/Table 切換
- 可進一步 deep link 至既有 Connector 管理頁
Dashboard V1 避免在 block 內放固定高度的 nested scrollbar。若最後採用 scroll container,必須可由鍵盤 focus 與捲動。
## API Implication
Overview API 建議只回 summary 與 bounded preview:
```json
{
"connectorSummary": {
"total": 30,
"faulted": 2,
"offline": 1,
"charging": 6,
"waiting": 3,
"available": 18
},
"connectorPreview": {
"items": [],
"limit": 8,
"total": 30,
"hasMore": true
}
}
```
- 查看全部:使用/擴充既有 `POST /api/connector/search`
- 點擊單卡:`GET /api/connector/info/{connectorId}`
- Overview 不內嵌所有 Connector 完整 detail
- Preview sorting 建議由 Backend 統一,避免 FE 與其他 client 規則漂移
## Acceptance Criteria
- [ ] 0、1、2、8、9、30、100 個 Connector fixture 均不破版
- [ ] 1 個 Connector 卡片不被拉滿整個區塊
- [ ] 30 個 Connector 不會使 Dashboard block 無限制增高
- [ ] Faulted/Offline/Stale/Blocked 永遠優先於 Available
- [ ] 異常超過 preview limit 時可看到剩餘異常數量
- [ ] Status summary 的各分項加總與 total 規則一致
- [ ] 390/768/1024/1440 px 無頁面級水平捲軸
- [ ] Search/Filters 僅在有必要時出現
- [ ] Keyboard 可操作卡片、filter、Drawer 與 scrollable content
- [ ] Unknown status 與 `null` 數值不會 fallback 為 Available/0
- [ ] Dashboard preview 與完整 Connector list 的資料規則一致
## 待確認事項
- [x] Desktop(≥ 1240px)preview limit 確定為 8 張。
- [x] Mobile(< 640px)採單欄,preview [ ] Mobile preview limit 確定為 4 張。 是否確定為 4?
- [ ] Tablet 是否固定 6 張,或沿用 8 張自動換欄?
- [ ] 「查看全部」採 Drawer、獨立頁面,或兩者都有?
- [ ] 9 個以上才出現搜尋/篩選是否合理?
- [ ] Preview sorting 由 Backend 還是 Frontend 負責?
- [ ] Queue waiting 超時門檻與 stale cutoff 由哪個設定提供?
- [ ] 是否需要 Grid/Table view toggle?
## 已確認決策
### UI-DEC-001:Desktop Preview Limit 為 8 張
**狀態:已確認(2026-09-03,Ken)**
- Desktop viewport `>= 1240px` 時,Connector Dashboard block 最多顯示 8 張 preview cards。
- Connector 總數 1–8 時全部顯示;總數 9 以上時只顯示 Backend 統一排序後的前 8 張。
- Preview 依既定 severity/operational priority 排序,不得單純依 Connector ID 截取前 8 張。
- 異常項目超過 8 張時,preview 仍維持 8 張上限,Footer 顯示「另有 N 個異常 Connector」及「查看全部 N 個 Connector」。
- Connector 數量少於一列容量時,卡片維持既定寬度並左對齊,不可為填滿區塊而無限制拉寬。
- Desktop 上限只控制 Dashboard preview 高度,不限制完整 Connector list/Drawer 的資料筆數。
- 0、1、2、8、9、30、100 個 Connector fixture 均須納入視覺與互動驗收。
### UI-DEC-002:Mobile Preview Limit 為 4 張
**狀態:已確認(2026-09-03,Ken)**
- Mobile viewport `< 640px` 時,Connector preview 使用單欄 cards,最多顯示 4 張。
- Connector 總數 1–4 時全部顯示;總數 5 以上時只顯示 Backend 統一排序後的前 4 張。
- 異常項目超過 4 張時,preview 仍維持 4 張上限,Footer 必須顯示剩餘異常數及「查看全部 N 個 Connector」。
- 「查看全部」在 Mobile 開啟全螢幕清單/Drawer,不使用狹窄側邊 Drawer,也不產生頁面級水平捲軸。
- Preview cards、剩餘異常提示及查看全部按鈕都必須支援鍵盤操作與可辨識的 focus state。
- Mobile preview limit 只限制 Dashboard 首頁高度,不限制完整清單搜尋、filter、pagination/virtualization 的資料筆數。
- 390px viewport 必須納入 0、1、2、4、5、30、100 個 Connector fixture 驗收。
## 需求管理狀態
- Parent:#1422
- Requirement status:**待確認**
- Final specification:確認後整併至 #1422 的 v1.0 最終需求文件
- Implementation tickets:需求鎖定後才建立 FE/BE/QA child issues
返回