diff --git a/src/client/pages/Servers.tsx b/src/client/pages/Servers.tsx index 4fa46a8..900e5f1 100644 --- a/src/client/pages/Servers.tsx +++ b/src/client/pages/Servers.tsx @@ -1,11 +1,13 @@ -import React, { useEffect, useMemo, useReducer, useRef, useState } from 'react'; +import React, { useMemo, useRef, useState } from 'react'; import { Badge, Button, + Divider, Empty, Form, Input, Modal, + Popconfirm, Steps, Switch, Table, @@ -28,15 +30,31 @@ import { Loading } from '../components/Loading'; import { without } from 'lodash-es'; import { useIntervalUpdate } from '../hooks/useIntervalUpdate'; import clsx from 'clsx'; +import { isServerOnline } from '../../shared'; +import { defaultErrorHandler, trpc } from '../api/trpc'; +import { useEvent } from '../hooks/useEvent'; +import { useRequest } from '../hooks/useRequest'; export const Servers: React.FC = React.memo(() => { const [isModalOpen, setIsModalOpen] = useState(false); const [hideOfflineServer, setHideOfflineServer] = useState(false); + const workspaceId = useCurrentWorkspaceId(); const handleOk = () => { setIsModalOpen(false); }; + const clearOfflineNodeMutation = + trpc.serverStatus.clearOfflineServerStatus.useMutation({ + onError: defaultErrorHandler, + }); + + const [{ loading }, handleClearOfflineNode] = useRequest(async (e) => { + await clearOfflineNodeMutation.mutateAsync({ + workspaceId, + }); + }); + return (
@@ -50,6 +68,21 @@ export const Servers: React.FC = React.memo(() => { Hide Offline
+
+ + + +
+ + +