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

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


The following commit(s) were added to refs/heads/release-v0.15 by this push:
     new a42535d58 fix(config-ui): transformation name is duplicated when 
upgrading bp (#4416)
a42535d58 is described below

commit a42535d58c42f34fdd95a3c4ca5e1d063c36e553
Author: 青湛 <[email protected]>
AuthorDate: Wed Feb 15 14:17:30 2023 +0700

    fix(config-ui): transformation name is duplicated when upgrading bp (#4416)
---
 config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts 
b/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
index 0a79d9990..80645d44c 100644
--- a/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
+++ b/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
@@ -90,27 +90,28 @@ export const useBPUpgrade = ({ id, onResetError }: 
UseBPUpgradeProps) => {
   };
 
   const upgradeScope = async (plugin: string, connectionId: ID, scope: any) => 
{
+    // get data scope detail
+    const scopeDetail = await getScopeDetail(plugin, connectionId, 
scope.options);
+    const scopeId = getScopeId(plugin, scopeDetail);
+
     let transformationRule;
 
     if (scope.transformation) {
       // create transfromation template
       transformationRule = await API.createTransformation(plugin, {
         ...scope.transformation,
-        name: `upgrade-${plugin}-${connectionId}-${new Date().getTime()}`,
+        name: `upgrade-${plugin}-${connectionId}-${scopeId}-${new 
Date().getTime()}`,
       });
     }
 
-    // get data scope detail
-    const scopeDetail = await getScopeDetail(plugin, connectionId, 
scope.options);
-
     // put data scope
-    await API.updateDataScope(plugin, connectionId, getScopeId(plugin, 
scopeDetail), {
+    await API.updateDataScope(plugin, connectionId, scopeId, {
       ...scopeDetail,
       transformationRuleId: transformationRule?.id,
     });
 
     return {
-      id: `${getScopeId(plugin, scopeDetail)}`,
+      id: scopeId,
       entities: scope.entities,
     };
   };

Reply via email to