This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new c7e86ed1ea [INLONG-10394][DashBoard] Agent page modifies the version
and sets the def… (#10403)
c7e86ed1ea is described below
commit c7e86ed1ea138207b4abe56f931d24d2e3aa3631
Author: wohainilaodou <[email protected]>
AuthorDate: Fri Jun 14 09:49:45 2024 +0800
[INLONG-10394][DashBoard] Agent page modifies the version and sets the def…
(#10403)
---
inlong-dashboard/src/core/utils/pattern.ts | 1 +
inlong-dashboard/src/ui/locales/cn.json | 4 ++--
inlong-dashboard/src/ui/locales/en.json | 2 ++
.../src/ui/pages/AgentModule/CreateModal.tsx | 25 ++++++++++++++++++----
.../src/ui/pages/Clusters/NodeEditModal.tsx | 19 ----------------
5 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/inlong-dashboard/src/core/utils/pattern.ts
b/inlong-dashboard/src/core/utils/pattern.ts
index 84e5e3985f..7f4dc7df21 100644
--- a/inlong-dashboard/src/core/utils/pattern.ts
+++ b/inlong-dashboard/src/core/utils/pattern.ts
@@ -27,4 +27,5 @@ export default {
/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:,\s*(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]))*$|^All$/,
url:
/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
port:
/^([1-9](\d{0,3}))$|^([1-5]\d{4})$|^(6[0-4]\d{3})$|^(65[0-4]\d{2})$|^(655[0-2]\d)$|^(6553[0-5])$/,
+ version: /^((\d+)\.(\d+)\.(\d+))$/,
};
diff --git a/inlong-dashboard/src/ui/locales/cn.json
b/inlong-dashboard/src/ui/locales/cn.json
index 09b1d493f8..a8856a8e65 100644
--- a/inlong-dashboard/src/ui/locales/cn.json
+++ b/inlong-dashboard/src/ui/locales/cn.json
@@ -760,8 +760,8 @@
"pages.Clusters.Node.Port": "端口",
"pages.Clusters.Node.ProtocolType": "协议类型",
"pages.Clusters.Node.Agent": "Agent",
- "pages.Clusters.Node.Agent.Version": "Version",
- "pages.Clusters.Node.AgentInstaller": "Installer",
+ "pages.Clusters.Node.Agent.Version": "版本",
+ "pages.Clusters.Node.AgentInstaller": "安装包",
"pages.Clusters.Node.IsInstall": "安装方式",
"pages.Clusters.Node.ManualInstall": "手动安装",
"pages.Clusters.Node.SSHInstall": "SSH 安装",
diff --git a/inlong-dashboard/src/ui/locales/en.json
b/inlong-dashboard/src/ui/locales/en.json
index fdc2bf3e85..8a0755ca39 100644
--- a/inlong-dashboard/src/ui/locales/en.json
+++ b/inlong-dashboard/src/ui/locales/en.json
@@ -34,6 +34,7 @@
"meta.Sources.File.FilePathHelp": "Must be an absolute path and support
regular expressions, such as: /data/.*log",
"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",
"meta.Sources.File.TimeOffset": "Time offset",
"meta.Sources.File.TimeOffsetHelp": "The file will be collected from a
certain time,' 1m' means 1 minute later,' -1m' means 1 minute before, and
m(minute), h(hour), d(day) are supported. If it is empty, the file will be
collected from the current time",
"meta.Sources.File.TimeOffsetRules": "Can only contain numbers and letters
m, h, d",
@@ -759,6 +760,7 @@
"pages.Clusters.Node.Port": "Port",
"pages.Clusters.Node.ProtocolType": "Protocol type",
"pages.Clusters.Node.Agent": "Agent",
+ "pages.Clusters.Node.Agent.Version": "Version",
"pages.Clusters.Node.AgentInstaller": "Installer",
"pages.Clusters.Node.IsInstall": "Installation",
"pages.Clusters.Node.ManualInstall": "Manual",
diff --git a/inlong-dashboard/src/ui/pages/AgentModule/CreateModal.tsx
b/inlong-dashboard/src/ui/pages/AgentModule/CreateModal.tsx
index b9532c1b29..7dded46610 100644
--- a/inlong-dashboard/src/ui/pages/AgentModule/CreateModal.tsx
+++ b/inlong-dashboard/src/ui/pages/AgentModule/CreateModal.tsx
@@ -17,13 +17,14 @@
* under the License.
*/
-import React, { useMemo } from 'react';
+import React, { useMemo, useState } from 'react';
import { Button, message, Modal } from 'antd';
import i18n from '@/i18n';
import FormGenerator, { useForm } from '@/ui/components/FormGenerator';
import { useRequest, useUpdateEffect } from '@/ui/hooks';
import request from '@/core/utils/request';
import { ModalProps } from 'antd/es/modal';
+import rulesPattern from '@/core/utils/pattern';
export interface Props extends ModalProps {
id?: string;
@@ -32,7 +33,7 @@ export interface Props extends ModalProps {
const Comp: React.FC<Props> = ({ id, type, ...modalProps }) => {
const [form] = useForm();
-
+ const [isCreate, setCreate] = useState(false);
const content = useMemo(() => {
return [
{
@@ -45,7 +46,13 @@ const Comp: React.FC<Props> = ({ id, type, ...modalProps })
=> {
type: 'input',
label: i18n.t('pages.ModuleAgent.Config.Version'),
name: 'version',
- rules: [{ required: true }],
+ rules: [
+ {
+ required: true,
+ pattern: rulesPattern.version,
+ message: i18n.t('meta.Sources.File.VersionRule'),
+ },
+ ],
},
{
type: 'select',
@@ -135,7 +142,12 @@ const Comp: React.FC<Props> = ({ id, type, ...modalProps
}) => {
{
manual: true,
onSuccess: result => {
- form.setFieldsValue(result);
+ if (isCreate) {
+ form.resetFields();
+ form.setFieldsValue({ ...result, name: '', version: '', packageId:
'' });
+ } else {
+ form.setFieldsValue(result);
+ }
},
},
);
@@ -160,7 +172,12 @@ const Comp: React.FC<Props> = ({ id, type, ...modalProps
}) => {
useUpdateEffect(() => {
if (modalProps.open) {
if (id) {
+ setCreate(false);
getData(id);
+ } else {
+ setCreate(true);
+ // here need a data which id is 1 to init create form
+ getData(1);
}
} else {
form.resetFields();
diff --git a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx
b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx
index 687713f9e7..a8a070f3aa 100644
--- a/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx
+++ b/inlong-dashboard/src/ui/pages/Clusters/NodeEditModal.tsx
@@ -165,25 +165,6 @@ const NodeEditModal: React.FC<NodeEditModalProps> = ({ id,
type, clusterId, ...m
],
},
},
- {
- type: 'select',
- label: i18n.t('pages.Clusters.Node.ProtocolType'),
- name: 'protocolType',
- initialValue: 'HTTP',
- rules: [{ required: true }],
- props: {
- options: [
- {
- label: 'HTTP',
- value: 'HTTP',
- },
- {
- label: 'TCP',
- value: 'TCP',
- },
- ],
- },
- },
{
type: 'select',
label: i18n.t('pages.Clusters.Node.Agent.Version'),