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

liujun pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/refactor-with-go by this push:
     new 51445ddf Update traffic pages (#1186)
51445ddf is described below

commit 51445ddf3f479e3933e8481e4dd67a8424f02752
Author: Ken Liu <[email protected]>
AuthorDate: Tue Jul 4 19:58:55 2023 +0800

    Update traffic pages (#1186)
---
 cmd/ui/dist/index.html                             |  2 +-
 cmd/ui/dist/static/js/app.006d706a.js.map          |  1 -
 .../static/js/{app.006d706a.js => app.97288c91.js} |  4 +-
 cmd/ui/dist/static/js/app.97288c91.js.map          |  1 +
 .../src/components/traffic/Accesslog.vue           | 46 ++++++------
 .../src/components/traffic/Arguments.vue           | 81 +++++++++++++++++-----
 dubbo-admin-ui/src/components/traffic/Gray.vue     | 10 +--
 dubbo-admin-ui/src/components/traffic/Mock.vue     |  9 +--
 dubbo-admin-ui/src/components/traffic/Region.vue   | 30 +++-----
 dubbo-admin-ui/src/components/traffic/Retry.vue    | 57 +++++++--------
 dubbo-admin-ui/src/components/traffic/Timeout.vue  | 56 ++++++++-------
 dubbo-admin-ui/src/components/traffic/Weight.vue   | 38 +++++-----
 pkg/admin/model/condition_route.go                 |  2 +-
 pkg/admin/model/match.go                           | 20 +++---
 pkg/admin/model/tag_route.go                       |  6 +-
 pkg/admin/model/traffic.go                         | 12 ++--
 pkg/admin/services/prometheus_service_impl.go      |  2 +-
 pkg/admin/services/route_service_impl.go           |  9 ++-
 pkg/admin/services/traffic/accesslog.go            | 28 ++++++--
 pkg/admin/services/traffic/argument.go             | 16 ++---
 .../services/traffic/generic_rule_operation.go     | 11 +--
 pkg/admin/services/traffic/gray.go                 | 16 +++--
 pkg/admin/services/traffic/mock.go                 | 19 +++--
 pkg/admin/services/traffic/region.go               | 35 +++++++---
 pkg/admin/services/traffic/retry.go                | 19 +++--
 pkg/admin/services/traffic/timeout.go              | 21 ++++--
 pkg/admin/services/traffic/weight.go               | 18 +++--
 27 files changed, 333 insertions(+), 236 deletions(-)

diff --git a/cmd/ui/dist/index.html b/cmd/ui/dist/index.html
index 03d26efb..d30a0004 100644
--- a/cmd/ui/dist/index.html
+++ b/cmd/ui/dist/index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport 
content="width=device-width,initial-scale=1"><title>Dubbo Admin</title><link 
href=/admin/OpenSans.css rel=stylesheet type=text/css><link rel="shortcut icon" 
href=/admin/dubbo.ico type=image/x-icon><script 
src=/admin/echarts-en.min.js></script><link 
href=/admin/static/css/app.be67f7a9.css rel=preload as=style><link 
href=/admin/static/css/chunk-vendors.52f99f04.css rel=preload as=style><link 
href=/admin/static/js/app.006d70 [...]
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport 
content="width=device-width,initial-scale=1"><title>Dubbo Admin</title><link 
href=/admin/OpenSans.css rel=stylesheet type=text/css><link 
rel="/admin/shortcut icon" href=dubbo.ico type=image/x-icon><script 
src=/admin/echarts-en.min.js></script><link 
href=/admin/static/css/app.be67f7a9.css rel=preload as=style><link 
href=/admin/static/css/chunk-vendors.52f99f04.css rel=preload as=style><link 
href=/admin/static/js/app.97288c [...]
\ No newline at end of file
diff --git a/cmd/ui/dist/static/js/app.006d706a.js.map 
b/cmd/ui/dist/static/js/app.006d706a.js.map
deleted file mode 100644
index 886865ae..00000000
--- a/cmd/ui/dist/static/js/app.006d706a.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/assets/avatar.png","webpack:///./src/components/apiDocs/ApiDocs.vue?0227","webpack:///./src/components/public/Drawer.vue?4ba8","webpack:///./src/components/public/Footers.vue?1d6f","webpack:///./src/App.vue?e446","webpack:///src/App.vue","webpack:///./src/App.vue?1160","webpack:///./src/App.vue","webpack:///./src/components/ServiceSearch.vue?d239","webpack:///./src/store/index.js","webpack:///src/components/ServiceS
 [...]
\ No newline at end of file
diff --git a/cmd/ui/dist/static/js/app.006d706a.js 
b/cmd/ui/dist/static/js/app.97288c91.js
similarity index 51%
rename from cmd/ui/dist/static/js/app.006d706a.js
rename to cmd/ui/dist/static/js/app.97288c91.js
index 5985ee02..f6244a9e 100644
--- a/cmd/ui/dist/static/js/app.006d706a.js
+++ b/cmd/ui/dist/static/js/app.97288c91.js
@@ -1,2 +1,2 @@
-(function(e){function t(t){for(var 
s,o,l=t[0],n=t[1],c=t[2],d=0,p=[];d<l.length;d++)o=l[d],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&p.push(i[o][0]),i[o]=0;for(s
 in 
n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s]);u&&u(t);while(p.length)p.shift()();return
 r.push.apply(r,c||[]),a()}function a(){for(var e,t=0;t<r.length;t++){for(var 
a=r[t],s=!0,l=1;l<a.length;l++){var 
n=a[l];0!==i[n]&&(s=!1)}s&&(r.splice(t--,1),e=o(o.s=a[0]))}return e}var 
s={},i={app:0},r=[];function o(t){if [...]
-//# sourceMappingURL=app.006d706a.js.map
\ No newline at end of file
+(function(e){function t(t){for(var 
s,o,l=t[0],n=t[1],c=t[2],d=0,p=[];d<l.length;d++)o=l[d],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&p.push(i[o][0]),i[o]=0;for(s
 in 
n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s]);u&&u(t);while(p.length)p.shift()();return
 r.push.apply(r,c||[]),a()}function a(){for(var e,t=0;t<r.length;t++){for(var 
a=r[t],s=!0,l=1;l<a.length;l++){var 
n=a[l];0!==i[n]&&(s=!1)}s&&(r.splice(t--,1),e=o(o.s=a[0]))}return e}var 
s={},i={app:0},r=[];function o(t){if [...]
+//# sourceMappingURL=app.97288c91.js.map
\ No newline at end of file
diff --git a/cmd/ui/dist/static/js/app.97288c91.js.map 
b/cmd/ui/dist/static/js/app.97288c91.js.map
new file mode 100644
index 00000000..167f7730
--- /dev/null
+++ b/cmd/ui/dist/static/js/app.97288c91.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/assets/avatar.png","webpack:///./src/components/apiDocs/ApiDocs.vue?0227","webpack:///./src/components/public/Drawer.vue?4ba8","webpack:///./src/components/public/Footers.vue?1d6f","webpack:///./src/App.vue?e446","webpack:///src/App.vue","webpack:///./src/App.vue?1160","webpack:///./src/App.vue","webpack:///./src/components/ServiceSearch.vue?d239","webpack:///./src/store/index.js","webpack:///src/components/ServiceS
 [...]
\ No newline at end of file
diff --git a/dubbo-admin-ui/src/components/traffic/Accesslog.vue 
b/dubbo-admin-ui/src/components/traffic/Accesslog.vue
index 4c12e940..9b605f08 100644
--- a/dubbo-admin-ui/src/components/traffic/Accesslog.vue
+++ b/dubbo-admin-ui/src/components/traffic/Accesslog.vue
@@ -228,12 +228,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.application) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       this.$axios.get('/traffic/accesslog', {
@@ -251,16 +246,26 @@ export default {
       })
     },
     saveUpdate () {
-      console.log(this.updateAccesslog)
       this.updateDialog = false
-      this.$axios.put('/traffic/accesslog', {
-        application: this.updateApplication,
-        accesslog: this.handleUpdateAccesslog ? this.updateAccesslog : 'false'
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (this.handleUpdateAccesslog) {
+        this.$axios.put('/traffic/accesslog', {
+          application: this.updateApplication,
+          accesslog: this.updateAccesslog === '' ? 'true' : 
this.updateAccesslog
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      } else {
+        this.$axios.put('/traffic/accesslog', {
+          application: this.updateApplication,
+          accesslog: '' // 删除
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      }
     },
     setHeaders: function () {
       this.headers = [
@@ -309,21 +314,14 @@ export default {
       if (this.handleAccesslog) {
         this.$axios.post('/traffic/accesslog', {
           application: this.createApplication,
-          accesslog: this.createAccesslog
+          accesslog: this.createAccesslog === '' ? 'true' : 
this.createAccesslog
         }).then((res) => {
           if (res) {
             alert('操作成功')
           }
         })
       } else {
-        this.$axios.post('/traffic/accesslog', {
-          application: this.createApplication,
-          accesslog: this.handleAccesslog.toString()
-        }).then((res) => {
-          if (res) {
-            alert('操作成功')
-          }
-        })
+        alert('访问日志未开启,请选中开关后再保存!')
       }
       this.dialog = false
     },
diff --git a/dubbo-admin-ui/src/components/traffic/Arguments.vue 
b/dubbo-admin-ui/src/components/traffic/Arguments.vue
index 0d0de27a..1e4b9ae6 100644
--- a/dubbo-admin-ui/src/components/traffic/Arguments.vue
+++ b/dubbo-admin-ui/src/components/traffic/Arguments.vue
@@ -123,6 +123,11 @@
             ></v-text-field>
           </v-flex>
         </v-layout>
+        <v-layout wrap>
+          <v-flex lg12>
+            符合以下条件的参数调用:
+          </v-flex>
+        </v-layout>
         <v-layout wrap>
           <v-flex xs6 sm3 md2>
             <v-text-field
@@ -147,6 +152,20 @@
             ></v-text-field>
           </v-flex>
         </v-layout>
+        <v-layout wrap>
+          <v-flex lg12>
+            将被路由到符合以下条件的目标机器上:
+          </v-flex>
+        </v-layout>
+        <v-layout wrap>
+          <v-flex xs6 sm3 md5>
+            <v-text-field
+              label="输入目标机器过滤条件"
+              hint="可以使用 URL 上的任意参数进行匹配,如 orderVersion=v2 & 
region=hangzhou,具体可参见文档说明。"
+              v-model="createFilterCondition"
+            ></v-text-field>
+          </v-flex>
+        </v-layout>
       </v-card-text>
       <v-card-actions>
         <v-spacer></v-spacer>
@@ -189,6 +208,11 @@
             ></v-text-field>
            </v-flex>
         </v-layout>
+        <v-layout wrap>
+          <v-flex lg12>
+            符合以下条件的参数调用:
+          </v-flex>
+        </v-layout>
         <v-layout wrap>
           <v-flex xs6 sm3 md2>
             <v-text-field
@@ -213,6 +237,20 @@
             ></v-text-field>
           </v-flex>
         </v-layout>
+        <v-layout wrap>
+          <v-flex lg12>
+            将被路由到符合以下条件的目标机器上:
+          </v-flex>
+        </v-layout>
+        <v-layout wrap>
+          <v-flex xs6 sm3 md5>
+            <v-text-field
+              label="输入目标机器过滤条件"
+              hint="可以是使用 URL 上的任意参数进行匹配,如 orderVersion=v2 & 
region=hangzhou,具体可参见文档说明。"
+              v-model="updateFilterCondition"
+            ></v-text-field>
+          </v-flex>
+        </v-layout>
       </v-card-text>
       <v-card-actions>
         <v-spacer></v-spacer>
@@ -280,10 +318,12 @@ export default {
     createRuleMethod: '',
     createRuleIndex: '',
     createRuleMatch: '',
+    createFilterCondition: '',
     updateService: '',
     updateRuleMethod: '',
     updateRuleIndex: '',
     updateRuleMatch: '',
+    updateFilterCondition: '',
     updateGroup: '',
     updateVersion: '',
     deleteDialog: false,
@@ -303,12 +343,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       this.$axios.get('/traffic/argument', {
@@ -327,16 +362,22 @@ export default {
     },
     saveUpdate () {
       this.updateDialog = false
-      this.$axios.put('/traffic/argument', {
-        service: this.updateService,
-        rule: 
`${this.updateRuleMethod}[${this.updateRuleIndex}]=${this.updateRuleMatch}`,
-        group: this.updateGroup,
-        version: this.updateVersion
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (!this.updateRuleMethod || !this.updateRuleMatch || 
!this.updateRuleIndex || !this.updateFilterCondition) {
+        alert('请分别输入方法匹配条件和机器过滤条件')
+      } else {
+        const matchCondition = `method=${this.updateRuleMethod} & 
arguments[${this.updateRuleIndex}]=${this.updateRuleMatch}`
+        const filterCondition = ` => ${this.updateFilterCondition}`
+        this.$axios.put('/traffic/argument', {
+          service: this.updateService,
+          rule: matchCondition + filterCondition,
+          group: this.updateGroup,
+          version: this.updateVersion
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      }
     },
     setHeaders: function () {
       this.headers = [
@@ -398,9 +439,14 @@ export default {
       this.updateDialog = true
     },
     save () {
+      // if (!this.createRuleMethod || !this.createRuleMatch || 
!this.createRuleIndex || !this.createFilterCondition) {
+      //  alert('请分别输入方法匹配条件和机器过滤条件')
+      // } else {
+      const matchCondition = `method=${this.createRuleMethod} & 
arguments[${this.createRuleIndex}]=${this.createRuleMatch}`
+      const filterCondition = ` => ${this.createFilterCondition}`
       this.$axios.post('/traffic/argument', {
         service: this.createService,
-        rule: 
`${this.createRuleMethod}[${this.createRuleIndex}]=${this.createRuleMatch}`,
+        rule: matchCondition + filterCondition,
         group: this.createGroup,
         version: this.createVersion
       }).then((res) => {
@@ -408,6 +454,7 @@ export default {
           alert('操作成功')
         }
       })
+      // }
       this.dialog = false
     },
     closeDialog () {
diff --git a/dubbo-admin-ui/src/components/traffic/Gray.vue 
b/dubbo-admin-ui/src/components/traffic/Gray.vue
index b53a82b0..75200c96 100644
--- a/dubbo-admin-ui/src/components/traffic/Gray.vue
+++ b/dubbo-admin-ui/src/components/traffic/Gray.vue
@@ -370,12 +370,7 @@ export default {
       this.updateGary.tags[index].match[idx].value = temp
     },
     submit () {
-      if (this.application) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     addCreateGary () {
       const temp = {
@@ -454,8 +449,8 @@ export default {
         }
       }).then(response => {
         this.tableData = []
-        const array = []
         response.data.forEach(element => {
+          const array = []
           element.tags.forEach(item => {
             array.push(item.name)
           })
@@ -468,7 +463,6 @@ export default {
           }
           this.tableData.push(result)
         })
-        console.log(this.tableData)
       })
     },
     saveUpdate () {
diff --git a/dubbo-admin-ui/src/components/traffic/Mock.vue 
b/dubbo-admin-ui/src/components/traffic/Mock.vue
index cb96104f..a1d28875 100644
--- a/dubbo-admin-ui/src/components/traffic/Mock.vue
+++ b/dubbo-admin-ui/src/components/traffic/Mock.vue
@@ -285,12 +285,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       console.log('mock: force:return Mock 
Comment'.split(/:\s(.*?):(.*)/)[2].replace(/^return\s/, ''))
@@ -313,7 +308,7 @@ export default {
       this.updateDialog = false
       this.$axios.put('/traffic/mock', {
         service: this.updateService,
-        mock: `${this.mockUpdateMethod === '失败时返回' ? `mock: fail:return 
${this.updateMock}` : `mock: force:return ${this.updateMock}`}`,
+        mock: `${this.mockUpdateMethod === '失败时返回' ? `fail:return 
${this.updateMock}` : `force:return ${this.updateMock}`}`,
         group: this.updateGroup,
         version: this.updateVersion
       }).then((res) => {
diff --git a/dubbo-admin-ui/src/components/traffic/Region.vue 
b/dubbo-admin-ui/src/components/traffic/Region.vue
index 0cd7f0d2..ea3cf0ae 100644
--- a/dubbo-admin-ui/src/components/traffic/Region.vue
+++ b/dubbo-admin-ui/src/components/traffic/Region.vue
@@ -129,8 +129,8 @@
         <v-layout v-if="handleRule" row wrap>
           <v-flex xs6 sm3 md5>
             <v-text-field
-               label="(可选)同区域规则已开启,可继续输入过滤条件"
-               hint="如果要过滤部分匹配流量才执行同区域规则,请继续输入匹配条件。如 method=sayHello & 
key=value 表示只有匹配 method、key 的流量才执行同区域优先。"
+               label="请输入表示同区域的 key 值"
+               
hint="每个公司的区域标识可能不同,比如对于以下地址:tri://host:port/service?timeout=1000&region=hangzhou&...,则同区域key值为:region。"
                v-model="createRule"
              ></v-text-field>
           </v-flex>
@@ -183,8 +183,8 @@
         <v-layout v-if="handleUpdateRule" row wrap>
           <v-flex xs6 sm3 md5>
             <v-text-field
-              label="(可选)同区域规则已开启,可继续输入过滤条件"
-              hint="如果要过滤部分匹配流量才执行同区域规则,请继续输入匹配条件。如 method=sayHello & 
key=value 表示只有匹配 method、key 的流量才执行同区域优先。"
+              label="请输入表示同区域的 key 值"
+              
hint="每个公司的区域标识可能不同,比如对于以下地址:tri://host:port/service?timeout=1000&region=hangzhou&...,则同区域key值为:region。"
               v-model="updateRule"
         ></v-text-field>
           </v-flex>
@@ -277,12 +277,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       this.$axios.get('/traffic/region', {
@@ -315,7 +310,7 @@ export default {
       } else {
         this.$axios.put('/traffic/region', {
           service: this.updateService,
-          rule: this.handleUpdateRule.toString(),
+          rule: '',
           group: this.updateGroup,
           version: this.updateVersion
         }).then((res) => {
@@ -332,7 +327,7 @@ export default {
           value: 'service'
         },
         {
-          text: '同区域(状态)',
+          text: '同区域Key',
           value: 'rule'
         },
         {
@@ -401,16 +396,7 @@ export default {
           }
         })
       } else {
-        this.$axios.post('/traffic/region', {
-          service: this.createService,
-          rule: this.handleRule.toString(),
-          group: this.createGroup,
-          version: this.createVersion
-        }).then((res) => {
-          if (res) {
-            alert('操作成功')
-          }
-        })
+        alert('同区域优先未开启,请选中开关后再保存!')
       }
       this.dialog = false
     },
diff --git a/dubbo-admin-ui/src/components/traffic/Retry.vue 
b/dubbo-admin-ui/src/components/traffic/Retry.vue
index 8b4937d8..00c007cd 100644
--- a/dubbo-admin-ui/src/components/traffic/Retry.vue
+++ b/dubbo-admin-ui/src/components/traffic/Retry.vue
@@ -270,12 +270,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       this.$axios.get('/traffic/retry', {
@@ -294,17 +289,21 @@ export default {
     },
     saveUpdate () {
       this.updateDialog = false
-      this.$axios.put('/traffic/retry', {
-        service: this.updateService,
-        retry: parseInt(this.updateRetry),
-        group: this.updateGroup,
-        version: this.updateVersion
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-        this.search()
-      })
+      if (this.updateRetry) {
+        this.$axios.put('/traffic/retry', {
+          service: this.updateService,
+          retry: parseInt(this.updateRetry),
+          group: this.updateGroup,
+          version: this.updateVersion
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+          this.search()
+        })
+      } else {
+        alert('请输入重试值')
+      }
     },
     setHeaders: function () {
       this.headers = [
@@ -363,16 +362,20 @@ export default {
       this.updateDialog = true
     },
     save () {
-      this.$axios.post('/traffic/retry', {
-        service: this.createService,
-        retry: parseInt(this.createRetry),
-        group: this.createGroup,
-        version: this.createVersion
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (this.createRetry) {
+        this.$axios.post('/traffic/retry', {
+          service: this.createService,
+          retry: parseInt(this.createRetry),
+          group: this.createGroup,
+          version: this.createVersion
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      } else {
+        alert('请输入重试值')
+      }
       this.dialog = false
     },
     closeDialog () {
diff --git a/dubbo-admin-ui/src/components/traffic/Timeout.vue 
b/dubbo-admin-ui/src/components/traffic/Timeout.vue
index 87e7fcc7..29de587a 100644
--- a/dubbo-admin-ui/src/components/traffic/Timeout.vue
+++ b/dubbo-admin-ui/src/components/traffic/Timeout.vue
@@ -174,6 +174,7 @@
               v-model="updateVersion"
             ></v-text-field>
           </v-flex>
+         </v-layout>
         <v-layout wrap>
           <v-flex style="margin-left: 10px;" xs6 sm3 md2>
               <v-text-field
@@ -270,12 +271,7 @@ export default {
   }),
   methods: {
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     search () {
       this.$axios.get('/traffic/timeout', {
@@ -294,16 +290,20 @@ export default {
     },
     saveUpdate () {
       this.updateDialog = false
-      this.$axios.put('/traffic/timeout', {
-        service: this.updateService,
-        timeout: parseInt(this.updateTimeout),
-        group: this.updateGroup,
-        version: this.updateVersion
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (this.updateTimeout) {
+        this.$axios.put('/traffic/timeout', {
+          service: this.updateService,
+          timeout: parseInt(this.updateTimeout),
+          group: this.updateGroup,
+          version: this.updateVersion
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      } else {
+        alert('请输入超时时间')
+      }
     },
     setHeaders: function () {
       this.headers = [
@@ -363,16 +363,20 @@ export default {
       this.updateDialog = true
     },
     save () {
-      this.$axios.post('/traffic/timeout', {
-        service: this.createService,
-        timeout: parseInt(this.createTimeout),
-        group: this.createGroup,
-        version: this.createVersion
-      }).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (this.createTimeout) {
+        this.$axios.post('/traffic/timeout', {
+          service: this.createService,
+          timeout: parseInt(this.createTimeout),
+          group: this.createGroup,
+          version: this.createVersion
+        }).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      } else {
+        alert('请输入超时时间')
+      }
       this.dialog = false
     },
     closeDialog () {
diff --git a/dubbo-admin-ui/src/components/traffic/Weight.vue 
b/dubbo-admin-ui/src/components/traffic/Weight.vue
index 0574a296..c779ac7d 100644
--- a/dubbo-admin-ui/src/components/traffic/Weight.vue
+++ b/dubbo-admin-ui/src/components/traffic/Weight.vue
@@ -427,12 +427,7 @@ export default {
       this.updateWeight.weights[index].match[idx].value = temp
     },
     submit () {
-      if (this.service) {
-        this.search()
-      } else {
-        this.$notify.error('service is needed')
-        return false
-      }
+      this.search()
     },
     addCreateWeight () {
       const temp = {
@@ -536,12 +531,16 @@ export default {
     },
     saveUpdate () {
       this.updateDialog = false
-      this.$axios.put('/traffic/weight', this.updateWeight).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
-      this.search()
+      if (this.updateWeight) {
+        this.$axios.put('/traffic/weight', this.updateWeight).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+        this.search()
+      } else {
+        alert('请输入权重值')
+      }
     },
     setHeaders: function () {
       this.headers = [
@@ -608,12 +607,15 @@ export default {
       this.updateDialog = true
     },
     save () {
-      console.log(this.createWeight)
-      this.$axios.post('/traffic/weight', this.createWeight).then((res) => {
-        if (res) {
-          alert('操作成功')
-        }
-      })
+      if (this.createWeight) {
+        this.$axios.post('/traffic/weight', this.createWeight).then((res) => {
+          if (res) {
+            alert('操作成功')
+          }
+        })
+      } else {
+        alert('请输入权重值')
+      }
       this.dialog = false
     },
     closeDialog () {
diff --git a/pkg/admin/model/condition_route.go 
b/pkg/admin/model/condition_route.go
index bb70fea0..7f2b53a0 100644
--- a/pkg/admin/model/condition_route.go
+++ b/pkg/admin/model/condition_route.go
@@ -33,7 +33,7 @@ type ConditionRoute struct {
        Priority      int      `json:"priority" yaml:"priority,omitempty"`
        Enabled       bool     `json:"enabled" yaml:"enabled"`
        Force         bool     `json:"force" yaml:"force"`
-       Runtime       bool     `json:"runtime" yaml:"runtime"`
+       Runtime       bool     `json:"runtime" yaml:"runtime,omitempty"`
        Key           string   `json:"key" yaml:"key"`
        Scope         string   `json:"scope" yaml:"scope"`
        Conditions    []string `json:"conditions" yaml:"conditions"`
diff --git a/pkg/admin/model/match.go b/pkg/admin/model/match.go
index 4e1a5236..48eaa69e 100644
--- a/pkg/admin/model/match.go
+++ b/pkg/admin/model/match.go
@@ -31,9 +31,9 @@ type ConditionMatch struct {
 }
 
 type AddressMatch struct {
-       Wildcard string `json:"wildcard" yaml:"wildcard"`
-       Cird     string `json:"cird" yaml:"cird"`
-       Exact    string `json:"exact" yaml:"exact"`
+       Wildcard string `json:"wildcard" yaml:"wildcard,omitempty"`
+       Cird     string `json:"cird" yaml:"cird,omitempty"`
+       Exact    string `json:"exact" yaml:"exact,omitempty"`
 }
 
 func (m *AddressMatch) IsMatch(input string) bool {
@@ -67,7 +67,7 @@ func (m *ParamMatch) IsMatch(url *common.URL) bool {
 }
 
 type ListStringMatch struct {
-       Oneof []StringMatch `json:"oneof" yaml:"oneof"`
+       Oneof []StringMatch `json:"oneof" yaml:"oneof,omitempty"`
 }
 
 func (l *ListStringMatch) IsMatch(input string) bool {
@@ -80,12 +80,12 @@ func (l *ListStringMatch) IsMatch(input string) bool {
 }
 
 type StringMatch struct {
-       Exact    string `json:"exact" yaml:"exact"`
-       Prefix   string `json:"prefix" yaml:"prefix"`
-       Regex    string `json:"regex" yaml:"regex"`
-       Noempty  string `json:"noempty" yaml:"noempty"`
-       Empty    string `json:"empty" yaml:"empty"`
-       Wildcard string `json:"wildcard" yaml:"wildcard"`
+       Exact    string `json:"exact" yaml:"exact,omitempty"`
+       Prefix   string `json:"prefix" yaml:"prefix,omitempty"`
+       Regex    string `json:"regex" yaml:"regex,omitempty"`
+       Noempty  string `json:"noempty" yaml:"noempty,omitempty"`
+       Empty    string `json:"empty" yaml:"empty,omitempty"`
+       Wildcard string `json:"wildcard" yaml:"wildcard,omitempty"`
 }
 
 func (m *StringMatch) IsMatch(input string) bool {
diff --git a/pkg/admin/model/tag_route.go b/pkg/admin/model/tag_route.go
index 2760281f..958b41b4 100644
--- a/pkg/admin/model/tag_route.go
+++ b/pkg/admin/model/tag_route.go
@@ -22,10 +22,10 @@ type TagRouteDto struct {
 
        Tags []Tag `json:"tags" yaml:"tags" binding:"required"`
 
-       Priority      int    `json:"priority" yaml:"priority"`
+       Priority      int    `json:"priority" yaml:"priority,omitempty"`
        Enabled       bool   `json:"enabled" yaml:"enabled" binding:"required"`
        Force         bool   `json:"force" yaml:"force"`
-       Runtime       bool   `json:"runtime" yaml:"runtime"`
+       Runtime       bool   `json:"runtime" yaml:"runtime,omitempty"`
        ConfigVersion string `json:"configVersion" yaml:"configVersion" 
binding:"required"`
 }
 
@@ -33,7 +33,7 @@ type TagRoute struct {
        Priority      int    `json:"priority" yaml:"priority,omitempty"`
        Enabled       bool   `json:"enabled" yaml:"enabled"`
        Force         bool   `json:"force" yaml:"force"`
-       Runtime       bool   `json:"runtime" yaml:"runtime"`
+       Runtime       bool   `json:"runtime" yaml:"runtime,omitempty"`
        Key           string `json:"key" yaml:"key"`
        Tags          []Tag  `json:"tags" yaml:"tags"`
        ConfigVersion string `json:"configVersion" yaml:"configVersion"`
diff --git a/pkg/admin/model/traffic.go b/pkg/admin/model/traffic.go
index 21d3ed6b..b8b36627 100644
--- a/pkg/admin/model/traffic.go
+++ b/pkg/admin/model/traffic.go
@@ -19,9 +19,11 @@ package model
 
 import (
        "github.com/apache/dubbo-admin/pkg/admin/util"
+       "strings"
 )
 
-const AdminIdentifier string = "& admin_rule!=false"
+const RegionAdminIdentifier string = " & region_admin_rule!=false"
+const ArgumentAdminIdentifier string = " & arg_admin_rule!=false"
 
 type Timeout struct {
        Service string `json:"service" binding:"required"`
@@ -66,7 +68,7 @@ func (t Retry) ToRule() Override {
 
 type Accesslog struct {
        Application string `json:"application" binding:"required"`
-       Accesslog   string `json:"accesslog" binding:"required"`
+       Accesslog   string `json:"accesslog"`
 }
 
 func (t Accesslog) ToRule() Override {
@@ -86,7 +88,7 @@ type Region struct {
        Service string `json:"service" binding:"required"`
        Group   string `json:"group"`
        Version string `json:"version"`
-       Rule    string `json:"rule" binding:"required"`
+       Rule    string `json:"rule"`
 }
 
 func (r Region) ToRule() ConditionRoute {
@@ -97,7 +99,7 @@ func (r Region) ToRule() ConditionRoute {
                Key:           r.Service,
                Scope:         "service",
                ConfigVersion: "v3.0",
-               Conditions:    []string{r.Rule + AdminIdentifier},
+               Conditions:    []string{strings.Join([]string{"=> ", r.Rule, 
"=$", r.Rule, RegionAdminIdentifier}, "")},
        }
 }
 
@@ -132,7 +134,7 @@ func (r Argument) ToRule() ConditionRoute {
                Key:           r.Service,
                Scope:         "service",
                ConfigVersion: "v3.0",
-               Conditions:    []string{r.Rule + AdminIdentifier},
+               Conditions:    []string{r.Rule + ArgumentAdminIdentifier},
        }
 }
 
diff --git a/pkg/admin/services/prometheus_service_impl.go 
b/pkg/admin/services/prometheus_service_impl.go
index d2b222ff..722f2519 100644
--- a/pkg/admin/services/prometheus_service_impl.go
+++ b/pkg/admin/services/prometheus_service_impl.go
@@ -236,7 +236,7 @@ func (p *PrometheusServiceImpl) Metadata() (model.Metadata, 
error) {
        metadata.ConfigCenter = config.RegistryCenter.GetURL().Location
 
        // rules
-       rules, err := GetRules("")
+       rules, err := GetRules("", "*")
        if err != nil {
                return model.Metadata{}, err
        }
diff --git a/pkg/admin/services/route_service_impl.go 
b/pkg/admin/services/route_service_impl.go
index a51c3b44..170669ea 100644
--- a/pkg/admin/services/route_service_impl.go
+++ b/pkg/admin/services/route_service_impl.go
@@ -271,7 +271,7 @@ func detachId(id string) []string {
        }
 }
 
-func GetRules(con string) (map[string]string, error) {
+func GetRules(con string, ruleType string) (map[string]string, error) {
        list := make(map[string]string)
        if con == "" || con == "*" {
                rules, err := config.Governance.GetList("dubbo")
@@ -279,7 +279,12 @@ func GetRules(con string) (map[string]string, error) {
                        logger.Infof("No rule found from config center, err msg 
is %s", err.Error())
                        return list, nil
                }
-               list = rules
+
+               for k, v := range rules {
+                       if ruleType == "*" || strings.HasSuffix(k, ruleType) {
+                               list[k] = v
+                       }
+               }
        } else {
                key := GetOverridePath(con)
                rule, err := config.Governance.GetConfig(key)
diff --git a/pkg/admin/services/traffic/accesslog.go 
b/pkg/admin/services/traffic/accesslog.go
index d78d839a..edd3dc14 100644
--- a/pkg/admin/services/traffic/accesslog.go
+++ b/pkg/admin/services/traffic/accesslog.go
@@ -18,8 +18,10 @@
 package traffic
 
 import (
+       "github.com/apache/dubbo-admin/pkg/admin/constant"
        "github.com/apache/dubbo-admin/pkg/admin/model"
        "github.com/apache/dubbo-admin/pkg/admin/services"
+       "gopkg.in/yaml.v2"
 )
 
 type AccesslogService struct{}
@@ -29,7 +31,13 @@ func (tm *AccesslogService) CreateOrUpdate(a 
*model.Accesslog) error {
        key := services.GetOverridePath(a.Application)
        newRule := a.ToRule()
 
-       err := createOrUpdateOverride(key, "provider", "accesslog", newRule)
+       var err error
+       if a.Accesslog == "" {
+               err = tm.Delete(a)
+       } else {
+               err = createOrUpdateOverride(key, "provider", "accesslog", 
newRule)
+       }
+
        return err
 }
 
@@ -45,21 +53,27 @@ func (tm *AccesslogService) Delete(a *model.Accesslog) 
error {
 func (tm *AccesslogService) Search(a *model.Accesslog) ([]*model.Accesslog, 
error) {
        result := make([]*model.Accesslog, 0)
 
-       list, err := services.GetRules(a.Application)
+       list, err := services.GetRules(a.Application, 
constant.ConfiguratorRuleSuffix)
        if err != nil {
                return result, err
        }
 
        for _, v := range list {
-               accesslog := &model.Accesslog{
-                       Application: a.Application,
-               }
                alv, err2 := getValue(v, "provider", "accesslog")
                if err2 != nil {
                        return result, err2
                }
-               accesslog.Accesslog = alv.(string)
-               result = append(result, accesslog)
+
+               override := &model.Override{}
+               err = yaml.Unmarshal([]byte(v), override)
+
+               if alv != nil {
+                       accesslog := &model.Accesslog{
+                               Application: override.Key,
+                       }
+                       accesslog.Accesslog = alv.(string)
+                       result = append(result, accesslog)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/argument.go 
b/pkg/admin/services/traffic/argument.go
index 0623b64c..6872caaa 100644
--- a/pkg/admin/services/traffic/argument.go
+++ b/pkg/admin/services/traffic/argument.go
@@ -40,7 +40,7 @@ func (tm *ArgumentService) CreateOrUpdate(a *model.Argument) 
error {
 
 func (tm *ArgumentService) Delete(a *model.Argument) error {
        key := services.GetRoutePath(util.ColonSeparatedKey(a.Service, a.Group, 
a.Version), constant.ConditionRoute)
-       err2 := removeCondition(key, a.Rule)
+       err2 := removeCondition(key, a.Rule, model.RegionAdminIdentifier)
        if err2 != nil {
                return err2
        }
@@ -51,11 +51,11 @@ func (tm *ArgumentService) Search(a *model.Argument) 
([]*model.Argument, error)
        result := make([]*model.Argument, 0)
 
        var con string
-       if a.Service != "" {
+       if a.Service != "" && a.Service != "*" {
                con = util.ColonSeparatedKey(a.Service, a.Group, a.Version)
        }
 
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConditionRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -65,8 +65,6 @@ func (tm *ArgumentService) Search(a *model.Argument) 
([]*model.Argument, error)
                split := strings.Split(k, ":")
                argument := &model.Argument{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
                }
 
                route := &model.ConditionRoute{}
@@ -76,13 +74,15 @@ func (tm *ArgumentService) Search(a *model.Argument) 
([]*model.Argument, error)
                }
                for _, c := range route.Conditions {
                        // fixme, regex match
-                       if strings.Contains(c, model.AdminIdentifier) {
-                               argument.Rule = c
+                       if i := strings.Index(c, 
model.ArgumentAdminIdentifier); i > 0 {
+                               argument.Rule = strings.TrimSpace(c[0:i])
                                break
                        }
                }
 
-               result = append(result, argument)
+               if argument.Rule != "" {
+                       result = append(result, argument)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/generic_rule_operation.go 
b/pkg/admin/services/traffic/generic_rule_operation.go
index 90228d61..61f92d17 100644
--- a/pkg/admin/services/traffic/generic_rule_operation.go
+++ b/pkg/admin/services/traffic/generic_rule_operation.go
@@ -23,6 +23,7 @@ import (
        "github.com/apache/dubbo-admin/pkg/logger"
        perrors "github.com/pkg/errors"
        "gopkg.in/yaml.v2"
+       "strings"
 )
 
 func removeFromOverride(key, side, param string) error {
@@ -162,15 +163,15 @@ func getValue(rawRule, side, param string) (interface{}, 
error) {
        override := &model.Override{}
        err := yaml.Unmarshal([]byte(rawRule), override)
        if err != nil {
-               return "", err
+               return nil, err
        }
        for _, c := range override.Configs {
-               if c.Side == side && c.Parameters[param] != "" {
+               if c.Side == side && c.Parameters[param] != nil {
                        return c.Parameters[param], nil
                }
        }
 
-       return "", nil
+       return nil, nil
 }
 
 func createOrUpdateCondition(key string, newRule model.ConditionRoute) error {
@@ -226,7 +227,7 @@ func createOrUpdateCondition(key string, newRule 
model.ConditionRoute) error {
        return nil
 }
 
-func removeCondition(key, rule string) error {
+func removeCondition(key, rule string, identifier string) error {
        oldRule, err := config.Governance.GetConfig(key)
        if err != nil {
                return err
@@ -243,7 +244,7 @@ func removeCondition(key, rule string) error {
                return err
        }
        for i, c := range route.Conditions {
-               if c == rule {
+               if strings.Contains(c, identifier) {
                        route.Conditions = append(route.Conditions[:i], 
route.Conditions[i+1:]...)
                        break
                }
diff --git a/pkg/admin/services/traffic/gray.go 
b/pkg/admin/services/traffic/gray.go
index c8235666..37ab35c1 100644
--- a/pkg/admin/services/traffic/gray.go
+++ b/pkg/admin/services/traffic/gray.go
@@ -47,23 +47,25 @@ func (tm *GrayService) Delete(g *model.Gray) error {
 func (tm *GrayService) Search(g *model.Gray) ([]*model.Gray, error) {
        result := make([]*model.Gray, 0)
 
-       list, err := services.GetRules(g.Application)
+       list, err := services.GetRules(g.Application, constant.TagRuleSuffix)
        if err != nil {
                return result, err
        }
 
        for _, v := range list {
-               gray := &model.Gray{
-                       Application: g.Application,
-               }
-
                route := &model.TagRoute{}
                err = yaml.Unmarshal([]byte(v), route)
                if err != nil {
                        return result, err
                }
-               gray.Tags = route.Tags
-               result = append(result, gray)
+
+               if len(route.Tags) > 0 {
+                       gray := &model.Gray{
+                               Application: route.Key,
+                       }
+                       gray.Tags = route.Tags
+                       result = append(result, gray)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/mock.go 
b/pkg/admin/services/traffic/mock.go
index 18de8e72..bcdac0e9 100644
--- a/pkg/admin/services/traffic/mock.go
+++ b/pkg/admin/services/traffic/mock.go
@@ -50,10 +50,10 @@ func (tm *MockService) Search(m *model.Mock) 
([]*model.Mock, error) {
        result := make([]*model.Mock, 0)
 
        var con string
-       if m.Service != "" {
+       if m.Service != "" && m.Service != "*" {
                con = util.ColonSeparatedKey(m.Service, m.Group, m.Version)
        }
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConfiguratorRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -63,15 +63,22 @@ func (tm *MockService) Search(m *model.Mock) 
([]*model.Mock, error) {
                split := strings.Split(k, ":")
                mock := &model.Mock{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
                }
+               if len(split) >= 2 {
+                       mock.Version = split[1]
+               }
+               if len(split) >= 3 {
+                       mock.Group = split[2]
+               }
+
                mv, err2 := getValue(v, "consumer", "mock")
                if err2 != nil {
                        return result, err2
                }
-               mock.Mock = mv.(string)
-               result = append(result, mock)
+               if mv != nil {
+                       mock.Mock = mv.(string)
+                       result = append(result, mock)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/region.go 
b/pkg/admin/services/traffic/region.go
index 95f0032e..5705b2d4 100644
--- a/pkg/admin/services/traffic/region.go
+++ b/pkg/admin/services/traffic/region.go
@@ -34,13 +34,19 @@ func (tm *RegionService) CreateOrUpdate(r *model.Region) 
error {
        key := services.GetRoutePath(util.ColonSeparatedKey(r.Service, r.Group, 
r.Version), constant.ConditionRoute)
        newRule := r.ToRule()
 
-       err := createOrUpdateCondition(key, newRule)
+       var err error
+       if r.Rule == "" {
+               err = tm.Delete(r)
+       } else {
+               err = createOrUpdateCondition(key, newRule)
+       }
+
        return err
 }
 
 func (tm *RegionService) Delete(r *model.Region) error {
        key := services.GetRoutePath(util.ColonSeparatedKey(r.Service, r.Group, 
r.Version), constant.ConditionRoute)
-       err2 := removeCondition(key, r.Rule)
+       err2 := removeCondition(key, r.Rule, model.RegionAdminIdentifier)
        if err2 != nil {
                return err2
        }
@@ -51,11 +57,11 @@ func (tm *RegionService) Search(r *model.Region) 
([]*model.Region, error) {
        result := make([]*model.Region, 0)
 
        var con string
-       if r.Service != "" {
+       if r.Service != "" && r.Service != "*" {
                con = util.ColonSeparatedKey(r.Service, r.Group, r.Version)
        }
 
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConditionRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -65,8 +71,12 @@ func (tm *RegionService) Search(r *model.Region) 
([]*model.Region, error) {
                split := strings.Split(k, ":")
                region := &model.Region{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
+               }
+               if len(split) >= 2 {
+                       region.Version = split[1]
+               }
+               if len(split) >= 3 {
+                       region.Group = split[2]
                }
 
                route := &model.ConditionRoute{}
@@ -76,13 +86,18 @@ func (tm *RegionService) Search(r *model.Region) 
([]*model.Region, error) {
                }
                for _, c := range route.Conditions {
                        // fixme, regex match
-                       if strings.Contains(c, model.AdminIdentifier) {
-                               region.Rule = c
-                               break
+                       if strings.Contains(c, model.RegionAdminIdentifier) {
+                               i := strings.Index(c, "=$")
+                               if i > 3 {
+                                       region.Rule = strings.TrimSpace(c[3:i])
+                                       break
+                               }
                        }
                }
 
-               result = append(result, region)
+               if region.Rule != "" {
+                       result = append(result, region)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/retry.go 
b/pkg/admin/services/traffic/retry.go
index 5b663b33..15b73c3c 100644
--- a/pkg/admin/services/traffic/retry.go
+++ b/pkg/admin/services/traffic/retry.go
@@ -50,11 +50,11 @@ func (tm *RetryService) Search(r *model.Retry) 
([]*model.Retry, error) {
        result := make([]*model.Retry, 0)
 
        var con string
-       if r.Service != "" {
+       if r.Service != "" && r.Service != "*" {
                con = util.ColonSeparatedKey(r.Service, r.Group, r.Version)
        }
 
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConfiguratorRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -64,15 +64,22 @@ func (tm *RetryService) Search(r *model.Retry) 
([]*model.Retry, error) {
                split := strings.Split(k, ":")
                retry := &model.Retry{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
                }
+               if len(split) >= 2 {
+                       retry.Version = split[1]
+               }
+               if len(split) >= 3 {
+                       retry.Group = split[2]
+               }
+
                rv, err2 := getValue(v, "consumer", "retries")
                if err2 != nil {
                        return result, err2
                }
-               retry.Retry = rv.(int)
-               result = append(result, retry)
+               if rv != nil {
+                       retry.Retry = rv.(int)
+                       result = append(result, retry)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/timeout.go 
b/pkg/admin/services/traffic/timeout.go
index 91b22bd3..f17e4ca8 100644
--- a/pkg/admin/services/traffic/timeout.go
+++ b/pkg/admin/services/traffic/timeout.go
@@ -50,11 +50,11 @@ func (tm *TimeoutService) Search(t *model.Timeout) 
([]*model.Timeout, error) {
        result := make([]*model.Timeout, 0)
 
        var con string
-       if t.Service != "" {
+       if t.Service != "" && t.Service != "*" {
                con = util.ColonSeparatedKey(t.Service, t.Group, t.Version)
        }
 
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConfiguratorRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -62,17 +62,26 @@ func (tm *TimeoutService) Search(t *model.Timeout) 
([]*model.Timeout, error) {
        for k, v := range list {
                k, _ = strings.CutSuffix(k, constant.ConfiguratorRuleSuffix)
                split := strings.Split(k, ":")
+
                t := &model.Timeout{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
                }
+               if len(split) >= 2 {
+                       t.Version = split[1]
+               }
+               if len(split) >= 3 {
+                       t.Group = split[2]
+               }
+
                tv, err2 := getValue(v, "consumer", "timeout")
                if err2 != nil {
                        return result, err2
                }
-               t.Timeout = tv.(int)
-               result = append(result, t)
+
+               if tv != nil {
+                       t.Timeout = tv.(int)
+                       result = append(result, t)
+               }
        }
 
        return result, nil
diff --git a/pkg/admin/services/traffic/weight.go 
b/pkg/admin/services/traffic/weight.go
index 276ac71b..6384ba45 100644
--- a/pkg/admin/services/traffic/weight.go
+++ b/pkg/admin/services/traffic/weight.go
@@ -51,11 +51,11 @@ func (tm *WeightService) Search(p *model.Percentage) 
([]*model.Percentage, error
        result := make([]*model.Percentage, 0)
 
        var con string
-       if p.Service != "" {
+       if p.Service != "" && p.Service != "*" {
                con = util.ColonSeparatedKey(p.Service, p.Group, p.Version)
        }
 
-       list, err := services.GetRules(con)
+       list, err := services.GetRules(con, constant.ConfiguratorRuleSuffix)
        if err != nil {
                return result, err
        }
@@ -65,10 +65,14 @@ func (tm *WeightService) Search(p *model.Percentage) 
([]*model.Percentage, error
                split := strings.Split(k, ":")
                percentage := &model.Percentage{
                        Service: split[0],
-                       Group:   split[1],
-                       Version: split[2],
                        Weights: make([]model.Weight, 0),
                }
+               if len(split) >= 2 {
+                       percentage.Version = split[1]
+               }
+               if len(split) >= 3 {
+                       percentage.Group = split[2]
+               }
 
                override := &model.Override{}
                err = yaml.Unmarshal([]byte(v), override)
@@ -76,7 +80,7 @@ func (tm *WeightService) Search(p *model.Percentage) 
([]*model.Percentage, error
                        return result, err
                }
                for _, c := range override.Configs {
-                       if c.Side == "provider" && c.Parameters["weight"] != "" 
{
+                       if c.Side == "provider" && c.Parameters["weight"] != 
nil {
                                percentage.Weights = append(percentage.Weights, 
model.Weight{
                                        Weight: c.Parameters["weight"].(int),
                                        Match:  c.Match,
@@ -84,7 +88,9 @@ func (tm *WeightService) Search(p *model.Percentage) 
([]*model.Percentage, error
                        }
                }
 
-               result = append(result, percentage)
+               if len(percentage.Weights) > 0 {
+                       result = append(result, percentage)
+               }
        }
 
        return result, nil


Reply via email to