You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/11/14 00:24:19 UTC

[GitHub] majinkai closed pull request #181: Optimization operation tips

majinkai closed pull request #181:  Optimization operation tips
URL: https://github.com/apache/incubator-dubbo-ops/pull/181
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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')
+            }
           })
       }
     },


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org