π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: inherited role badge update
Ramesh Maneb9c773738951
diff --git a/packages/nc-gui/components/project/AccessSettings.vue b/packages/nc-gui/components/project/AccessSettings.vueindex f0e0168c03..66fdad6f58 100644--- a/packages/nc-gui/components/project/AccessSettings.vue+++ b/packages/nc-gui/components/project/AccessSettings.vue@@ -734,48 +734,22 @@ onBeforeUnmount(() => {/></template><template v-else>- <div class="flex items-center gap-2">+ <div class="flex flex-col gap-1"><RolesBadge:border="false"- :role="getInheritanceInfo(record) ? ProjectRoles.INHERIT : record.roles"- :inherit="!!getInheritanceInfo(record)"+ :role="getInheritanceInfo(record) ? getInheritanceInfo(record)?.effectiveRole : record.roles"/>- <NcTooltip+ <divv-if="isEeUI && getInheritanceInfo(record)"- class="uppercase text-[10px] leading-4 text-nc-content-gray-muted"- placement="bottom"+ class="flex items-center gap-1 text-xs text-nc-content-gray-muted">- <template #title>- <div class="flex flex-col gap-1">- <div>- {{- getInheritanceInfo(record)?.source === 'team'- ? $t('tooltip.roleInheritedFromTeam')- : $t('tooltip.roleInheritedFromWorkspace')- }}- </div>- <div v-if="getInheritanceInfo(record)?.effectiveRole" class="text-xs font-normal">- {{- $t('tooltip.effectiveRole', {- role: $t(`objects.roleType.${getInheritanceInfo(record)?.effectiveRole}`),- })- }}- </div>- </div>- </template>- <div class="flex items-center gap-1">- <RolesBadge- v-if="getInheritanceInfo(record)?.effectiveRole"- :border="false"- :role="getInheritanceInfo(record)?.effectiveRole"- icon-only- nc-badge-class="!px-1"- />- <span>{{- getInheritanceInfo(record)?.source === 'team' ? $t('objects.team') : $t('objects.workspace')- }}</span>- </div>- </NcTooltip>+ <GeneralIcon icon="role_inherit" class="h-3 w-3" />+ <span>{{+ getInheritanceInfo(record)?.source === 'team'+ ? $t('tooltip.roleInheritedFromTeam')+ : $t('tooltip.roleInheritedFromWorkspace')+ }}</span>+ </div></div></template></div>diff --git a/packages/nc-gui/components/roles/SelectorV2.vue b/packages/nc-gui/components/roles/SelectorV2.vueindex 076ae736eb..94925ad020 100644--- a/packages/nc-gui/components/roles/SelectorV2.vue+++ b/packages/nc-gui/components/roles/SelectorV2.vue@@ -51,30 +51,18 @@ async function onChangeRole(val: SelectValue) {}const roleSelectorOptions = computed<NcListItemType[]>(() => {- return (props.disabledRoles || []).concat(props.roles || []).map(- (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] ?? '' : '',- }+ return (props.disabledRoles || []).concat(props.roles || []).map((role: keyof typeof RoleLabels): NcListItemType => {+ return {+ 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] ?? '' : '',}- )+ })})--// Helper computed for template access to RoleIcons and RoleColors-const roleIconsRef = computed(() => RoleIcons)-const roleColorsRef = computed(() => RoleColors)</script><template>@@ -85,35 +73,18 @@ const roleColorsRef = computed(() => RoleColors)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 class="flex flex-col gap-1 cursor-pointer">+ <RolesBadge data-testid="roles" :border="false" :role="effectiveRole || role" :size="size" clickable class="flex-none" />+ <div+ v-if="showInherit && isEeUI && role === ProjectRoles.INHERIT && !!inherit"+ class="flex items-center gap-1 text-xs text-nc-content-gray-muted"+ >+ <GeneralIcon icon="role_inherit" 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"- :size="size"- clickable- data-testid="roles"- class="flex-none"- /><template #overlay="{ onEsc }"><NcList@@ -135,82 +106,38 @@ const roleColorsRef = computed(() => RoleColors)><template #listItem="{ option }"><div class="w-full flex flex-col rounded-md" :class="[`nc-role-select-${option.value}`]">- <!-- 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') }}+ <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>- <!-- 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>+ <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>-- <!-- 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+ 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></template>diff --git a/packages/nc-gui/components/workspace/CollaboratorsList.vue b/packages/nc-gui/components/workspace/CollaboratorsList.vueindex 1d84dfbe5d..368a233e9d 100644--- a/packages/nc-gui/components/workspace/CollaboratorsList.vue+++ b/packages/nc-gui/components/workspace/CollaboratorsList.vue@@ -7,8 +7,6 @@ import {PlanTitles,WorkspaceUserRoles,type WorkspaceUserType,- extractBaseRoleFromWorkspaceRole,- ProjectRoles,} from 'nocodb-sdk'const props = defineProps<{@@ -344,16 +342,6 @@ 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(() => {@@ -636,26 +624,11 @@ 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>- <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" />+ <RolesBadge :border="false" :role="record.roles" class="cursor-default" /></template></div><div v-if="column.key === 'created_at'">