From ad528e02094acd675146a40653eb3d66cbf0ffc0 Mon Sep 17 00:00:00 2001 From: wb-msm261421 Date: Fri, 10 May 2024 18:12:59 +0800 Subject: [PATCH] Fix(sysom-web): Create hotfix validate hotfix id and patch file choose... --- sysom_web/src/locales/zh-CN/pages.js | 2 + sysom_web/src/pages/hotfix/Make/index.jsx | 60 ++++++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/sysom_web/src/locales/zh-CN/pages.js b/sysom_web/src/locales/zh-CN/pages.js index 331c97c1..b0f0e994 100644 --- a/sysom_web/src/locales/zh-CN/pages.js +++ b/sysom_web/src/locales/zh-CN/pages.js @@ -199,6 +199,7 @@ export default { 'pages.changepassword': '修改密码', 'pages.hotfix.title': '热补丁列表', 'pages.hotfix.created_at': '创建时间', + 'pages.hotfix.created': '创建', 'pages.hotfix.kernel_version': '内核版本', 'pages.hotfix.creator': '创建人', 'pages.hotfix.progress': '进度', @@ -301,6 +302,7 @@ export default { 'pages.hotfix.serious_explain': '推荐信息简介', 'pages.hotfix.edit_released_hotfix': '编辑Hotfix Released 配置', 'pages.hotfix.bulk_import_hotfix_released': '批量导入hotfix released', + 'pages.hotfix.choose_hotfix_id_patch_error': 'Hotfix id or patch file 必选一个字段', 'pages.account.account_list': '账号列表', 'pages.account.username': '用户名', 'pages.account.password': '密码', diff --git a/sysom_web/src/pages/hotfix/Make/index.jsx b/sysom_web/src/pages/hotfix/Make/index.jsx index 4ffcbc0f..138118b4 100644 --- a/sysom_web/src/pages/hotfix/Make/index.jsx +++ b/sysom_web/src/pages/hotfix/Make/index.jsx @@ -38,11 +38,16 @@ const submitHotfix = (params) => { hotfix_id: params.hotfix_id, hotfix_name: params.hotfix_name, kernel_version: params.kernel_version, - upload: params.patch[0].response.data.patch_name, - patch: params.patch, } + + // When uploading patch files, creating hot patches carries patches + if (params.patch && params.upload) { + datapar.upload = params.patch[0].response.data.patch_name + datapar.patch = params.patch + } + const token = localStorage.getItem('token'); - createHotfix(token, datapar) + return createHotfix(token, datapar) } // 下载 const downloadHotfix = async (record) => { @@ -78,6 +83,13 @@ const HotfixList = () => { title: , dataIndex: 'hotfix_id', valueType: 'message', + renderFormItem: () => { + return ( + + + + ) + } }, { title: , @@ -98,6 +110,16 @@ const HotfixList = () => { dataIndex: 'kernel_version', key: 'kernel_version', tooltip: '请输入全量内核版本名称,如:4.19.91-26.an8.x86_64', + renderFormItem: () => { + return ( + + + + ) + } }, { title: , @@ -127,6 +149,16 @@ const HotfixList = () => { title: , dataIndex: 'hotfix_name', valueType: 'input', + renderFormItem: () => { + return ( + + + + ) + } }, { title: , @@ -260,12 +292,26 @@ const HotfixList = () => { key="create" type="primary" onClick={() => { const values = searchConfig?.form?.getFieldsValue(); - submitHotfix(values); - actionRef.current?.reload(); - searchConfig?.form?.resetFields(); + + if (!values.hotfix_id && (!values.patch || values.patch.length === 0)) { + message.error(intl.formatMessage({ + id: 'pages.hotfix.choose_hotfix_id_patch_error', + defaultMessage: "Hotfix_id field or patch file field choose one" + })) + return + } else { + searchConfig?.form?.validateFields() + .then((res) => { + submitHotfix(res) + .then(res => { + actionRef.current?.reload(); + searchConfig?.form?.resetFields(); + }) + }) + } }} > - 创建 + , ], }} -- Gitee