import React, { useState, useEffect } from 'react'
import {
Box,
Container,
AppBar,
Toolbar,
Typography,
Tabs,
Tab,
Card,
CardContent,
Grid,
Alert as MuiAlert,
CircularProgress,
} from '@mui/material'
import { HealthDashboard } from './components/HealthDashboard'
import { AlertsList } from './components/AlertsList'
import { CreateAlert } from './components/CreateAlert'
import { IncidentsList } from './components/IncidentsList'
interface TabPanelProps {
children?: React.ReactNode
index: number
value: number
}
function TabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props
return (
{value === index && {children}}
)
}
function App() {
const [currentTab, setCurrentTab] = useState(0)
const [isLoading, setIsLoading] = useState(true)
const [error, setError] = useState(null)
useEffect(() => {
// Check if API is available
const checkApi = async () => {
try {
const response = await fetch('http://localhost:8001/api/v1/health')
if (!response.ok) {
setError('Backend API is not responding. Make sure Docker services are running.')
}
setIsLoading(false)
} catch (err) {
setError('Cannot connect to backend API at http://localhost:8001')
setIsLoading(false)
}
}
checkApi()
}, [])
const handleTabChange = (event: React.SyntheticEvent, newValue: number) => {
setCurrentTab(newValue)
}
if (isLoading) {
return (
)
}
return (
{/* App Bar */}
🚨 Autonomous Incident Management System
v0.1.0
{/* Main Content */}
{error && (
{error}
)}
{/* Tabs */}
{/* Tab Panels */}
💡 Quick Tips
- Source: Alert origin (prometheus, datadog, etc.)
- Severity: CRITICAL, HIGH, MEDIUM, LOW, INFO
- Multiple services can be affected
- Tags help organize and filter alerts
- Metadata stores custom alert data
{/* Footer */}
Backend: http://localhost:8001 | API Docs: http://localhost:8001/docs
)
}
export default App