From 86de3af082ba6c541d9a6cb10c4db0d14f6267e8 Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Mon, 5 Sep 2022 15:56:39 +0300
Subject: add method for isNotAdmin

---
 .../_sila/Operations/FactoryReset/FactoryReset.vue | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

(limited to 'src/views/_sila/Operations/FactoryReset/FactoryReset.vue')

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();
   },
-- 
cgit v1.2.3

