"use client"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { MessageSquare, GitGraph, ExternalLink, RefreshCw, Bell } from "lucide-react"; import { useEffect, useState } from "react"; import { api } from "@/lib/api"; const IntegrationsPage = () => { const [loading, setLoading] = useState(false); const [lastSync, setLastSync] = useState("Never"); const [isHealthy, setIsHealthy] = useState(false); const syncIntegrations = async () => { setLoading(true); try { const [health] = await Promise.all([ api.getHealth(), api.getDashboard(), ]); setIsHealthy(Boolean(health?.environment_ready)); setLastSync(new Date().toLocaleTimeString()); } catch (error) { console.error("Failed to sync integration status:", error); setIsHealthy(false); setLastSync("Sync failed"); } finally { setLoading(false); } }; useEffect(() => { const initialSync = setTimeout(() => { void syncIntegrations(); }, 0); return () => clearTimeout(initialSync); }, []); const integrations = [ { id: "slack", name: "Slack", description: "Automated rollout notifications and approval workflows.", icon: MessageSquare, status: isHealthy ? "connected" : "disconnected", details: isHealthy ? "Alerts can be routed through backend automation" : "Backend unavailable", lastSync }, { id: "github", name: "GitHub", description: "Trigger rollouts from PRs and sync deployment status.", icon: GitGraph, status: "disconnected", details: "Requires OAuth", lastSync } ]; return (
Manage external connections and observability sync.
Uses live backend monitoring routes for alert ingestion and observability polling.