feat(platform): add notification orchestration strip

This commit is contained in:
lingniu
2026-07-06 03:32:00 +08:00
parent 08f2b62362
commit 3e9128b441
3 changed files with 234 additions and 1 deletions

View File

@@ -761,6 +761,74 @@ export function NotificationRules() {
onClick: () => copyText(notificationRulesRunbook(plan, release), '通知规则Runbook') onClick: () => copyText(notificationRulesRunbook(plan, release), '通知规则Runbook')
} }
]; ];
const primaryPolicy = policies.find((policy) => policy.name.startsWith('P0')) ?? policies[0];
const notificationOrchestrationItems = [
{
label: '告警触发',
value: `${activeRuleCount.toLocaleString()} 类活跃规则`,
detail: `${p0RuleCount.toLocaleString()} 类 P0当前命中 ${totalActiveHits.toLocaleString()} 次。`,
color: p0RuleCount > 0 ? 'red' as const : activeRuleCount > 0 ? 'orange' as const : 'green' as const,
onClick: () => navigateHash('#/alert-events')
},
{
label: '受影响车辆',
value: `${priorityIssues.length.toLocaleString()} 待通知`,
detail: p0IssueCount > 0 ? `P0 ${p0IssueCount.toLocaleString()} 条,优先通知业务责任人。` : `${evidenceCompleteCount}/${priorityIssues.length || 0} 证据完整。`,
color: p0IssueCount > 0 ? 'red' as const : priorityIssues.length > 0 ? 'orange' as const : 'green' as const,
onClick: () => copyText(priorityIssueDigest(plan, release), '待通知告警')
},
{
label: '通知对象',
value: primaryPolicy?.target || primaryOwner,
detail: `渠道:${primaryPolicy?.channel || policies[0]?.channel || '待配置渠道'}`,
color: primaryPolicy?.target ? 'blue' as const : 'orange' as const,
onClick: () => copyText(priorityIssueDigest(plan, release), '待通知告警')
},
{
label: '升级时钟',
value: overdueCount > 0 ? `已超时 ${overdueCount.toLocaleString()}` : dueSoonCount > 0 ? `临近 ${dueSoonCount.toLocaleString()}` : '正常跟进',
detail: primaryPolicy ? formatEscalationMinutes(primaryPolicy.escalationMinutes) : '缺少升级策略。',
color: overdueCount > 0 ? 'red' as const : dueSoonCount > 0 ? 'orange' as const : 'green' as const,
onClick: () => copyText(slaEscalationReport(slaRows, release), 'SLA升级报告')
},
{
label: '恢复验收',
value: primaryPolicy?.acceptanceCriteria || '按车辆服务证据验收',
detail: '恢复后必须复核实时、轨迹、原始记录和规则命中状态。',
color: primaryPolicy?.acceptanceCriteria ? 'green' as const : 'orange' as const,
onClick: () => copyText(notificationRulesRunbook(plan, release), '通知规则Runbook')
}
];
const notificationOrchestrationActions = [
{
label: '查看告警',
action: '告警队列',
color: priorityIssues.length > 0 ? 'orange' as const : 'green' as const,
disabled: false,
onClick: () => navigateHash('#/alert-events')
},
{
label: '复制通知',
action: '待通知',
color: priorityIssues.length > 0 ? 'blue' as const : 'grey' as const,
disabled: priorityIssues.length === 0,
onClick: () => copyText(priorityIssueDigest(plan, release), '待通知告警')
},
{
label: '复制SLA',
action: 'SLA报告',
color: overdueCount > 0 ? 'red' as const : dueSoonCount > 0 ? 'orange' as const : 'green' as const,
disabled: slaRows.length === 0,
onClick: () => copyText(slaEscalationReport(slaRows, release), 'SLA升级报告')
},
{
label: '导出演练',
action: '演练包',
color: 'blue' as const,
disabled: false,
onClick: () => copyText(alertNotificationDrillPackage(plan, health, release), '通知演练包')
}
];
const exportNotificationRules = () => { const exportNotificationRules = () => {
const rows = notificationExportRows(plan, release); const rows = notificationExportRows(plan, release);
if (rows.length === 0) { if (rows.length === 0) {
@@ -812,6 +880,53 @@ export function NotificationRules() {
))} ))}
</div> </div>
</Card> </Card>
<section className="vp-notification-orchestration-strip" aria-label="客户通知编排条">
<div className="vp-notification-orchestration-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={p0IssueCount > 0 || overdueCount > 0 ? 'red' : priorityIssues.length > 0 ? 'orange' : 'green'}>
{priorityIssues.length > 0 ? `${priorityIssues.length.toLocaleString()} 待通知` : '当前稳定'}
</Tag>
<Tag color={primaryPolicy?.target ? 'blue' : 'orange'}>{primaryPolicy?.channel || '待配置渠道'}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>
SLA
</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-notification-orchestration-grid">
{notificationOrchestrationItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-notification-orchestration-item"
onClick={item.onClick}
aria-label={`客户通知编排 ${item.label} ${item.value}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
<div className="vp-notification-orchestration-actions">
{notificationOrchestrationActions.map((item) => (
<button
key={item.label}
type="button"
className="vp-notification-orchestration-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`客户通知编排动作 ${item.label} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<span>{item.action}</span>
</button>
))}
</div>
</section>
<Card bordered loading={loading} title="客户通知常问" style={{ marginBottom: 16 }}> <Card bordered loading={loading} title="客户通知常问" style={{ marginBottom: 16 }}>
<div className="vp-notification-question-board"> <div className="vp-notification-question-board">
<div className="vp-notification-question-summary"> <div className="vp-notification-question-summary">

