Frontend: - Replace Tailwind CSS with ChakraUI v3 (react, recharts, fontsource) - 24 themes (12 Dune factions x day/night variants) - Collapsible sidebar navigation with 6 groups - Recharts AreaChart/PieChart for CPU/RAM/metrics - New Experimental page (ports legacy admin_experimental.html) - Common components: DataTable, Modal, Badge, Toaster Backend: - Fix services to use direct SQL (dune.* schema) instead of stored procedures - PlayerService, EconomyService, GuildService, WorldService rewritten - Auto-login for SPA development in factory.py - Fix settings.yaml path resolution Launcher: - Add option [7] Start New Dashboard in launcher.ps1 and start.sh - Auto-installs pip + npm dependencies - Sets up SSH tunnels + kubectl port-forwards - Starts backend API + frontend Vite dev server Security: - Sanitize hardcoded RMQ password in config.py - Add frontend/dist/ to .gitignore
71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
import { Box, Flex, Text, Tooltip, VStack, Circle } from '@chakra-ui/react'
|
|
import { FiWifi, FiWifiOff } from 'react-icons/fi'
|
|
import { useApp } from '../../stores/AppContext'
|
|
|
|
const SERVICES = [
|
|
{ key: 'database' as const, label: 'Database' },
|
|
{ key: 'ssh' as const, label: 'SSH Tunnel' },
|
|
{ key: 'bgd' as const, label: 'BG Director' },
|
|
{ key: 'rmq' as const, label: 'RMQ' },
|
|
]
|
|
|
|
export default function ConnectionBadge() {
|
|
const { state } = useApp()
|
|
const statuses = SERVICES.map((s) => state.connectionStatus[s.key])
|
|
const upCount = statuses.filter(Boolean).length
|
|
const allUp = upCount === statuses.length
|
|
const allDown = upCount === 0
|
|
|
|
const dotColor = allUp ? 'success.DEFAULT' : allDown ? 'danger.DEFAULT' : 'warning.DEFAULT'
|
|
|
|
return (
|
|
<Tooltip.Root>
|
|
<Tooltip.Trigger asChild>
|
|
<Flex
|
|
align="center"
|
|
gap={1.5}
|
|
px={2.5}
|
|
py={1}
|
|
borderRadius="full"
|
|
bg="bg.subtle"
|
|
border="1px solid"
|
|
borderColor="border.subtle"
|
|
cursor="default"
|
|
>
|
|
{allUp ? (
|
|
<FiWifi size={14} color="currentColor" />
|
|
) : (
|
|
<FiWifiOff size={14} color="currentColor" />
|
|
)}
|
|
<Circle size="6px" bg={dotColor} />
|
|
</Flex>
|
|
</Tooltip.Trigger>
|
|
<Tooltip.Positioner>
|
|
<Tooltip.Content bg="card.bg" border="1px solid" borderColor="border" borderRadius="md" p={3}>
|
|
<VStack align="stretch" gap={2} minW="160px">
|
|
<Text fontSize="xs" fontWeight="semibold" color="fg" mb={1}>
|
|
Service Status
|
|
</Text>
|
|
{SERVICES.map((s) => (
|
|
<Flex key={s.key} justify="space-between" align="center" gap={4}>
|
|
<Text fontSize="xs" color="fg.muted">
|
|
{s.label}
|
|
</Text>
|
|
<Flex align="center" gap={1.5}>
|
|
<Circle
|
|
size="6px"
|
|
bg={state.connectionStatus[s.key] ? 'success.DEFAULT' : 'danger.DEFAULT'}
|
|
/>
|
|
<Text fontSize="2xs" color="fg.muted">
|
|
{state.connectionStatus[s.key] ? 'OK' : 'DOWN'}
|
|
</Text>
|
|
</Flex>
|
|
</Flex>
|
|
))}
|
|
</VStack>
|
|
</Tooltip.Content>
|
|
</Tooltip.Positioner>
|
|
</Tooltip.Root>
|
|
)
|
|
}
|