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/components | |
parent | fec1602b12c66e7675f4020d544886871cf5f5c9 (diff) | |
download | webui-vue-86de3af082ba6c541d9a6cb10c4db0d14f6267e8.tar.xz |
add method for isNotAdmin
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/_sila/Global/FormFile.vue | 5 | ||||
-rw-r--r-- | src/components/_sila/Global/TableRowAction.vue | 7 | ||||
-rw-r--r-- | src/components/_sila/Global/TableToolbar.vue | 10 |
3 files changed, 17 insertions, 5 deletions
diff --git a/src/components/_sila/Global/FormFile.vue b/src/components/_sila/Global/FormFile.vue index 874b4ebd..4d79e987 100644 --- a/src/components/_sila/Global/FormFile.vue +++ b/src/components/_sila/Global/FormFile.vue @@ -28,7 +28,7 @@ 'btn-secondary': isSecondary, 'btn-primary': !isSecondary, }" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="$bvModal.show(`modal-${id}`)" > {{ $t('global.fileUpload.browseText') }} @@ -86,6 +86,9 @@ export default { }; }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, isSecondary() { return this.variant === 'secondary'; }, diff --git a/src/components/_sila/Global/TableRowAction.vue b/src/components/_sila/Global/TableRowAction.vue index c18b4f20..9384538e 100644 --- a/src/components/_sila/Global/TableRowAction.vue +++ b/src/components/_sila/Global/TableRowAction.vue @@ -42,9 +42,7 @@ v-else-if="showButton" variant="link" :class="{ 'btn-icon-only': btnIconOnly }" - :disabled=" - !enabled || $store.getters['authentication/role'] === 'ReadOnly' - " + :disabled="!enabled || isNotAdmin" :title="btnIconOnly ? title : !title" @click="$emit('click-table-action', value)" > @@ -100,6 +98,9 @@ export default { }, }, computed: { + isNotAdmin() { + return this.$store.getters['authentication/role'] === 'ReadOnly'; + }, dataForExport() { return JSON.stringify(omit(this.rowData, 'actions')); }, diff --git a/src/components/_sila/Global/TableToolbar.vue b/src/components/_sila/Global/TableToolbar.vue index 53d004cf..4f1dfe63 100644 --- a/src/components/_sila/Global/TableToolbar.vue +++ b/src/components/_sila/Global/TableToolbar.vue @@ -13,7 +13,7 @@ :data-test-id="`table-button-${action.value}Selected`" variant="primary" class="d-block" - :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + :disabled="isNotAdmin" @click="$emit('batch-action', action.value)" > {{ action.label }} @@ -57,6 +57,14 @@ export default { isToolbarActive: false, }; }, + computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, + }, watch: { selectedItemsCount: function (selectedItemsCount) { if (selectedItemsCount > 0) { |