-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tooltips-permissions' into 'main'
Show tooltips on buttons for missing permissions See merge request reportcreator/reportcreator!822
- Loading branch information
Showing
8 changed files
with
82 additions
and
29 deletions.
There are no files selected for viewing
12 changes: 7 additions & 5 deletions
12
packages/frontend/src/components/Design/CreateDesignDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
packages/frontend/src/components/Design/ImportDesignDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/nuxt-base-layer/src/components/PermissionInfo.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<span v-if="!props.value" class="permission-info" @click.prevent> | ||
<slot /> | ||
<s-tooltip activator="parent" :text="text" /> | ||
</span> | ||
<span v-else><slot /></span> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps<{ | ||
value: boolean; | ||
text?: string; | ||
permissionName?: string; | ||
}>(); | ||
const auth = useAuth(); | ||
const apiSettings = useApiSettings(); | ||
const text = computed(() => { | ||
if (props.text) { | ||
return props.text; | ||
} else if (auth.permissions.value.superuser && !auth.permissions.value.admin && apiSettings.isProfessionalLicense) { | ||
return 'Superuser permissions not enabled'; | ||
} else if (props.permissionName) { | ||
return `Permission required: ${props.permissionName}`; | ||
} else { | ||
return 'No permission to perform this action'; | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.permission-info { | ||
pointer-events: auto; | ||
} | ||
</style> |