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

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new b1e66a2  fix: improve the Duplicate Route feature (#1833)
b1e66a2 is described below

commit b1e66a286a7fa0fd276bcd4bf1dee8a065947676
Author: qian0817 <[email protected]>
AuthorDate: Thu May 6 09:00:49 2021 +0800

    fix: improve the Duplicate Route feature (#1833)
---
 web/src/pages/Route/Create.tsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/web/src/pages/Route/Create.tsx b/web/src/pages/Route/Create.tsx
index 8da9546..295048e 100644
--- a/web/src/pages/Route/Create.tsx
+++ b/web/src/pages/Route/Create.tsx
@@ -72,10 +72,14 @@ const Page: React.FC<Props> = (props) => {
 
   const setupRoute = (rid: number) =>
     fetchItem(rid).then((data) => {
-      form1.setFieldsValue(data.form1Data);
-      setAdvancedMatchingRules(data.advancedMatchingRules);
-      form2.setFieldsValue(data.form2Data);
-      setStep3Data(data.step3Data);
+      const routeData = {...data};
+      if (props.route.path.indexOf('duplicate') !== -1) {
+        routeData.form1Data.name = "";
+      }
+      form1.setFieldsValue(routeData.form1Data);
+      setAdvancedMatchingRules(routeData.advancedMatchingRules);
+      form2.setFieldsValue(routeData.form2Data);
+      setStep3Data(routeData.step3Data);
     });
 
   const onReset = () => {

Reply via email to