Skip to content

Commit

Permalink
🛂 Remove start edditing button, if no permissions (gchq#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Feb 12, 2022
1 parent 0146e99 commit ca9498b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Settings/ConfigLauncher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
v-tooltip="tooltip($t('settings.config-launcher-tooltip'))" />
<IconInteractiveEditor @click="startInteractiveEditor()" tabindex="-2"
v-tooltip="tooltip(enterEditModeTooltip)"
:class="isEditMode ? 'disabled' : ''" />
:class="(isEditMode || !isEditAllowed) ? 'disabled' : ''" />
<IconViewMode @click="openChangeViewMenu()" tabindex="-2"
v-tooltip="tooltip($t('alternate-views.alternate-view-heading'))" />
</div>
Expand Down Expand Up @@ -91,8 +91,12 @@ export default {
isEditMode() {
return this.$store.state.editMode;
},
isEditAllowed() {
return this.$store.getters.permissions.allowViewConfig;
},
/* Tooltip text for Edit Mode button, to change depending on it in edit mode */
enterEditModeTooltip() {
if (!this.isEditAllowed) return 'Config editor not available';
return this.$t(
`interactive-editor.menu.${this.isEditMode
? 'edit-mode-subtitle' : 'start-editing-tooltip'}`,
Expand Down Expand Up @@ -126,7 +130,7 @@ export default {
this.viewSwitcherOpen = false;
},
startInteractiveEditor() {
if (!this.isEditMode) {
if (!this.isEditMode && this.isEditAllowed) {
this.$store.commit(Keys.SET_EDIT_MODE, true);
}
},
Expand Down

0 comments on commit ca9498b

Please sign in to comment.