From 86de3af082ba6c541d9a6cb10c4db0d14f6267e8 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 5 Sep 2022 15:56:39 +0300 Subject: add method for isNotAdmin --- src/views/_sila/Overview/DateTime/DateTime.vue | 39 ++++++++------------------ 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'src/views/_sila/Overview/DateTime') 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') }} @@ -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 @@ -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') }} @@ -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']; }, -- cgit v1.2.3