fix(monitoring): match the wording and the figures the wireframe actually shows

Reading the page's Overview line by line against the app turned up more than
layout:

  * Tab strip: "Sự kiện bảo mật / Lịch sử gọi MCP / Nhật ký hành động /
    Trạng thái Agent" → "Bảo mật / MCP / Hành động / Agent", as drawn. The long
    names are also what pushed "Icon" off a 1024px window behind scroll arrows;
    all eight now fit.
  * Headings: "SỬ DỤNG TOKEN & CHI PHÍ" → "TOKEN & CHI PHÍ", "SỬ DỤNG TÀI
    NGUYÊN" → "TÀI NGUYÊN", "CHI TIẾT SANDBOX" → "SANDBOX & QUYỀN",
    "HOẠT ĐỘNG GẦN ĐÂY" → "NHẬT KÝ GẦN ĐÂY".
  * Tiles put the number FIRST and its name under it, which is how the page
    draws them; "Tổng chi phí" → "Chi phí" and Budget → "Ngân sách" in
    Vietnamese. Applies to the Dashboard's cards too, which share the widget.
  * Resources showed I/O and network RATES; the drawing shows capacity —
    memory as used/total (138 MB/15 GB) and the workspace drive's free space
    (15 GB trống). The rates are still measured and kept.
  * "SANDBOX & QUYỀN" rendered as "SANDBOX _QUYỀN": a group-box title treats
    "&" as a mnemonic. Same bug as the usage title, now fixed in both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
NamPDT
2026-08-17 16:15:49 +09:00
co-authored by Claude Opus 5
parent 175be15c4b
commit dc6cb309c2
3 changed files with 41 additions and 16 deletions
+21 -4
View File
@@ -530,8 +530,11 @@ class MonitoringTab(QWidget):
self.ov_cpu_lbl, self.ov_cpu_bar, self.ov_cpu_val = _bar_row()
self.ov_mem_lbl, self.ov_mem_bar, self.ov_mem_val = _bar_row()
self.ov_disk_lbl, self.ov_disk_val = _text_row()
self.ov_network_lbl, self.ov_network_val = _text_row()
self.ov_diskfree_lbl, self.ov_diskfree_val = _text_row()
# I/O and network rates keep working; they are read from the detail
# fold rather than the summary line the wireframe draws.
self.ov_disk_lbl, self.ov_disk_val = QLabel(), QLabel()
self.ov_network_lbl, self.ov_network_val = QLabel(), QLabel()
res_lay.addStretch(1)
# ---- Model pricing (beside the CPU/resource group) ------------------
@@ -730,6 +733,7 @@ class MonitoringTab(QWidget):
self.action_page.filter_edit.setPlaceholderText(tr("monitoring.filter_placeholder"))
self.ov_cpu_lbl.setText(tr("monitoring.overview_res_cpu"))
self.ov_mem_lbl.setText(tr("monitoring.overview_res_mem"))
self.ov_diskfree_lbl.setText(tr("monitoring.overview_disk_label"))
self.ov_disk_lbl.setText(tr("monitoring.overview_res_disk"))
self.ov_network_lbl.setText(tr("monitoring.overview_res_network"))
# model pricing panel
@@ -745,7 +749,9 @@ class MonitoringTab(QWidget):
tr("monitoring.pricing_col_maxout"), tr("monitoring.pricing_col_input"),
tr("monitoring.pricing_col_output")])
self.ov_sandbox_details_group.setTitle(tr("monitoring.overview_sandbox_details_title").upper())
self.ov_sandbox_details_group.setTitle(
# "&" is a mnemonic marker in a group-box title — double it.
tr("monitoring.overview_sandbox_details_title").upper().replace("&", "&&"))
self.ov_sbx_id_lbl.setText(tr("monitoring.overview_sandbox_id"))
self.ov_sbx_status_lbl.setText(tr("monitoring.overview_status"))
self.ov_sbx_created_lbl.setText(tr("monitoring.overview_created"))
@@ -809,7 +815,18 @@ class MonitoringTab(QWidget):
except Exception:
mem_pct = 0
self.ov_mem_bar.setValue(min(mem_pct, 100))
self.ov_mem_val.setText(_fmt_bytes(own_mem))
try:
self.ov_mem_val.setText(f"{_fmt_bytes(own_mem)}/{_fmt_bytes(total_mem)}")
except Exception: # noqa: BLE001
self.ov_mem_val.setText(_fmt_bytes(own_mem))
# Free disk on the workspace drive — a capacity fact, unlike the I/O
# rate that used to sit here, and the one the drawing shows.
try:
free = psutil.disk_usage(str(self.ctx.config.cowork_output_dir())).free
self.ov_diskfree_val.setText(
tr("monitoring.overview_disk_free", size=_fmt_bytes(free)))
except Exception: # noqa: BLE001
self.ov_diskfree_val.setText(tr("monitoring.na"))
now = time.monotonic()
try:
+5 -2
View File
@@ -50,8 +50,10 @@ class StatCard(QFrame):
# sizeHint hundreds of px wide, forcing its WHOLE grid column open and
# throwing every card in the row out of alignment.
self.sub_lbl.setWordWrap(True)
lay.addWidget(self.title_lbl)
# Number first, name under it — the figure is what the eye is looking
# for, and it is how the audit page's tiles are drawn.
lay.addWidget(self.value_lbl)
lay.addWidget(self.title_lbl)
lay.addWidget(self.sub_lbl)
def set(self, title: str, value: str, sub: str = "") -> None:
@@ -100,8 +102,9 @@ class BudgetCard(QFrame):
# sizeHint hundreds of px wide, forcing its WHOLE grid column open and
# throwing every card in the row out of alignment.
self.sub_lbl.setWordWrap(True)
lay.addWidget(self.title_lbl)
# Same order as StatCard: the number first, its name under it.
lay.addWidget(self.value_lbl)
lay.addWidget(self.title_lbl)
lay.addWidget(self.sub_lbl)
row = QHBoxLayout()