From 2964c3a2e3e97acf619ba8af750efb15f95c2408 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 17 Dec 2023 18:46:07 +0800 Subject: [PATCH] refactor: add monitor list --- .../components/monitor/MonitorPicker.tsx | 2 +- .../monitor/StatusPage/EditForm.tsx | 46 +++++++++++++++++++ .../components/monitor/StatusPage/index.tsx | 10 ++-- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/client/components/monitor/MonitorPicker.tsx b/src/client/components/monitor/MonitorPicker.tsx index 23b9b88..610be6e 100644 --- a/src/client/components/monitor/MonitorPicker.tsx +++ b/src/client/components/monitor/MonitorPicker.tsx @@ -13,7 +13,7 @@ export const MonitorPicker: React.FC = React.memo( }); return ( - {allMonitor.map((m) => ( diff --git a/src/client/components/monitor/StatusPage/EditForm.tsx b/src/client/components/monitor/StatusPage/EditForm.tsx index 1ff014c..11b0708 100644 --- a/src/client/components/monitor/StatusPage/EditForm.tsx +++ b/src/client/components/monitor/StatusPage/EditForm.tsx @@ -2,6 +2,8 @@ import { Button, Form, Input, Typography } from 'antd'; import React from 'react'; import { slugRegex } from '../../../../shared'; import { z } from 'zod'; +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import { MonitorPicker } from '../MonitorPicker'; const { Text } = Typography; @@ -26,6 +28,7 @@ export const MonitorStatusPageEditForm: React.FC layout="vertical" initialValues={props.initialValues} onFinish={props.onFinish} + onValuesChange={console.log} > + + {(fields, { add, remove }, { errors }) => { + return ( + <> + + {fields.map((field, index) => ( +
+ + + + + remove(field.name)} + /> +
+ ))} + + + + +
+ + ); + }} +
+
-
- {allowEdit && !editMode && ( + {allowEdit && !editMode && ( +
- )} -
+
+ )}
Services
{info && ( -
+
{monitorList.length > 0 ? ( monitorList.map((item) => (