Skip to content

Commit

Permalink
Host console pops on click in Server power ops
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
Nikhil-Ashoka committed Nov 28, 2022
1 parent b311334 commit 4160920
Showing 1 changed file with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
},
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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');
}
});
}
},
Expand Down

0 comments on commit 4160920

Please sign in to comment.