import { CheckOutlined, ClockCircleOutlined, DashboardOutlined, DeleteOutlined, DownOutlined, LockOutlined, SafetyOutlined, UpOutlined } from "@ant-design/icons"; import { Card, Chip, Stack, Tooltip } from "@mui/material"; import { useState } from "react"; import { useTheme } from '@mui/material/styles'; let routeImages = { "SERVAPP": { label: "ServApp", icon: "🐳", backgroundColor: "#0db7ed", color: "white", colorDark: "black", }, "STATIC": { label: "Static", icon: "📁", backgroundColor: "#f9d71c", color: "black", colorDark: "black", }, "REDIRECT": { label: "Redir", icon: "🔀", backgroundColor: "#2c3e50", color: "white", colorDark: "white", }, "PROXY": { label: "Proxy", icon: "🔗", backgroundColor: "#2ecc71", color: "white", colorDark: "black", }, "SPA": { label: "SPA", icon: "🌐", backgroundColor: "#e74c3c", color: "white", colorDark: "black", }, } export const RouteMode = ({route}) => { const theme = useTheme(); const isDark = theme.palette.mode === 'dark'; let c = routeImages[route.Mode.toUpperCase()]; return c ? <> {c.icon}} label={c.label} sx={{ backgroundColor: c.backgroundColor, color: isDark ? c.colorDark : c.color, paddingLeft: "5px", alignItems: "right", }} > : <>; } export const RouteSecurity = ({route}) => { return
{route.SmartShield && route.SmartShield.Enabled ? : }
 
{route.AuthEnabled ? : }
 
{route.ThrottlePerMinute ? : }
 
{route.Timeout ? : }
} export const RouteActions = ({route, routeKey, up, down, deleteRoute}) => { const [confirmDelete, setConfirmDelete] = useState(false); const theme = useTheme(); const isDark = theme.palette.mode === 'dark'; const miniChip = { width: '30px', height: '20px', display: 'inline-block', textAlign: 'center', cursor: 'pointer', color: theme.palette.text.secondary, fontSize: '12px', lineHeight: '20px', padding: '0px', borderRadius: '0px', background: isDark ? 'rgba(255, 255, 255, 0.03)' : '', fontWeight: 'bold', '&:hover': { backgroundColor: 'rgba(0, 0, 0, 0.04)', } } return <> {!confirmDelete && (} onClick={() => setConfirmDelete(true)}/>)} {confirmDelete && (} color="error" onClick={(event) => deleteRoute(event)}/>)} up(event)}> {routeKey} down(event)}> ; }