@@ -17,6 +17,7 @@ type Props = {
1717
1818type AlertField =
1919 | "serverOfflineAlert"
20+ | "resourceUsageAlert"
2021 | "buildFailure"
2122 | "deploymentFailure"
2223 | "deploymentMovedAlert"
@@ -34,6 +35,12 @@ const ALERT_SETTINGS: AlertSetting[] = [
3435 label : "Server Offline Alert" ,
3536 description : "Receive a notification when a server goes offline" ,
3637 } ,
38+ {
39+ field : "resourceUsageAlert" ,
40+ label : "Resource Usage Alert" ,
41+ description :
42+ "Receive a notification when server CPU, memory, or disk usage is high" ,
43+ } ,
3744 {
3845 field : "buildFailure" ,
3946 label : "Build Failure Alert" ,
@@ -59,6 +66,7 @@ const ALERT_SETTINGS: AlertSetting[] = [
5966
6067type State = {
6168 serverOfflineAlert : boolean ;
69+ resourceUsageAlert : boolean ;
6270 buildFailure : boolean ;
6371 deploymentFailure : boolean ;
6472 deploymentMovedAlert : boolean ;
@@ -74,6 +82,7 @@ function createInitialState(props: Props): State {
7482 const { initialAlertsConfig : alertsConfig } = props ;
7583 return {
7684 serverOfflineAlert : alertsConfig ?. serverOfflineAlert ?? true ,
85+ resourceUsageAlert : alertsConfig ?. resourceUsageAlert ?? true ,
7786 buildFailure : alertsConfig ?. buildFailure ?? true ,
7887 deploymentFailure : alertsConfig ?. deploymentFailure ?? true ,
7988 deploymentMovedAlert : alertsConfig ?. deploymentMovedAlert ?? true ,
@@ -104,6 +113,7 @@ export function EmailSettings({ initialAlertsConfig }: Props) {
104113 try {
105114 await updateEmailAlertsConfig ( {
106115 serverOfflineAlert : state . serverOfflineAlert ,
116+ resourceUsageAlert : state . resourceUsageAlert ,
107117 buildFailure : state . buildFailure ,
108118 deploymentFailure : state . deploymentFailure ,
109119 deploymentMovedAlert : state . deploymentMovedAlert ,
@@ -125,6 +135,8 @@ export function EmailSettings({ initialAlertsConfig }: Props) {
125135 const hasAlertsChanges =
126136 state . serverOfflineAlert !==
127137 ( initialAlertsConfig ?. serverOfflineAlert ?? true ) ||
138+ state . resourceUsageAlert !==
139+ ( initialAlertsConfig ?. resourceUsageAlert ?? true ) ||
128140 state . buildFailure !== ( initialAlertsConfig ?. buildFailure ?? true ) ||
129141 state . deploymentFailure !==
130142 ( initialAlertsConfig ?. deploymentFailure ?? true ) ||
0 commit comments