diff --git a/src/client/pages/Layout.tsx b/src/client/pages/Layout.tsx index d8cc97b..9e8f5b4 100644 --- a/src/client/pages/Layout.tsx +++ b/src/client/pages/Layout.tsx @@ -60,7 +60,7 @@ export const Layout: React.FC = React.memo(() => {
-
+
diff --git a/src/client/pages/Monitor.tsx b/src/client/pages/Monitor.tsx index f275708..273689f 100644 --- a/src/client/pages/Monitor.tsx +++ b/src/client/pages/Monitor.tsx @@ -1,9 +1,11 @@ -import { Tag } from 'antd'; import clsx from 'clsx'; import React from 'react'; +import { RouterOutput, trpc } from '../api/trpc'; import { HealthBar } from '../components/HealthBar'; +import { useEvent } from '../hooks/useEvent'; +import { useCurrentWorkspaceId } from '../store/user'; -interface MonitorInfo { +interface MonitorHeartbeatInfo { name: string; dayOnlineRate: number; monthOnlineRate: number; @@ -28,23 +30,46 @@ const demoMonitors = [ ]; export const Monitor: React.FC = React.memo(() => { + const currentWorkspaceId = useCurrentWorkspaceId()!; + const { data: monitors = [] } = trpc.monitor.all.useQuery({ + workspaceId: currentWorkspaceId, + }); + + const handleCreateMonitor = useEvent(() => { + // TODO + }); + return ( -
-
- +
+
+
+
+ Add new Montior +
+
+
+
+
+ +
+
Info
-
InfoInfo
); }); Monitor.displayName = 'Monitor'; -const MonitorList: React.FC = React.memo(() => { +const MonitorList: React.FC<{ + monitors: RouterOutput['monitor']['all']; +}> = React.memo((props) => { const selectedMonitorName = 'Tianji1'; return (
- {demoMonitors.map((monitor) => ( + {props.monitors.map((monitor) => (
{ 'bg-green-400 min-w-[62px] p-0.5 rounded-full text-white inline-block text-center' } > - {monitor.monthOnlineRate * 100}% + {/* {monitor.monthOnlineRate * 100}% */} + 80%
{monitor.name}
-
+ {/*
{monitor.tags.map((tag) => ( { {tag.label} ))} -
+
*/}