Skip to content

Commit 4160920

Browse files
committed
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 <[email protected]>
1 parent b311334 commit 4160920

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue

+37-4
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ export default {
212212
isOperationInProgress() {
213213
return this.$store.getters['controls/isOperationInProgress'];
214214
},
215+
isReadOnlyUser() {
216+
return this.$store.getters['global/isReadOnlyUser'];
217+
},
215218
lastPowerOperationTime() {
216219
return this.$store.getters['controls/lastPowerOperationTime'];
217220
},
@@ -245,6 +248,9 @@ export default {
245248
this.bmc.statusState === 'Enabled' &&
246249
this.bmc.health === 'OK'
247250
) {
251+
if (!this.isReadOnlyUser) {
252+
this.showHostConsole();
253+
}
248254
this.$store.dispatch('controls/serverPowerOn');
249255
} else {
250256
this.errorToast(
@@ -272,17 +278,34 @@ export default {
272278
this.$bvModal
273279
.msgBoxConfirm(modalMessage, modalOptions)
274280
.then((confirmed) => {
275-
if (confirmed) this.$store.dispatch('controls/serverSoftReboot');
281+
if (confirmed) {
282+
if (!this.isReadOnlyUser) {
283+
this.showHostConsole();
284+
}
285+
this.$store.dispatch('controls/serverSoftReboot');
286+
}
276287
});
277288
} else if (this.form.rebootOption === 'immediate') {
278289
this.$bvModal
279290
.msgBoxConfirm(modalMessage, modalOptions)
280291
.then((confirmed) => {
281-
if (confirmed) this.$store.dispatch('controls/serverHardReboot');
292+
if (confirmed) {
293+
if (!this.isReadOnlyUser) {
294+
this.showHostConsole();
295+
}
296+
this.$store.dispatch('controls/serverHardReboot');
297+
}
282298
});
283299
}
284300
});
285301
},
302+
showHostConsole() {
303+
window.open(
304+
'#/console/host-console-console',
305+
'_blank',
306+
'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=600,height=550'
307+
);
308+
},
286309
shutdownServer() {
287310
const modalMessage = `${
288311
this.systemDumpActive
@@ -302,14 +325,24 @@ export default {
302325
this.$bvModal
303326
.msgBoxConfirm(modalMessage, modalOptions)
304327
.then((confirmed) => {
305-
if (confirmed) this.$store.dispatch('controls/serverSoftPowerOff');
328+
if (confirmed) {
329+
if (!this.isReadOnlyUser) {
330+
this.showHostConsole();
331+
}
332+
this.$store.dispatch('controls/serverSoftPowerOff');
333+
}
306334
});
307335
}
308336
if (this.form.shutdownOption === 'immediate') {
309337
this.$bvModal
310338
.msgBoxConfirm(modalMessage, modalOptions)
311339
.then((confirmed) => {
312-
if (confirmed) this.$store.dispatch('controls/serverHardPowerOff');
340+
if (confirmed) {
341+
if (!this.isReadOnlyUser) {
342+
this.showHostConsole();
343+
}
344+
this.$store.dispatch('controls/serverHardPowerOff');
345+
}
313346
});
314347
}
315348
},

0 commit comments

Comments
 (0)