You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by mj...@apache.org on 2018/11/14 00:24:22 UTC

[incubator-dubbo-ops] branch develop updated: Optimization operation tips (#181)

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

mjk 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 7241d07   Optimization operation tips (#181)
7241d07 is described below

commit 7241d07ec8151ee7584ce8935b896080151af27a
Author: Zhiguo.Chen <ch...@live.com>
AuthorDate: Wed Nov 14 08:24:17 2018 +0800

     Optimization operation tips (#181)
    
    * Unify the window button style
    
    * Optimization operation tips
---
 .../src/components/governance/LoadBalance.vue      | 21 ++++++++-----
 .../src/components/governance/Overrides.vue        | 34 +++++++++++++++-------
 .../src/components/governance/RoutingRule.vue      | 31 +++++++++++++-------
 .../src/components/governance/WeightAdjust.vue     | 25 +++++++++++-----
 4 files changed, 76 insertions(+), 35 deletions(-)

diff --git a/dubbo-admin-frontend/src/components/governance/LoadBalance.vue b/dubbo-admin-frontend/src/components/governance/LoadBalance.vue
index a9fc1ea..15b2dd0 100644
--- a/dubbo-admin-frontend/src/components/governance/LoadBalance.vue
+++ b/dubbo-admin-frontend/src/components/governance/LoadBalance.vue
@@ -200,19 +200,23 @@
             balancing.id = this.updateId
             this.$axios.put('/rules/balancing/' + balancing.id, balancing)
               .then(response => {
-                this.search(this.service, true)
-                this.filter = this.service
-                this.closeDialog()
+                if (response.status === 200) {
+                  this.search(this.service, true)
+                  this.filter = this.service
+                  this.closeDialog()
+                  this.$notify.success('Update success')
+                }
               })
           }
         } else {
           this.$axios.post('/rules/balancing', balancing)
             .then(response => {
-              if (response.data) {
+              if (response.status === 201) {
                 this.search(this.service, true)
                 this.filter = this.service
+                this.closeDialog()
+                this.$notify.success('Create success')
               }
-              this.closeDialog()
             })
         }
       },
@@ -254,8 +258,11 @@
       deleteItem: function (id) {
         this.$axios.delete('/rules/balancing/' + id)
           .then(response => {
-            this.warn = false
-            this.search(this.filter, false)
+            if (response.status === 200) {
+              this.warn = false
+              this.search(this.filter, false)
+              this.$notify.success('Delete success')
+            }
           })
       }
     },
diff --git a/dubbo-admin-frontend/src/components/governance/Overrides.vue b/dubbo-admin-frontend/src/components/governance/Overrides.vue
index 94cb8ac..9c0c9e2 100644
--- a/dubbo-admin-frontend/src/components/governance/Overrides.vue
+++ b/dubbo-admin-frontend/src/components/governance/Overrides.vue
@@ -196,18 +196,23 @@
           } else {
             this.$axios.put('/rules/override/' + this.updateId, override)
               .then(response => {
-                this.search(this.service, true)
-                this.filter = this.service
+                if (response.status === 200) {
+                  this.search(this.service, true)
+                  this.filter = this.service
+                  this.$notify.success('Update success')
+                  this.closeDialog()
+                }
               })
           }
         } else {
           this.$axios.post('/rules/override', override)
             .then(response => {
-              if (response.data) {
+              if (response.status === 201) {
                 this.search(this.service, true)
                 this.filter = this.service
+                this.$notify.success('Create success')
+                this.closeDialog()
               }
-              this.closeDialog()
             })
         }
       },
@@ -262,20 +267,29 @@
         if (operation === 'delete') {
           this.$axios.delete('/rules/override/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Delete success')
+              }
             })
         } else if (operation === 'disable') {
           this.$axios.put('/rules/override/disable/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Disable success')
+              }
             })
         } else if (operation === 'enable') {
           this.$axios.put('/rules/override/enable/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Enable success')
+              }
             })
         }
       }
diff --git a/dubbo-admin-frontend/src/components/governance/RoutingRule.vue b/dubbo-admin-frontend/src/components/governance/RoutingRule.vue
index 51e322d..6a3f279 100644
--- a/dubbo-admin-frontend/src/components/governance/RoutingRule.vue
+++ b/dubbo-admin-frontend/src/components/governance/RoutingRule.vue
@@ -224,20 +224,22 @@
             rule.id = this.updateId
             this.$axios.put('/rules/route/' + rule.id, rule)
               .then(response => {
-                if (response.data) {
+                if (response.status === 200) {
                   this.search(this.service, true)
+                  this.closeDialog()
+                  this.$notify.success('Update success')
                 }
-                this.closeDialog()
               })
           }
         } else {
           this.$axios.post('/rules/route/', rule)
             .then(response => {
-              if (response.data) {
+              if (response.status === 201) {
                 this.search(this.service, true)
                 this.filter = this.service
+                this.closeDialog()
+                this.$notify.success('Create success')
               }
-              this.closeDialog()
             })
             .catch(error => {
               console.log(error)
@@ -299,20 +301,29 @@
         if (operation === 'delete') {
           this.$axios.delete('/rules/route/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Delete success')
+              }
             })
         } else if (operation === 'disable') {
           this.$axios.put('/rules/route/disable/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Disable success')
+              }
             })
         } else if (operation === 'enable') {
           this.$axios.put('/rules/route/enable/' + id)
             .then(response => {
-              this.warn = false
-              this.search(this.filter, false)
+              if (response.status === 200) {
+                this.warn = false
+                this.search(this.filter, false)
+                this.$notify.success('Enable success')
+              }
             })
         }
       }
diff --git a/dubbo-admin-frontend/src/components/governance/WeightAdjust.vue b/dubbo-admin-frontend/src/components/governance/WeightAdjust.vue
index 33e3ce5..0112c22 100644
--- a/dubbo-admin-frontend/src/components/governance/WeightAdjust.vue
+++ b/dubbo-admin-frontend/src/components/governance/WeightAdjust.vue
@@ -202,17 +202,23 @@
             weight.id = this.updateId
             this.$axios.put('/rules/weight/' + weight.id, weight)
               .then(response => {
-                this.search(this.service, true)
-                this.filter = this.service
-                this.closeDialog()
+                if (response.status === 200) {
+                  this.search(this.service, true)
+                  this.filter = this.service
+                  this.closeDialog()
+                  this.$notify.success('Update success')
+                }
               })
           }
         } else {
           this.$axios.post('/rules/weight', weight)
             .then(response => {
-              this.search(this.service, true)
-              this.filter = this.service
-              this.closeDialog()
+              if (response.status === 200) {
+                this.search(this.service, true)
+                this.filter = this.service
+                this.closeDialog()
+                this.$notify.success('Create success')
+              }
             })
         }
       },
@@ -253,8 +259,11 @@
       deleteItem: function (warnStatus) {
         this.$axios.delete('/rules/weight/' + warnStatus.id)
           .then(response => {
-            this.warn = false
-            this.search(this.filter, false)
+            if (response.status === 200) {
+              this.warn = false
+              this.search(this.filter, false)
+              this.$notify.success('Delete success')
+            }
           })
       }
     },