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

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

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

Loading…
Cancel
Save