Browse Source

fix: prevented unwanted rerender

pull/6496/head
sreehari jayaraj 1 year ago
parent
commit
fcaae47749
  1. 67
      packages/nc-gui/components/project/AccessSettings.vue

67
packages/nc-gui/components/project/AccessSettings.vue

@ -74,12 +74,6 @@ const loadListData = async ($state: any) => {
$state.loaded() $state.loaded()
} }
const reloadCollabs = async () => {
currentPage.value = 0
collaborators.value = []
await loadCollaborators()
}
const updateCollaborator = async (collab: any, roles: ProjectRoles) => { const updateCollaborator = async (collab: any, roles: ProjectRoles) => {
try { try {
if ( if (
@ -106,8 +100,7 @@ const updateCollaborator = async (collab: any, roles: ProjectRoles) => {
} }
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} finally { loadCollaborators()
reloadCollabs()
} }
} }
@ -180,36 +173,39 @@ onMounted(async () => {
<div class="h-160 nc-scrollbar-md rounded-lg border-1 w-250"> <div class="h-160 nc-scrollbar-md rounded-lg border-1 w-250">
<table> <table>
<thead class="bg-gray-50 h-10 sticky top-0"> <thead class="bg-gray-50 h-10 sticky top-0">
<th class="text-start w-1/4 text-gray-700 sticky top-0 pr-40">{{ $t('objects.users') }}</th> <th class="text-start w-80 text-gray-700 sticky top-0 pr-50">{{ $t('objects.users') }}</th>
<th class="text-start w-1/4 text-gray-700 sticky top-0 pl-20">{{ $t('title.dateJoined') }}</th> <th class="text-start w-80 text-gray-700 sticky top-0 pl-6">{{ $t('title.dateJoined') }}</th>
<th class="text-start w-2/4 text-gray-700 sticky top-0">{{ $t('general.access') }}</th> <th class="text-start w-80 text-gray-700 sticky top-0 pr-13">{{ $t('general.access') }}</th>
<th class="pr-8 text-gray-700 sticky top-0">Actions</th>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(collab, i) of collaborators" :key="i" class="border-b-1 py-1 h-14"> <tr v-for="(collab, i) of collaborators" :key="i" class="border-b-1 py-1 h-14">
<td class="flex gap-3 justify-start items-center h-14 pl-8"> <td class="flex gap-3 justify-start items-center h-14 w-75 ml-15">
<GeneralUserIcon size="base" :name="collab.email" :email="collab.email" /> <GeneralUserIcon size="base" :name="collab.email" :email="collab.email" />
<span class="truncate"> <span class="truncate">
{{ collab.email }} {{ collab.email }}
</span> </span>
</td> </td>
<td class="w-1/4 text-center pl-20"> <td class="w-75 text-center pl-18">
{{ timeAgo(collab.created_at) }} <div class="flex justify-start w-35 ml-15">
{{ timeAgo(collab.created_at) }}
</div>
</td> </td>
<td class="w-1/4"> <td class="w-75">
<template v-if="accessibleRoles.includes(collab.roles)"> <template v-if="accessibleRoles.includes(collab.roles)">
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<RolesSelector <div class="w-25.5">
:role="collab.roles" <RolesSelector
:roles="accessibleRoles" :role="collab.roles"
:inherit=" :roles="accessibleRoles"
isEeUI && collab.workspace_roles && WorkspaceRolesToProjectRoles[collab.workspace_roles] :inherit="
? WorkspaceRolesToProjectRoles[collab.workspace_roles] isEeUI && collab.workspace_roles && WorkspaceRolesToProjectRoles[collab.workspace_roles]
: null ? WorkspaceRolesToProjectRoles[collab.workspace_roles]
" : null
:description="false" "
:on-role-change="(role: ProjectRoles) => updateCollaborator(collab, role)" :description="false"
/> :on-role-change="(role: ProjectRoles) => updateCollaborator(collab, role)"
/>
</div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -218,23 +214,6 @@ onMounted(async () => {
</div> </div>
</template> </template>
</td> </td>
<td class="w-1/4 pr-8">
<div class="flex justify-center items-center">
<NcDropdown v-if="collab.roles !== ProjectRoles.OWNER" :trigger="['click']">
<MdiDotsVertical
class="border-1 !text-gray-600 h-5.5 w-5.5 rounded outline-0 p-0.5 nc-workspace-menu transform transition-transform !text-gray-400 cursor-pointer hover:(!text-gray-500 bg-gray-100)"
/>
<template #overlay>
<NcMenu>
<NcMenuItem class="!text-red-500 !hover:bg-red-50" @click="removeProjectUser(activeProjectId!, collab)">
<MaterialSymbolsDeleteOutlineRounded />
Remove user
</NcMenuItem>
</NcMenu>
</template>
</NcDropdown>
</div>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

Loading…
Cancel
Save