|
|
@ -4,6 +4,7 @@ import {
|
|
|
|
ModalForm,
|
|
|
|
ModalForm,
|
|
|
|
ProForm,
|
|
|
|
ProForm,
|
|
|
|
ProFormDependency,
|
|
|
|
ProFormDependency,
|
|
|
|
|
|
|
|
ProFormTextArea,
|
|
|
|
ProFormSelect,
|
|
|
|
ProFormSelect,
|
|
|
|
ProFormText,
|
|
|
|
ProFormText,
|
|
|
|
} from '@ant-design/pro-components';
|
|
|
|
} from '@ant-design/pro-components';
|
|
|
@ -53,12 +54,12 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isValidIPv4(form.getFieldValue('IP'))) {
|
|
|
|
if (!isValidIPv4(form.getFieldValue('ip'))) {
|
|
|
|
message.warning('无效的服务器地址');
|
|
|
|
message.warning('无效的服务器地址');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isValidPort(form.getFieldValue('IPPort'))) {
|
|
|
|
if (!isValidPort(form.getFieldValue('ipPort'))) {
|
|
|
|
message.warning('无效的端口');
|
|
|
|
message.warning('无效的端口');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -66,7 +67,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
|
|
|
|
|
|
|
|
setIsFlag(true);
|
|
|
|
setIsFlag(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const handleResponse = (data) => {
|
|
|
|
const handleResponse = (data: any) => {
|
|
|
|
console.log(data, 'handleResponse');
|
|
|
|
console.log(data, 'handleResponse');
|
|
|
|
// 对返回的数据进行处理
|
|
|
|
// 对返回的数据进行处理
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -74,15 +75,16 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
async function postCurrentIP() {
|
|
|
|
async function postCurrentIP() {
|
|
|
|
// http://192.168.10.96:5003/v2/_catalog
|
|
|
|
// http://192.168.10.96:5003/v2/_catalog
|
|
|
|
const resp = await axios.get(
|
|
|
|
const resp = await axios.get(
|
|
|
|
`http://${form.getFieldValue('IP')}:${form.getFieldValue('IPPort')}/v2/_catalog`,
|
|
|
|
`http://${form.getFieldValue('ip')}:${form.getFieldValue('ipPort')}/v2/_catalog`,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
console.log(resp, 'resp');
|
|
|
|
console.log(resp, 'resp');
|
|
|
|
return resp?.data;
|
|
|
|
return resp?.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function doChangeUseIPPort() {
|
|
|
|
async function doChangeUseipPort() {
|
|
|
|
|
|
|
|
form.setFieldValue('imageVersion', null)
|
|
|
|
const resp = await axios.get(
|
|
|
|
const resp = await axios.get(
|
|
|
|
`http://${form.getFieldValue('IP')}:${form.getFieldValue('IPPort')}/v2/${form.getFieldValue('useIPPort')}/tags/list`,
|
|
|
|
`http://${form.getFieldValue('ip')}:${form.getFieldValue('ipPort')}/v2/${form.getFieldValue('imageName')}/tags/list`,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
let finalData = resp?.data?.tags?.map((v: any) => {
|
|
|
|
let finalData = resp?.data?.tags?.map((v: any) => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -108,7 +110,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ModalForm<API.ModelImage>
|
|
|
|
<ModalForm<API.ModelImage & {imageName?: string, imageVersion?: string, ip?: string, ipPort?: string }>
|
|
|
|
width={proFormModelWidth}
|
|
|
|
width={proFormModelWidth}
|
|
|
|
title={intl.formatMessage({
|
|
|
|
title={intl.formatMessage({
|
|
|
|
id: 'resource.model_image.table.list.add',
|
|
|
|
id: 'resource.model_image.table.list.add',
|
|
|
@ -123,6 +125,9 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
submitTimeout={2000}
|
|
|
|
submitTimeout={2000}
|
|
|
|
onFinish={async (values) => {
|
|
|
|
onFinish={async (values) => {
|
|
|
|
|
|
|
|
console.log(4444, values)
|
|
|
|
|
|
|
|
// let imageId = `${values.ip}:${values.ipPort}/${values.imageName}:${values.imageVersion}`
|
|
|
|
|
|
|
|
// console.log(5555, imageId)
|
|
|
|
postModelImageCreateModelImage(values)
|
|
|
|
postModelImageCreateModelImage(values)
|
|
|
|
.then(() => {
|
|
|
|
.then(() => {
|
|
|
|
message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
|
|
|
|
message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
|
|
|
@ -162,40 +167,10 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<ProFormSelect
|
|
|
|
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
|
|
|
|
name="modelVersionFkId"
|
|
|
|
|
|
|
|
label={
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
|
|
|
id="resource.model_image.table.list.modelVersionFkId"
|
|
|
|
|
|
|
|
defaultMessage="$$$"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
placeholder={`${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'common.please_select',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'resource.model_image.table.list.modelVersionFkId',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
required={true}
|
|
|
|
|
|
|
|
showSearch
|
|
|
|
|
|
|
|
debounceTime={1000}
|
|
|
|
|
|
|
|
request={async (keyWord) => {
|
|
|
|
|
|
|
|
const resp = await postModelVersionGetModelVersionFkSelect({
|
|
|
|
|
|
|
|
keyword: keyWord?.keyWords || '',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return resp.data.list.map((v: any) => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
label: v.name,
|
|
|
|
|
|
|
|
value: v.id,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<ProFormText
|
|
|
|
<ProFormText
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
name="path"
|
|
|
|
name="path"
|
|
|
|
|
|
|
|
tooltip={'请在下方填入镜像服务器地址'}
|
|
|
|
label={
|
|
|
|
label={
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.path" defaultMessage="$$$" />
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.path" defaultMessage="$$$" />
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -206,37 +181,19 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
id: 'resource.model_image.table.list.path',
|
|
|
|
id: 'resource.model_image.table.list.path',
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
})}`}
|
|
|
|
})}`}
|
|
|
|
required={false}
|
|
|
|
required={true}
|
|
|
|
/>
|
|
|
|
disabled={true}
|
|
|
|
<ProFormText
|
|
|
|
rules={[
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
{
|
|
|
|
name="startCode"
|
|
|
|
required: true,
|
|
|
|
label={
|
|
|
|
message: (
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.startCode" defaultMessage="$$$" />
|
|
|
|
<FormattedMessage
|
|
|
|
}
|
|
|
|
id="resource.model_image.table.rule.required.path"
|
|
|
|
placeholder={`${intl.formatMessage({
|
|
|
|
defaultMessage="path is required"
|
|
|
|
id: 'common.please_input',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'resource.model_image.table.list.startCode',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
required={false}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<ProFormText
|
|
|
|
),
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
},
|
|
|
|
name="remark"
|
|
|
|
]}
|
|
|
|
label={
|
|
|
|
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.remark" defaultMessage="$$$" />
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
placeholder={`${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'common.please_input',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'resource.model_image.table.list.remark',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
required={false}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
{/*
|
|
|
|
{/*
|
|
|
@ -252,22 +209,24 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
<Space>
|
|
|
|
<Space>
|
|
|
|
<ProFormText
|
|
|
|
<ProFormText
|
|
|
|
width={180}
|
|
|
|
width={180}
|
|
|
|
name="IP"
|
|
|
|
name="ip"
|
|
|
|
label={'IP地址'}
|
|
|
|
label={'IP地址'}
|
|
|
|
|
|
|
|
initialValue={"192.168.10.60"}
|
|
|
|
placeholder={'请输入IP地址'}
|
|
|
|
placeholder={'请输入IP地址'}
|
|
|
|
required={false}
|
|
|
|
required={false}
|
|
|
|
onChange={() => {
|
|
|
|
fieldProps={{onChange: () => {
|
|
|
|
setIsFlag(false);
|
|
|
|
setIsFlag(false)}
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<ProFormText
|
|
|
|
<ProFormText
|
|
|
|
width={110}
|
|
|
|
width={110}
|
|
|
|
name="IPPort"
|
|
|
|
name="ipPort"
|
|
|
|
label={'端口号'}
|
|
|
|
label={'端口号'}
|
|
|
|
placeholder={'请输入端口号'}
|
|
|
|
placeholder={'请输入端口号'}
|
|
|
|
|
|
|
|
initialValue={"5000"}
|
|
|
|
required={false}
|
|
|
|
required={false}
|
|
|
|
onChange={() => {
|
|
|
|
fieldProps={{onChange: () => {
|
|
|
|
setIsFlag(false);
|
|
|
|
setIsFlag(false)}
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Button style={{ marginTop: 15 }} type="primary" onClick={() => doFindIPNext()}>
|
|
|
|
<Button style={{ marginTop: 15 }} type="primary" onClick={() => doFindIPNext()}>
|
|
|
@ -276,14 +235,14 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
</Space>
|
|
|
|
</Space>
|
|
|
|
{isFlag ? (
|
|
|
|
{isFlag ? (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<ProFormDependency name={['IP']}>
|
|
|
|
<ProFormDependency name={['ip']}>
|
|
|
|
{({ IP }) => {
|
|
|
|
{({ ip }) => {
|
|
|
|
if (IP) {
|
|
|
|
if (ip) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ProFormSelect
|
|
|
|
<ProFormSelect
|
|
|
|
width={175}
|
|
|
|
width={175}
|
|
|
|
name="useIPPort"
|
|
|
|
name="imageName"
|
|
|
|
label="选择1"
|
|
|
|
label="镜像名称"
|
|
|
|
debounceTime={1000}
|
|
|
|
debounceTime={1000}
|
|
|
|
request={async () => {
|
|
|
|
request={async () => {
|
|
|
|
const resp = await postCurrentIP();
|
|
|
|
const resp = await postCurrentIP();
|
|
|
@ -294,21 +253,25 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
onChange={() => doChangeUseIPPort()}
|
|
|
|
onChange={() => doChangeUseipPort()}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return <></>;
|
|
|
|
return <></>;
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
</ProFormDependency>
|
|
|
|
</ProFormDependency>
|
|
|
|
<ProFormDependency name={['useIPPort']}>
|
|
|
|
<ProFormDependency name={['imageName', 'ip', 'ipPort', 'imageName']}>
|
|
|
|
{({ useIPPort }) => {
|
|
|
|
{({ imageName, ip, ipPort }) => {
|
|
|
|
if (useIPPort) {
|
|
|
|
if (imageName) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ProFormSelect
|
|
|
|
<ProFormSelect
|
|
|
|
width={175}
|
|
|
|
width={175}
|
|
|
|
name="useMode2"
|
|
|
|
onChange={(value) =>{
|
|
|
|
label="选择2"
|
|
|
|
console.log(`${ip}:${ipPort}/${imageName}:${value}`)
|
|
|
|
|
|
|
|
form.setFieldValue('path', `${ip}:${ipPort}/${imageName}:${value}`)
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
name="imageVersion"
|
|
|
|
|
|
|
|
label="镜像版本"
|
|
|
|
debounceTime={1000}
|
|
|
|
debounceTime={1000}
|
|
|
|
options={mode2Options}
|
|
|
|
options={mode2Options}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -319,9 +282,40 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
|
|
|
|
</ProFormDependency>
|
|
|
|
</ProFormDependency>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
) : (
|
|
|
|
''
|
|
|
|
<></>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</ProForm.Group>
|
|
|
|
</ProForm.Group>
|
|
|
|
|
|
|
|
<ProFormTextArea
|
|
|
|
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
|
|
|
|
name="startCode"
|
|
|
|
|
|
|
|
label={
|
|
|
|
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.startCode" defaultMessage="$$$" />
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
placeholder={`${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'common.please_input',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'resource.model_image.table.list.startCode',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
required={false}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<ProFormText
|
|
|
|
|
|
|
|
width={proFormItemStyleProps.column2Width}
|
|
|
|
|
|
|
|
name="remark"
|
|
|
|
|
|
|
|
label={
|
|
|
|
|
|
|
|
<FormattedMessage id="resource.model_image.table.list.remark" defaultMessage="$$$" />
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
placeholder={`${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'common.please_input',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}${intl.formatMessage({
|
|
|
|
|
|
|
|
id: 'resource.model_image.table.list.remark',
|
|
|
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
required={false}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
</ProForm.Group>
|
|
|
|
</ProForm.Group>
|
|
|
|
</ModalForm>
|
|
|
|
</ModalForm>
|
|
|
|
);
|
|
|
|
);
|
|
|
|