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

likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new db171d1d2 fix(config-ui): some issues about transformation (#5527)
db171d1d2 is described below

commit db171d1d2c23e4c485ee7a3d7418cb2379012772
Author: 青湛 <[email protected]>
AuthorDate: Tue Jun 20 21:59:22 2023 +0800

    fix(config-ui): some issues about transformation (#5527)
    
    * fix(config-ui): missed transformation default value
    
    * refactor(config-ui): set default value to false in additional settings
    
    * refactor(config-ui): cicd switch is not affected by transformation
---
 .../plugins/components/scope-config-form/fields/additional-settings.tsx | 2 +-
 config-ui/src/plugins/components/scope-config-form/index.tsx            | 1 +
 config-ui/src/plugins/register/azure/transformation.tsx                 | 2 +-
 config-ui/src/plugins/register/github/transformation.tsx                | 2 +-
 config-ui/src/plugins/register/gitlab/transformation.tsx                | 2 +-
 config-ui/src/plugins/register/jenkins/transformation.tsx               | 2 +-
 6 files changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/config-ui/src/plugins/components/scope-config-form/fields/additional-settings.tsx
 
b/config-ui/src/plugins/components/scope-config-form/fields/additional-settings.tsx
index dba4315d6..b27206526 100644
--- 
a/config-ui/src/plugins/components/scope-config-form/fields/additional-settings.tsx
+++ 
b/config-ui/src/plugins/components/scope-config-form/fields/additional-settings.tsx
@@ -29,7 +29,7 @@ interface Props {
 }
 
 export const AdditionalSettings = ({ transformation, setTransformation }: 
Props) => {
-  const [enable, setEnable] = useState(true);
+  const [enable, setEnable] = useState(false);
 
   const handleChange = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
diff --git a/config-ui/src/plugins/components/scope-config-form/index.tsx 
b/config-ui/src/plugins/components/scope-config-form/index.tsx
index 2f04bb64f..963310b58 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -67,6 +67,7 @@ export const ScopeConfigForm = ({
 
   useEffect(() => {
     setHasRefDiff(!!config.scopeConfig?.transformation.refdiff);
+    setTransformation(config.scopeConfig?.transformation ?? {});
   }, [config.scopeConfig?.transformation]);
 
   useEffect(() => {
diff --git a/config-ui/src/plugins/register/azure/transformation.tsx 
b/config-ui/src/plugins/register/azure/transformation.tsx
index adcd9e59d..6a216bd47 100644
--- a/config-ui/src/plugins/register/azure/transformation.tsx
+++ b/config-ui/src/plugins/register/azure/transformation.tsx
@@ -36,7 +36,7 @@ export const AzureTransformation = ({ entities, 
transformation, setTransformatio
     if (!transformation.deploymentPattern) {
       setEnableCICD(false);
     }
-  }, [transformation]);
+  }, []);
 
   const handleChangeCICDEnable = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
diff --git a/config-ui/src/plugins/register/github/transformation.tsx 
b/config-ui/src/plugins/register/github/transformation.tsx
index 8c56067b5..47f2e8dcd 100644
--- a/config-ui/src/plugins/register/github/transformation.tsx
+++ b/config-ui/src/plugins/register/github/transformation.tsx
@@ -36,7 +36,7 @@ export const GitHubTransformation = ({ entities, 
transformation, setTransformati
     if (!transformation.deploymentPattern) {
       setEnableCICD(false);
     }
-  }, [transformation]);
+  }, []);
 
   const handleChangeEnableCICD = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
diff --git a/config-ui/src/plugins/register/gitlab/transformation.tsx 
b/config-ui/src/plugins/register/gitlab/transformation.tsx
index 301cfef1e..b663473f4 100644
--- a/config-ui/src/plugins/register/gitlab/transformation.tsx
+++ b/config-ui/src/plugins/register/gitlab/transformation.tsx
@@ -36,7 +36,7 @@ export const GitLabTransformation = ({ entities, 
transformation, setTransformati
     if (!transformation.deploymentPattern) {
       setEnableCICD(false);
     }
-  }, [transformation]);
+  }, []);
 
   const handleChangeCICDEnable = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
diff --git a/config-ui/src/plugins/register/jenkins/transformation.tsx 
b/config-ui/src/plugins/register/jenkins/transformation.tsx
index a7250e0ee..df96fca51 100644
--- a/config-ui/src/plugins/register/jenkins/transformation.tsx
+++ b/config-ui/src/plugins/register/jenkins/transformation.tsx
@@ -35,7 +35,7 @@ export const JenkinsTransformation = ({ entities, 
transformation, setTransformat
     if (!transformation.deploymentPattern) {
       setEnableCICD(false);
     }
-  }, [transformation]);
+  }, []);
 
   const handleChangeCICDEnable = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;

Reply via email to