fix: 用量行 pace 列真 0 窗口不再缺席,diff=0 三角位画等号

Claude 5h 空闲时接口回 utilization 0、resets_at null,算不出 time_pct,
渲染器整列跳过 pace 导致该行进度条比别行长。数据层对 pct=0 且无重置时刻的
窗口记 time_pct=0;基类 _usage_row 只要有百分比就画 pace(缺 time_pct 按 0)。
diff=0 时三角位由留空改为画等宽等号「=」,预留逻辑从宽版下沉到基类,小屏同样齐平。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 15:33:21 +08:00
parent f96ae29590
commit d35f233ef3
4 changed files with 17 additions and 14 deletions

View File

@@ -75,11 +75,6 @@ class E1002Renderer(DashboardRenderer):
bar = dict(bar, pct=0, time_pct=0, _null=True)
return super()._usage_row(x0, x1, y, bar, warn, label_w=label_w)
def _pace(self, xr, cy, diff):
"""宽版diff=0持平/无数据)不画三角,但**仍预留三角位**6 + 间隙 4使每行 pace 列等宽、进度条右端齐平。"""
w = super()._pace(xr, cy, diff)
return w if diff != 0 else w + 10 * self.k
def _usage_colors(self, ok, pct, warn, bar):
"""进度条填充、边框、百分比数字三者同色pct ≤ ok 绿「健康」其间黑「正常」pct ≥ warn 红「危险」无数据_null黑。"""
if not ok or bar.get("_null"):