fix: multi-app migration (#7540)

This commit is contained in:
Jiann
2025-10-09 14:44:55 +08:00
committed by GitHub
parent 63a3fb9cf9
commit 228fc5e1b6
3 changed files with 21 additions and 19 deletions
@@ -120,27 +120,25 @@ export const useMigrateData = () => {
const port = React.useRef<any>();
const api = useAPIClient();
const { t } = usePluginUtils();
const [form] = Form.useForm();
return {
async run() {
console.log('migrateData');
form.resetFields();
await Modal.confirm({
title: t('Migrate data'),
content: (
<Form.Item
label={t('Port')}
tooltip={t(
'When migrate data, the system automatically assigns an incrementing port number to each application based on this port number. You can also manually modify port number after the migrate.',
)}
>
<InputNumber
onChange={(value) => {
port.current = value as number;
}}
defaultValue={port.current}
style={{ width: '100%' }}
min={1}
/>
</Form.Item>
<Form form={form}>
<Form.Item
label={t('Port')}
tooltip={t(
'When migrate data, the system automatically assigns an incrementing port number to each application based on this port number. You can also manually modify port number after the migrate.',
)}
rules={[{ required: true, message: t('Port is required') }]}
name="port"
>
<InputNumber style={{ width: '100%' }} min={1} />
</Form.Item>
</Form>
),
onOk: async () => {
const { data } = await api.resource('pm').get({
@@ -150,11 +148,12 @@ export const useMigrateData = () => {
message.error(t('Multi-app is not enabled, please enable it first'));
return;
}
const values = await form.validateFields();
await api.request({
url: 'multiApplications:importFromMultiappManager',
method: 'post',
data: {
port: port.current,
port: values.port,
},
});
message.success(t('Migrate successfully'));
@@ -7,5 +7,7 @@
"Custom domain": "Custom domain",
"Manage applications": "Manage applications",
"Standalone deployment": "Standalone deployment",
"Auto start": "Auto start"
"Auto start": "Auto start",
"Port": "Port",
"Please enter the port": "Please enter the port"
}
@@ -20,5 +20,6 @@
"Port": "端口号",
"When migrate data, the system automatically assigns an incrementing port number to each application based on this port number. You can also manually modify port number after the migrate.": "迁移数据时,系统会基于该端口号自动为每个应用分配一个递增的端口号,您也可以在迁移后手动修改。",
"Migrate data to new multi-app": "迁移数据至新多应用",
"Multi-app is not enabled, please enable it first": "多应用未启用,请先启用"
"Multi-app is not enabled, please enable it first": "多应用未启用,请先启用",
"Please enter the port": "请输入端口号"
}