feat(platform): surface global alert pressure
This commit is contained in:
@@ -497,6 +497,7 @@ export function Quality({
|
||||
onOpenMileage,
|
||||
onOpenNotificationRules,
|
||||
onHealthLoaded,
|
||||
onNotificationPlanLoaded,
|
||||
onFiltersChange,
|
||||
initialFilters = {}
|
||||
}: {
|
||||
@@ -507,6 +508,7 @@ export function Quality({
|
||||
onOpenMileage?: (filters: Record<string, string>) => void;
|
||||
onOpenNotificationRules?: () => void;
|
||||
onHealthLoaded?: (health: OpsHealth) => void;
|
||||
onNotificationPlanLoaded?: (plan: QualityNotificationPlan) => void;
|
||||
onFiltersChange?: (filters: Record<string, string>) => void;
|
||||
initialFilters?: Record<string, string>;
|
||||
}) {
|
||||
@@ -519,7 +521,13 @@ export function Quality({
|
||||
const [loadingHealth, setLoadingHealth] = useState(true);
|
||||
const [filters, setFilters] = useState<Record<string, string>>(initialFilters);
|
||||
const [pagination, setPagination] = useState({ currentPage: 1, pageSize: 20, total: 0 });
|
||||
const primaryIssueType = summary.issueTypes[0]?.name;
|
||||
const summaryIssueTypes = Array.isArray(summary.issueTypes) ? summary.issueTypes : [];
|
||||
const summaryProtocols = Array.isArray(summary.protocols) ? summary.protocols : [];
|
||||
const issueVehicleCount = Number(summary.issueVehicleCount ?? 0);
|
||||
const issueRecordCount = Number(summary.issueRecordCount ?? 0);
|
||||
const errorCount = Number(summary.errorCount ?? 0);
|
||||
const warningCount = Number(summary.warningCount ?? 0);
|
||||
const primaryIssueType = summaryIssueTypes[0]?.name;
|
||||
const rules = normalizeAlertRules(notificationPlan?.rules) ?? alertRuleRows(summary, health);
|
||||
const policies = normalizeNotificationPolicies(notificationPlan?.policies) ?? notificationPolicies;
|
||||
const activeRuleCount = notificationPlan?.activeRuleCount ?? rules.filter((item) => item.count > 0).length;
|
||||
@@ -565,6 +573,7 @@ export function Quality({
|
||||
.then((plan) => {
|
||||
if (Array.isArray(plan.rules) && Array.isArray(plan.policies) && Array.isArray(plan.priorityIssues)) {
|
||||
setNotificationPlan(plan);
|
||||
onNotificationPlanLoaded?.(plan);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -662,12 +671,12 @@ export function Quality({
|
||||
<PageHeader title="告警事件" description="围绕车辆服务沉淀断链、VIN 缺失、字段缺失和链路健康事件,并形成通知闭环" />
|
||||
<div className="vp-kpi-grid">
|
||||
{[
|
||||
{ label: '问题车辆', value: summary.issueVehicleCount.toLocaleString() },
|
||||
{ label: '问题记录', value: summary.issueRecordCount.toLocaleString() },
|
||||
{ label: '错误 / 警告', value: `${summary.errorCount}/${summary.warningCount}` },
|
||||
{ label: '问题车辆', value: issueVehicleCount.toLocaleString() },
|
||||
{ label: '问题记录', value: issueRecordCount.toLocaleString() },
|
||||
{ label: '错误 / 警告', value: `${errorCount}/${warningCount}` },
|
||||
{
|
||||
label: '主要问题',
|
||||
value: primaryIssueType ? `${qualityIssueLabel(primaryIssueType)} ${summary.issueTypes[0].count}` : '-',
|
||||
value: primaryIssueType ? `${qualityIssueLabel(primaryIssueType)} ${summaryIssueTypes[0].count}` : '-',
|
||||
onClick: primaryIssueType ? drillPrimaryIssue : undefined
|
||||
}
|
||||
].map((item) => (
|
||||
@@ -709,7 +718,7 @@ export function Quality({
|
||||
{[
|
||||
{ label: '事件触发', value: `${activeRuleCount} 类活跃`, detail: '断链、无来源、VIN 缺失、字段缺失和容量异常进入告警池。' },
|
||||
{ label: '分级通知', value: `${p0RuleCount} 类 P0`, detail: '按错误、警告、关注分层推送给平台、运维和业务责任人。' },
|
||||
{ label: '处置回执', value: `${summary.issueVehicleCount.toLocaleString()} 辆车`, detail: '告警需要关联车辆服务、来源证据和处理结论,形成可追踪闭环。' }
|
||||
{ label: '处置回执', value: `${issueVehicleCount.toLocaleString()} 辆车`, detail: '告警需要关联车辆服务、来源证据和处理结论,形成可追踪闭环。' }
|
||||
].map((item) => (
|
||||
<div key={item.label} className="vp-alert-flow-item">
|
||||
<Tag color="blue">{item.label}</Tag>
|
||||
@@ -856,7 +865,7 @@ export function Quality({
|
||||
<Card bordered title="问题来源分布" loading={loadingSummary} style={{ marginTop: 16 }}>
|
||||
<Table
|
||||
pagination={false}
|
||||
dataSource={summary.protocols}
|
||||
dataSource={summaryProtocols}
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{ title: '数据来源', render: (_: unknown, row: { name: string }) => qualityProtocolLabel(row.name) },
|
||||
@@ -874,7 +883,7 @@ export function Quality({
|
||||
<Card bordered title="问题类型分布" loading={loadingSummary} style={{ marginTop: 16 }}>
|
||||
<Table
|
||||
pagination={false}
|
||||
dataSource={summary.issueTypes}
|
||||
dataSource={summaryIssueTypes}
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{ title: '问题类型', render: (_: unknown, row: { name: string }) => qualityIssueLabel(row.name) },
|
||||
|
||||
Reference in New Issue
Block a user