|
|
|
@ -3,7 +3,7 @@ import { Modal, Form, Select, Grid, Slider, Switch, Input, Message } from '@arco
|
|
|
|
import EditableTable from '@/components/EditableTable';
|
|
|
|
import EditableTable from '@/components/EditableTable';
|
|
|
|
import { getComponentClassify } from '@/api/componentClassify';
|
|
|
|
import { getComponentClassify } from '@/api/componentClassify';
|
|
|
|
import { getHostList } from '@/api/componentDeployEnv';
|
|
|
|
import { getHostList } from '@/api/componentDeployEnv';
|
|
|
|
import { createInstance } from '@/api/componentInstance';
|
|
|
|
import { createInstance, localStart } from '@/api/componentInstance';
|
|
|
|
|
|
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
|
|
const FormItem = Form.Item;
|
|
|
|
const Option = Select.Option;
|
|
|
|
const Option = Select.Option;
|
|
|
|
@ -121,13 +121,6 @@ const AddModal = ({ addItem, visible, setVisible, onSuccess }) => {
|
|
|
|
|
|
|
|
|
|
|
|
// 处理确认
|
|
|
|
// 处理确认
|
|
|
|
const handleOk = async () => {
|
|
|
|
const handleOk = async () => {
|
|
|
|
if (currentRunType === 'local') {
|
|
|
|
|
|
|
|
// TODO: 本地运行逻辑,由用户自己实现
|
|
|
|
|
|
|
|
Message.info('本地运行逻辑待实现');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 线上运行 - 校验表单
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
setLoading(true);
|
|
|
|
setLoading(true);
|
|
|
|
const values = await form.validate();
|
|
|
|
const values = await form.validate();
|
|
|
|
@ -138,7 +131,12 @@ const AddModal = ({ addItem, visible, setVisible, onSuccess }) => {
|
|
|
|
componentBaseId: addItem.componentBaseId
|
|
|
|
componentBaseId: addItem.componentBaseId
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const res: any = await createInstance(params);
|
|
|
|
const apiMap = {
|
|
|
|
|
|
|
|
'local': localStart, // 本地运行
|
|
|
|
|
|
|
|
'online': createInstance // 线上运行
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res: any = await apiMap[currentRunType](params);
|
|
|
|
|
|
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
if (res.code === 200) {
|
|
|
|
Message.success('新增实例成功');
|
|
|
|
Message.success('新增实例成功');
|
|
|
|
@ -147,7 +145,8 @@ const AddModal = ({ addItem, visible, setVisible, onSuccess }) => {
|
|
|
|
if (onSuccess) {
|
|
|
|
if (onSuccess) {
|
|
|
|
onSuccess();
|
|
|
|
onSuccess();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
Message.error(res.msg || '新增实例失败');
|
|
|
|
Message.error(res.msg || '新增实例失败');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
|