Skip to content

Commit 215fce5

Browse files
committed
fix: status page no agents
1 parent e9c5840 commit 215fce5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

backend/src/services/StatusService.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export async function getStatusPageConfig(userId: number) {
6363

6464
// 构建返回的客户端列表,标记哪些客户端被选中
6565
const agents = allAgents.map((agent: any) => {
66-
const isSelected = agentsResult.some(
67-
(a: any) => a.agent_id === agent.id
68-
);
66+
const isSelected = agentsResult.some((a: any) => a.agent_id === agent.id);
6967
return { ...agent, selected: isSelected };
7068
});
7169

@@ -203,8 +201,9 @@ export async function getStatusPagePublicData(userId: number) {
203201
);
204202
if (monitor) {
205203
// 确保监控项存在
206-
const monitorDailyStats =
207-
await repositories.getMonitorDailyStatsById(monitorId);
204+
const monitorDailyStats = await repositories.getMonitorDailyStatsById(
205+
monitorId
206+
);
208207
const monitorHistory =
209208
await repositories.getMonitorStatusHistoryIn24h(monitorId);
210209
monitors.push({
@@ -223,10 +222,8 @@ export async function getStatusPagePublicData(userId: number) {
223222
const agentIds = selectedAgents.map((a: any) => a.agent_id);
224223
if (agentIds.length > 0) {
225224
const agentsResult = await repositories.getAgentsByIds(agentIds);
226-
// @ts-ignore
227-
if (agentsResult && agentsResult.results) {
228-
// @ts-ignore
229-
agents = agentsResult.results as Agent[];
225+
if (agentsResult) {
226+
agents = agentsResult as Agent[];
230227
}
231228
}
232229
}

0 commit comments

Comments
 (0)