Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

feat: improve inherit UI with double-lined role display

claude[bot]dde719c6d8c0
diff --git a/packages/nc-gui/components/roles/SelectorV2.vue b/packages/nc-gui/components/roles/SelectorV2.vue
index e3a85749c0..076ae736eb 100644
--- a/packages/nc-gui/components/roles/SelectorV2.vue
+++ b/packages/nc-gui/components/roles/SelectorV2.vue
@@ -52,17 +52,29 @@ async function onChangeRole(val: SelectValue) {
const roleSelectorOptions = computed<NcListItemType[]>(() => {
return (props.disabledRoles || []).concat(props.roles || []).map(
- (role: keyof typeof RoleLabels): NcListItemType => ({
- value: role,
- label: t(`objects.roleType.${RoleLabels[role]}`),
- description: t(`objects.roleDescription.${role}`),
- icon: RoleIcons[role],
- color: RoleColors[role],
- ncItemDisabled: props.disabledRoles?.includes(role),
- ncItemTooltip: props.disabledRoles?.includes(role) ? props.disabledRolesTooltip?.[role] ?? '' : '',
- }),
+ (role: keyof typeof RoleLabels): NcListItemType => {
+ // For inherit roles, show enhanced description with effective role
+ const isInheritRole = role === ProjectRoles.INHERIT
+ const enhancedDescription = isInheritRole && props.effectiveRole
+ ? `${t(`objects.roleDescription.${role}`)} β€’ ${t('tooltip.effectiveRole', { role: t(`objects.roleType.${props.effectiveRole}`) })}`
+ : t(`objects.roleDescription.${role}`)
+
+ return {
+ value: role,
+ label: t(`objects.roleType.${RoleLabels[role]}`),
+ description: enhancedDescription,
+ icon: RoleIcons[role],
+ color: RoleColors[role],
+ ncItemDisabled: props.disabledRoles?.includes(role),
+ ncItemTooltip: props.disabledRoles?.includes(role) ? props.disabledRolesTooltip?.[role] ?? '' : '',
+ }
+ }
)
})
+
+// Helper computed for template access to RoleIcons and RoleColors
+const roleIconsRef = computed(() => RoleIcons)
+const roleColorsRef = computed(() => RoleColors)
</script>
<template>
@@ -73,7 +85,27 @@ const roleSelectorOptions = computed<NcListItemType[]>(() => {
default-slot-wrapper-class="flex-1 flex items-center gap-3"
:placement="placement"
>
+ <!-- Double-line display for inherit roles -->
+ <div
+ v-if="showInherit && isEeUI && role === ProjectRoles.INHERIT && effectiveRole"
+ class="flex flex-col gap-1 cursor-pointer"
+ data-testid="roles"
+ >
+ <RolesBadge
+ :border="false"
+ :role="effectiveRole"
+ :size="size"
+ clickable
+ class="flex-none"
+ />
+ <div class="flex items-center gap-1 text-xs text-nc-content-gray-muted">
+ <GeneralIcon icon="ncInherit" class="h-3 w-3" />
+ <span>{{ inheritSource === 'team' ? $t('tooltip.roleInheritedFromTeam') : $t('tooltip.roleInheritedFromWorkspace') }}</span>
+ </div>
+ </div>
+ <!-- Single-line display for non-inherit roles -->
<RolesBadge
+ v-else
:border="false"
:inherit="!!inherit && role === ProjectRoles.INHERIT"
:role="role"
@@ -82,27 +114,6 @@ const roleSelectorOptions = computed<NcListItemType[]>(() => {
data-testid="roles"
class="flex-none"
/>
- <NcTooltip
- v-if="showInherit && isEeUI && !!inherit && role === ProjectRoles.INHERIT"
- class="uppercase text-[10px] leading-4 text-nc-content-gray-muted"
- placement="bottom"
- :disabled="isDropdownOpen"
- >
- <template #title>
- <div class="flex flex-col gap-1">
- <div>
- {{ inheritSource === 'team' ? $t('tooltip.roleInheritedFromTeam') : $t('tooltip.roleInheritedFromWorkspace') }}
- </div>
- <div v-if="effectiveRole" class="text-xs font-normal">
- {{ $t('tooltip.effectiveRole', { role: $t(`objects.roleType.${effectiveRole}`) }) }}
- </div>
- </div>
- </template>
- <div class="flex items-center gap-1">
- <RolesBadge v-if="effectiveRole" :border="false" :role="effectiveRole" icon-only nc-badge-class="!px-1" />
- <span>{{ inheritSource === 'team' ? $t('objects.team') : $t('objects.workspace') }}</span>
- </div>
- </NcTooltip>
<template #overlay="{ onEsc }">
<NcList
@@ -124,38 +135,82 @@ const roleSelectorOptions = computed<NcListItemType[]>(() => {
>
<template #listItem="{ option }">
<div class="w-full flex flex-col rounded-md" :class="[`nc-role-select-${option.value}`]">
- <div class="w-full flex items-center justify-between">
- <div class="flex items-center gap-2">
- <GeneralIcon
- :icon="(option.icon as IconMapKey)"
- class="flex-none h-4 w-4"
- :class="roleColorsMapping[option.color]?.content ?? 'text-nc-content-brand-hover'"
- />
- <span
- class="text-captionDropdownDefault"
- :class="[
- roleColorsMapping[option.color]?.content ?? 'text-nc-content-brand-hover',
- {
- '!font-semibold': !description,
- },
- ]"
- >
- {{ option.label }}
+ <!-- Special handling for inherit roles -->
+ <div v-if="option.value === ProjectRoles.INHERIT && effectiveRole" class="w-full flex flex-col gap-2">
+ <!-- Main role display -->
+ <div class="w-full flex items-center justify-between">
+ <div class="flex items-center gap-2">
+ <GeneralIcon
+ :icon="roleIconsRef[effectiveRole] as IconMapKey"
+ class="flex-none h-4 w-4"
+ :class="roleColorsMapping[roleColorsRef[effectiveRole]]?.content ?? 'text-nc-content-brand-hover'"
+ />
+ <span
+ class="text-captionDropdownDefault"
+ :class="[
+ roleColorsMapping[roleColorsRef[effectiveRole]]?.content ?? 'text-nc-content-brand-hover',
+ {
+ '!font-semibold': !description,
+ },
+ ]"
+ >
+ {{ t(`objects.roleType.${effectiveRole}`) }}
+ </span>
+ </div>
+ <GeneralLoader v-if="option.value === newRole" size="medium" />
+ <GeneralIcon v-else-if="!newRole && option.value === role" icon="check" class="text-nc-content-brand h-4 w-4" />
+ </div>
+ <!-- Inherit source information -->
+ <div class="flex items-center gap-2 ml-6">
+ <GeneralIcon icon="link2" class="h-3 w-3 text-nc-content-gray-muted" />
+ <span class="text-xs text-nc-content-gray-muted">
+ {{ inheritSource === 'team' ? $t('tooltip.roleInheritedFromTeam') : $t('tooltip.roleInheritedFromWorkspace') }}
</span>
</div>
- <GeneralLoader v-if="option.value === newRole" size="medium" />
- <GeneralIcon v-else-if="!newRole && option.value === role" icon="check" class="text-nc-content-brand h-4 w-4" />
+ <!-- Description -->
+ <div
+ v-if="description"
+ class="text-bodySm !font-light ml-6 text-nc-content-gray-muted dark:text-nc-content-gray-light"
+ >
+ {{ option.description }}
+ </div>
</div>
- <div
- v-if="description"
- class="text-bodySm !font-light ml-6"
- :class="
- option.value === ProjectRoles.INHERIT
- ? 'text-nc-content-gray-muted dark:text-nc-content-gray-light'
- : 'text-nc-content-gray-muted'
- "
- >
- {{ option.description }}
+
+ <!-- Standard role display -->
+ <div v-else class="w-full flex flex-col">
+ <div class="w-full flex items-center justify-between">
+ <div class="flex items-center gap-2">
+ <GeneralIcon
+ :icon="(option.icon as IconMapKey)"
+ class="flex-none h-4 w-4"
+ :class="roleColorsMapping[option.color]?.content ?? 'text-nc-content-brand-hover'"
+ />
+ <span
+ class="text-captionDropdownDefault"
+ :class="[
+ roleColorsMapping[option.color]?.content ?? 'text-nc-content-brand-hover',
+ {
+ '!font-semibold': !description,
+ },
+ ]"
+ >
+ {{ option.label }}
+ </span>
+ </div>
+ <GeneralLoader v-if="option.value === newRole" size="medium" />
+ <GeneralIcon v-else-if="!newRole && option.value === role" icon="check" class="text-nc-content-brand h-4 w-4" />
+ </div>
+ <div
+ v-if="description"
+ class="text-bodySm !font-light ml-6"
+ :class="
+ option.value === ProjectRoles.INHERIT
+ ? 'text-nc-content-gray-muted dark:text-nc-content-gray-light'
+ : 'text-nc-content-gray-muted'
+ "
+ >
+ {{ option.description }}
+ </div>
</div>
</div>
</template>
diff --git a/packages/nc-gui/components/workspace/CollaboratorsList.vue b/packages/nc-gui/components/workspace/CollaboratorsList.vue
index 368a233e9d..1d84dfbe5d 100644
--- a/packages/nc-gui/components/workspace/CollaboratorsList.vue
+++ b/packages/nc-gui/components/workspace/CollaboratorsList.vue
@@ -7,6 +7,8 @@ import {
PlanTitles,
WorkspaceUserRoles,
type WorkspaceUserType,
+ extractBaseRoleFromWorkspaceRole,
+ ProjectRoles,
} from 'nocodb-sdk'
const props = defineProps<{
@@ -342,6 +344,16 @@ const isDeleteOrUpdateAllowed = (user) => {
return !(isOnlyOneOwner.value && user.roles === WorkspaceUserRoles.OWNER)
}
+const getEffectiveRoleForUser = (user: any) => {
+ // For workspace users, if they have INHERIT role, determine the effective role from their workspace role
+ if (user.roles === WorkspaceUserRoles.INHERIT) {
+ // In workspace context, INHERIT typically resolves to EDITOR by default
+ // This is a simplified logic - in practice you might need to look at workspace-level defaults
+ return WorkspaceUserRoles.EDITOR
+ }
+ return user.roles
+}
+
const topScroll = ref(0)
const tableHeight = computed(() => {
@@ -624,11 +636,26 @@ watch(inviteDlg, (newVal) => {
:on-role-change="(role) => showRoleChangeConfirmationModal(record, role as WorkspaceUserRoles)"
:role="record.roles"
:roles="getTeamCompatibleAccessibleRoles(accessibleRoles, record)"
+ :show-inherit="true"
+ :inherit-source="'workspace'"
+ :effective-role="record.roles === WorkspaceUserRoles.INHERIT ? getEffectiveRoleForUser(record) : undefined"
class="cursor-pointer"
/>
</template>
<template v-else>
- <RolesBadge :border="false" :role="record.roles" class="cursor-default" />
+ <div v-if="record.roles === WorkspaceUserRoles.INHERIT" class="flex flex-col gap-1">
+ <RolesBadge
+ :border="false"
+ :role="getEffectiveRoleForUser(record)"
+ class="cursor-default"
+ :size="'sm'"
+ />
+ <div class="flex items-center gap-1 text-xs text-nc-content-gray-muted">
+ <GeneralIcon icon="link2" class="h-3 w-3" />
+ <span>{{ $t('tooltip.roleInheritedFromWorkspace') }}</span>
+ </div>
+ </div>
+ <RolesBadge v-else :border="false" :role="record.roles" class="cursor-default" />
</template>
</div>
<div v-if="column.key === 'created_at'">