This is an automated email from the ASF dual-hosted git repository.

healchow 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 3fbdfbde6 [INLONG-7738][Dashboard] The name and type of cluster and 
node cannot be modified (#7748)
3fbdfbde6 is described below

commit 3fbdfbde6b0c8dff933c455fa1df636772d4501d
Author: Lizhen <[email protected]>
AuthorDate: Fri Mar 31 19:28:01 2023 +0800

    [INLONG-7738][Dashboard] The name and type of cluster and node cannot be 
modified (#7748)
---
 .../src/plugins/clusters/common/ClusterDefaultInfo.ts          | 10 ++++++----
 inlong-dashboard/src/plugins/nodes/common/NodeDefaultInfo.ts   | 10 ++++++----
 inlong-dashboard/src/ui/pages/Clusters/CreateModal.tsx         |  1 +
 inlong-dashboard/src/ui/pages/Nodes/DetailModal.tsx            |  1 +
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/inlong-dashboard/src/plugins/clusters/common/ClusterDefaultInfo.ts 
b/inlong-dashboard/src/plugins/clusters/common/ClusterDefaultInfo.ts
index 4da07c26d..6d40d3e10 100644
--- a/inlong-dashboard/src/plugins/clusters/common/ClusterDefaultInfo.ts
+++ b/inlong-dashboard/src/plugins/clusters/common/ClusterDefaultInfo.ts
@@ -37,9 +37,10 @@ export class ClusterDefaultInfo implements DataWithBackend, 
RenderRow, RenderLis
   @FieldDecorator({
     type: 'input',
     rules: [{ required: true }],
-    props: {
+    props: values => ({
       maxLength: 128,
-    },
+      disabled: Boolean(values.id),
+    }),
   })
   @ColumnDecorator()
   @I18n('pages.Clusters.Name')
@@ -49,14 +50,15 @@ export class ClusterDefaultInfo implements DataWithBackend, 
RenderRow, RenderLis
     type: clusters.length > 3 ? 'select' : 'radio',
     initialValue: defaultValue,
     rules: [{ required: true }],
-    props: {
+    props: values => ({
+      disabled: Boolean(values.id),
       options: clusters
         .filter(item => item.value)
         .map(item => ({
           label: item.label,
           value: item.value,
         })),
-    },
+    }),
   })
   @ColumnDecorator({
     render: type => clusters.find(c => c.value === type)?.label || type,
diff --git a/inlong-dashboard/src/plugins/nodes/common/NodeDefaultInfo.ts 
b/inlong-dashboard/src/plugins/nodes/common/NodeDefaultInfo.ts
index 2c5b3a7e3..98e8c2de9 100644
--- a/inlong-dashboard/src/plugins/nodes/common/NodeDefaultInfo.ts
+++ b/inlong-dashboard/src/plugins/nodes/common/NodeDefaultInfo.ts
@@ -37,9 +37,10 @@ export class NodeDefaultInfo implements DataWithBackend, 
RenderRow, RenderList {
   @FieldDecorator({
     type: 'input',
     rules: [{ required: true }],
-    props: {
+    props: values => ({
       maxLength: 128,
-    },
+      disabled: Boolean(values.id),
+    }),
   })
   @ColumnDecorator()
   @I18n('meta.Nodes.Name')
@@ -49,14 +50,15 @@ export class NodeDefaultInfo implements DataWithBackend, 
RenderRow, RenderList {
     type: nodes.length > 3 ? 'select' : 'radio',
     initialValue: defaultValue,
     rules: [{ required: true }],
-    props: {
+    props: values => ({
+      disabled: Boolean(values.id),
       options: nodes
         .filter(item => item.value)
         .map(item => ({
           label: item.label,
           value: item.value,
         })),
-    },
+    }),
   })
   @ColumnDecorator({
     render: type => nodes.find(c => c.value === type)?.label || type,
diff --git a/inlong-dashboard/src/ui/pages/Clusters/CreateModal.tsx 
b/inlong-dashboard/src/ui/pages/Clusters/CreateModal.tsx
index cc36947c6..59e5de89b 100644
--- a/inlong-dashboard/src/ui/pages/Clusters/CreateModal.tsx
+++ b/inlong-dashboard/src/ui/pages/Clusters/CreateModal.tsx
@@ -132,6 +132,7 @@ const Comp: React.FC<Props> = ({ id, defaultType, 
...modalProps }) => {
         content={content}
         form={form}
         onValuesChange={(c, values) => setType(values.type)}
+        initialValues={id ? savedData : {}}
         useMaxWidth
       />
     </Modal>
diff --git a/inlong-dashboard/src/ui/pages/Nodes/DetailModal.tsx 
b/inlong-dashboard/src/ui/pages/Nodes/DetailModal.tsx
index 72cb3ee1d..9714f26e9 100644
--- a/inlong-dashboard/src/ui/pages/Nodes/DetailModal.tsx
+++ b/inlong-dashboard/src/ui/pages/Nodes/DetailModal.tsx
@@ -120,6 +120,7 @@ const Comp: React.FC<Props> = ({ id, defaultType, 
...modalProps }) => {
         content={content}
         form={form}
         onValuesChange={(c, values) => setType(values.type)}
+        initialValues={id ? savedData : {}}
         useMaxWidth
       />
     </Modal>

Reply via email to