Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import type { IntegrationStatus } from "@/types/appops";
|
||||
|
||||
export type IntegrationFlowState = "healthy" | "warning" | "critical" | "stopped" | "loading" | "unknown";
|
||||
|
||||
export interface IntegrationRuntimeStates {
|
||||
mcp: IntegrationFlowState;
|
||||
rag: IntegrationFlowState;
|
||||
n8n: IntegrationFlowState;
|
||||
executionBoundary: IntegrationFlowState;
|
||||
}
|
||||
|
||||
export const getIntegrationRuntimeStates = (
|
||||
status: IntegrationStatus | undefined,
|
||||
loading: boolean,
|
||||
unavailable: boolean,
|
||||
): IntegrationRuntimeStates => {
|
||||
if (unavailable) {
|
||||
return { mcp: "unknown", rag: "unknown", n8n: "unknown", executionBoundary: "unknown" };
|
||||
}
|
||||
if (loading || !status) {
|
||||
return { mcp: "loading", rag: "loading", n8n: "loading", executionBoundary: "loading" };
|
||||
}
|
||||
|
||||
const mcp: IntegrationFlowState = !status.mcp.enabled
|
||||
? "stopped"
|
||||
: status.mcp.authenticated && status.mcp.state === "listening"
|
||||
? "healthy"
|
||||
: "warning";
|
||||
|
||||
const rag: IntegrationFlowState = status.rag.secretsIndexed
|
||||
? "critical"
|
||||
: status.rag.status === "ready" && status.rag.secretScanStatus?.startsWith("passed")
|
||||
? "healthy"
|
||||
: "warning";
|
||||
|
||||
const n8n: IntegrationFlowState = status.n8n.canExecute
|
||||
? "critical"
|
||||
: !status.n8n.enabled
|
||||
? "stopped"
|
||||
: status.n8n.authenticated && status.n8n.state === "reachable"
|
||||
? "healthy"
|
||||
: "warning";
|
||||
|
||||
const executionBoundary: IntegrationFlowState = status.n8n.canExecute === true
|
||||
? "critical"
|
||||
: status.n8n.canExecute === false
|
||||
? "healthy"
|
||||
: "unknown";
|
||||
|
||||
return { mcp, rag, n8n, executionBoundary };
|
||||
};
|
||||
|
||||
export const integrationFlowStateLabel: Record<IntegrationFlowState, string> = {
|
||||
healthy: "geverifieerd",
|
||||
warning: "aandacht",
|
||||
critical: "kritiek",
|
||||
stopped: "uitgeschakeld",
|
||||
loading: "controleren",
|
||||
unknown: "onbekend",
|
||||
};
|
||||
Reference in new issue
Block a user