diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-05 15:56:39 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-05 15:56:39 +0300 |
commit | 86de3af082ba6c541d9a6cb10c4db0d14f6267e8 (patch) | |
tree | d68f6f7560b98cbd9451e035198778f7fbf1b340 /src/views/_sila/Operations/ServerPowerOperations | |
parent | fec1602b12c66e7675f4020d544886871cf5f5c9 (diff) | |
download | webui-vue-86de3af082ba6c541d9a6cb10c4db0d14f6267e8.tar.xz |
add method for isNotAdmin
Diffstat (limited to 'src/views/_sila/Operations/ServerPowerOperations')
-rw-r--r-- | src/views/_sila/Operations/ServerPowerOperations/BootSettings.vue | 19 | ||||
-rw-r--r-- | src/views/_sila/Operations/ServerPowerOperations/ServerPowerOperations.vue | 25 |
2 files changed, 18 insertions, 26 deletions
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']; }, |