Skip to content

Feat/custom alert severity names - #2304

Merged
jsers merged 3 commits into
mainfrom
feat/custom-alert-severity-names
Sep 10, 2026
Merged

jsers merged 3 commits into
mainfrom
feat/custom-alert-severity-names

Conversation

@jsers

@jsers jsers commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Site administrators can customize alert severity names (S1, S2, and S3) for each supported language.
    • Custom names are applied consistently across alerts, rules, events, history, and subscription views.
    • Severity labels include localized tooltips where applicable.
    • Added localized settings text for all supported languages.
  • Bug Fixes

    • Severity names now consistently fall back to translated defaults when custom values are unavailable.

Add a centralised alertSeverity utility that reads custom severity
names from site_info and syncs them into i18next resources, keeping
the original translations as fallback. Replace hardcoded "S1/S2/S3"
labels across alert/event/subscribe/pipeline pages with the resolved
names, and add a multilingual configuration UI in site settings.
…rrectly

Add forceRender to severity Tabs.TabPane so the Form.Item fields are
always mounted for submit/populate. Use string severity keys so the
stored structure is an object (not an array) and survives JSON round
trips. Reset the form before setFieldsValue to avoid stale values on
reload.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 04798dd9-f118-468b-a066-df9275319f0e

📥 Commits

Reviewing files that changed from the base of the PR and between 5fdd1b7 and 8a9d169.

📒 Files selected for processing (28)
  • src/App.tsx
  • src/i18n.ts
  • src/pages/alertCurEvent/pages/List/index.tsx
  • src/pages/alertRules/Form/EventSettings/Relabel/EventsModal.tsx
  • src/pages/alertRules/FormNG/PipelineConfigsNG/Relabel/EventsModal.tsx
  • src/pages/alertRules/FormNG/components/Sidebar/RuleSummary.tsx
  • src/pages/alertRules/List/EvalRecordsDrawer/index.tsx
  • src/pages/alertRules/List/EventsDrawer/index.tsx
  • src/pages/alertRules/List/ListNG.tsx
  • src/pages/event/DetailNG/index.tsx
  • src/pages/event/index.tsx
  • src/pages/eventPipeline/pages/Form/TestModal/EventsTable.tsx
  • src/pages/historyEvents/ListNG/index.tsx
  • src/pages/siteSettings/index.tsx
  • src/pages/siteSettings/locale/en_US.ts
  • src/pages/siteSettings/locale/es_ES.ts
  • src/pages/siteSettings/locale/fr_FR.ts
  • src/pages/siteSettings/locale/id_ID.ts
  • src/pages/siteSettings/locale/ja_JP.ts
  • src/pages/siteSettings/locale/ko_KR.ts
  • src/pages/siteSettings/locale/pt_BR.ts
  • src/pages/siteSettings/locale/ru_RU.ts
  • src/pages/siteSettings/locale/zh_CN.ts
  • src/pages/siteSettings/locale/zh_HK.ts
  • src/pages/warning/subscribe/ListNG.tsx
  • src/pages/warning/subscribe/components/ruleModal.tsx
  • src/utils/alertSeverity.test.ts
  • src/utils/alertSeverity.ts

📝 Walkthrough

Walkthrough

The PR adds typed, multilingual alert severity names. Site settings store custom names, application initialization loads them, and alert-related views use localized names for options, tags, and tooltips.

Changes

Alert severity naming

Layer / File(s) Summary
Severity naming utilities and contracts
src/utils/alertSeverity.ts, src/utils/alertSeverity.test.ts
Adds severity types, normalization, localized default resolution, configured-name storage, i18next synchronization, incident-name mapping, and tests.
Site configuration and multilingual settings
src/App.tsx, src/i18n.ts, src/pages/siteSettings/...
Adds typed site configuration, initializes normalized severity names in common state, exports language labels, and adds multilingual severity-name inputs with locale strings.
Alert interface label migration
src/pages/alertCurEvent/..., src/pages/alertRules/..., src/pages/event/..., src/pages/eventPipeline/..., src/pages/historyEvents/..., src/pages/warning/...
Replaces hardcoded severity labels with getAlertSeverityName in filters, tags, tables, event details, and tooltips. Numeric severity color mappings remain in place.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SiteSettings
  participant App
  participant AlertSeverity
  participant AlertView
  SiteSettings->>App: provide alert_severity_names
  App->>AlertSeverity: normalize and set severity names
  AlertSeverity-->>AlertView: resolve configured or default label
  AlertView-->>SiteSettings: render localized severity label
