fix(config-ui): transformation name is duplicated when upgrading bp (#4416)
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 0a79d99..80645d4 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 @@
};
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,
};
};