From 5953ecfa85b831db4a989739bfc6730a7e4a3665 Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Tue, 9 Jan 2024 08:04:30 +0200 Subject: [PATCH 1/5] fix: same id in user db --- src/data/pages/users-db.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/data/pages/users-db.json b/src/data/pages/users-db.json index 1b31ed735..7c3cb6f1b 100644 --- a/src/data/pages/users-db.json +++ b/src/data/pages/users-db.json @@ -210,7 +210,7 @@ "notes": "voluptatibus et soluta" }, { - "id": 21, + "id": 22, "active": true, "fullname": "Raymond Simonis", "email": "Tressie.Bruen45@gmail.com", @@ -220,7 +220,7 @@ "notes": "aut id molestiae" }, { - "id": 22, + "id": 23, "active": true, "fullname": "Janice Sporer", "email": "Anastasia85@hotmail.com", @@ -230,7 +230,7 @@ "notes": "magnam eum aliquam" }, { - "id": 23, + "id": 24, "active": true, "fullname": "Francis Schowalter", "email": "Tess56@gmail.com", @@ -240,7 +240,7 @@ "notes": "similique architecto in" }, { - "id": 24, + "id": 25, "active": true, "fullname": "Emilio Hoppe", "email": "Bruce49@yahoo.com", @@ -250,7 +250,7 @@ "notes": "rerum quae dolorem" }, { - "id": 25, + "id": 26, "active": true, "fullname": "Janice Harber", "email": "Jude38@hotmail.com", @@ -260,7 +260,7 @@ "notes": "iure dolor provident" }, { - "id": 26, + "id": 27, "fullname": "Evelyn Morar", "email": "Laverne.Roberts@hotmail.com", "role": "user", @@ -270,7 +270,7 @@ "notes": "quae eos placeat" }, { - "id": 27, + "id": 28, "fullname": "Antoinette Schneider", "email": "Ambrose_Stehr25@gmail.com", "role": "user", @@ -280,7 +280,7 @@ "notes": "qui cumque unde" }, { - "id": 28, + "id": 29, "fullname": "Ebony Daniel", "email": "Nyah44@hotmail.com", "role": "user", From 3194596cf1dd791091200813d76eaa488c261cb5 Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Tue, 9 Jan 2024 08:04:46 +0200 Subject: [PATCH 2/5] fix: incorrect active users when searching --- src/data/pages/users.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/pages/users.ts b/src/data/pages/users.ts index 5e6988540..259ef6936 100644 --- a/src/data/pages/users.ts +++ b/src/data/pages/users.ts @@ -40,10 +40,10 @@ export const getUsers = async (filters: Partial) const { isActive, search, sortBy, sortingOrder } = filters let filteredUsers = users - filteredUsers = users.filter((user) => user.active === isActive) + filteredUsers = filteredUsers.filter((user) => user.active === isActive) if (search) { - filteredUsers = users.filter((user) => user.fullname.toLowerCase().includes(search.toLowerCase())) + filteredUsers = filteredUsers.filter((user) => user.fullname.toLowerCase().includes(search.toLowerCase())) } if (sortBy && sortingOrder) { From d07adc6fec185e239471c35c65f514d1e58cfd1c Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Tue, 9 Jan 2024 08:05:16 +0200 Subject: [PATCH 3/5] fix: fetch new data when it is updated --- src/pages/projects/composables/useProjects.ts | 8 ++++---- src/pages/users/composables/useUsers.ts | 13 +++---------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/pages/projects/composables/useProjects.ts b/src/pages/projects/composables/useProjects.ts index 420e4c52d..d50e4f1c3 100644 --- a/src/pages/projects/composables/useProjects.ts +++ b/src/pages/projects/composables/useProjects.ts @@ -47,12 +47,12 @@ export const useProjects = (options?: { sorting: Ref; pagination: Ref

) { isLoading.value = true - const createdProject = await addProject({ + await addProject({ ...project, project_owner: project.project_owner.id, team: project.team.map((user) => user.id), }) - projects.value.unshift(createdProject as Project) + await fetch() isLoading.value = false }, @@ -63,7 +63,7 @@ export const useProjects = (options?: { sorting: Ref; pagination: Ref

user.id), }) - projects.value = projects.value.map((u) => (u.id === project.id ? project : u)) + await fetch() isLoading.value = false }, @@ -74,7 +74,7 @@ export const useProjects = (options?: { sorting: Ref; pagination: Ref

user.id), }) - projects.value = projects.value.filter((u) => u.id !== project.id) + await fetch() isLoading.value = false }, diff --git a/src/pages/users/composables/useUsers.ts b/src/pages/users/composables/useUsers.ts index 0460b5947..1d051f97d 100644 --- a/src/pages/users/composables/useUsers.ts +++ b/src/pages/users/composables/useUsers.ts @@ -61,28 +61,21 @@ export const useUsers = (options?: { async add(user: User) { isLoading.value = true await addUser(user) - users.value.unshift(user) + await fetch() isLoading.value = false }, async update(user: User) { isLoading.value = true await updateUser(user) - users.value = users.value - .map((u) => (u.id === user.id ? user : u)) - .filter((u) => u.active === filters.value.isActive) - .filter((u) => { - if (!filters.value.search) return true - - return u.fullname.toLowerCase().includes(filters.value.search.toLowerCase()) - }) + await fetch() isLoading.value = false }, async remove(user: User) { isLoading.value = true await removeUser(user) - users.value = users.value.filter((u) => u.id !== user.id) + await fetch() isLoading.value = false }, } From 18ee331c4492eb618a71639df26e9c4b18015929 Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Tue, 9 Jan 2024 08:05:56 +0200 Subject: [PATCH 4/5] fix: make edit and delete button smaller --- src/pages/projects/widgets/ProjectsTable.vue | 7 +++---- src/pages/users/widgets/UsersTable.vue | 10 ++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pages/projects/widgets/ProjectsTable.vue b/src/pages/projects/widgets/ProjectsTable.vue index b815bde77..acd73e4e6 100644 --- a/src/pages/projects/widgets/ProjectsTable.vue +++ b/src/pages/projects/widgets/ProjectsTable.vue @@ -57,7 +57,7 @@ const totalPages = computed(() => Math.ceil(props.pagination.total / props.pagin diff --git a/src/pages/users/widgets/UsersTable.vue b/src/pages/users/widgets/UsersTable.vue index 38255a2a8..9c5e71054 100644 --- a/src/pages/users/widgets/UsersTable.vue +++ b/src/pages/users/widgets/UsersTable.vue @@ -118,8 +118,14 @@ const formatProjectNames = (projects: Project[]) => { From edc7d6605eadcabb1ad049c0a1f59853123ef6d0 Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Tue, 9 Jan 2024 08:06:15 +0200 Subject: [PATCH 5/5] fix: save projects layout to local storage --- src/pages/projects/ProjectsPage.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pages/projects/ProjectsPage.vue b/src/pages/projects/ProjectsPage.vue index 68561012c..ac4ea57ca 100644 --- a/src/pages/projects/ProjectsPage.vue +++ b/src/pages/projects/ProjectsPage.vue @@ -1,5 +1,6 @@