import { defaultErrorHandler, trpc } from '@/api/trpc'; import { CommonHeader } from '@/components/CommonHeader'; import { CommonList } from '@/components/CommonList'; import { CommonWrapper } from '@/components/CommonWrapper'; import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { Button } from '@/components/ui/button'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Switch } from '@/components/ui/switch'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { useEventWithLoading } from '@/hooks/useEvent'; import { LayoutV2 } from '@/pages/LayoutV2'; import { AddServerStep, InstallScript, ServerList } from '@/pages/Servers'; import { useCurrentWorkspaceId } from '@/store/user'; import { routeAuthBeforeLoad } from '@/utils/route'; import { useTranslation } from '@i18next-toolkit/react'; import { createFileRoute } from '@tanstack/react-router'; import { Popconfirm } from 'antd'; import React from 'react'; import { useState } from 'react'; import { LuPlus } from 'react-icons/lu'; export const Route = createFileRoute('/server')({ beforeLoad: routeAuthBeforeLoad, component: ServerComponent, }); function ServerComponent() { return ( ); } export const ServerContent: React.FC = React.memo(() => { const [hideOfflineServer, setHideOfflineServer] = useState(false); const { t } = useTranslation(); const workspaceId = useCurrentWorkspaceId(); const clearOfflineNodeMutation = trpc.serverStatus.clearOfflineServerStatus.useMutation({ onError: defaultErrorHandler, }); const [handleClearOfflineNode, loading] = useEventWithLoading(async (e) => { await clearOfflineNodeMutation.mutateAsync({ workspaceId, }); }); return ( {t('Hide Offline')}
{t('Auto')} {t('Manual')}
{t('Continue')}
} /> } >
); }); ServerContent.displayName = 'ServerContent';