mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
feat(notification): add option to convert metric units in request body (#147)
* feat(notification): add option to convert metric units in request body * rename fields * add prettierignore * chore: auto-fix linting and formatting issues
This commit is contained in:
@@ -57,6 +57,7 @@ const notificationFormSchema = z.object({
|
||||
request_body: z.string(),
|
||||
verify_tls: asOptionalField(z.boolean()),
|
||||
skip_check: asOptionalField(z.boolean()),
|
||||
format_metric_units: asOptionalField(z.boolean()),
|
||||
})
|
||||
|
||||
export const NotifierCard: React.FC<NotifierCardProps> = ({ data, mutate }) => {
|
||||
@@ -75,6 +76,7 @@ export const NotifierCard: React.FC<NotifierCardProps> = ({ data, mutate }) => {
|
||||
request_body: data.request_body ?? "",
|
||||
verify_tls: (data as any).verify_tls ?? false,
|
||||
skip_check: (data as any).skip_check ?? false,
|
||||
format_metric_units: (data as any).format_body ?? false,
|
||||
}
|
||||
: {
|
||||
name: "",
|
||||
@@ -85,6 +87,7 @@ export const NotifierCard: React.FC<NotifierCardProps> = ({ data, mutate }) => {
|
||||
request_body: "",
|
||||
verify_tls: false,
|
||||
skip_check: false,
|
||||
format_body: false,
|
||||
},
|
||||
resetOptions: {
|
||||
keepDefaultValues: false,
|
||||
@@ -283,6 +286,26 @@ export const NotifierCard: React.FC<NotifierCardProps> = ({ data, mutate }) => {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="format_metric_units"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex items-center space-x-2">
|
||||
<FormControl>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={field.value}
|
||||
onCheckedChange={field.onChange}
|
||||
/>
|
||||
<Label className="text-sm">
|
||||
{t("FormatMetricUnits")}
|
||||
</Label>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<DialogFooter className="justify-end">
|
||||
<DialogClose asChild>
|
||||
<Button type="button" className="my-2" variant="secondary">
|
||||
|
||||
Reference in New Issue
Block a user