Making form and lang better

This commit is contained in:
Owen
2026-04-20 18:14:30 -07:00
parent 1a36475afa
commit 49b3163bbe
5 changed files with 21 additions and 19 deletions

View File

@@ -1383,13 +1383,15 @@
"alertingTrigger": "When to alert", "alertingTrigger": "When to alert",
"alertingTriggerSiteOnline": "Site online", "alertingTriggerSiteOnline": "Site online",
"alertingTriggerSiteOffline": "Site offline", "alertingTriggerSiteOffline": "Site offline",
"alertingTriggerSiteToggle": "Site toggled", "alertingTriggerSiteToggle": "Site status changes",
"alertingTriggerHcHealthy": "Health check healthy", "alertingTriggerHcHealthy": "Health check healthy",
"alertingTriggerHcUnhealthy": "Health check unhealthy", "alertingTriggerHcUnhealthy": "Health check unhealthy",
"alertingTriggerHcToggle": "Health check toggled", "alertingTriggerHcToggle": "Health check status changes",
"alertingTriggerResourceHealthy": "Resource healthy", "alertingTriggerResourceHealthy": "Resource healthy",
"alertingTriggerResourceUnhealthy": "Resource unhealthy", "alertingTriggerResourceUnhealthy": "Resource unhealthy",
"alertingTriggerResourceToggle": "Resource toggled", "alertingSearchHealthChecks": "Search health checks…",
"alertingHealthChecksEmpty": "No health checks available.",
"alertingTriggerResourceToggle": "Resource status changes",
"alertingSourceResource": "Resource", "alertingSourceResource": "Resource",
"alertingSectionActions": "Actions", "alertingSectionActions": "Actions",
"alertingAddAction": "Add action", "alertingAddAction": "Add action",

View File

@@ -73,13 +73,13 @@ function buildSubject(context: AlertContext): string {
case "site_offline": case "site_offline":
return "[Alert] Site Offline"; return "[Alert] Site Offline";
case "site_toggle": case "site_toggle":
return "[Alert] Site Toggled"; return "[Alert] Site Status Changed";
case "health_check_healthy": case "health_check_healthy":
return "[Alert] Health Check Recovered"; return "[Alert] Health Check Recovered";
case "health_check_unhealthy": case "health_check_unhealthy":
return "[Alert] Health Check Failing"; return "[Alert] Health Check Failing";
case "health_check_toggle": case "health_check_toggle":
return "[Alert] Health Check Toggled"; return "[Alert] Health Check Status Changed";
case "resource_healthy": case "resource_healthy":
return "[Alert] Resource Healthy"; return "[Alert] Resource Healthy";
case "resource_unhealthy": case "resource_unhealthy":

View File

@@ -978,7 +978,7 @@ export function AlertRuleSourceFields({
curTrigger !== "site_offline" && curTrigger !== "site_offline" &&
curTrigger !== "site_toggle" curTrigger !== "site_toggle"
) { ) {
setValue("trigger", "site_offline", { setValue("trigger", "site_toggle", {
shouldValidate: true shouldValidate: true
}); });
} }
@@ -990,7 +990,7 @@ export function AlertRuleSourceFields({
) { ) {
setValue( setValue(
"trigger", "trigger",
"resource_unhealthy", "resource_toggle",
{ shouldValidate: true } { shouldValidate: true }
); );
} }
@@ -1001,7 +1001,7 @@ export function AlertRuleSourceFields({
) { ) {
setValue( setValue(
"trigger", "trigger",
"health_check_unhealthy", "health_check_toggle",
{ shouldValidate: true } { shouldValidate: true }
); );
} }
@@ -1110,39 +1110,39 @@ export function AlertRuleTriggerFields({
<SelectContent> <SelectContent>
{sourceType === "site" ? ( {sourceType === "site" ? (
<> <>
<SelectItem value="site_toggle">
{t("alertingTriggerSiteToggle")}
</SelectItem>
<SelectItem value="site_online"> <SelectItem value="site_online">
{t("alertingTriggerSiteOnline")} {t("alertingTriggerSiteOnline")}
</SelectItem> </SelectItem>
<SelectItem value="site_offline"> <SelectItem value="site_offline">
{t("alertingTriggerSiteOffline")} {t("alertingTriggerSiteOffline")}
</SelectItem> </SelectItem>
<SelectItem value="site_toggle">
{t("alertingTriggerSiteToggle")}
</SelectItem>
</> </>
) : sourceType === "resource" ? ( ) : sourceType === "resource" ? (
<> <>
<SelectItem value="resource_toggle">
{t("alertingTriggerResourceToggle")}
</SelectItem>
<SelectItem value="resource_healthy"> <SelectItem value="resource_healthy">
{t("alertingTriggerResourceHealthy")} {t("alertingTriggerResourceHealthy")}
</SelectItem> </SelectItem>
<SelectItem value="resource_unhealthy"> <SelectItem value="resource_unhealthy">
{t("alertingTriggerResourceUnhealthy")} {t("alertingTriggerResourceUnhealthy")}
</SelectItem> </SelectItem>
<SelectItem value="resource_toggle">
{t("alertingTriggerResourceToggle")}
</SelectItem>
</> </>
) : ( ) : (
<> <>
<SelectItem value="health_check_toggle">
{t("alertingTriggerHcToggle")}
</SelectItem>
<SelectItem value="health_check_healthy"> <SelectItem value="health_check_healthy">
{t("alertingTriggerHcHealthy")} {t("alertingTriggerHcHealthy")}
</SelectItem> </SelectItem>
<SelectItem value="health_check_unhealthy"> <SelectItem value="health_check_unhealthy">
{t("alertingTriggerHcUnhealthy")} {t("alertingTriggerHcUnhealthy")}
</SelectItem> </SelectItem>
<SelectItem value="health_check_toggle">
{t("alertingTriggerHcToggle")}
</SelectItem>
</> </>
)} )}
</SelectContent> </SelectContent>

View File

@@ -354,7 +354,7 @@ export default function AlertRuleGraphEditor({
useWatch({ control: form.control, name: "resourceIds" }) ?? []; useWatch({ control: form.control, name: "resourceIds" }) ?? [];
const wTrigger = const wTrigger =
useWatch({ control: form.control, name: "trigger" }) ?? useWatch({ control: form.control, name: "trigger" }) ??
"site_offline"; "site_toggle";
const wActions = const wActions =
useWatch({ control: form.control, name: "actions" }) ?? []; useWatch({ control: form.control, name: "actions" }) ?? [];

View File

@@ -298,7 +298,7 @@ export function defaultFormValues(): AlertRuleFormValues {
siteIds: [], siteIds: [],
healthCheckIds: [], healthCheckIds: [],
resourceIds: [], resourceIds: [],
trigger: "site_offline", trigger: "site_toggle",
actions: [ actions: [
{ {
type: "notify", type: "notify",