fix: set default os image

This commit is contained in:
jialin
2025-12-04 10:48:34 +08:00
parent f87989d32e
commit f0a3e84e4f
@@ -266,18 +266,9 @@ const PoolForm: React.FC<AddModalProps> = forwardRef((props, ref) => {
count: option.count
});
// if current os_image is not in new image list, clear the os_image field
const currentOsImage = form.getFieldValue('os_image');
const isCurrentOsImageValid = newImageList.some(
(item) => item.os_image === currentOsImage
);
if (!isCurrentOsImageValid) {
form.setFieldsValue({
os_image: undefined,
image_name: undefined
});
}
form.setFieldsValue({
os_image: newImageList[0]?.os_image,
image_name: newImageList[0]?.value,
instance_spec: {
...option.specInfo,
label: option.label,