feat(platform): include release in alert digest
This commit is contained in:
@@ -335,9 +335,10 @@ function priorityIssueTicketText(row: PriorityIssueRow) {
|
|||||||
].join('\n');
|
].join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function priorityIssueDigestText(rows: PriorityIssueRow[], summary: QualitySummary) {
|
function priorityIssueDigestText(rows: PriorityIssueRow[], summary: QualitySummary, platformRelease?: string) {
|
||||||
const p0Count = rows.filter((row) => row.priority === 'P0').length;
|
const p0Count = rows.filter((row) => row.priority === 'P0').length;
|
||||||
const p1Count = rows.filter((row) => row.priority === 'P1').length;
|
const p1Count = rows.filter((row) => row.priority === 'P1').length;
|
||||||
|
const release = platformRelease?.trim();
|
||||||
const lines = rows.map((row, index) => [
|
const lines = rows.map((row, index) => [
|
||||||
`${index + 1}. [${row.priority}] ${row.vehicleLabel}`,
|
`${index + 1}. [${row.priority}] ${row.vehicleLabel}`,
|
||||||
` 来源:${qualityProtocolLabel(row.protocol)} / 问题:${qualityIssueLabel(row.issueType)}`,
|
` 来源:${qualityProtocolLabel(row.protocol)} / 问题:${qualityIssueLabel(row.issueType)}`,
|
||||||
@@ -348,6 +349,7 @@ function priorityIssueDigestText(rows: PriorityIssueRow[], summary: QualitySumma
|
|||||||
'【告警优先队列汇总】',
|
'【告警优先队列汇总】',
|
||||||
`问题车辆:${summary.issueVehicleCount.toLocaleString()},问题记录:${summary.issueRecordCount.toLocaleString()}`,
|
`问题车辆:${summary.issueVehicleCount.toLocaleString()},问题记录:${summary.issueRecordCount.toLocaleString()}`,
|
||||||
`P0:${p0Count.toLocaleString()} 条,P1:${p1Count.toLocaleString()} 条`,
|
`P0:${p0Count.toLocaleString()} 条,P1:${p1Count.toLocaleString()} 条`,
|
||||||
|
...(release ? [`运行版本:${release}`] : []),
|
||||||
'',
|
'',
|
||||||
...lines,
|
...lines,
|
||||||
'',
|
'',
|
||||||
@@ -602,7 +604,7 @@ export function Quality({
|
|||||||
Toast.warning('当前没有可复制的优先告警');
|
Toast.warning('当前没有可复制的优先告警');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
copyText(priorityIssueDigestText(priorityRows, notificationPlan?.summary ?? summary), '优先队列通知汇总');
|
copyText(priorityIssueDigestText(priorityRows, notificationPlan?.summary ?? summary, health?.runtime?.platformRelease), '优先队列通知汇总');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -3338,7 +3338,7 @@ test('copies priority queue notification digest on quality page', async () => {
|
|||||||
return {
|
return {
|
||||||
ok: true,
|
ok: true,
|
||||||
json: async () => ({
|
json: async () => ({
|
||||||
data: { linkHealth: [], kafkaLag: 0, activeConnections: 120000, capacityFindings: [], redisOnlineKeys: 368, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } },
|
data: { linkHealth: [], kafkaLag: 0, activeConnections: 120000, capacityFindings: [], redisOnlineKeys: 368, tdengineWritable: true, mysqlWritable: true, runtime: { platformRelease: 'platform-20260704153951', requestTimeoutMs: 5000 } },
|
||||||
traceId: 'trace-test',
|
traceId: 'trace-test',
|
||||||
timestamp: 1783094400000
|
timestamp: 1783094400000
|
||||||
})
|
})
|
||||||
@@ -3412,9 +3412,11 @@ test('copies priority queue notification digest on quality page', async () => {
|
|||||||
render(<App />);
|
render(<App />);
|
||||||
|
|
||||||
expect(await screen.findByText('处置优先队列')).toBeInTheDocument();
|
expect(await screen.findByText('处置优先队列')).toBeInTheDocument();
|
||||||
|
expect(await screen.findByText('platform-20260704153951')).toBeInTheDocument();
|
||||||
fireEvent.click(screen.getByRole('button', { name: '复制优先队列通知汇总' }));
|
fireEvent.click(screen.getByRole('button', { name: '复制优先队列通知汇总' }));
|
||||||
|
|
||||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【告警优先队列汇总】'));
|
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【告警优先队列汇总】'));
|
||||||
|
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('运行版本:platform-20260704153951'));
|
||||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('P0:1 条,P1:1 条'));
|
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('P0:1 条,P1:1 条'));
|
||||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. [P0] 粤A汇总1 / VIN-DIGEST-001'));
|
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. [P0] 粤A汇总1 / VIN-DIGEST-001'));
|
||||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('确认平台转发'));
|
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('确认平台转发'));
|
||||||
|
|||||||
Reference in New Issue
Block a user