Browse Source

refactor: add leave workspace option and after leaving workspace navigate to the first workspace in list

pull/9293/head
Pranav C 3 months ago
parent
commit
1479bb4975
  1. 15
      packages/nc-gui/components/workspace/CollaboratorsList.vue

15
packages/nc-gui/components/workspace/CollaboratorsList.vue

@ -7,6 +7,8 @@ const props = defineProps<{
const { workspaceRoles } = useRoles() const { workspaceRoles } = useRoles()
const { user } = useGlobal()
const workspaceStore = useWorkspace() const workspaceStore = useWorkspace()
const { removeCollaborator, updateCollaborator: _updateCollaborator, loadWorkspace } = workspaceStore const { removeCollaborator, updateCollaborator: _updateCollaborator, loadWorkspace } = workspaceStore
@ -289,24 +291,13 @@ const isDeleteOrUpdateAllowed = (user) => {
<a-menu-divider class="my-1.5" /> <a-menu-divider class="my-1.5" />
</template> </template>
<NcMenuItem
v-if="isUIAllowed('transferWorkspaceOwnership')"
:disabled="!isDeleteOrUpdateAllowed(record)"
data-testid="nc-admin-org-user-assign-admin"
@click="updateCollaborator(record, WorkspaceUserRoles.OWNER)"
>
<GeneralIcon :class="{ 'text-gray-800': isDeleteOrUpdateAllowed(record) }" icon="user" />
<span>{{ $t('labels.assignAs') }}</span>
<RolesBadge :border="false" :show-icon="false" role="owner" :disabled="!isDeleteOrUpdateAllowed(record)" />
</NcMenuItem>
<NcMenuItem <NcMenuItem
:disabled="!isDeleteOrUpdateAllowed(record)" :disabled="!isDeleteOrUpdateAllowed(record)"
:class="{ '!text-red-500 !hover:bg-red-50': isDeleteOrUpdateAllowed(record) }" :class="{ '!text-red-500 !hover:bg-red-50': isDeleteOrUpdateAllowed(record) }"
@click="removeCollaborator(record.id, currentWorkspace?.id)" @click="removeCollaborator(record.id, currentWorkspace?.id)"
> >
<MaterialSymbolsDeleteOutlineRounded /> <MaterialSymbolsDeleteOutlineRounded />
Remove user {{ record.id === user.id ? 'Leave workspace' : 'Remove user' }}
</NcMenuItem> </NcMenuItem>
</NcMenu> </NcMenu>
</template> </template>

Loading…
Cancel
Save