168cbbe90SSandeepa Singh<template> 268cbbe90SSandeepa Singh <b-container fluid="xl"> 368cbbe90SSandeepa Singh <page-title /> 468cbbe90SSandeepa Singh <b-row class="mb-4"> 568cbbe90SSandeepa Singh <b-col md="8" xl="6"> 668cbbe90SSandeepa Singh <page-section 768cbbe90SSandeepa Singh :section-title="$t('pageServerPowerOperations.currentStatus')" 868cbbe90SSandeepa Singh > 968cbbe90SSandeepa Singh <b-row> 1068cbbe90SSandeepa Singh <b-col> 1168cbbe90SSandeepa Singh <dl> 1268cbbe90SSandeepa Singh <dt>{{ $t('pageServerPowerOperations.serverStatus') }}</dt> 1368cbbe90SSandeepa Singh <dd 1468cbbe90SSandeepa Singh v-if="serverStatus === 'on'" 1568cbbe90SSandeepa Singh data-test-id="powerServerOps-text-hostStatus" 1668cbbe90SSandeepa Singh > 1768cbbe90SSandeepa Singh {{ $t('global.status.on') }} 1868cbbe90SSandeepa Singh </dd> 1968cbbe90SSandeepa Singh <dd 2068cbbe90SSandeepa Singh v-else-if="serverStatus === 'off'" 2168cbbe90SSandeepa Singh data-test-id="powerServerOps-text-hostStatus" 2268cbbe90SSandeepa Singh > 2368cbbe90SSandeepa Singh {{ $t('global.status.off') }} 2468cbbe90SSandeepa Singh </dd> 25ed7278a2Sglukhov.mikhail <dd 26ed7278a2Sglukhov.mikhail v-else-if="serverStatus === 'diagnosticMode'" 27ed7278a2Sglukhov.mikhail data-test-id="powerServerOps-text-hostStatus" 28ed7278a2Sglukhov.mikhail > 29ed7278a2Sglukhov.mikhail {{ $t('global.status.diagnosticMode') }} 30ed7278a2Sglukhov.mikhail </dd> 3168cbbe90SSandeepa Singh <dd v-else> 3268cbbe90SSandeepa Singh {{ $t('global.status.notAvailable') }} 3368cbbe90SSandeepa Singh </dd> 3468cbbe90SSandeepa Singh </dl> 3568cbbe90SSandeepa Singh </b-col> 3668cbbe90SSandeepa Singh </b-row> 3768cbbe90SSandeepa Singh <b-row> 3868cbbe90SSandeepa Singh <b-col> 3968cbbe90SSandeepa Singh <dl> 4068cbbe90SSandeepa Singh <dt> 4168cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.lastPowerOperation') }} 4268cbbe90SSandeepa Singh </dt> 4368cbbe90SSandeepa Singh <dd 4468cbbe90SSandeepa Singh v-if="lastPowerOperationTime" 4568cbbe90SSandeepa Singh data-test-id="powerServerOps-text-lastPowerOp" 4668cbbe90SSandeepa Singh > 47de23ea23SSurya V {{ $filters.formatDate(lastPowerOperationTime) }} 48de23ea23SSurya V {{ $filters.formatTime(lastPowerOperationTime) }} 4968cbbe90SSandeepa Singh </dd> 5068cbbe90SSandeepa Singh <dd v-else>--</dd> 5168cbbe90SSandeepa Singh </dl> 5268cbbe90SSandeepa Singh </b-col> 5368cbbe90SSandeepa Singh </b-row> 5468cbbe90SSandeepa Singh </page-section> 5568cbbe90SSandeepa Singh </b-col> 5668cbbe90SSandeepa Singh </b-row> 5768cbbe90SSandeepa Singh <b-row> 58*918526f2SShubhi Garg <b-col 59*918526f2SShubhi Garg v-if="hasBootSourceOptions && oneTimeBootEnabled" 60*918526f2SShubhi Garg sm="8" 61*918526f2SShubhi Garg md="6" 62*918526f2SShubhi Garg xl="4" 63*918526f2SShubhi Garg > 6468cbbe90SSandeepa Singh <page-section 6568cbbe90SSandeepa Singh :section-title="$t('pageServerPowerOperations.serverBootSettings')" 6668cbbe90SSandeepa Singh > 6768cbbe90SSandeepa Singh <boot-settings /> 6868cbbe90SSandeepa Singh </page-section> 6968cbbe90SSandeepa Singh </b-col> 7068cbbe90SSandeepa Singh <b-col sm="8" md="6" xl="7"> 7168cbbe90SSandeepa Singh <page-section 7268cbbe90SSandeepa Singh :section-title="$t('pageServerPowerOperations.operations')" 7368cbbe90SSandeepa Singh > 7468cbbe90SSandeepa Singh <alert :show="oneTimeBootEnabled" variant="warning"> 7568cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.oneTimeBootWarning') }} 7668cbbe90SSandeepa Singh </alert> 7768cbbe90SSandeepa Singh <template v-if="isOperationInProgress"> 7868cbbe90SSandeepa Singh <alert variant="info"> 7968cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.operationInProgress') }} 8068cbbe90SSandeepa Singh </alert> 8168cbbe90SSandeepa Singh </template> 8268cbbe90SSandeepa Singh <template v-else-if="serverStatus === 'off'"> 8368cbbe90SSandeepa Singh <b-button 8468cbbe90SSandeepa Singh variant="primary" 8568cbbe90SSandeepa Singh data-test-id="serverPowerOperations-button-powerOn" 8668cbbe90SSandeepa Singh @click="powerOn" 8768cbbe90SSandeepa Singh > 8868cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.powerOn') }} 8968cbbe90SSandeepa Singh </b-button> 9068cbbe90SSandeepa Singh </template> 9168cbbe90SSandeepa Singh <template v-else> 9268cbbe90SSandeepa Singh <!-- Reboot server options --> 9368cbbe90SSandeepa Singh <b-form novalidate class="mb-5" @submit.prevent="rebootServer"> 9468cbbe90SSandeepa Singh <b-form-group 9568cbbe90SSandeepa Singh :label="$t('pageServerPowerOperations.rebootServer')" 9668cbbe90SSandeepa Singh > 9768cbbe90SSandeepa Singh <b-form-radio 9868cbbe90SSandeepa Singh v-model="form.rebootOption" 9968cbbe90SSandeepa Singh name="reboot-option" 10068cbbe90SSandeepa Singh data-test-id="serverPowerOperations-radio-rebootOrderly" 10168cbbe90SSandeepa Singh value="orderly" 10268cbbe90SSandeepa Singh > 103*918526f2SShubhi Garg {{ $t('pageServerPowerOperations.gracefulRestart') }} 104*918526f2SShubhi Garg <info-tooltip 105*918526f2SShubhi Garg :title="$t('pageServerPowerOperations.gracefulRestartInfo')" 106*918526f2SShubhi Garg /> 10768cbbe90SSandeepa Singh </b-form-radio> 10868cbbe90SSandeepa Singh <b-form-radio 10968cbbe90SSandeepa Singh v-model="form.rebootOption" 11068cbbe90SSandeepa Singh name="reboot-option" 11168cbbe90SSandeepa Singh data-test-id="serverPowerOperations-radio-rebootImmediate" 11268cbbe90SSandeepa Singh value="immediate" 11368cbbe90SSandeepa Singh > 114*918526f2SShubhi Garg {{ $t('pageServerPowerOperations.forceRestart') }} 115*918526f2SShubhi Garg <info-tooltip 116*918526f2SShubhi Garg :title="$t('pageServerPowerOperations.forceRestartInfo')" 117*918526f2SShubhi Garg /> 11868cbbe90SSandeepa Singh </b-form-radio> 11968cbbe90SSandeepa Singh </b-form-group> 12068cbbe90SSandeepa Singh <b-button 12168cbbe90SSandeepa Singh variant="primary" 12268cbbe90SSandeepa Singh type="submit" 12368cbbe90SSandeepa Singh data-test-id="serverPowerOperations-button-reboot" 12468cbbe90SSandeepa Singh > 12568cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.reboot') }} 12668cbbe90SSandeepa Singh </b-button> 12768cbbe90SSandeepa Singh </b-form> 12868cbbe90SSandeepa Singh <!-- Shutdown server options --> 12968cbbe90SSandeepa Singh <b-form novalidate @submit.prevent="shutdownServer"> 13068cbbe90SSandeepa Singh <b-form-group 13168cbbe90SSandeepa Singh :label="$t('pageServerPowerOperations.shutdownServer')" 13268cbbe90SSandeepa Singh > 13368cbbe90SSandeepa Singh <b-form-radio 13468cbbe90SSandeepa Singh v-model="form.shutdownOption" 13568cbbe90SSandeepa Singh name="shutdown-option" 13668cbbe90SSandeepa Singh data-test-id="serverPowerOperations-radio-shutdownOrderly" 13768cbbe90SSandeepa Singh value="orderly" 13868cbbe90SSandeepa Singh > 139*918526f2SShubhi Garg {{ $t('pageServerPowerOperations.gracefulShutdown') }} 140*918526f2SShubhi Garg <info-tooltip 141*918526f2SShubhi Garg :title=" 142*918526f2SShubhi Garg $t('pageServerPowerOperations.gracefulShutdownInfo') 143*918526f2SShubhi Garg " 144*918526f2SShubhi Garg /> 14568cbbe90SSandeepa Singh </b-form-radio> 14668cbbe90SSandeepa Singh <b-form-radio 14768cbbe90SSandeepa Singh v-model="form.shutdownOption" 14868cbbe90SSandeepa Singh name="shutdown-option" 14968cbbe90SSandeepa Singh data-test-id="serverPowerOperations-radio-shutdownImmediate" 15068cbbe90SSandeepa Singh value="immediate" 15168cbbe90SSandeepa Singh > 152*918526f2SShubhi Garg {{ $t('pageServerPowerOperations.forceOff') }} 153*918526f2SShubhi Garg <info-tooltip 154*918526f2SShubhi Garg :title="$t('pageServerPowerOperations.forceOffInfo')" 155*918526f2SShubhi Garg /> 15668cbbe90SSandeepa Singh </b-form-radio> 15768cbbe90SSandeepa Singh </b-form-group> 15868cbbe90SSandeepa Singh <b-button 15968cbbe90SSandeepa Singh variant="primary" 16068cbbe90SSandeepa Singh type="submit" 16168cbbe90SSandeepa Singh data-test-id="serverPowerOperations-button-shutDown" 16268cbbe90SSandeepa Singh > 16368cbbe90SSandeepa Singh {{ $t('pageServerPowerOperations.shutDown') }} 16468cbbe90SSandeepa Singh </b-button> 16568cbbe90SSandeepa Singh </b-form> 16668cbbe90SSandeepa Singh </template> 16768cbbe90SSandeepa Singh </page-section> 16868cbbe90SSandeepa Singh </b-col> 16968cbbe90SSandeepa Singh </b-row> 17068cbbe90SSandeepa Singh </b-container> 17168cbbe90SSandeepa Singh</template> 17268cbbe90SSandeepa Singh 17368cbbe90SSandeepa Singh<script> 17468cbbe90SSandeepa Singhimport PageTitle from '@/components/Global/PageTitle'; 17568cbbe90SSandeepa Singhimport PageSection from '@/components/Global/PageSection'; 17668cbbe90SSandeepa Singhimport BVToastMixin from '@/components/Mixins/BVToastMixin'; 17768cbbe90SSandeepa Singhimport BootSettings from './BootSettings'; 17868cbbe90SSandeepa Singhimport LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; 17968cbbe90SSandeepa Singhimport Alert from '@/components/Global/Alert'; 180*918526f2SShubhi Gargimport InfoTooltip from '@/components/Global/InfoTooltip'; 181de23ea23SSurya Vimport { useI18n } from 'vue-i18n'; 182de23ea23SSurya Vimport i18n from '@/i18n'; 18368cbbe90SSandeepa Singh 18468cbbe90SSandeepa Singhexport default { 18568cbbe90SSandeepa Singh name: 'ServerPowerOperations', 186*918526f2SShubhi Garg components: { PageTitle, PageSection, BootSettings, Alert, InfoTooltip }, 18768cbbe90SSandeepa Singh mixins: [BVToastMixin, LoadingBarMixin], 18868cbbe90SSandeepa Singh beforeRouteLeave(to, from, next) { 18968cbbe90SSandeepa Singh this.hideLoader(); 19068cbbe90SSandeepa Singh next(); 19168cbbe90SSandeepa Singh }, 19268cbbe90SSandeepa Singh data() { 19368cbbe90SSandeepa Singh return { 194de23ea23SSurya V $t: useI18n().t, 19568cbbe90SSandeepa Singh form: { 19668cbbe90SSandeepa Singh rebootOption: 'orderly', 19768cbbe90SSandeepa Singh shutdownOption: 'orderly', 19868cbbe90SSandeepa Singh }, 19968cbbe90SSandeepa Singh }; 20068cbbe90SSandeepa Singh }, 20168cbbe90SSandeepa Singh computed: { 20268cbbe90SSandeepa Singh serverStatus() { 20368cbbe90SSandeepa Singh return this.$store.getters['global/serverStatus']; 20468cbbe90SSandeepa Singh }, 20568cbbe90SSandeepa Singh isOperationInProgress() { 20668cbbe90SSandeepa Singh return this.$store.getters['controls/isOperationInProgress']; 20768cbbe90SSandeepa Singh }, 20868cbbe90SSandeepa Singh lastPowerOperationTime() { 20968cbbe90SSandeepa Singh return this.$store.getters['controls/lastPowerOperationTime']; 21068cbbe90SSandeepa Singh }, 21168cbbe90SSandeepa Singh oneTimeBootEnabled() { 21268cbbe90SSandeepa Singh return this.$store.getters['serverBootSettings/overrideEnabled']; 21368cbbe90SSandeepa Singh }, 21468cbbe90SSandeepa Singh hasBootSourceOptions() { 2158132399cSEd Tanous let bootOptions = 2168132399cSEd Tanous this.$store.getters['serverBootSettings/bootSourceOptions']; 21768cbbe90SSandeepa Singh return bootOptions.length !== 0; 21868cbbe90SSandeepa Singh }, 21968cbbe90SSandeepa Singh }, 22068cbbe90SSandeepa Singh created() { 22168cbbe90SSandeepa Singh this.startLoader(); 22268cbbe90SSandeepa Singh const bootSettingsPromise = new Promise((resolve) => { 22368cbbe90SSandeepa Singh this.$root.$on('server-power-operations-boot-settings-complete', () => 2248132399cSEd Tanous resolve(), 22568cbbe90SSandeepa Singh ); 22668cbbe90SSandeepa Singh }); 22768cbbe90SSandeepa Singh Promise.all([ 22868cbbe90SSandeepa Singh this.$store.dispatch('serverBootSettings/getBootSettings'), 22968cbbe90SSandeepa Singh this.$store.dispatch('controls/getLastPowerOperationTime'), 23068cbbe90SSandeepa Singh bootSettingsPromise, 23168cbbe90SSandeepa Singh ]).finally(() => this.endLoader()); 23268cbbe90SSandeepa Singh }, 23368cbbe90SSandeepa Singh methods: { 23468cbbe90SSandeepa Singh powerOn() { 23568cbbe90SSandeepa Singh this.$store.dispatch('controls/serverPowerOn'); 23668cbbe90SSandeepa Singh }, 23768cbbe90SSandeepa Singh rebootServer() { 238de23ea23SSurya V const modalMessage = i18n.global.t( 2398132399cSEd Tanous 'pageServerPowerOperations.modal.confirmRebootMessage', 24068cbbe90SSandeepa Singh ); 24168cbbe90SSandeepa Singh const modalOptions = { 242de23ea23SSurya V title: i18n.global.t( 243de23ea23SSurya V 'pageServerPowerOperations.modal.confirmRebootTitle', 244de23ea23SSurya V ), 245de23ea23SSurya V okTitle: i18n.global.t('global.action.confirm'), 246de23ea23SSurya V cancelTitle: i18n.global.t('global.action.cancel'), 247d1ef18e6SPaul Fertser autoFocusButton: 'ok', 24868cbbe90SSandeepa Singh }; 24968cbbe90SSandeepa Singh 25068cbbe90SSandeepa Singh if (this.form.rebootOption === 'orderly') { 25168cbbe90SSandeepa Singh this.$bvModal 25268cbbe90SSandeepa Singh .msgBoxConfirm(modalMessage, modalOptions) 25368cbbe90SSandeepa Singh .then((confirmed) => { 25468cbbe90SSandeepa Singh if (confirmed) this.$store.dispatch('controls/serverSoftReboot'); 25568cbbe90SSandeepa Singh }); 25668cbbe90SSandeepa Singh } else if (this.form.rebootOption === 'immediate') { 25768cbbe90SSandeepa Singh this.$bvModal 25868cbbe90SSandeepa Singh .msgBoxConfirm(modalMessage, modalOptions) 25968cbbe90SSandeepa Singh .then((confirmed) => { 26068cbbe90SSandeepa Singh if (confirmed) this.$store.dispatch('controls/serverHardReboot'); 26168cbbe90SSandeepa Singh }); 26268cbbe90SSandeepa Singh } 26368cbbe90SSandeepa Singh }, 26468cbbe90SSandeepa Singh shutdownServer() { 265de23ea23SSurya V const modalMessage = i18n.global.t( 2668132399cSEd Tanous 'pageServerPowerOperations.modal.confirmShutdownMessage', 26768cbbe90SSandeepa Singh ); 26868cbbe90SSandeepa Singh const modalOptions = { 269de23ea23SSurya V title: i18n.global.t( 270de23ea23SSurya V 'pageServerPowerOperations.modal.confirmShutdownTitle', 271de23ea23SSurya V ), 272de23ea23SSurya V okTitle: i18n.global.t('global.action.confirm'), 273de23ea23SSurya V cancelTitle: i18n.global.t('global.action.cancel'), 274d1ef18e6SPaul Fertser autoFocusButton: 'ok', 27568cbbe90SSandeepa Singh }; 27668cbbe90SSandeepa Singh 27768cbbe90SSandeepa Singh if (this.form.shutdownOption === 'orderly') { 27868cbbe90SSandeepa Singh this.$bvModal 27968cbbe90SSandeepa Singh .msgBoxConfirm(modalMessage, modalOptions) 28068cbbe90SSandeepa Singh .then((confirmed) => { 28168cbbe90SSandeepa Singh if (confirmed) this.$store.dispatch('controls/serverSoftPowerOff'); 28268cbbe90SSandeepa Singh }); 28368cbbe90SSandeepa Singh } 28468cbbe90SSandeepa Singh if (this.form.shutdownOption === 'immediate') { 28568cbbe90SSandeepa Singh this.$bvModal 28668cbbe90SSandeepa Singh .msgBoxConfirm(modalMessage, modalOptions) 28768cbbe90SSandeepa Singh .then((confirmed) => { 28868cbbe90SSandeepa Singh if (confirmed) this.$store.dispatch('controls/serverHardPowerOff'); 28968cbbe90SSandeepa Singh }); 29068cbbe90SSandeepa Singh } 29168cbbe90SSandeepa Singh }, 29268cbbe90SSandeepa Singh }, 29368cbbe90SSandeepa Singh}; 29468cbbe90SSandeepa Singh</script> 295