From 1c699fe307ef349c91855a7d25d27491fbdc85c0 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 4 Dec 2025 14:30:41 +0800 Subject: [PATCH] chore: tidy code --- .../components/pool-form.tsx | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/pages/cluster-management/components/pool-form.tsx b/src/pages/cluster-management/components/pool-form.tsx index 578c2664..ecf5cd40 100644 --- a/src/pages/cluster-management/components/pool-form.tsx +++ b/src/pages/cluster-management/components/pool-form.tsx @@ -250,32 +250,21 @@ const PoolForm: React.FC = forwardRef((props, ref) => { }; const handleInstanceTypeChange = (value: string, option: any) => { - setInstanceSpec({ + const newInstanceSpec = { ...option.specInfo, label: option.label, vendor: option.vendor, description: option.description, count: option.count - }); + }; + setInstanceSpec({ ...newInstanceSpec }); - const newImageList = updateImageList({ - ...option.specInfo, - label: option.label, - vendor: option.vendor, - description: option.description, - count: option.count - }); + const newImageList = updateImageList({ ...newInstanceSpec }); form.setFieldsValue({ os_image: newImageList[0]?.os_image, image_name: newImageList[0]?.value, - instance_spec: { - ...option.specInfo, - label: option.label, - vendor: option.vendor, - description: option.description, - count: option.count - } + instance_spec: { ...newInstanceSpec } }); };