Browse Source

fix/gui-v2-user-management-add-todo-for-edit-and-delete-action-closes-the-modal-and-sync-with-user-list

pull/2854/head
Muhammed Mustafa 2 years ago
parent
commit
215f94937c
  1. 3
      packages/nc-gui-v2/components/dashboard/settings/UserManagement.vue
  2. 10
      packages/nc-gui-v2/components/dashboard/settings/user-management/UsersModal.vue

3
packages/nc-gui-v2/components/dashboard/settings/UserManagement.vue

@ -78,6 +78,7 @@ const deleteUser = async () => {
await $api.auth.projectUserRemove(project.value.id, selectedUser.id); await $api.auth.projectUserRemove(project.value.id, selectedUser.id);
toast.success('Successfully deleted user from project'); toast.success('Successfully deleted user from project');
await loadUsers(); await loadUsers();
showUserDeleteModal = false;
} catch (e: any) { } catch (e: any) {
console.error(e) console.error(e)
toast.error(await extractSdkResponseErrorMsg(e)) toast.error(await extractSdkResponseErrorMsg(e))
@ -140,7 +141,7 @@ watch(
<template> <template>
<div class="flex flex-col w-full px-6"> <div class="flex flex-col w-full px-6">
<UsersModal :key="showUserModal" :show="showUserModal" :selected-user="selectedUser" @closed="showUserModal = false" /> <UsersModal :key="showUserModal" :show="showUserModal" :selected-user="selectedUser" @closed="showUserModal = false" @reload="loadUsers()"/>
<a-modal v-model:visible="showUserDeleteModal" :closable="false" width="28rem" centered :footer="null"> <a-modal v-model:visible="showUserDeleteModal" :closable="false" width="28rem" centered :footer="null">
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
<div class="flex flex-row justify-center mt-2 text-center w-full text-base"> <div class="flex flex-row justify-center mt-2 text-center w-full text-base">

10
packages/nc-gui-v2/components/dashboard/settings/user-management/UsersModal.vue

@ -25,7 +25,7 @@ interface Users {
} }
const { show, selectedUser } = defineProps<Props>() const { show, selectedUser } = defineProps<Props>()
const emits = defineEmits(['closed']) const emit = defineEmits(['closed', 'reload'])
const toast = useToast() const toast = useToast()
const { project } = useProject() const { project } = useProject()
@ -75,11 +75,13 @@ const saveUser = async () => {
try { try {
if (selectedUser?.id) { if (selectedUser?.id) {
await $api.auth.projectUserUpdate(project.value.id, selectedUser.id, { await $api.auth.projectUserUpdate(project.value.id, selectedUser.id, {
roles: selectedUser.roles, roles: usersData.role,
email: selectedUser.email, email: selectedUser.email,
project_id: project.value.id, project_id: project.value.id,
projectName: project.value.title, projectName: project.value.title,
}) })
emit('reload')
emit('closed')
} else { } else {
const res = await $api.auth.projectUserAdd(project.value.id, { const res = await $api.auth.projectUserAdd(project.value.id, {
roles: usersData.role, roles: usersData.role,
@ -120,11 +122,11 @@ const clickInviteMore = () => {
</script> </script>
<template> <template>
<a-modal :footer="null" centered :visible="show" :closable="false" width="max(50vw, 44rem)" @cancel="emits('closed')"> <a-modal :footer="null" centered :visible="show" :closable="false" width="max(50vw, 44rem)" @cancel="emit('closed')">
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex flex-row justify-between items-center pb-1.5 mb-2 border-b-1 w-full"> <div class="flex flex-row justify-between items-center pb-1.5 mb-2 border-b-1 w-full">
<a-typography-title class="select-none" :level="4"> Share: {{ project.title }} </a-typography-title> <a-typography-title class="select-none" :level="4"> Share: {{ project.title }} </a-typography-title>
<a-button type="text" class="!rounded-md mr-1 -mt-1.5" @click="emits('closed')"> <a-button type="text" class="!rounded-md mr-1 -mt-1.5" @click="emit('closed')">
<template #icon> <template #icon>
<CloseIcon class="flex mx-auto" /> <CloseIcon class="flex mx-auto" />
</template> </template>

Loading…
Cancel
Save