feat(waf): ausgeschlossene Regeln grün + Bereits-Ausnahme-Tag — v1.2.84
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -292,7 +292,7 @@ async function fetchAlerts(domainId?: number): Promise<WafAlert[]> {
|
||||
return (r.data.data as { alerts?: WafAlert[] }).alerts ?? []
|
||||
}
|
||||
|
||||
function AlertsTab({ domainId }: { domainId?: number }) {
|
||||
function AlertsTab({ domainId, configMap }: { domainId?: number; configMap: Map<number, WafConfig> }) {
|
||||
const { t } = useTranslation()
|
||||
const qc = useQueryClient()
|
||||
const isViewer = useAuthStore((s) => s.user?.role) === 'viewer'
|
||||
@@ -388,6 +388,15 @@ function AlertsTab({ domainId }: { domainId?: number }) {
|
||||
key: 'exception',
|
||||
width: 130,
|
||||
render: (_: unknown, row: WafAlert) => {
|
||||
const isExcluded = !!row.domain_id &&
|
||||
(configMap.get(row.domain_id)?.rule_exclusions ?? []).includes(String(row.rule_id))
|
||||
if (isExcluded) {
|
||||
return (
|
||||
<Tag color="success" icon={<CheckCircleOutlined />}>
|
||||
{t('waf.alerts.alreadyExcluded')}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
const canExclude = !!row.domain_id && row.rule_id > 0 && !isViewer
|
||||
return (
|
||||
<Tooltip title={!row.domain_id ? t('waf.alerts.noDomain') : undefined}>
|
||||
@@ -432,9 +441,13 @@ function AlertsTab({ domainId }: { domainId?: number }) {
|
||||
loading={isLoading}
|
||||
dataSource={alerts ?? []}
|
||||
columns={columns}
|
||||
rowClassName={(row: WafAlert) =>
|
||||
row.action === 'blocked' ? 'fw-rule-row--zero-hit' : ''
|
||||
}
|
||||
rowClassName={(row: WafAlert) => {
|
||||
const isExcluded = !!row.domain_id &&
|
||||
(configMap.get(row.domain_id)?.rule_exclusions ?? []).includes(String(row.rule_id))
|
||||
if (isExcluded) return 'waf-alert-row--excluded'
|
||||
if (row.action === 'blocked') return 'fw-rule-row--zero-hit'
|
||||
return ''
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -642,7 +655,7 @@ export default function WAFPage() {
|
||||
{
|
||||
key: 'alerts',
|
||||
label: t('waf.tabs.alerts'),
|
||||
children: <AlertsTab />,
|
||||
children: <AlertsTab configMap={configMap} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user