From 9bf8b5d09ddbbf67f8e22b2dcb507cc7809862db Mon Sep 17 00:00:00 2001 From: kamianlaida <165994047+wohainilaodou@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:28:00 +0800 Subject: [PATCH] [INLONG-11496][Dashboard] File source adds a new judgment on spaces in the file path (#11497) --- inlong-dashboard/src/plugins/sources/defaults/File.ts | 8 +++++++- inlong-dashboard/src/ui/locales/cn.json | 1 + inlong-dashboard/src/ui/locales/en.json | 1 + .../src/ui/pages/ModuleAudit/IdModule/index.tsx | 8 ++++---- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/inlong-dashboard/src/plugins/sources/defaults/File.ts b/inlong-dashboard/src/plugins/sources/defaults/File.ts index e227362eb8..5cbfa61b0b 100644 --- a/inlong-dashboard/src/plugins/sources/defaults/File.ts +++ b/inlong-dashboard/src/plugins/sources/defaults/File.ts @@ -139,7 +139,13 @@ export default class PulsarSource @FieldDecorator({ type: 'input', tooltip: i18n.t('meta.Sources.File.FilePathHelp'), - rules: [{ required: true }], + rules: [ + { required: true }, + { + pattern: /^\S*$/, + message: i18n.t('meta.Sources.File.FilePathPatternHelp'), + }, + ], props: values => ({ disabled: Boolean(values.id), }), diff --git a/inlong-dashboard/src/ui/locales/cn.json b/inlong-dashboard/src/ui/locales/cn.json index 8e498f8f2c..535063ee00 100644 --- a/inlong-dashboard/src/ui/locales/cn.json +++ b/inlong-dashboard/src/ui/locales/cn.json @@ -34,6 +34,7 @@ "meta.Sources.File.ClusterName": "集群名称", "meta.Sources.File.FilePath": "⽂件路径", "meta.Sources.File.FilePathHelp": "必须是绝对路径,支持正则表达式,多个时以逗号分隔,如:/data/.*log", + "meta.Sources.File.FilePathPatternHelp": "文件路径不能包含空格", "meta.Sources.File.FileIpHelp": "请选择文件采集节点 IP,若 IP 不固定请选择 All", "meta.Sources.File.IpRule": "请输入正确的 IP 地址", "meta.Sources.File.VersionRule": "请输入正确的版本号", diff --git a/inlong-dashboard/src/ui/locales/en.json b/inlong-dashboard/src/ui/locales/en.json index a176d810ef..b74f54e58e 100644 --- a/inlong-dashboard/src/ui/locales/en.json +++ b/inlong-dashboard/src/ui/locales/en.json @@ -34,6 +34,7 @@ "meta.Sources.File.ClusterName": "Cluster name", "meta.Sources.File.FilePath": "File path", "meta.Sources.File.FilePathHelp": "Must be an absolute path and support regular expressions, such as: /data/.*log", + "meta.Sources.File.FilePathPatternHelp": "File path cannot contain spaces", "meta.Sources.File.FileIpHelp": "Please select the file collection node IP. If the IP is not fixed, please select All", "meta.Sources.File.IpRule": "Please enter the IP address correctly", "meta.Sources.File.VersionRule":"Please enter the correct version number", diff --git a/inlong-dashboard/src/ui/pages/ModuleAudit/IdModule/index.tsx b/inlong-dashboard/src/ui/pages/ModuleAudit/IdModule/index.tsx index 20f9d64fd6..9deebc3d0f 100644 --- a/inlong-dashboard/src/ui/pages/ModuleAudit/IdModule/index.tsx +++ b/inlong-dashboard/src/ui/pages/ModuleAudit/IdModule/index.tsx @@ -74,14 +74,14 @@ const Comp: React.FC = ({ auditData }) => { base: sourceData[0].auditId === baseData.auditId ? cur.count - : sourceData[0].auditSet.find(item => (item.ip = cur.ip)) - ? sourceData[0].auditSet.find(item => (item.ip = cur.ip)).count + : sourceData[0].auditSet.find(item => item.ip === cur.ip) + ? sourceData[0].auditSet.find(item => item.ip === cur.ip).count : 0, compared: sourceData[1].auditId === baseData.auditId ? cur.count - : sourceData[1].auditSet.find(item => (item.ip = cur.ip)) - ? sourceData[1].auditSet.find(item => (item.ip = cur.ip)).count + : sourceData[1].auditSet.find(item => item.ip === cur.ip) + ? sourceData[1].auditSet.find(item => item.ip === cur.ip).count : 0, }; return acc;