feat(routing): add panel-only comment field to routing rules (#6361)

Can annotate rules with a human-readable note for easier management.
The comment is stripped before sending the config to xray-core (same
pattern as the existing 'enabled' flag).

Backend: stripDisabledRules now removes 'comment' from generated config.
Frontend: input field in RuleFormModal, column in desktop table, chip
with tooltip in mobile card list. Schema and type definitions updated.
This commit is contained in:
Sentiago
2026-09-02 21:22:50 +03:00
committed by GitHub
parent 7100fbcd08
commit 1bf078c51e
9 changed files with 71 additions and 4 deletions
@@ -13,6 +13,7 @@ import { buildRemarkByTag, formatInboundTag, isApiRule } from './helpers';
export interface RoutingRule {
enabled?: boolean;
comment?: string;
type?: string;
domain?: string | string[];
ip?: string | string[];
@@ -42,6 +43,7 @@ interface RuleFormModalProps {
const initialForm = (): RuleFormValues => ({
enabled: true,
comment: '',
domain: '',
ip: '',
port: '',
@@ -104,6 +106,7 @@ export default function RuleFormModal({
if (rule) {
methods.reset({
enabled: rule.enabled !== false,
comment: rule.comment || '',
domain: Array.isArray(rule.domain) ? rule.domain.join(',') : rule.domain || '',
ip: Array.isArray(rule.ip) ? rule.ip.join(',') : rule.ip || '',
port: rule.port || '',
@@ -132,6 +135,7 @@ export default function RuleFormModal({
const built: Record<string, unknown> = {
type: 'field',
enabled: v.enabled,
comment: v.comment,
domain: csv(v.domain),
ip: csv(v.ip),
port: v.port,
@@ -185,6 +189,10 @@ export default function RuleFormModal({
<Switch disabled={isApiRule(rule ?? {})} />
</FormField>
<FormField name="comment" label={t('comment')}>
<Input maxLength={200} showCount placeholder={t('comment')} />
</FormField>
<FormField
name="sourceIP"
label={