diff options
author | Konstantin <sulwirld@gmail.com> | 2023-06-14 17:23:14 +0300 |
---|---|---|
committer | sulwirld <sulwirld@gmail.com> | 2023-06-20 21:30:40 +0300 |
commit | fb6c6de90cba53dff84d687d6b3f2b07b822b1dc (patch) | |
tree | 5d16a32c5458f469caf27402a94f96e63d239987 /src/views/Operations | |
parent | af76e2bc3e756a5325478cada4e643d82e7b466e (diff) | |
download | webui-vue-fb6c6de90cba53dff84d687d6b3f2b07b822b1dc.tar.xz |
Fix kvm session and add event bus
Bug description:
Before this commit KVM window wasn't being closed
after logging out
Test: Step1. Launch webui on browser and see KVM page on /#/operations/kvm.
Step2. Open additional window using 'Open in new tab'.
Step3. Navigate to another page. For example, /#/operations/key-clear.
Step4. Logout. Window is still open.
Change-Id: Ife79ebca41eb4d588c0b8f4fae06135420eda155
Signed-off-by: Konstantin Maskov <sulwirld@gmail.com>
Diffstat (limited to 'src/views/Operations')
-rw-r--r-- | src/views/Operations/Kvm/KvmConsole.vue | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/views/Operations/Kvm/KvmConsole.vue b/src/views/Operations/Kvm/KvmConsole.vue index 212514d1..8483c4f3 100644 --- a/src/views/Operations/Kvm/KvmConsole.vue +++ b/src/views/Operations/Kvm/KvmConsole.vue @@ -46,7 +46,6 @@ import StatusIcon from '@/components/Global/StatusIcon'; import IconLaunch from '@carbon/icons-vue/es/launch/20'; import IconArrowDown from '@carbon/icons-vue/es/arrow--down/16'; import { throttle } from 'lodash'; -import { mapState } from 'vuex'; const Connecting = 0; const Connected = 1; @@ -63,7 +62,6 @@ export default { }, data() { return { - isConsoleWindow: null, rfb: null, isConnected: false, terminalClass: this.isFullWindow ? 'full-window' : '', @@ -74,7 +72,6 @@ export default { }; }, computed: { - ...mapState('authentication', ['consoleWindow']), serverStatusIcon() { if (this.status === Connected) { return 'success'; @@ -92,11 +89,6 @@ export default { return this.$t('pageKvm.connecting'); }, }, - watch: { - consoleWindow() { - if (this.consoleWindow == false) this.isConsoleWindow.close(); - }, - }, created() { this.$store.dispatch('global/getSystemInfo'); }, @@ -154,24 +146,24 @@ export default { } }, openConsoleWindow() { - // If isConsoleWindow is not null + // If consoleWindow is not null // Check the newly opened window is closed or not - if (this.isConsoleWindow) { + if (this.$eventBus.$consoleWindow) { // If window is not closed set focus to new window // If window is closed, do open new window - if (!this.isConsoleWindow.closed) { - this.isConsoleWindow.focus(); + if (!this.$eventBus.$consoleWindow.closed) { + this.$eventBus.$consoleWindow.focus(); return; } else { this.openNewWindow(); } } else { - // If isConsoleWindow is null, open new window + // If consoleWindow is null, open new window this.openNewWindow(); } }, openNewWindow() { - this.isConsoleWindow = window.open( + this.$eventBus.$consoleWindow = window.open( '#/console/kvm', 'kvmConsoleWindow', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=550' |