The GitHub Actions job "CI" on 
rocketmq-dashboard.git/fix/alert-threshold-unit-label has failed.
Run started by GitHub user unbridled-41 (triggered by unbridled-41).

Head commit for run:
6f12857a8ecb6f261cc0e738de1234b57bd49ea4 / unbridled-41 
<[email protected]>
fix(alert): translate the stored threshold unit in the rules table

A native alert rule stores its threshold unit as the metric catalog's code
(NativeAlertMetricCatalogService: "messages" for consumer.lag.total,
topic.backlog.total and dlq.message.count, "seconds" for consumer.delay.seconds,
"ratio"/"%" for the usage ratios) because that is what the API round-trips.
The rule dialog translated it for the threshold field's addonAfter
(thresholdUnitLabel -> alerts.unitMessages "条"/"messages"), but the rules table
rendered the raw code: formatThresholdCondition concatenated
rule.thresholdUnit, so the Cluster and Business Alerts pages showed

  > 12000messages      (both languages)
  > 420seconds

for the very rules the dialog renders as "> 12000 条" / "> 420 秒" - the same
field disagreeing between the list and its own edit dialog, and an internal
catalog code leaking into the UI.

Extract the dialog's mapping into one exported thresholdUnitText(unit, t), use
it from both places, and separate a word unit from the number the way the
dialog's addonAfter does (a percent sign stays attached). Values with no unit
render exactly as before.

Tests (web/): npx vitest run src/pages/ops/__tests__/AlertsPage.test.tsx
- new cases "renders the stored catalog unit code as the label the dialog shows"
  and "translates the catalog unit code in the rules table" fail before this
  change (expected '> 12000 条', received '> 12000messages') and pass after it.
- 32 tests in AlertsPage.test.tsx pass; npx eslint on both files reports no
  errors; npx tsc -b passes.

Report URL: 
https://github.com/apache/rocketmq-dashboard/actions/runs/37960040489

With regards,
GitHub Actions via GitBox

Reply via email to