Fix bug start a task without assignee (#4204)

This commit is contained in:
Maurizio Vitale
2019-01-24 09:13:30 +00:00
committed by GitHub
parent e63aa9a684
commit 87d973d8d2
3 changed files with 10 additions and 6 deletions

View File

@@ -123,6 +123,9 @@ export class PeopleCloudComponent implements OnInit {
if (value) { if (value) {
this.setError(); this.setError();
} else { } else {
if (!this.isMultipleMode()) {
this.removeUser.emit();
}
this.clearError(); this.clearError();
} }
}), }),

View File

@@ -62,7 +62,7 @@
</mat-form-field> </mat-form-field>
<div fxFlex> <div fxFlex>
<adf-cloud-people #peopleInput *ngIf="currentUser" [appName]="appName" [preSelectUsers]="[currentUser]" (selectUser)="onAssigneeSelect($event)"></adf-cloud-people> <adf-cloud-people #peopleInput *ngIf="currentUser" [appName]="appName" [preSelectUsers]="[currentUser]" (selectUser)="onAssigneeSelect($event)" (removeUser)="onRemoveUser()"></adf-cloud-people>
</div> </div>
</div> </div>
</mat-card-content> </mat-card-content>

View File

@@ -136,6 +136,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
private loadCurrentUser() { private loadCurrentUser() {
this.currentUser = this.identityUserService.getCurrentUserInfo(); this.currentUser = this.identityUserService.getCurrentUserInfo();
this.assigneeName = this.currentUser.username;
} }
public saveTask() { public saveTask() {
@@ -143,7 +144,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
const newTask = Object.assign(this.taskForm.value); const newTask = Object.assign(this.taskForm.value);
newTask.appName = this.getAppName(); newTask.appName = this.getAppName();
newTask.dueDate = this.getDueDate(); newTask.dueDate = this.getDueDate();
newTask.assignee = this.getAssigneeName(); newTask.assignee = this.assigneeName;
this.createNewTask(new TaskDetailsCloudModel(newTask)); this.createNewTask(new TaskDetailsCloudModel(newTask));
} }
@@ -173,10 +174,6 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
return this.appName ? this.appName : ''; return this.appName ? this.appName : '';
} }
private getAssigneeName(): string {
return this.assigneeName ? this.assigneeName : this.currentUser.username;
}
onDateChanged(newDateValue) { onDateChanged(newDateValue) {
this.dateError = false; this.dateError = false;
@@ -192,6 +189,10 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
this.assigneeName = assignee ? assignee.username : ''; this.assigneeName = assignee ? assignee.username : '';
} }
onRemoveUser() {
this.assigneeName = null;
}
public whitespaceValidator(control: FormControl) { public whitespaceValidator(control: FormControl) {
const isWhitespace = (control.value || '').trim().length === 0; const isWhitespace = (control.value || '').trim().length === 0;
const isValid = !isWhitespace; const isValid = !isWhitespace;