This is an automated email from the ASF dual-hosted git repository.
joao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 8608f28842b Fix ctrl-enter on vm start dialog (#9743)
8608f28842b is described below
commit 8608f28842bff5375f021e0200cd8bbcfb9b5b95
Author: Lucas Martins <[email protected]>
AuthorDate: Wed Nov 13 10:16:49 2024 -0300
Fix ctrl-enter on vm start dialog (#9743)
Co-authored-by: Lucas Martins <[email protected]>
---
ui/src/views/compute/StartVirtualMachine.vue | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/ui/src/views/compute/StartVirtualMachine.vue
b/ui/src/views/compute/StartVirtualMachine.vue
index 7438ebc1beb..f229cb44f67 100644
--- a/ui/src/views/compute/StartVirtualMachine.vue
+++ b/ui/src/views/compute/StartVirtualMachine.vue
@@ -16,7 +16,7 @@
// under the License.
<template>
- <div class="form-layout" v-ctrl-enter="handleSubmit">
+ <div class="form-layout">
<a-spin :spinning="loading">
<a-alert type="warning">
<template #message>{{ $t('message.action.start.instance') }}</template>
@@ -93,7 +93,7 @@
<template #label>
<tooltip-label :title="$t('label.considerlasthost')"
:tooltip="apiParams.considerlasthost.description"/>
</template>
- <a-switch v-model:checked="form.considerlasthost" />
+ <a-switch v-model:checked="form.considerlasthost" v-focus="true"/>
</a-form-item>
</div>
@@ -151,6 +151,12 @@ export default {
this.fetchHosts()
}
},
+ mounted () {
+ document.addEventListener('keydown', this.handleKeyPress)
+ },
+ beforeUnmount () {
+ document.removeEventListener('keydown', this.handleKeyPress)
+ },
methods: {
initForm () {
this.formRef = ref()
@@ -264,6 +270,12 @@ export default {
},
closeAction () {
this.$emit('close-action')
+ },
+ handleKeyPress (event) {
+ event.preventDefault()
+ if ((event.code === 'Enter' || event.code === 'NumpadEnter') &&
event.ctrlKey === true) {
+ this.handleSubmit(event)
+ }
}
}
}