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

min pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6ba4b9e  encode url with encodeURIComponent
6ba4b9e is described below

commit 6ba4b9e17584431cef56a8673d14087f84962ec2
Author: nzomkxia <[email protected]>
AuthorDate: Thu Sep 20 13:38:26 2018 +0800

    encode url with encodeURIComponent
---
 .../dubbo/admin/controller/RoutesController.java   | 26 +++++++++++++++++-----
 .../src/components/RoutingRule.vue                 |  4 ++--
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
index a7e2af2..e2a0f6e 100644
--- 
a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
+++ 
b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
@@ -1,11 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ *  he License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
 package org.apache.dubbo.admin.controller;
 
 import org.apache.dubbo.admin.governance.service.ProviderService;
 import org.apache.dubbo.admin.governance.service.RouteService;
 import org.apache.dubbo.admin.registry.common.domain.Route;
+import org.apache.dubbo.admin.util.YamlUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.yaml.snakeyaml.Yaml;
 
 import java.util.List;
 import java.util.Map;
@@ -26,9 +43,7 @@ public class RoutesController {
         if (serviceName == null && app == null) {
 
         }
-        Yaml yaml = new Yaml();
-        rule = rule.replace("===", "\n");
-        Map<String, Object> result = yaml.load(rule);
+        Map<String, Object> result = YamlUtil.loadString(rule);
         if (serviceName != null) {
             result.put("scope", serviceName);
             result.put("group/service:version", result.get("group") + "/" + 
serviceName);
@@ -70,8 +85,7 @@ public class RoutesController {
             //TODO Exception
         }
         rule = rule.replace("===", "\n");
-        Yaml yaml = new Yaml();
-        Map<String, Object> result = yaml.load(rule);
+        Map<String, Object> result = YamlUtil.loadString(rule);
         List<String> conditions = (List)result.get("conditions");
         for (String condition : conditions) {
             Route newRoute = new Route();
diff --git a/dubbo-admin-frontend/src/components/RoutingRule.vue 
b/dubbo-admin-frontend/src/components/RoutingRule.vue
index 5874d40..c0e3fb6 100644
--- a/dubbo-admin-frontend/src/components/RoutingRule.vue
+++ b/dubbo-admin-frontend/src/components/RoutingRule.vue
@@ -282,11 +282,11 @@
         this.warn = false
       },
       saveItem: function () {
-        let text = this.ruleText.replace(/\n/g, '===')
+        let text = encodeURIComponent(this.ruleText)
         AXIOS.get('/routes/create?serviceName=' + this.service + '&rule=' + 
text)
           .then(response => {
             if (response.data) {
-              this.search(this.filter, false)
+              this.search(this.service, true)
             }
           })
       },

Reply via email to