fix(striker-ui-api): include brief node info in alert override response

main
Tsu-ba-me 11 months ago
parent dc0c919436
commit e340169dbe
  1. 23
      striker-ui-api/src/lib/request_handlers/alert-override/getAlertOverride.ts
  2. 23
      striker-ui-api/src/lib/request_handlers/alert-override/getAlertOverrideDetail.ts
  3. 3
      striker-ui-api/src/types/ApiAlertOverride.d.ts

@ -31,12 +31,15 @@ export const getAlertOverride: RequestHandler<
b.recipient_name, b.recipient_name,
c.host_uuid, c.host_uuid,
c.host_name, c.host_name,
c.host_type d.anvil_uuid,
d.anvil_name
FROM alert_overrides AS a FROM alert_overrides AS a
JOIN recipients AS b JOIN recipients AS b
ON a.alert_override_recipient_uuid = b.recipient_uuid ON a.alert_override_recipient_uuid = b.recipient_uuid
JOIN hosts AS c JOIN hosts AS c
ON a.alert_override_host_uuid = c.host_uuid ON a.alert_override_host_uuid = c.host_uuid
JOIN anvils AS d
ON c.host_uuid IN (d.anvil_node1_host_uuid, d.anvil_node2_host_uuid)
WHERE a.alert_override_alert_level != -1 WHERE a.alert_override_alert_level != -1
AND b.recipient_name != '${DELETED}' AND b.recipient_name != '${DELETED}'
AND ${mailRecipientCond} AND ${mailRecipientCond}
@ -53,21 +56,25 @@ export const getAlertOverride: RequestHandler<
mailRecipientName, mailRecipientName,
hostUuid, hostUuid,
hostName, hostName,
hostType, anvilUuid,
anvilName,
], ],
) => { ) => {
previous[uuid] = { previous[uuid] = {
host: {
hostName,
hostType,
hostUUID: hostUuid,
shortHostName: getShortHostName(hostName),
},
level: Number(level), level: Number(level),
mailRecipient: { mailRecipient: {
name: mailRecipientName, name: mailRecipientName,
uuid: mailRecipientUuid, uuid: mailRecipientUuid,
}, },
node: {
name: anvilName,
uuid: anvilUuid,
},
subnode: {
name: hostName,
short: getShortHostName(hostName),
uuid: hostUuid,
},
uuid, uuid,
}; };

@ -23,12 +23,15 @@ export const getAlertOverrideDetail: RequestHandler<AlertOverrideReqParams> =
b.recipient_name, b.recipient_name,
c.host_uuid, c.host_uuid,
c.host_name, c.host_name,
c.host_type d.anvil_uuid,
d.anvil_name
FROM alert_overrides AS a FROM alert_overrides AS a
JOIN recipients AS b JOIN recipients AS b
ON a.alert_override_recipient_uuid = b.recipient_uuid ON a.alert_override_recipient_uuid = b.recipient_uuid
JOIN hosts AS c JOIN hosts AS c
ON a.alert_override_host_uuid = c.host_uuid ON a.alert_override_host_uuid = c.host_uuid
JOIN anvils AS d
ON c.host_uuid IN (d.anvil_node1_host_uuid, d.anvil_node2_host_uuid)
WHERE a.alert_override_alert_level != -1 WHERE a.alert_override_alert_level != -1
AND b.recipient_name != '${DELETED}' AND b.recipient_name != '${DELETED}'
AND a.alert_override_uuid = '${uuid}' AND a.alert_override_uuid = '${uuid}'
@ -48,22 +51,26 @@ export const getAlertOverrideDetail: RequestHandler<AlertOverrideReqParams> =
mailRecipientName, mailRecipientName,
hostUuid, hostUuid,
hostName, hostName,
hostType, anvilUuid,
anvilName,
], ],
} = rows; } = rows;
return { return {
host: {
hostName,
hostType,
hostUUID: hostUuid,
shortHostName: getShortHostName(hostName),
},
level: Number(level), level: Number(level),
mailRecipient: { mailRecipient: {
name: mailRecipientName, name: mailRecipientName,
uuid: mailRecipientUuid, uuid: mailRecipientUuid,
}, },
node: {
name: anvilName,
uuid: anvilUuid,
},
subnode: {
name: hostName,
short: getShortHostName(hostName),
uuid: hostUuid,
},
uuid, uuid,
}; };
}); });

@ -1,7 +1,8 @@
type AlertOverrideOverview = { type AlertOverrideOverview = {
level: number; level: number;
host: HostOverview;
mailRecipient: MailRecipientOverview; mailRecipient: MailRecipientOverview;
node: { name: string; uuid: string };
subnode: { name: string; short: string; uuid: string };
uuid: string; uuid: string;
}; };

Loading…
Cancel
Save