diff options
Diffstat (limited to 'src/views/_sila/Operations')
9 files changed, 66 insertions, 76 deletions
diff --git a/src/views/_sila/Operations/FactoryReset/FactoryReset.vue b/src/views/_sila/Operations/FactoryReset/FactoryReset.vue index 0b88ddd2..f6578a7c 100644 --- a/src/views/_sila/Operations/FactoryReset/FactoryReset.vue +++ b/src/views/_sila/Operations/FactoryReset/FactoryReset.vue @@ -17,10 +17,7 @@ value="resetBios" aria-describedby="reset-bios" data-test-id="factoryReset-radio-resetBios" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > {{ $t('pageFactoryReset.form.resetBiosOptionLabel') }} </b-form-radio> @@ -33,10 +30,7 @@ value="resetToDefaults" aria-describedby="reset-to-defaults" data-test-id="factoryReset-radio-resetToDefaults" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > {{ $t('pageFactoryReset.form.resetToDefaultsOptionLabel') }} </b-form-radio> @@ -51,10 +45,7 @@ type="submit" variant="primary" data-test-id="factoryReset-button-submit" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > {{ $t('global.action.reset') }} </b-button> @@ -82,6 +73,14 @@ export default { resetOption: 'resetBios', }; }, + computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, + }, created() { this.hideLoader(); }, diff --git a/src/views/_sila/Operations/Firmware/FirmwareFormUpdate.vue b/src/views/_sila/Operations/Firmware/FirmwareFormUpdate.vue index dcf867ee..e667ceae 100644 --- a/src/views/_sila/Operations/Firmware/FirmwareFormUpdate.vue +++ b/src/views/_sila/Operations/Firmware/FirmwareFormUpdate.vue @@ -60,10 +60,7 @@ data-test-id="firmware-button-startUpdate" type="submit" variant="primary" - :disabled=" - isPageDisabled || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isPageDisabled || isNotAdmin" > {{ $t('pageFirmware.form.updateFirmware.startUpdate') }} </b-btn> @@ -112,6 +109,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, isTftpUploadAvailable() { return this.$store.getters['firmware/isTftpUploadAvailable']; }, diff --git a/src/views/_sila/Operations/KeyClear/KeyClear.vue b/src/views/_sila/Operations/KeyClear/KeyClear.vue index 4b797e1d..183657f9 100644 --- a/src/views/_sila/Operations/KeyClear/KeyClear.vue +++ b/src/views/_sila/Operations/KeyClear/KeyClear.vue @@ -23,27 +23,13 @@ v-model="keyOption" stacked > - <b-form-radio - class="mb-1" - value="NONE" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " - > + <b-form-radio class="mb-1" value="NONE" :disabled="isNotAdmin"> {{ $t('pageKeyClear.form.none') }} </b-form-radio> <b-form-text id="key-clear-not-requested" class="ml-4 mb-3"> {{ $t('pageKeyClear.form.keyClearNotRequested') }} </b-form-text> - <b-form-radio - class="mb-1" - value="ALL" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " - > + <b-form-radio class="mb-1" value="ALL" :disabled="isNotAdmin"> {{ $t('pageKeyClear.form.clearAllLabel') }} </b-form-radio> <b-form-text id="clear-all" class="ml-4 mb-3"> @@ -52,10 +38,7 @@ <b-form-radio class="mb-1" value="POWERVM_SYSKEY" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > {{ $t('pageKeyClear.form.clearHypervisorSystemKeyLabel') }} </b-form-radio> @@ -76,10 +59,7 @@ type="submit" variant="primary" data-test-id="keyClear-button-submit" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > {{ $t('pageKeyClear.form.clear') }} </b-button> @@ -105,6 +85,14 @@ export default { username: this.$store.getters['global/username'], }; }, + computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, + }, created() { this.hideLoader(); }, diff --git a/src/views/_sila/Operations/Kvm/Kvm.vue b/src/views/_sila/Operations/Kvm/Kvm.vue index 4db46372..b498180d 100644 --- a/src/views/_sila/Operations/Kvm/Kvm.vue +++ b/src/views/_sila/Operations/Kvm/Kvm.vue @@ -4,7 +4,7 @@ <div class="terminal-container" :class="{ - disabledDiv: $store.getters['authentication/role'] === 'ReadOnly', + disabledDiv: isNotAdmin, }" > <kvm-console :is-full-window="false" /> @@ -19,6 +19,11 @@ import KvmConsole from './KvmConsole'; export default { name: 'Kvm', components: { PageTitle, KvmConsole }, + computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + }, }; </script> diff --git a/src/views/_sila/Operations/RebootBmc/RebootBmc.vue b/src/views/_sila/Operations/RebootBmc/RebootBmc.vue index f332de88..ff0fb73a 100644 --- a/src/views/_sila/Operations/RebootBmc/RebootBmc.vue +++ b/src/views/_sila/Operations/RebootBmc/RebootBmc.vue @@ -23,7 +23,7 @@ variant="primary" class="d-block mt-5" data-test-id="rebootBmc-button-reboot" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="onClick" > {{ $t('pageRebootBmc.rebootBmc') }} @@ -49,6 +49,9 @@ export default { next(); }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, lastBmcRebootTime() { return this.$store.getters['controls/lastBmcRebootTime']; }, diff --git a/src/views/_sila/Operations/SerialOverLan/SerialOverLan.vue b/src/views/_sila/Operations/SerialOverLan/SerialOverLan.vue index e09b43d3..357ec8e9 100644 --- a/src/views/_sila/Operations/SerialOverLan/SerialOverLan.vue +++ b/src/views/_sila/Operations/SerialOverLan/SerialOverLan.vue @@ -6,7 +6,7 @@ <serial-over-lan-console :is-full-window="false" :class="{ - disabledDiv: $store.getters['authentication/role'] === 'ReadOnly', + disabledDiv: isNotAdmin, }" /> </page-section> @@ -25,5 +25,10 @@ export default { PageTitle, SerialOverLanConsole, }, + computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + }, }; </script> diff --git a/src/views/_sila/Operations/ServerPowerOperations/BootSettings.vue b/src/views/_sila/Operations/ServerPowerOperations/BootSettings.vue index 826d8607..17b51212 100644 --- a/src/views/_sila/Operations/ServerPowerOperations/BootSettings.vue +++ b/src/views/_sila/Operations/ServerPowerOperations/BootSettings.vue @@ -11,10 +11,7 @@ <b-form-select id="boot-option" v-model="form.bootOption" - :disabled=" - bootSourceOptions.length === 0 || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="bootSourceOptions.length === 0 || isNotAdmin" :options="bootSourceOptionsReplaced" @change="onChangeSelect" > @@ -23,10 +20,7 @@ <b-form-checkbox v-model="form.oneTimeBoot" class="mb-4" - :disabled=" - form.bootOption === 'Отключено' || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="form.bootOption === 'Отключено' || isNotAdmin" @change="$v.form.oneTimeBoot.$touch()" > {{ $t('pageServerPowerOperations.bootSettings.enableOneTimeBoot') }} @@ -35,7 +29,7 @@ <b-form-radio-group id="boot-settings-mode" v-model="form.bootMode" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" stacked > <b-form-radio class="mb-1" :value="bootModeOptions[0]"> @@ -59,7 +53,7 @@ id="tpm-required-policy" v-model="form.tpmPolicyOn" aria-describedby="tpm-required-policy-help-block" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="$v.form.tpmPolicyOn.$touch()" > {{ $t('global.status.enabled') }} @@ -69,7 +63,7 @@ variant="primary" type="submit" class="mb-3" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('global.action.save') }} </b-button> @@ -111,6 +105,9 @@ export default { 'overrideEnabled', 'tpmEnabled', ]), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, bootSourceOptionsReplaced() { return replaceNoneArr(this.bootSourceOptions); }, diff --git a/src/views/_sila/Operations/ServerPowerOperations/ServerPowerOperations.vue b/src/views/_sila/Operations/ServerPowerOperations/ServerPowerOperations.vue index f8a18a9e..8f422d26 100644 --- a/src/views/_sila/Operations/ServerPowerOperations/ServerPowerOperations.vue +++ b/src/views/_sila/Operations/ServerPowerOperations/ServerPowerOperations.vue @@ -72,7 +72,7 @@ <b-button variant="primary" data-test-id="serverPowerOperations-button-powerOn" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="powerOn" > {{ $t('pageServerPowerOperations.powerOn') }} @@ -89,9 +89,7 @@ name="reboot-option" data-test-id="serverPowerOperations-radio-rebootOrderly" value="orderly" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.orderlyReboot') }} </b-form-radio> @@ -100,9 +98,7 @@ name="reboot-option" data-test-id="serverPowerOperations-radio-rebootImmediate" value="immediate" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.immediateReboot') }} </b-form-radio> @@ -111,7 +107,7 @@ variant="primary" type="submit" data-test-id="serverPowerOperations-button-reboot" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.reboot') }} </b-button> @@ -126,9 +122,7 @@ name="shutdown-option" data-test-id="serverPowerOperations-radio-shutdownOrderly" value="orderly" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.orderlyShutdown') }} </b-form-radio> @@ -137,9 +131,7 @@ name="shutdown-option" data-test-id="serverPowerOperations-radio-shutdownImmediate" value="immediate" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.immediateShutdown') }} </b-form-radio> @@ -148,7 +140,7 @@ variant="primary" type="submit" data-test-id="serverPowerOperations-button-shutDown" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('pageServerPowerOperations.shutDown') }} </b-button> @@ -185,6 +177,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, serverStatus() { return this.$store.getters['global/serverStatus']; }, diff --git a/src/views/_sila/Operations/VirtualMedia/VirtualMedia.vue b/src/views/_sila/Operations/VirtualMedia/VirtualMedia.vue index 4c3f4da0..e283867c 100644 --- a/src/views/_sila/Operations/VirtualMedia/VirtualMedia.vue +++ b/src/views/_sila/Operations/VirtualMedia/VirtualMedia.vue @@ -17,9 +17,7 @@ v-if="!dev.isActive" :id="concatId(dev.id)" v-model="dev.file" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="isNotAdmin" > <template #invalid> <b-form-invalid-feedback role="alert"> @@ -76,10 +74,7 @@ > <b-button variant="primary" - :disabled=" - device.isActive || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="device.isActive || isNotAdmin" @click="configureConnection(device)" > {{ $t('pageVirtualMedia.configureConnection') }} @@ -135,6 +130,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, proxyDevices() { return this.$store.getters['virtualMedia/proxyDevices']; }, |