feat: Add error_message placeholder for uptime notifications
- Add support for the `${error_message}` placeholder in uptime service notifications
This commit is contained in:
@@ -221,6 +221,23 @@ export const PlaceholdersTabContent: React.FC<PlaceholdersTabContentProps> = ({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={control}
|
||||
name="error_message_placeholder"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Error Message Placeholder</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="${error_message}" {...field} />
|
||||
</FormControl>
|
||||
<FormDescription className="text-xs">
|
||||
Used for error details when service is down
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -283,6 +300,10 @@ export const PlaceholdersTabContent: React.FC<PlaceholdersTabContentProps> = ({
|
||||
<code className="text-xs">${"{time}"}</code>
|
||||
<p className="text-xs text-muted-foreground mt-1">Current date and time</p>
|
||||
</div>
|
||||
<div className="bg-muted/30 p-2 rounded">
|
||||
<code className="text-xs">${"{error_message}"}</code>
|
||||
<p className="text-xs text-muted-foreground mt-1">Error details when service is down</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
@@ -56,6 +56,7 @@ export function processTemplate(
|
||||
.replace(/\${region_name}/g, service.region_name || service.RegionName || 'Default')
|
||||
.replace(/\${agent_id}/g, service.agent_id ? service.agent_id.toString() : (service.AgentID ? service.AgentID.toString() : '1'))
|
||||
.replace(/\${uptime}/g, service.uptime ? `${service.uptime}%` : (service.Uptime ? `${service.Uptime}%` : 'N/A'))
|
||||
.replace(/\${error_message}/g, service.error_message || service.ErrorMessage || service.error || '')
|
||||
.replace(/\${time}/g, new Date().toLocaleString());
|
||||
|
||||
return message;
|
||||
|
||||
Reference in New Issue
Block a user