From 46aeb82fd77073946d1f80c3b5b0fad2dcbde3c7 Mon Sep 17 00:00:00 2001 From: Daniel Chua <53444908+DCH25@users.noreply.github.com> Date: Wed, 12 Apr 2023 10:45:45 -0400 Subject: [PATCH 1/4] feat: [513] added loading state to async button --- backend/src/api/boards.ts | 2 +- .../configuration-modal.component.html | 6 +- .../configuration-modal.component.ts | 232 ++++++++++++------ frontend/src/app/services/board.service.ts | 2 +- frontend/src/styles.scss | 20 ++ 5 files changed, 184 insertions(+), 78 deletions(-) diff --git a/backend/src/api/boards.ts b/backend/src/api/boards.ts index 50998db6..ccd8b2fd 100644 --- a/backend/src/api/boards.ts +++ b/backend/src/api/boards.ts @@ -98,7 +98,7 @@ router.post('/:boardID/copy-configuration', async (req, res) => { ); await dalBoard.updateMany(boards, updatedBoard); - res.status(200); + res.status(200).json(boards); }); router.get('/:id', async (req, res) => { diff --git a/frontend/src/app/components/configuration-modal/configuration-modal.component.html b/frontend/src/app/components/configuration-modal/configuration-modal.component.html index 1acab3dd..469d033b 100644 --- a/frontend/src/app/components/configuration-modal/configuration-modal.component.html +++ b/frontend/src/app/components/configuration-modal/configuration-modal.component.html @@ -239,7 +239,8 @@

UI Elements

- diff --git a/frontend/src/app/components/project-configuration-modal/project-configuration-modal.component.ts b/frontend/src/app/components/project-configuration-modal/project-configuration-modal.component.ts index 50241f6b..f096ceaf 100644 --- a/frontend/src/app/components/project-configuration-modal/project-configuration-modal.component.ts +++ b/frontend/src/app/components/project-configuration-modal/project-configuration-modal.component.ts @@ -21,6 +21,8 @@ export class ProjectConfigurationModalComponent implements OnInit { Role: typeof Role = Role; + loading: boolean = false; + constructor( public dialogRef: MatDialogRef, public boardService: BoardService, @@ -34,22 +36,30 @@ export class ProjectConfigurationModalComponent implements OnInit { this.membershipDisabledEditable = this.project.membershipDisabled; } - async ngOnInit() { - this.members = ( - await this.userService.getMultipleByIds(this.project.members) - ).sort((a, b) => b.role.charCodeAt(0) - a.role.charCodeAt(0)); + ngOnInit(): void { + this.userService.getMultipleByIds(this.project.members) + .then((users) => { + this.members = users.sort((a, b) => b.role.charCodeAt(0) - a.role.charCodeAt(0)); + }); } - async handleDialogSubmit() { - this.project = await this.projectService.update(this.project.projectID, { + handleDialogSubmit(): void { + this.loading = true; + this.projectService.update(this.project.projectID, { name: this.nameEditable, membershipDisabled: this.membershipDisabledEditable, members: this.members.map((user) => user.userID), - }); - this.close(); + }) + .then((project) => { + this.project = project; + }) + .finally(() => { + this.close(); + this.loading = false; + }); } - async removeUser(_user: User) { + removeUser(_user: User): void { this.members = this.members.filter((user) => user.userID !== _user.userID); } From e10558f75474def46a2fa29a9530618b82438b2e Mon Sep 17 00:00:00 2001 From: Daniel Chua <53444908+DCH25@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:26:24 -0400 Subject: [PATCH 3/4] feat: post modal loading spinners --- .../add-post-modal/add-post.component.html | 2 +- .../post-modal/post-modal.component.html | 5 ++++- .../post-modal/post-modal.component.ts | 22 +++++++++++++------ .../project-configuration-modal.component.ts | 20 +++++++++-------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/components/add-post-modal/add-post.component.html b/frontend/src/app/components/add-post-modal/add-post.component.html index bb66aeb0..4f2ecdd8 100644 --- a/frontend/src/app/components/add-post-modal/add-post.component.html +++ b/frontend/src/app/components/add-post-modal/add-post.component.html @@ -174,7 +174,7 @@

Update Post

cancel -
+
No tags available.
{{ tagOption.name }} @@ -190,7 +192,8 @@