Browse Source

Merge pull request #7540 from nocodb/nc-fix/creator-role-change

Nc fix: org level creator own role update issue
pull/7546/head
Raju Udava 9 months ago committed by GitHub
parent
commit
39ebb6226d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      packages/nc-gui/components/account/UserList.vue
  2. 18
      packages/nc-gui/components/roles/Badge.vue
  3. 29
      packages/nc-gui/components/roles/Selector.vue
  4. 10
      packages/nc-gui/components/workspace/InviteSection.vue

5
packages/nc-gui/components/account/UserList.vue

@ -252,7 +252,7 @@ const openDeleteModal = (user: UserType) => {
{{ $t('labels.superAdmin') }} {{ $t('labels.superAdmin') }}
</div> </div>
<NcSelect <NcSelect
v-else v-else-if="el.id !== loggedInUser?.id"
v-model:value="el.roles" v-model:value="el.roles"
class="w-55 nc-user-roles" class="w-55 nc-user-roles"
:dropdown-match-select-width="false" :dropdown-match-select-width="false"
@ -297,6 +297,9 @@ const openDeleteModal = (user: UserType) => {
</span> </span>
</a-select-option> </a-select-option>
</NcSelect> </NcSelect>
<div v-else class="font-weight-bold" data-rec="true">
{{ $t(`objects.roleType.orgLevelCreator`) }}
</div>
</div> </div>
<span class="w-26 flex items-center justify-end mr-4"> <span class="w-26 flex items-center justify-end mr-4">
<div <div

18
packages/nc-gui/components/roles/Badge.vue

@ -39,14 +39,14 @@ const roleProperties = computed(() => {
<template> <template>
<div <div
class="flex items-start rounded-md" class="flex items-start rounded-md w-[fit-content] nc-role-badge"
:class="{ :class="{
'cursor-pointer': clickableRef, 'cursor-pointer': clickableRef,
}" }"
> >
<NcBadge class="!px-2" :color="roleProperties.color" :border="borderRef" :size="sizeSelect"> <NcBadge class="!px-2 w-full" :color="roleProperties.color" :border="borderRef" :size="sizeSelect">
<div <div
class="badge-text flex items-center gap-2" class="badge-text w-full flex items-center justify-between gap-2"
:class="{ :class="{
'text-purple-700': roleProperties.color === 'purple', 'text-purple-700': roleProperties.color === 'purple',
'text-blue-700': roleProperties.color === 'blue', 'text-blue-700': roleProperties.color === 'blue',
@ -59,11 +59,13 @@ const roleProperties = computed(() => {
sizeSelect, sizeSelect,
}" }"
> >
<GeneralIcon :icon="roleProperties.icon" /> <div class="flex items-center gap-2">
<span class="flex whitespace-nowrap"> <GeneralIcon :icon="roleProperties.icon" />
{{ $t(`objects.roleType.${roleProperties.label}`) }} <span class="flex whitespace-nowrap">
</span> {{ $t(`objects.roleType.${roleProperties.label}`) }}
<GeneralIcon v-if="clickableRef" icon="arrowDown" /> </span>
</div>
<GeneralIcon v-if="clickableRef" icon="arrowDown" class="flex-none" />
</div> </div>
</NcBadge> </NcBadge>
<!-- <!--

29
packages/nc-gui/components/roles/Selector.vue

@ -36,19 +36,19 @@ function onChangeRole(val: SelectValue) {
<template> <template>
<div ref="dropdownRef" size="lg" class="nc-roles-selector relative" @click="isDropdownOpen = !isDropdownOpen"> <div ref="dropdownRef" size="lg" class="nc-roles-selector relative" @click="isDropdownOpen = !isDropdownOpen">
<RolesBadge data-testid="roles" :role="roleRef" :inherit="inheritRef === role" :size="sizeRef" /> <RolesBadge data-testid="roles" :role="roleRef" :inherit="inheritRef === role" :size="sizeRef" clickable />
<a-select <a-select
v-model:value="roleRef" v-model:value="roleRef"
:open="isDropdownOpen" :open="isDropdownOpen"
:dropdown-match-select-width="false" :dropdown-match-select-width="false"
dropdown-class-name="!rounded-lg !h-fit max-w-64" dropdown-class-name="!rounded-lg !h-fit max-w-[350px] nc-role-selector-dropdown"
class="py-1 !absolute top-0 left-0 w-full h-full z-10 text-xs opacity-0" class="py-1 !absolute top-0 left-0 w-full h-full z-10 text-xs opacity-0"
@change="onChangeRole" @change="onChangeRole"
> >
<a-select-option v-for="rl in props.roles" :key="rl" v-e="['c:workspace:settings:user-role-change']" :value="rl"> <a-select-option v-for="rl in props.roles" :key="rl" v-e="['c:workspace:settings:user-role-change']" :value="rl">
<div <div
:class="{ :class="{
'w-[350px]': descriptionRef, 'w-full': descriptionRef,
'w-[200px]': !descriptionRef, 'w-[200px]': !descriptionRef,
}" }"
class="flex flex-col nc-role-select-dropdown gap-1" class="flex flex-col nc-role-select-dropdown gap-1"
@ -57,7 +57,7 @@ function onChangeRole(val: SelectValue) {
<RolesBadge :class="`nc-role-select-${rl}`" :role="rl" :inherit="inheritRef === rl" :border="false" /> <RolesBadge :class="`nc-role-select-${rl}`" :role="rl" :inherit="inheritRef === rl" :border="false" />
<GeneralIcon v-if="rl === roleRef" icon="check" class="text-primary" /> <GeneralIcon v-if="rl === roleRef" icon="check" class="text-primary" />
</div> </div>
<div v-if="descriptionRef" class="text-gray-500">{{ RoleDescriptions[rl] }}</div> <div v-if="descriptionRef" class="text-gray-500 text-xs">{{ RoleDescriptions[rl] }}</div>
</div> </div>
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -68,4 +68,25 @@ function onChangeRole(val: SelectValue) {
.ant-select-item-option-content { .ant-select-item-option-content {
white-space: normal; /* Change from 'nowrap' to 'normal' */ white-space: normal; /* Change from 'nowrap' to 'normal' */
} }
.nc-role-selector-dropdown {
.rc-virtual-list-holder {
&::-webkit-scrollbar {
width: 4px;
height: 4px;
}
&::-webkit-scrollbar-track-piece {
width: 0px;
}
&::-webkit-scrollbar {
@apply bg-transparent;
}
&::-webkit-scrollbar-thumb {
width: 4px;
@apply bg-gray-200 rounded-md;
}
&::-webkit-scrollbar-thumb:hover {
@apply bg-gray-300;
}
}
}
</style> </style>

10
packages/nc-gui/components/workspace/InviteSection.vue

@ -233,11 +233,13 @@ const onPaste = (e: ClipboardEvent) => {
@paste.prevent="onPaste" @paste.prevent="onPaste"
/> />
</div> </div>
<span v-if="emailValidation.isError" class="ml-2 text-red-500 text-[10px] mt-1.5">{{ emailValidation.message }}</span> <span v-if="emailValidation.isError && emailValidation.message" class="ml-2 text-red-500 text-[10px] mt-1.5">{{
emailValidation.message
}}</span>
</div> </div>
<RolesSelector <RolesSelector
size="md" size="md"
class="px-1" class="px-1 min-w-[152px] nc-invite-role-selector"
:role="inviteData.roles" :role="inviteData.roles"
:roles="allowedRoles" :roles="allowedRoles"
:on-role-change="(role: WorkspaceUserRoles) => (inviteData.roles = role)" :on-role-change="(role: WorkspaceUserRoles) => (inviteData.roles = role)"
@ -270,4 +272,8 @@ const onPaste = (e: ClipboardEvent) => {
:deep(.ant-select-selection-item) { :deep(.ant-select-selection-item) {
@apply mt-0.75; @apply mt-0.75;
} }
:deep(.nc-invite-role-selector .nc-role-badge) {
@apply w-full;
}
</style> </style>

Loading…
Cancel
Save