bernardodemarco commented on code in PR #10606:
URL: https://github.com/apache/cloudstack/pull/10606#discussion_r2010415334
##########
ui/src/views/infra/HostEnableDisable.vue:
##########
@@ -97,37 +94,44 @@ export default {
})
},
handleSubmit (e) {
- e.preventDefault()
- this.formRef.value.validate().then(() => {
+ if (e) {
Review Comment:
Is it necessary to check if `e` is _truthy_?
##########
plugins/storage/volume/linstor/CHANGELOG.md:
##########
@@ -5,12 +5,14 @@ All notable changes to Linstor CloudStack plugin will be
documented in this file
The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).
+
Review Comment:
I believe these changes on `plugins/storage/volume/linstor/CHANGELOG.md` are
not necessary, right?
##########
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:
Are these changes necessary?
##########
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)
Review Comment:
It would be better to return a notification error in the UI instead of
printing the error to the console
--
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]