From 0f1bf00bdb7dbdafaef4c90a3b753bb4b6dd0f13 Mon Sep 17 00:00:00 2001 From: Paul Rangger <48455539+PaRangger@users.noreply.github.com> Date: Tue, 24 Dec 2024 13:50:33 +0100 Subject: [PATCH] Communication: Add loading indicator when adding users to channel (#10032) --- .../conversation-add-users-form.component.html | 3 +++ .../conversation-add-users-form.component.ts | 13 ++++++++++--- .../conversation-add-users-dialog.component.html | 1 + .../conversation-add-users-dialog.component.ts | 9 +++++++++ .../conversation-add-users-dialog.component.spec.ts | 4 +++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html index b22435bd18ab..123cb0dc37ea 100644 --- a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html +++ b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html @@ -63,6 +63,9 @@
diff --git a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts index d465889f1cc0..08c13cd628ab 100644 --- a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts +++ b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts @@ -1,8 +1,9 @@ -import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, input } from '@angular/core'; import { UserPublicInfoDTO } from 'app/core/user/user.model'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ConversationDTO } from 'app/entities/metis/conversation/conversation.model'; import { getAsChannelDTO } from 'app/entities/metis/conversation/channel.model'; +import { faSpinner } from '@fortawesome/free-solid-svg-icons'; export interface AddUsersFormData { selectedUsers?: UserPublicInfoDTO[]; @@ -24,8 +25,13 @@ export class ConversationAddUsersFormComponent implements OnInit, OnChanges { @Input() activeConversation: ConversationDTO; + protected readonly isLoading = input(false); + form: FormGroup; + // Icons + protected readonly faSpinner = faSpinner; + getAsChannel = getAsChannelDTO; mode: 'individual' | 'group' = 'individual'; @@ -37,8 +43,9 @@ export class ConversationAddUsersFormComponent implements OnInit, OnChanges { get isSubmitPossible() { return ( - (this.mode === 'individual' && !this.form.invalid) || - (this.mode === 'group' && (this.form.value?.addAllStudents || this.form.value?.addAllTutors || this.form.value?.addAllInstructors)) + !this.isLoading() && + ((this.mode === 'individual' && !this.form.invalid) || + (this.mode === 'group' && (this.form.value?.addAllStudents || this.form.value?.addAllTutors || this.form.value?.addAllInstructors))) ); } diff --git a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html index 32f3096ca9f0..7082cf10ef0d 100644 --- a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html +++ b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html @@ -17,6 +17,7 @@