View File

@@ -8751,6 +8751,109 @@ button.vp-realtime-command-item:focus-visible {
align-self: end; align-self: end;
} }
.vp-notification-orchestration-strip {
margin-bottom: 16px;
border: 1px solid rgba(22, 100, 255, 0.18);
border-radius: var(--vp-radius);
background: #fff;
display: grid;
grid-template-columns: minmax(280px, 0.74fr) minmax(0, 1.34fr) minmax(190px, 0.52fr);
overflow: hidden;
box-shadow: var(--vp-shadow-sm);
}
.vp-notification-orchestration-copy {
padding: 18px;
border-right: 1px solid var(--vp-border);
background: #f7fbff;
display: grid;
gap: 10px;
align-content: start;
}
.vp-notification-orchestration-grid {
padding: 14px;
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 10px;
}
.vp-notification-orchestration-item {
min-height: 124px;
padding: 12px;
border: 1px solid rgba(22, 100, 255, 0.13);
border-radius: 8px;
background: #fbfcff;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: grid;
gap: 8px;
align-content: start;
}
.vp-notification-orchestration-item:hover,
.vp-notification-orchestration-item:focus-visible,
.vp-notification-orchestration-action:hover,
.vp-notification-orchestration-action:focus-visible {
border-color: rgba(22, 100, 255, 0.42);
background: #f5f9ff;
box-shadow: var(--vp-shadow-sm);
outline: none;
}
.vp-notification-orchestration-item strong {
color: var(--vp-text);
font-size: 18px;
line-height: 24px;
word-break: break-word;
}
.vp-notification-orchestration-item span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
word-break: break-word;
}
.vp-notification-orchestration-actions {
padding: 14px;
border-left: 1px solid var(--vp-border);
background: #fafcff;
display: grid;
gap: 8px;
}
.vp-notification-orchestration-action {
min-height: 46px;
padding: 8px 10px;
border: 1px solid rgba(22, 100, 255, 0.13);
border-radius: 8px;
background: #fff;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.vp-notification-orchestration-action:disabled {
cursor: not-allowed;
opacity: 0.62;
}
.vp-notification-orchestration-action span {
color: var(--vp-primary);
font-size: 12px;
font-weight: 700;
line-height: 18px;
white-space: nowrap;
}
.vp-notification-question-board { .vp-notification-question-board {
display: grid; display: grid;
grid-template-columns: minmax(260px, 0.58fr) minmax(0, 1.42fr); grid-template-columns: minmax(260px, 0.58fr) minmax(0, 1.42fr);
@@ -13995,6 +14098,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-alert-command-grid, .vp-alert-command-grid,
.vp-notification-customer-board .semi-card-body, .vp-notification-customer-board .semi-card-body,
.vp-notification-customer-steps, .vp-notification-customer-steps,
.vp-notification-orchestration-strip,
.vp-notification-orchestration-grid,
.vp-notification-question-board, .vp-notification-question-board,
.vp-notification-question-grid, .vp-notification-question-grid,
.vp-notification-coverage-board, .vp-notification-coverage-board,
@@ -14181,7 +14286,9 @@ button.vp-realtime-command-item:focus-visible {
.vp-history-delivery-conclusion-copy, .vp-history-delivery-conclusion-copy,
.vp-history-delivery-conclusion-actions, .vp-history-delivery-conclusion-actions,
.vp-history-next-export-copy, .vp-history-next-export-copy,
.vp-history-next-export-actions { .vp-history-next-export-actions,
.vp-notification-orchestration-copy,
.vp-notification-orchestration-actions {
border-left: 0; border-left: 0;
border-right: 0; border-right: 0;
border-bottom: 1px solid var(--vp-border); border-bottom: 1px solid var(--vp-border);

View File

@@ -4839,6 +4839,17 @@ test('renders notification rules as a standalone operations page', async () => {
expect(screen.getByRole('button', { name: '客户告警闭环 超时升级 SLA报告' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户告警闭环 超时升级 SLA报告' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户告警闭环 验收恢复 运行手册' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户告警闭环 验收恢复 运行手册' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '复制值班清单' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '复制值班清单' })).toBeInTheDocument();
expect(screen.getByText('客户通知编排条')).toBeInTheDocument();
expect(screen.getByText('先把规则命中转成可执行的通知编排触发条件、受影响车辆、责任方、渠道、SLA 和验收口径在一行里完成确认。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排 告警触发 2 类活跃规则' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排 受影响车辆 1 待通知' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排 通知对象 接入运维 + 业务责任人' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排 升级时钟 已超时 1' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排 恢复验收 来源恢复并持续 10 分钟' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排动作 查看告警 告警队列' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排动作 复制通知 待通知' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排动作 复制SLA SLA报告' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知编排动作 导出演练 演练包' })).toBeInTheDocument();
expect(screen.getByText('客户通知常问')).toBeInTheDocument(); expect(screen.getByText('客户通知常问')).toBeInTheDocument();
expect(screen.getByText('把通知规则翻译成客户能理解的影响、责任、升级和恢复口径')).toBeInTheDocument(); expect(screen.getByText('把通知规则翻译成客户能理解的影响、责任、升级和恢复口径')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户通知常问 哪些车受影响? 影响摘要' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户通知常问 哪些车受影响? 影响摘要' })).toBeInTheDocument();