diff options
Diffstat (limited to 'src/views')
37 files changed, 241 insertions, 261 deletions
diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue index 08294d95..d63980bc 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue @@ -16,7 +16,7 @@ <b-form-group :label="$t('pageFans.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -36,7 +36,7 @@ <b-form-group :label="$t('pageFans.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -55,11 +55,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || - isPageLoading || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isPageLoading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -210,6 +206,9 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, groups() { return getGroups(this.filteredForChart); }, diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue index 4ee0ed29..cbcfe13d 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue @@ -16,7 +16,7 @@ <b-form-group :label="$t('pageFans.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -36,7 +36,7 @@ <b-form-group :label="$t('pageFans.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -55,11 +55,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || - isPageLoading || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isPageLoading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -210,6 +206,9 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, groups() { return getGroups(this.filteredForChart); }, diff --git a/src/views/_sila/Logs/EventLogs/EventLogs.vue b/src/views/_sila/Logs/EventLogs/EventLogs.vue index 4e72ac49..7e425472 100644 --- a/src/views/_sila/Logs/EventLogs/EventLogs.vue +++ b/src/views/_sila/Logs/EventLogs/EventLogs.vue @@ -32,10 +32,7 @@ <table-filter :filters="tableFilters" @filter-change="onFilterChange" /> <b-button variant="link" - :disabled=" - allLogs.length === 0 || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="allLogs.length === 0 || isNotAdmin" @click="deleteAllLogs" > <icon-delete /> {{ $t('global.action.deleteAll') }} @@ -62,14 +59,14 @@ <template #toolbar-buttons> <b-button variant="primary" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="resolveLogs" > {{ $t('pageEventLogs.resolve') }} </b-button> <b-button variant="primary" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="unresolveLogs" > {{ $t('pageEventLogs.unresolve') }} @@ -196,7 +193,7 @@ v-model="row.item.status" name="switch" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changelogStatus(row.item)" > <span v-if="row.item.status"> @@ -220,9 +217,7 @@ :export-name="exportFileNameByDate('export')" :data-test-id="`eventLogs-button-deleteRow-${row.index}`" :class="{ - disabledDiv: - $store.getters['authentication/role'] === 'ReadOnly' && - action.value === 'delete', + disabledDiv: isNotAdmin && action.value === 'delete', }" @click-table-action="onTableRowAction($event, row.item)" > @@ -433,6 +428,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, href() { return `data:text/json;charset=utf-8,${this.exportAllLogs()}`; }, diff --git a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue index e374e807..462fb606 100644 --- a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue +++ b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue @@ -10,7 +10,7 @@ <b-form-group :label="$t('pageMemory.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -29,7 +29,7 @@ <b-form-group :label="$t('pageMemory.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -49,9 +49,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -186,6 +184,9 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, groups() { return getGroups(this.filteredSensors); }, diff --git a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue index a8d1464b..4c8f3345 100644 --- a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue +++ b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue @@ -11,7 +11,7 @@ <b-form-group :label="$t('pageMotherboard.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -30,9 +30,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -161,6 +159,9 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, groups() { return getGroups(this.filteredSensors); }, 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']; }, diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index 4440cd4a..e4bc89b7 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -42,7 +42,7 @@ v-model="form.configurationSelected" value="manual" data-test-id="dateTime-radio-configureManual" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('pageDateTime.form.manual') }} </b-form-radio> @@ -57,10 +57,7 @@ id="input-manual-date" v-model="form.manual.date" :state="getValidationState($v.form.manual.date)" - :disabled=" - ntpOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="ntpOptionSelected || isNotAdmin" placeholder="YYYY-MM-DD" data-test-id="dateTime-input-manualDate" class="form-control-with-button" @@ -85,10 +82,7 @@ $t('global.calendar.useCursorKeysToNavigateCalendarDates') " :title="$t('global.calendar.selectDate')" - :disabled=" - ntpOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="ntpOptionSelected || isNotAdmin" button-variant="link" aria-controls="input-manual-date" > @@ -112,10 +106,7 @@ id="input-manual-time" v-model="form.manual.time" :state="getValidationState($v.form.manual.time)" - :disabled=" - ntpOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="ntpOptionSelected || isNotAdmin" placeholder="HH:MM" data-test-id="dateTime-input-manualTime" @blur="$v.form.manual.time.$touch()" @@ -136,7 +127,7 @@ v-model="form.configurationSelected" value="ntp" data-test-id="dateTime-radio-configureNTP" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > NTP </b-form-radio> @@ -151,10 +142,7 @@ id="input-ntp-1" v-model="form.ntp.firstAddress" :state="getValidationState($v.form.ntp.firstAddress)" - :disabled=" - manualOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="manualOptionSelected || isNotAdmin" data-test-id="dateTime-input-ntpServer1" @blur="$v.form.ntp.firstAddress.$touch()" /> @@ -179,10 +167,7 @@ id="input-ntp-2" v-model="form.ntp.secondAddress" :state="getValidationState($v.form.ntp.secondAddress)" - :disabled=" - manualOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="manualOptionSelected || isNotAdmin" data-test-id="dateTime-input-ntpServer2" @blur="$v.form.ntp.secondAddress.$touch()" /> @@ -204,10 +189,7 @@ id="input-ntp-3" v-model="form.ntp.thirdAddress" :state="getValidationState($v.form.ntp.thirdAddress)" - :disabled=" - manualOptionSelected || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="manualOptionSelected || isNotAdmin" data-test-id="dateTime-input-ntpServer3" @blur="$v.form.ntp.thirdAddress.$touch()" /> @@ -224,7 +206,7 @@ variant="primary" type="submit" data-test-id="dateTime-button-saveSettings" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('global.action.saveSettings') }} </b-button> @@ -318,6 +300,9 @@ export default { }, computed: { ...mapState('dateTime', ['ntpServers', 'isNtpProtocolEnabled']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, bmcTime() { return this.$store.getters['global/bmcTime']; }, diff --git a/src/views/_sila/Overview/Inventory/InventoryServiceIndicator.vue b/src/views/_sila/Overview/Inventory/InventoryServiceIndicator.vue index 7f0c9030..d823f40a 100644 --- a/src/views/_sila/Overview/Inventory/InventoryServiceIndicator.vue +++ b/src/views/_sila/Overview/Inventory/InventoryServiceIndicator.vue @@ -23,7 +23,7 @@ v-model="systems.locationIndicatorActive" data-test-id="inventoryService-toggle-identifyLed" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedSwitch" > <span v-if="systems.locationIndicatorActive"> @@ -46,6 +46,9 @@ export default { components: { PageSection }, mixins: [BVToastMixin], computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, systems() { let systemData = this.$store.getters['system/systems'][0]; return systemData ? systemData : {}; diff --git a/src/views/_sila/Overview/Inventory/InventoryTableAssembly.vue b/src/views/_sila/Overview/Inventory/InventoryTableAssembly.vue index 929c172b..93a5fe51 100644 --- a/src/views/_sila/Overview/Inventory/InventoryTableAssembly.vue +++ b/src/views/_sila/Overview/Inventory/InventoryTableAssembly.vue @@ -32,7 +32,7 @@ v-model="row.item.identifyLed" name="switch" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedValue(row.item)" > <span v-if="row.item.identifyLed"> @@ -118,6 +118,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, assemblies() { return this.$store.getters['assemblies/assemblies']; }, diff --git a/src/views/_sila/Overview/Inventory/InventoryTableBmcManager.vue b/src/views/_sila/Overview/Inventory/InventoryTableBmcManager.vue index 5fb23bfd..e73dab05 100644 --- a/src/views/_sila/Overview/Inventory/InventoryTableBmcManager.vue +++ b/src/views/_sila/Overview/Inventory/InventoryTableBmcManager.vue @@ -36,7 +36,7 @@ v-model="row.item.identifyLed" name="switch" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedValue(row.item)" > <span v-if="row.item.identifyLed"> @@ -209,6 +209,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, bmc() { return this.$store.getters['bmc/bmc']; }, diff --git a/src/views/_sila/Overview/Inventory/InventoryTableChassis.vue b/src/views/_sila/Overview/Inventory/InventoryTableChassis.vue index d141924f..8897d87a 100644 --- a/src/views/_sila/Overview/Inventory/InventoryTableChassis.vue +++ b/src/views/_sila/Overview/Inventory/InventoryTableChassis.vue @@ -35,7 +35,7 @@ v-model="row.item.identifyLed" name="switch" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedValue(row.item)" > <span v-if="row.item.identifyLed"> @@ -163,6 +163,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, chassis() { return this.$store.getters['chassis/chassis']; }, diff --git a/src/views/_sila/Overview/Inventory/InventoryTableProcessors.vue b/src/views/_sila/Overview/Inventory/InventoryTableProcessors.vue index 60121818..83968314 100644 --- a/src/views/_sila/Overview/Inventory/InventoryTableProcessors.vue +++ b/src/views/_sila/Overview/Inventory/InventoryTableProcessors.vue @@ -56,7 +56,7 @@ v-model="row.item.identifyLed" name="switch" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedValue(row.item)" > <span v-if="row.item.identifyLed"> @@ -207,6 +207,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, filteredRows() { return this.searchFilter ? this.searchTotalFilteredRows diff --git a/src/views/_sila/Overview/Inventory/InventoryTableSystem.vue b/src/views/_sila/Overview/Inventory/InventoryTableSystem.vue index 286df969..e6929987 100644 --- a/src/views/_sila/Overview/Inventory/InventoryTableSystem.vue +++ b/src/views/_sila/Overview/Inventory/InventoryTableSystem.vue @@ -35,7 +35,7 @@ v-model="item.locationIndicatorActive" data-test-id="inventorySystem-toggle-identifyLed" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedSwitch" > <span v-if="item.locationIndicatorActive"> @@ -203,6 +203,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, systems() { return this.$store.getters['system/systems']; }, diff --git a/src/views/_sila/Overview/Network/NetworkGlobalSettings.vue b/src/views/_sila/Overview/Network/NetworkGlobalSettings.vue index 6a08c2c2..2d3ae4d0 100644 --- a/src/views/_sila/Overview/Network/NetworkGlobalSettings.vue +++ b/src/views/_sila/Overview/Network/NetworkGlobalSettings.vue @@ -11,7 +11,7 @@ <b-button variant="link" class="p-1" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="initSettingsModal()" > <icon-edit :title="$t('pageNetwork.modal.editHostnameTitle')" /> @@ -29,7 +29,7 @@ v-model="useDomainNameState" data-test-id="networkSettings-switch-useDomainName" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeDomainNameState" > <span v-if="useDomainNameState"> @@ -49,7 +49,7 @@ v-model="useDnsState" data-test-id="networkSettings-switch-useDns" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeDnsState" > <span v-if="useDnsState"> @@ -69,7 +69,7 @@ v-model="useNtpState" data-test-id="networkSettings-switch-useNtp" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeNtpState" > <span v-if="useNtpState"> @@ -103,6 +103,9 @@ export default { }, computed: { ...mapState('network', ['ethernetData']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, firstInterface() { return this.$store.getters['network/globalNetworkSettings'][0]; }, diff --git a/src/views/_sila/Overview/Network/NetworkInterfaceSettings.vue b/src/views/_sila/Overview/Network/NetworkInterfaceSettings.vue index 6eccb455..918b0f2e 100644 --- a/src/views/_sila/Overview/Network/NetworkInterfaceSettings.vue +++ b/src/views/_sila/Overview/Network/NetworkInterfaceSettings.vue @@ -39,7 +39,7 @@ <b-button variant="link" class="p-1" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="initMacAddressModal()" > <icon-edit @@ -88,6 +88,9 @@ export default { }, computed: { ...mapState('network', ['ethernetData']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, }, watch: { // Watch for change in tab index diff --git a/src/views/_sila/Overview/Network/TableDns.vue b/src/views/_sila/Overview/Network/TableDns.vue index e522d69b..d6e55f27 100644 --- a/src/views/_sila/Overview/Network/TableDns.vue +++ b/src/views/_sila/Overview/Network/TableDns.vue @@ -5,7 +5,7 @@ <div class="text-right"> <b-button variant="primary" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="initDnsModal()" > <icon-add /> @@ -93,6 +93,9 @@ export default { }, computed: { ...mapState('network', ['ethernetData']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, }, watch: { // Watch for change in tab index diff --git a/src/views/_sila/Overview/Network/TableIpv4.vue b/src/views/_sila/Overview/Network/TableIpv4.vue index 4cdc6a92..0e3bf576 100644 --- a/src/views/_sila/Overview/Network/TableIpv4.vue +++ b/src/views/_sila/Overview/Network/TableIpv4.vue @@ -9,7 +9,7 @@ <b-col class="text-right"> <b-button variant="primary" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="initAddIpv4Address()" > <icon-add /> @@ -109,6 +109,9 @@ export default { }, computed: { ...mapState('network', ['ethernetData']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, }, watch: { // Watch for change in tab index diff --git a/src/views/_sila/Overview/OverviewInventory.vue b/src/views/_sila/Overview/OverviewInventory.vue index bc0fd69e..10d198a8 100644 --- a/src/views/_sila/Overview/OverviewInventory.vue +++ b/src/views/_sila/Overview/OverviewInventory.vue @@ -13,7 +13,7 @@ v-model="systems.locationIndicatorActive" data-test-id="overviewInventory-checkbox-identifyLed" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="toggleIdentifyLedSwitch" > <span v-if="systems.locationIndicatorActive"> @@ -37,6 +37,9 @@ export default { OverviewCard, }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, systems() { let systemData = this.$store.getters['system/systems'][0]; return systemData ? systemData : {}; diff --git a/src/views/_sila/Power/Dynamic/PowerTemp.vue b/src/views/_sila/Power/Dynamic/PowerTemp.vue index 2b08abf5..c2d2217e 100644 --- a/src/views/_sila/Power/Dynamic/PowerTemp.vue +++ b/src/views/_sila/Power/Dynamic/PowerTemp.vue @@ -16,7 +16,7 @@ <b-form-group :label="$t('pagePowerSup.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -36,7 +36,7 @@ <b-form-group :label="$t('pagePowerSup.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -56,9 +56,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -198,6 +196,10 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + groups() { return getGroups(this.allSensors); }, diff --git a/src/views/_sila/Power/Dynamic/VoltInput.vue b/src/views/_sila/Power/Dynamic/VoltInput.vue index 794ca0d2..b8d21e36 100644 --- a/src/views/_sila/Power/Dynamic/VoltInput.vue +++ b/src/views/_sila/Power/Dynamic/VoltInput.vue @@ -15,7 +15,7 @@ <b-form-group :label="$t('pagePowerSup.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -34,7 +34,7 @@ <b-form-group :label="$t('pagePowerSup.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -54,11 +54,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || - isPageLoading || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isPageLoading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -196,6 +192,10 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + groups() { return getGroups(this.filteredItems); }, diff --git a/src/views/_sila/Power/Dynamic/VoltOutput.vue b/src/views/_sila/Power/Dynamic/VoltOutput.vue index 7659d235..2d6f99dc 100644 --- a/src/views/_sila/Power/Dynamic/VoltOutput.vue +++ b/src/views/_sila/Power/Dynamic/VoltOutput.vue @@ -15,7 +15,7 @@ <b-form-group :label="$t('pagePowerSup.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -34,7 +34,7 @@ <b-form-group :label="$t('pagePowerSup.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -54,11 +54,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || - isPageLoading || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isPageLoading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -196,6 +192,10 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + groups() { return getGroups(this.filteredItems); }, diff --git a/src/views/_sila/Processors/Dynamic/CpuTemp.vue b/src/views/_sila/Processors/Dynamic/CpuTemp.vue index 8946bedd..d367b90f 100644 --- a/src/views/_sila/Processors/Dynamic/CpuTemp.vue +++ b/src/views/_sila/Processors/Dynamic/CpuTemp.vue @@ -16,7 +16,7 @@ <b-form-group :label="$t('pageProcessors.labels.warning')"> <b-form-input v-model.number="warning" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.warning)" @blur="$v.warning.$touch()" @@ -36,7 +36,7 @@ <b-form-group :label="$t('pageProcessors.labels.critical')"> <b-form-input v-model.number="critical" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" type="number" :state="getValidationState($v.critical)" @blur="$v.critical.$touch()" @@ -56,9 +56,7 @@ <b-button variant="primary" style="height: 35px" - :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="loading || isNotAdmin" @click="saveLimit" > {{ $t('global.action.save') }} @@ -198,6 +196,10 @@ export default { }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, + groups() { return getGroups(this.filteredSensors); }, diff --git a/src/views/_sila/ResourceManagement/Power.vue b/src/views/_sila/ResourceManagement/Power.vue index aaa9929f..4aaf86d5 100644 --- a/src/views/_sila/ResourceManagement/Power.vue +++ b/src/views/_sila/ResourceManagement/Power.vue @@ -26,7 +26,7 @@ v-model="isPowerCapFieldEnabled" data-test-id="power-checkbox-togglePowerCapField" name="power-cap-setting" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('pagePower.powerCapSettingData') }} </b-form-checkbox> @@ -57,10 +57,7 @@ <b-form-input id="input-1" v-model.number="powerCapValue" - :disabled=" - !isPowerCapFieldEnabled || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="!isPowerCapFieldEnabled || isNotAdmin" data-test-id="power-input-powerCapValue" type="number" variant="with-label" @@ -83,7 +80,7 @@ variant="primary" type="submit" data-test-id="power-button-savePowerCapValue" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" > {{ $t('global.action.save') }} </b-button> @@ -120,7 +117,9 @@ export default { ...mapGetters({ powerConsumptionValue: 'powerControl/powerConsumptionValue', }), - + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, /** Computed property isPowerCapFieldEnabled is used to enable or disable the input field. The input field is enabled when the powercapValue property is not null. diff --git a/src/views/_sila/SecurityAndAccess/Certificates/Certificates.vue b/src/views/_sila/SecurityAndAccess/Certificates/Certificates.vue index b7d56e08..c2bc2ac4 100644 --- a/src/views/_sila/SecurityAndAccess/Certificates/Certificates.vue +++ b/src/views/_sila/SecurityAndAccess/Certificates/Certificates.vue @@ -37,20 +37,14 @@ v-b-modal.generate-csr data-test-id="certificates-button-generateCsr" variant="link" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" > <icon-add /> {{ $t('pageCertificates.generateCsr') }} </b-button> <b-button variant="primary" - :disabled=" - certificatesForUpload.length === 0 || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="certificatesForUpload.length === 0 || isNotAdmin" @click="initModalUploadCertificate(null)" > <icon-add /> @@ -90,7 +84,7 @@ :enabled="action.enabled" :class="{ disabledDiv: - $store.getters['authentication/role'] === 'ReadOnly' && + isNotAdmin && (action.value === 'delete' || action.value === 'replace'), }" @click-table-action="onTableRowAction($event, item)" @@ -178,6 +172,12 @@ export default { }; }, computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, certificates() { return this.$store.getters['certificates/allCertificates']; }, diff --git a/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue b/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue index 358cdf70..304ebc03 100644 --- a/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue +++ b/src/views/_sila/SecurityAndAccess/Ldap/Ldap.vue @@ -13,10 +13,7 @@ <b-form-checkbox v-model="form.ldapAuthenticationEnabled" data-test-id="ldap-checkbox-ldapAuthenticationEnabled" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="onChangeldapAuthenticationEnabled" > {{ $t('global.action.enable') }} @@ -48,8 +45,7 @@ :disabled=" !caCertificateExpiration || !ldapCertificateExpiration || - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' + isNotAdmin " @change="$v.form.secureLdapEnabled.$touch()" > @@ -83,11 +79,7 @@ v-model="form.activeDirectoryEnabled" data-test-id="ldap-radio-activeDirectoryEnabled" :value="false" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="onChangeServiceType" > OpenLDAP @@ -96,11 +88,7 @@ v-model="form.activeDirectoryEnabled" data-test-id="ldap-radio-activeDirectoryEnabled" :value="true" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="onChangeServiceType" > Active Directory @@ -123,11 +111,7 @@ v-model="form.serverUri" data-test-id="ldap-input-serverUri" :state="getValidationState($v.form.serverUri)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.serverUri.$touch()" /> <b-form-invalid-feedback role="alert"> @@ -146,11 +130,7 @@ v-model="form.bindDn" data-test-id="ldap-input-bindDn" :state="getValidationState($v.form.bindDn)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.bindDn.$touch()" /> <b-form-invalid-feedback role="alert"> @@ -172,11 +152,7 @@ type="password" :state="getValidationState($v.form.bindPassword)" class="form-control-with-button" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.bindPassword.$touch()" /> <b-form-invalid-feedback role="alert"> @@ -195,11 +171,7 @@ v-model="form.baseDn" data-test-id="ldap-input-baseDn" :state="getValidationState($v.form.baseDn)" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.baseDn.$touch()" /> <b-form-invalid-feedback role="alert"> @@ -219,11 +191,7 @@ id="user-id-attribute" v-model="form.userIdAttribute" data-test-id="ldap-input-userIdAttribute" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.userIdAttribute.$touch()" /> </b-form-group> @@ -240,11 +208,7 @@ id="group-id-attribute" v-model="form.groupIdAttribute" data-test-id="ldap-input-groupIdAttribute" - :disabled=" - $store.getters['authentication/role'] === - 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @change="$v.form.groupIdAttribute.$touch()" /> </b-form-group> @@ -260,11 +224,7 @@ variant="primary" type="submit" data-test-id="ldap-button-saveSettings" - :disabled=" - loading || - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="loading || isNotAdmin" > {{ $t('global.action.saveSettings') }} </b-btn> @@ -335,6 +295,12 @@ export default { 'ldap', 'activeDirectory', ]), + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, sslCertificates() { return this.$store.getters['certificates/allCertificates']; }, diff --git a/src/views/_sila/SecurityAndAccess/Ldap/TableRoleGroups.vue b/src/views/_sila/SecurityAndAccess/Ldap/TableRoleGroups.vue index 6168ae63..13247e24 100644 --- a/src/views/_sila/SecurityAndAccess/Ldap/TableRoleGroups.vue +++ b/src/views/_sila/SecurityAndAccess/Ldap/TableRoleGroups.vue @@ -11,10 +11,7 @@ <b-col class="text-right" md="9"> <b-btn variant="primary" - :disabled=" - !isServiceEnabled || - $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="!isServiceEnabled || isNotAdmin" @click="initRoleGroupModal(null)" > <icon-add /> @@ -162,6 +159,9 @@ export default { }, computed: { ...mapGetters('ldap', ['isServiceEnabled', 'enabledRoleGroups']), + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, tableItems() { return this.enabledRoleGroups.map(({ LocalRole, RemoteGroup }) => { return { diff --git a/src/views/_sila/SecurityAndAccess/Policies/Policies.vue b/src/views/_sila/SecurityAndAccess/Policies/Policies.vue index 8e690557..d3f2ffcb 100644 --- a/src/views/_sila/SecurityAndAccess/Policies/Policies.vue +++ b/src/views/_sila/SecurityAndAccess/Policies/Policies.vue @@ -16,7 +16,7 @@ v-model="sshProtocolState" data-test-id="policies-toggle-bmcShell" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeSshProtocolState" > <span class="sr-only"> @@ -42,7 +42,7 @@ v-model="ipmiProtocolState" data-test-id="polices-toggle-networkIpmi" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeIpmiProtocolState" > <span class="sr-only"> @@ -68,7 +68,7 @@ v-model="vtpmState" data-test-id="policies-toggle-vtpm" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeVtpmState" > <span class="sr-only"> @@ -94,7 +94,7 @@ v-model="rtadState" data-test-id="policies-toggle-rtad" switch - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @change="changeRtadState" > <span class="sr-only"> @@ -133,6 +133,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, sshProtocolState: { get() { return this.$store.getters['policies/sshProtocolEnabled']; diff --git a/src/views/_sila/SecurityAndAccess/UserManagement/UserManagement.vue b/src/views/_sila/SecurityAndAccess/UserManagement/UserManagement.vue index 8c073224..ed09564c 100644 --- a/src/views/_sila/SecurityAndAccess/UserManagement/UserManagement.vue +++ b/src/views/_sila/SecurityAndAccess/UserManagement/UserManagement.vue @@ -5,10 +5,7 @@ <b-col xl="9" class="text-right"> <b-button variant="link" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @click="initModalSettings" > <icon-settings /> @@ -17,10 +14,7 @@ <b-button variant="primary" data-test-id="userManagement-button-addUser" - :disabled=" - $store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator' - " + :disabled="isNotAdmin" @click="initModalUser(null)" > <icon-add /> @@ -81,8 +75,7 @@ :title="action.title" :class="{ disabledDiv: - ($store.getters['authentication/role'] === 'ReadOnly' || - $store.getters['authentication/role'] === 'Operator') && + isNotAdmin && (action.value === 'delete' || action.value === 'edit'), }" @click-table-action="onTableRowAction($event, item)" @@ -217,6 +210,12 @@ export default { }; }, computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, allUsers() { return this.$store.getters['userManagement/allUsers']; }, diff --git a/src/views/_sila/Settings/PowerRestorePolicy/PowerRestorePolicy.vue b/src/views/_sila/Settings/PowerRestorePolicy/PowerRestorePolicy.vue index ec6f332f..f9854721 100644 --- a/src/views/_sila/Settings/PowerRestorePolicy/PowerRestorePolicy.vue +++ b/src/views/_sila/Settings/PowerRestorePolicy/PowerRestorePolicy.vue @@ -9,7 +9,7 @@ v-model="currentPowerRestorePolicy" :options="options" name="power-restore-policy" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" ></b-form-radio-group> </b-form-group> </b-col> @@ -18,7 +18,7 @@ <b-button variant="primary" type="submit" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="submitForm" > {{ $t('global.action.saveSettings') }} @@ -47,6 +47,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, powerRestorePolicies() { return this.$store.getters['powerPolicy/powerRestorePolicies']; }, |