From 416092029c8bf18b7192666595fb132a8fc00c2d Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Mon, 28 Nov 2022 14:56:22 +0530 Subject: [PATCH] Host console pops on click in Server power ops - On click of Power on, Reboot and Shut down, the host console window pops up in the Server power ops page. - It does not apply for Read-Only users. Signed-off-by: Nikhil Ashoka --- .../ServerPowerOperations.vue | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue b/src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue index cd833a3cdb..2f17dc351b 100644 --- a/src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue +++ b/src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue @@ -212,6 +212,9 @@ export default { isOperationInProgress() { return this.$store.getters['controls/isOperationInProgress']; }, + isReadOnlyUser() { + return this.$store.getters['global/isReadOnlyUser']; + }, lastPowerOperationTime() { return this.$store.getters['controls/lastPowerOperationTime']; }, @@ -245,6 +248,9 @@ export default { this.bmc.statusState === 'Enabled' && this.bmc.health === 'OK' ) { + if (!this.isReadOnlyUser) { + this.showHostConsole(); + } this.$store.dispatch('controls/serverPowerOn'); } else { this.errorToast( @@ -272,17 +278,34 @@ export default { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) .then((confirmed) => { - if (confirmed) this.$store.dispatch('controls/serverSoftReboot'); + if (confirmed) { + if (!this.isReadOnlyUser) { + this.showHostConsole(); + } + this.$store.dispatch('controls/serverSoftReboot'); + } }); } else if (this.form.rebootOption === 'immediate') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) .then((confirmed) => { - if (confirmed) this.$store.dispatch('controls/serverHardReboot'); + if (confirmed) { + if (!this.isReadOnlyUser) { + this.showHostConsole(); + } + this.$store.dispatch('controls/serverHardReboot'); + } }); } }); }, + showHostConsole() { + window.open( + '#/console/host-console-console', + '_blank', + 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=600,height=550' + ); + }, shutdownServer() { const modalMessage = `${ this.systemDumpActive @@ -302,14 +325,24 @@ export default { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) .then((confirmed) => { - if (confirmed) this.$store.dispatch('controls/serverSoftPowerOff'); + if (confirmed) { + if (!this.isReadOnlyUser) { + this.showHostConsole(); + } + this.$store.dispatch('controls/serverSoftPowerOff'); + } }); } if (this.form.shutdownOption === 'immediate') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) .then((confirmed) => { - if (confirmed) this.$store.dispatch('controls/serverHardPowerOff'); + if (confirmed) { + if (!this.isReadOnlyUser) { + this.showHostConsole(); + } + this.$store.dispatch('controls/serverHardPowerOff'); + } }); } },