This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 9206ce598 fix(ops): present the alert-silence, group-settings and 
cloud-import audit operations (#5538)
9206ce598 is described below

commit 9206ce59875dc4125f3192d8fb44ccc936341ca3
Author: Zhao Jianing <[email protected]>
AuthorDate: Fri Oct 9 18:47:06 2026 +0800

    fix(ops): present the alert-silence, group-settings and cloud-import audit 
operations (#5538)
    
    Four audit operation codes the server already writes had no presentation 
entry, so the audit page
    showed them as raw codes with no category or localized label: 
`CREATE_ALERT_SILENCE`,
    `UPDATE_GROUP_SETTINGS` and the cloud-import pair, plus the `ALERT_SILENCE` 
resource. This adds them
    to `operationPresentation` with zh/en labels, and pins 
`UPDATE_GROUP_SETTINGS` as a control-plane
    operation - the author's own `not.toBe('other')` assertion would have 
passed with the wrong category,
    so the added `isControlPlaneAuditRecord` assertion is the load-bearing one 
(verified: flipping the
    category reddens it).
    
    `auditPresentation` + `translations` + `AuditPage`: 25 tests green; 
prettier clean; the wider audit
    suite is unaffected.
    
    Merged on top of #5524, which added the two credential-reveal operations to 
the same table the same
    day; both sets coexist and #5524's case is unchanged.
---
 web/src/i18n/translations.ts                          |  5 +++++
 web/src/pages/ops/__tests__/auditPresentation.test.ts | 18 ++++++++++++++++++
 web/src/pages/ops/auditPresentation.ts                |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/web/src/i18n/translations.ts b/web/src/i18n/translations.ts
index 26588b377..a1d09c4b3 100644
--- a/web/src/i18n/translations.ts
+++ b/web/src/i18n/translations.ts
@@ -1550,6 +1550,10 @@ const translations: Record<string, Record<Lang, string>> 
= {
   'audit.op.TOGGLE_ALERT_RULE': { zh: '启停告警规则', en: 'Toggle Alert Rule' },
   'audit.op.DELETE_ALERT_RULE': { zh: '删除告警规则', en: 'Delete Alert Rule' },
   'audit.op.ACKNOWLEDGE_SYSTEM_ALERT': { zh: '确认系统告警', en: 'Acknowledge System 
Alert' },
+  'audit.op.CREATE_ALERT_SILENCE': { zh: '创建告警静默', en: 'Create Alert Silence' 
},
+  'audit.op.DELETE_ALERT_SILENCE': { zh: '删除告警静默', en: 'Delete Alert Silence' 
},
+  'audit.op.IMPORT_CLOUD_INSTANCES': { zh: '导入云端实例', en: 'Import Cloud 
Instances' },
+  'audit.op.UPDATE_GROUP_SETTINGS': { zh: '更新消费组设置', en: 'Update Group 
Settings' },
   'audit.op.CLEAR_ACKNOWLEDGED_SYSTEM_ALERTS': {
     zh: '清除已确认告警',
     en: 'Clear Acknowledged Alerts',
@@ -1574,6 +1578,7 @@ const translations: Record<string, Record<Lang, string>> 
= {
   'audit.res.SETTINGS': { zh: '设置', en: 'Settings' },
   'audit.res.METRICS_DATA_SOURCE': { zh: '指标数据源', en: 'Metrics Data Source' },
   'audit.res.CLOUD_CREDENTIAL': { zh: '云凭据', en: 'Cloud Credential' },
+  'audit.res.ALERT_SILENCE': { zh: '告警静默', en: 'Alert Silence' },
   'audit.res.ALERT_RULE': { zh: '告警规则', en: 'Alert Rule' },
   'audit.res.SYSTEM_ALERT': { zh: '系统告警', en: 'System Alert' },
   'audit.res.K8S_CERTIFICATE': { zh: 'K8s 证书', en: 'K8s Certificate' },
diff --git a/web/src/pages/ops/__tests__/auditPresentation.test.ts 
b/web/src/pages/ops/__tests__/auditPresentation.test.ts
index f74147a85..21f6a4644 100644
--- a/web/src/pages/ops/__tests__/auditPresentation.test.ts
+++ b/web/src/pages/ops/__tests__/auditPresentation.test.ts
@@ -82,6 +82,24 @@ describe('audit presentation helpers', () => {
     });
   });
 
+  it('presents the alert-silence, group-settings and cloud-import audit 
operations', () => {
+    const ops = [
+      'CREATE_ALERT_SILENCE',
+      'DELETE_ALERT_SILENCE',
+      'UPDATE_GROUP_SETTINGS',
+      'IMPORT_CLOUD_INSTANCES',
+    ] as const;
+    for (const op of ops) {
+      const presentation = getAuditOperationPresentation(op);
+      expect(presentation.category, op).not.toBe('other');
+      expect(presentation.labelKey, op).toBe(`audit.op.${op}`);
+    }
+    const silence = getAuditResourcePresentation('ALERT_SILENCE');
+    expect(silence.labelKey).toBe('audit.res.ALERT_SILENCE');
+    // The metadata category also makes the operation count as control-plane.
+    expect(isControlPlaneAuditRecord({ operationType: 'UPDATE_GROUP_SETTINGS' 
})).toBe(true);
+  });
+
   it('falls back to title-cased labels for new operation codes', () => {
     expect(getAuditOperationPresentation('UPSERT_NEW_RESOURCE')).toEqual({
       label: 'Upsert New Resource',
diff --git a/web/src/pages/ops/auditPresentation.ts 
b/web/src/pages/ops/auditPresentation.ts
index 588d10c90..e2a71502a 100644
--- a/web/src/pages/ops/auditPresentation.ts
+++ b/web/src/pages/ops/auditPresentation.ts
@@ -118,6 +118,8 @@ const operationPresentation: Record<string, 
AuditOperationPresentation> = {
   UPDATE_ALERT_RULE: { label: 'Update Alert Rule', color: 'cyan', category: 
'alerts' },
   TOGGLE_ALERT_RULE: { label: 'Toggle Alert Rule', color: 'gold', category: 
'alerts' },
   DELETE_ALERT_RULE: { label: 'Delete Alert Rule', color: 'volcano', category: 
'alerts' },
+  CREATE_ALERT_SILENCE: { label: 'Create Alert Silence', color: 'blue', 
category: 'alerts' },
+  DELETE_ALERT_SILENCE: { label: 'Delete Alert Silence', color: 'volcano', 
category: 'alerts' },
   ACKNOWLEDGE_SYSTEM_ALERT: {
     label: 'Acknowledge System Alert',
     color: 'green',
@@ -129,6 +131,10 @@ const operationPresentation: Record<string, 
AuditOperationPresentation> = {
     category: 'alerts',
   },
 
+  IMPORT_CLOUD_INSTANCES: { label: 'Import Cloud Instances', color: 'cyan', 
category: 'instance' },
+
+  UPDATE_GROUP_SETTINGS: { label: 'Update Group Settings', color: 'purple', 
category: 'metadata' },
+
   CREATE_INSTANCE: { label: 'Create Instance', color: 'blue', category: 
'instance' },
   UPDATE_INSTANCE: { label: 'Update Instance', color: 'cyan', category: 
'instance' },
   DELETE_INSTANCE: { label: 'Delete Instance', color: 'volcano', category: 
'instance' },
@@ -166,6 +172,7 @@ const resourcePresentation: Record<string, 
AuditPresentation> = {
   METRICS_DATA_SOURCE: { label: 'Metrics Data Source', color: 'purple' },
   CLOUD_CREDENTIAL: { label: 'Cloud Credential', color: 'cyan' },
   ALERT_RULE: { label: 'Alert Rule', color: 'gold' },
+  ALERT_SILENCE: { label: 'Alert Silence', color: 'gold' },
   SYSTEM_ALERT: { label: 'System Alert', color: 'gold' },
   K8S_CERTIFICATE: { label: 'K8s Certificate', color: 'lime' },
 };

Reply via email to