diff --git a/packages/nc-gui/components/roles/Selector.vue b/packages/nc-gui/components/roles/Selector.vue
index 3f4486d9cd..3258ec7337 100644
--- a/packages/nc-gui/components/roles/Selector.vue
+++ b/packages/nc-gui/components/roles/Selector.vue
@@ -2,20 +2,27 @@
import type { RoleLabels } from 'nocodb-sdk'
import { toRef } from '#imports'
-const props = defineProps<{
- role: keyof typeof RoleLabels
- roles: (keyof typeof RoleLabels)[]
- inherit?: string
- onRoleChange: (role: keyof typeof RoleLabels) => void
-}>()
+const props = withDefaults(
+ defineProps<{
+ role: keyof typeof RoleLabels
+ roles: (keyof typeof RoleLabels)[]
+ description?: boolean
+ inherit?: string
+ onRoleChange: (role: keyof typeof RoleLabels) => void
+ }>(),
+ {
+ description: true,
+ },
+)
const roleRef = toRef(props, 'role')
const inheritRef = toRef(props, 'inherit')
+const descriptionRef = toRef(props, 'description')
-
+
@@ -32,6 +39,7 @@ const inheritRef = toRef(props, 'inherit')
:class="`nc-role-select-${rl}`"
:role="rl"
:inherit="inheritRef === rl"
+ :description="descriptionRef"
/>
diff --git a/packages/nc-gui/components/workspace/InviteSection.vue b/packages/nc-gui/components/workspace/InviteSection.vue
index 4121663bf4..031e5fb6a2 100644
--- a/packages/nc-gui/components/workspace/InviteSection.vue
+++ b/packages/nc-gui/components/workspace/InviteSection.vue
@@ -10,7 +10,8 @@ const inviteData = reactive({
const workspaceStore = useWorkspace()
const { inviteCollaborator: _inviteCollaborator } = workspaceStore
-const { isInvitingCollaborators, workspaceRole } = storeToRefs(workspaceStore)
+const { isInvitingCollaborators } = storeToRefs(workspaceStore)
+const { workspaceRoles } = useRoles()
const inviteCollaborator = async () => {
try {
@@ -23,9 +24,19 @@ const inviteCollaborator = async () => {
}
// allow only lower roles to be assigned
-const allowedRoles = computed(() => {
- const currentRoleIndex = OrderedWorkspaceRoles.findIndex((role) => role === workspaceRole.value)
- return OrderedWorkspaceRoles.slice(currentRoleIndex + 1)
+const allowedRoles = ref([])
+
+onMounted(async () => {
+ try {
+ const currentRoleIndex = OrderedWorkspaceRoles.findIndex(
+ (role) => workspaceRoles.value && Object.keys(workspaceRoles.value).includes(role),
+ )
+ if (currentRoleIndex !== -1) {
+ allowedRoles.value = OrderedWorkspaceRoles.slice(currentRoleIndex + 1).filter((r) => r)
+ }
+ } catch (e: any) {
+ message.error(await extractSdkResponseErrorMsg(e))
+ }
})
@@ -41,18 +52,13 @@ const allowedRoles = computed(() => {
class="!max-w-130 !rounded"
/>
-
-
-
-
-
-
-
- {{ RoleLabels[role] }}
-
-
-
-
+