summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/Operations/Kvm/KvmConsole.vue29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/views/Operations/Kvm/KvmConsole.vue b/src/views/Operations/Kvm/KvmConsole.vue
index c028a9fc..4f24db24 100644
--- a/src/views/Operations/Kvm/KvmConsole.vue
+++ b/src/views/Operations/Kvm/KvmConsole.vue
@@ -46,6 +46,7 @@ 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;
@@ -62,6 +63,7 @@ export default {
},
data() {
return {
+ isConsoleWindow: null,
rfb: null,
isConnected: false,
terminalClass: this.isFullWindow ? 'full-window' : '',
@@ -72,6 +74,7 @@ export default {
};
},
computed: {
+ ...mapState('authentication', ['consoleWindow']),
serverStatusIcon() {
if (this.status === Connected) {
return 'success';
@@ -89,6 +92,11 @@ export default {
return this.$t('pageKvm.connecting');
},
},
+ watch: {
+ consoleWindow() {
+ if (this.consoleWindow == false) this.isConsoleWindow.close();
+ },
+ },
mounted() {
this.openTerminal();
},
@@ -143,9 +151,26 @@ export default {
}
},
openConsoleWindow() {
- window.open(
+ // If isConsoleWindow is not null
+ // Check the newly opened window is closed or not
+ if (this.isConsoleWindow) {
+ // 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();
+ return;
+ } else {
+ this.openNewWindow();
+ }
+ } else {
+ // If isConsoleWindow is null, open new window
+ this.openNewWindow();
+ }
+ },
+ openNewWindow() {
+ this.isConsoleWindow = window.open(
'#/console/kvm',
- '_blank',
+ 'kvmConsoleWindow',
'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=550'
);
},