mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-16 01:09:40 +02:00
✨ send webhook action
This commit is contained in:
@@ -180,8 +180,9 @@ export default function AlertRuleGraphEditor({
|
||||
|
||||
const testAlert = async () => {
|
||||
const isValid = await form.trigger();
|
||||
const values = form.getValues();
|
||||
|
||||
if (!isValid) {
|
||||
const values = form.getValues();
|
||||
if (values.actions.length === 0) {
|
||||
toast({
|
||||
variant: "warning",
|
||||
@@ -193,27 +194,14 @@ export default function AlertRuleGraphEditor({
|
||||
return;
|
||||
}
|
||||
|
||||
const values = form.getValues();
|
||||
try {
|
||||
const payload = formValuesToApiPayload(values);
|
||||
if (isNew) {
|
||||
const res = await api.post<
|
||||
AxiosResponse<CreateAlertRuleResponse>
|
||||
>(`/org/${orgId}/test-alert-rule`, payload);
|
||||
toast({
|
||||
title: t("alertingTestAlertSent"),
|
||||
description: t("alertingTestAlertSentDescription")
|
||||
});
|
||||
} else {
|
||||
await api.post(
|
||||
`/org/${orgId}/alert-rule/${alertRuleId}`,
|
||||
payload
|
||||
);
|
||||
toast({
|
||||
title: t("alertingTestAlertSent"),
|
||||
description: t("alertingTestAlertSentDescription")
|
||||
});
|
||||
}
|
||||
await api.post(`/org/${orgId}/test-alert-rule`, payload);
|
||||
|
||||
toast({
|
||||
title: t("alertingTestAlertSent"),
|
||||
description: t("alertingTestAlertSentDescription")
|
||||
});
|
||||
} catch (e) {
|
||||
toast({
|
||||
title: t("error"),
|
||||
|
||||
+1
-1
@@ -1371,7 +1371,7 @@ export const approvalQueries = {
|
||||
},
|
||||
refetchInterval: (query) => {
|
||||
if (query.state.data) {
|
||||
return durationToMs(30, "seconds");
|
||||
return durationToMs(1.5, "minutes");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user