Loading

Suggested reviewers: 710leo

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/custom-alert-severity-names

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jsers
jsers marked this pull request as ready for review September 10, 2026 02:41
Copilot AI lite review requested due to automatic review settings September 10, 2026 02:41
@jsers
jsers merged commit 230bd33 into main Sep 10, 2026
1 check was pending

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

setAlertSeverityNames can fail to preserve/restore true default translations after overwrites, and there is at least one verified unused import that may break builds under typical TS/lint settings.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces configurable alert severity display names (per language) via site settings, syncs those names into i18next so existing common:severity.* lookups are automatically overridden, and updates multiple UI locations to render severity labels using the new resolver.

Changes:

  • Add src/utils/alertSeverity.ts to normalize configured names, resolve display labels, and sync them into i18next resources.
  • Add a Site Settings UI section to edit severity names for each supported language.
  • Replace hard-coded S1/S2/S3 (Critical/Warning/Info) strings across several pages with getAlertSeverityName(...), and export languages / languageLabels from src/i18n.ts for reuse.
File summaries
File Description
src/utils/alertSeverity.ts Adds severity-name resolution, normalization, and i18next resource syncing.
src/utils/alertSeverity.test.ts Adds unit tests for configured names, fallback behavior, and incident-name mapping.
src/pages/warning/subscribe/ListNG.tsx Updates severity tags to use numeric data + tooltip titles from getAlertSeverityName.
src/pages/warning/subscribe/components/ruleModal.tsx Renders severity tags using getAlertSeverityName.
src/pages/siteSettings/locale/zh_HK.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/zh_CN.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/ru_RU.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/pt_BR.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/ko_KR.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/ja_JP.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/id_ID.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/fr_FR.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/es_ES.ts Adds alert_severity_names label translation.
src/pages/siteSettings/locale/en_US.ts Adds alert_severity_names label translation.
src/pages/siteSettings/index.tsx Adds a per-language severity-name editor (Tabs + inputs) using exported i18n language metadata and default placeholders.
src/pages/historyEvents/ListNG/index.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/eventPipeline/pages/Form/TestModal/EventsTable.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/event/index.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/event/DetailNG/index.tsx Uses getAlertSeverityName for severity Tag text.
src/pages/alertRules/List/ListNG.tsx Updates severity tags + Select options to use getAlertSeverityName and numeric tag data.
src/pages/alertRules/List/EventsDrawer/index.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/alertRules/List/EvalRecordsDrawer/index.tsx Renders severity tags using getAlertSeverityName.
src/pages/alertRules/FormNG/PipelineConfigsNG/Relabel/EventsModal.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/alertRules/FormNG/components/Sidebar/RuleSummary.tsx Adds tooltip and keeps S# label while sourcing tooltip from getAlertSeverityName.
src/pages/alertRules/Form/EventSettings/Relabel/EventsModal.tsx Replaces hard-coded severity Select options with getAlertSeverityName.
src/pages/alertCurEvent/pages/List/index.tsx Adds import for getAlertSeverityName (currently unused).
src/i18n.ts Exports languages and introduces languageLabels for UI use.
src/App.tsx Loads alert_severity_names from site_info, normalizes them, syncs to i18next, and stores them in common state.
Review details
  • Files reviewed: 28/28 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

import { getAlertCards } from '@/services/warning';
import { getDefaultValue, parseRange } from '@/components/TimeRangePicker';
import { useParamsAiAction } from '@/components/AiChat/utils/useHook';
import { getAlertSeverityName } from '@/utils/alertSeverity';
Comment on lines +57 to +62
const languages = new Set([...Object.keys(i18next.store.data), ...Object.keys(configuredNames)]);
languages.forEach((language) => {
severities.forEach((severity) => {
i18next.addResource(language, 'common', `severity.${severity}`, getConfiguredName(configuredNames, language, severity) || getDefaultName(language, severity));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants