mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-05 03:12:14 +00:00
fix(jira): fix connection check timeout (#12742)
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
This commit is contained in:
co-authored by
alejandrobailo
parent
8bdb597921
commit
1edcf6e5de
@@ -0,0 +1,42 @@
|
||||
"use client";
|
||||
|
||||
import { revalidateIntegrationConnectionPages } from "@/actions/integrations";
|
||||
import { toast } from "@/components/shadcn/toast";
|
||||
import { evaluateIntegrationConnectionTask } from "@/lib/integrations/test-connection-result";
|
||||
import type { TaskKindHandler } from "@/store/task-watcher/store";
|
||||
import type { IntegrationConnectionTaskResult } from "@/types/integrations";
|
||||
|
||||
const refreshIntegrationPages = (): void => {
|
||||
void revalidateIntegrationConnectionPages().catch(() => undefined);
|
||||
};
|
||||
|
||||
export const integrationConnectionTaskHandler: TaskKindHandler = {
|
||||
onReady: (task) => {
|
||||
refreshIntegrationPages();
|
||||
const result = evaluateIntegrationConnectionTask(
|
||||
task.result as IntegrationConnectionTaskResult | undefined,
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
toast({
|
||||
title: "Connection test successful!",
|
||||
description: result.message,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Connection test failed",
|
||||
description: result.error,
|
||||
});
|
||||
},
|
||||
onError: (task) => {
|
||||
refreshIntegrationPages();
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Connection test failed",
|
||||
description: task.error || "The connection test failed unexpectedly.",
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user