From b6ed664db2bffdf2a239045bd8b30191fe80051f Mon Sep 17 00:00:00 2001 From: v_haifxu Date: Tue, 9 Apr 2024 14:34:16 +0800 Subject: [PATCH 1/3] [INLONG-9944][Dashboard] Add Agent and Installer for Agent Cluster Node --- inlong-dashboard/src/ui/locales/cn.json | 2 + inlong-dashboard/src/ui/locales/en.json | 2 + .../src/ui/pages/Clusters/NodeEditModal.tsx | 65 +++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/inlong-dashboard/src/ui/locales/cn.json b/inlong-dashboard/src/ui/locales/cn.json index 69eebbcb5a8..614a2e73cd3 100644 --- a/inlong-dashboard/src/ui/locales/cn.json +++ b/inlong-dashboard/src/ui/locales/cn.json @@ -751,6 +751,8 @@ "pages.Clusters.Node.Name": "节点", "pages.Clusters.Node.Port": "端口", "pages.Clusters.Node.ProtocolType": "协议类型", + "pages.Clusters.Node.Agent": "Agent", + "pages.Clusters.Node.AgentInstaller": "Installer", "pages.Clusters.Node.Status": "状态", "pages.Clusters.Node.Status.Normal": "正常", "pages.Clusters.Node.Status.Timeout": "心跳超时", diff --git a/inlong-dashboard/src/ui/locales/en.json b/inlong-dashboard/src/ui/locales/en.json index 06a27fb7e83..87198b1e8da 100644 --- a/inlong-dashboard/src/ui/locales/en.json +++ b/inlong-dashboard/src/ui/locales/en.json @@ -751,6 +751,8 @@ "pages.Clusters.Node.Name": "Node", "pages.Clusters.Node.Port": "Port", "pages.Clusters.Node.ProtocolType": "Protocol type", + "pages.Clusters.Node.Agent": "Agent", + "pages.Clusters.Node.AgentInstaller": "Installer", "pages.Clusters.Node.Status": "Status", "pages.Clusters.Node.Status.Normal": "Normal", "pages.Clusters.Node.Status.Timeout": "Timeout", diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx index 9ced80eb681..ca5a4d0f2de 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx @@ -145,6 +145,71 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m ], }, }, + { + type: 'select', + label: i18n.t('pages.Clusters.Node.Agent'), + name: 'moduleIdList', + rules: [{ required: false }], + hidden: type !== 'AGENT', + props: { + options: { + requestAuto: true, + requestTrigger: ['onOpen'], + requestService: keyword => ({ + url: '/module/list', + method: 'POST', + data: { + keyword, + pageNum: 1, + pageSize: 9999, + }, + }), + requestParams: { + formatResult: result => + result?.list + ?.filter(item => item.type === 'AGENT') + .map(item => ({ + ...item, + label: `${item.name} ${item.version}`, + value: item.id, + })), + }, + }, + }, + }, + { + type: 'select', + label: i18n.t('pages.Clusters.Node.AgentInstaller'), + name: 'installer', + rules: [{ required: false }], + hidden: type !== 'AGENT', + props: { + mode: 'multiple', + options: { + requestAuto: true, + requestTrigger: ['onOpen'], + requestService: keyword => ({ + url: '/module/list', + method: 'POST', + data: { + keyword, + pageNum: 1, + pageSize: 9999, + }, + }), + requestParams: { + formatResult: result => + result?.list + ?.filter(item => item.type === 'INSTALLER') + .map(item => ({ + ...item, + label: `${item.name} ${item.version}`, + value: item.id, + })), + }, + }, + }, + }, { type: 'textarea', label: i18n.t('pages.Clusters.Description'), From df8a812fb48e1f08eb7fe0cdf7c6466cc07ee017 Mon Sep 17 00:00:00 2001 From: v_haifxu Date: Tue, 9 Apr 2024 14:48:26 +0800 Subject: [PATCH 2/3] [INLONG-9944][Dashboard] Add Agent and Installer for Agent Cluster Node --- .../src/ui/pages/Clusters/NodeEditModal.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx index ca5a4d0f2de..93d83677541 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx @@ -42,6 +42,11 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m { manual: true, onSuccess: result => { + if (type === 'AGENT') { + // Only keep the first element and give the rest to the 'installer' + result.installer = result?.moduleIdList.slice(1); + result.moduleIdList = result?.moduleIdList.slice(0, 1); + } form.setFieldsValue(result); }, }, @@ -59,6 +64,14 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m submitData.id = id; submitData.version = savedData?.version; } + if (type === 'AGENT') { + if (submitData.installer !== undefined) { + submitData.moduleIdList = submitData.moduleIdList.concat(submitData.installer); + } + if (isUpdate === undefined) { + submitData.isInstall = true; + } + } await request({ url: `/cluster/node/${isUpdate ? 'update' : 'save'}`, method: 'POST', From 8911970041893c21923b3f7e00a907b5b059154a Mon Sep 17 00:00:00 2001 From: v_haifxu Date: Wed, 10 Apr 2024 09:52:48 +0800 Subject: [PATCH 3/3] [INLONG-9950][Dashboard] Fix audit query using incorrect end time --- inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx index 93d83677541..cfdb6634397 100644 --- a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx +++ b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx @@ -162,7 +162,6 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m type: 'select', label: i18n.t('pages.Clusters.Node.Agent'), name: 'moduleIdList', - rules: [{ required: false }], hidden: type !== 'AGENT', props: { options: { @@ -194,7 +193,6 @@ const NodeEditModal: React.FC = ({ id, type, clusterId, ...m type: 'select', label: i18n.t('pages.Clusters.Node.AgentInstaller'), name: 'installer', - rules: [{ required: false }], hidden: type !== 'AGENT', props: { mode: 'multiple',