Imvedansh commented on code in PR #10606:
URL: https://github.com/apache/cloudstack/pull/10606#discussion_r2010590711


##########
ui/src/views/infra/HostEnableDisable.vue:
##########
@@ -97,37 +94,44 @@ export default {
       })
     },
     handleSubmit (e) {
-      e.preventDefault()
-      this.formRef.value.validate().then(() => {
+      if (e) {
+        e.preventDefault()
+      }
+      this.$refs.formRef.validate().then(() => {
         const values = toRaw(this.form)
-
-        var data = {
+        const data = {
           allocationstate: this.allocationstate,
           id: this.resource.id
         }
         if (values.reason) {
           data.annotation = values.reason
         }
-        api('updateHost', data).then(_ => {
-          this.$emit('close-action')
-        })
+        api('updateHost', data)
+          .then(response => {
+            this.$emit('refresh-data')
+            this.$emit('close-action')
+          })
+          .catch(error => {
+            console.error('Error updating host:', error)
+            this.$emit('close-action')
+          })
+      }).catch(error => {
+        console.error('Validation failed:', error)
       })
     }
   }
 }
-
 </script>
 
 <style scoped>
 .reason {
-  padding-top: 20px
+  padding-top: 20px;
 }
 
 .form-layout {
-    width: 30vw;
-
-    @media (min-width: 500px) {
-      width: 450px;
-    }
+  width: 30vw;
+  @media (min-width: 500px) {
+    width: 450px;

Review Comment:
   Let me just push the feature in first go , and will do the enhancement later 
on



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to