Skip to content

Commit

Permalink
fix: fix project service form error (#863) (#870)
Browse files Browse the repository at this point in the history
Co-authored-by: zxj <782803291@qq.com>
  • Loading branch information
erda-bot and laojun authored Aug 5, 2021
1 parent b1864c0 commit c6cb386
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AddonModal extends React.PureComponent<IProps, IState> {
// const kvTableData = pickBy(form2Rest, (v, k) => k.startsWith('_tb_'));
// const kvTextData = form2Rest['kv-text'];
if (isCustom) {
const configs = this.edit.current.getEditData();
const configs = this.edit.current?.getEditData();
if (isEmpty(configs)) {
message.warn(i18n.t('parameter cannot be empty'));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ const InstanceForm = ({ form, editData, addonProto, workspace, edit, category }:
const { addonName } = addonProto;
const isEditMode = !isEmpty(editData);
React.useEffect(() => {
let _mode = MODE_MAP.EXIST;
if (addonName && !CLOUD_TYPES.includes(addonName)) {
// 类型不为云Addon时时,只能填自定义变量
updater.mode(MODE_MAP.CUSTOM);
_mode = MODE_MAP.CUSTOM;
} else if ([AddonType.AliCloudOss, AddonType.AliCloudRedis].includes(addonName)) {
// oss和redis默认为新购买
updater.mode(MODE_MAP.NEW);
_mode = MODE_MAP.NEW;
}
}, [addonName, updater]);
updater.mode(_mode);
form.setFieldsValue({ mode: _mode });
}, [addonName, updater, form]);

React.useEffect(() => {
const curMode = editData && editData.customAddonType;
Expand Down Expand Up @@ -211,6 +214,7 @@ const InstanceForm = ({ form, editData, addonProto, workspace, edit, category }:

const FCForm = forwardRef((props: IProps, ref: any) => {
const [form] = Form.useForm();

useImperativeHandle(ref, () => ({
form,
}));
Expand Down

0 comments on commit c6cb386

Please sign in to comment.