From b4e3a71befbeae75b3cb9c26830d317aed1664a7 Mon Sep 17 00:00:00 2001 From: Silviu Popa Date: Wed, 15 May 2019 17:49:46 +0300 Subject: [PATCH] =?UTF-8?q?[ADF-4269]=20ProcessCloud=20-=20fix=20start=20t?= =?UTF-8?q?ask=20with=20invalid=20Asignee=20or=20Candidat=E2=80=A6=20(#472?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [ADF-4269] - prevent starting a task with invalid Asignee or CandidateUser * [ADF-4269] - refractor people/group cloud * [ADF-4269] - change docs --- .../components/group-cloud.component.md | 1 + .../components/people-cloud.component.md | 1 + .../group/components/group-cloud.component.ts | 10 ++++---- .../people-cloud/people-cloud.component.ts | 7 +++--- .../start-task-cloud.component.html | 4 +++- .../start-task-cloud.component.spec.ts | 12 ++++++++++ .../components/start-task-cloud.component.ts | 23 +++++++++++++++++++ 7 files changed, 49 insertions(+), 9 deletions(-) diff --git a/docs/process-services-cloud/components/group-cloud.component.md b/docs/process-services-cloud/components/group-cloud.component.md index ad94ba5784..54663768e7 100644 --- a/docs/process-services-cloud/components/group-cloud.component.md +++ b/docs/process-services-cloud/components/group-cloud.component.md @@ -29,6 +29,7 @@ Searches Groups. | appName | `string` | | Name of the application. If specified this shows the users who have access to the app. | | mode | `string` | | User selection mode (single/multiple). | | preSelectGroups | [`GroupModel`](../../../lib/process-services-cloud/src/lib/group/models/group.model.ts)`[]` | \[] | Array of users to be pre-selected. This pre-selects all users in multi selection mode and only the first user of the array in single selection mode. | +| searchGroupsControl | `FormControl` | new FormControl() | FormControl to search the group. | | roles | `string[]` | \[] | Role names of the groups to be listed. | | title | `string` | | Title of the field | diff --git a/docs/process-services-cloud/components/people-cloud.component.md b/docs/process-services-cloud/components/people-cloud.component.md index da3cc9df6b..880e4f1ffd 100644 --- a/docs/process-services-cloud/components/people-cloud.component.md +++ b/docs/process-services-cloud/components/people-cloud.component.md @@ -29,6 +29,7 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu | preSelectUsers | [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. Mandatory properties are: id, email, username | | roles | `string[]` | | Role names of the users to be listed. | | title | `string` | | Placeholder translation key | +| searchUserCtrl | `FormControl` | new FormControl() | FormControl to search the users. | | validate | `Boolean` | false | This flag enables the validation on the preSelectUsers passed as input. In case the flag is true the components call the [identity service](../../../lib/testing/src/lib/core/actions/identity/identity.service.ts) to verify the validity of the information passed as input. Otherwise, no check will be done. | ### Events diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts index 271370ed27..de411748e7 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts @@ -71,6 +71,10 @@ export class GroupCloudComponent implements OnInit, OnChanges { @Input() preSelectGroups: GroupModel[] = []; + /** FormControl to search the group */ + @Input() + searchGroupsControl: FormControl = new FormControl(); + /** Role names of the groups to be listed. */ @Input() roles: string[] = []; @@ -98,8 +102,6 @@ export class GroupCloudComponent implements OnInit, OnChanges { selectedGroups$: Observable; - searchGroupsControl: FormControl = new FormControl(''); - _subscriptAnimationState = 'enter'; clientId: string; @@ -154,8 +156,6 @@ export class GroupCloudComponent implements OnInit, OnChanges { this.searchedValue = value; if (value) { this.setError(); - } else { - this.clearError(); } }), debounceTime(500), @@ -300,7 +300,7 @@ export class GroupCloudComponent implements OnInit, OnChanges { } hasError(): boolean { - return this.searchGroupsControl && this.searchGroupsControl.errors && this.searchGroupsControl.errors.invalid; + return this.searchGroupsControl && this.searchGroupsControl.errors && (this.searchGroupsControl.errors.invalid || this.searchGroupsControl.errors.required); } setFocus(isFocused: boolean) { diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts index 42bc47f2b0..fcc3e6c244 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts @@ -71,6 +71,10 @@ export class PeopleCloudComponent implements OnInit, OnChanges { @Input() preSelectUsers: IdentityUserModel[]; + /** FormControl to search the user */ + @Input() + searchUserCtrl: FormControl = new FormControl(); + /** Placeholder translation key */ @Input() @@ -97,8 +101,6 @@ export class PeopleCloudComponent implements OnInit, OnChanges { selectedUsers$: Observable; searchUsers$: Observable; - searchUserCtrl: FormControl = new FormControl(); - _subscriptAnimationState: string = 'enter'; clientId: string; @@ -241,7 +243,6 @@ export class PeopleCloudComponent implements OnInit, OnChanges { if (!this.isMultipleMode()) { this.removeUser.emit(); } - this.clearError(); } }), debounceTime(500), diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html index ac8628379f..100aa0c7b1 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.html @@ -64,6 +64,7 @@ @@ -74,6 +75,7 @@ [mode]="'multiple'" [title]="'ADF_CLOUD_TASK_LIST.START_TASK.FORM.LABEL.CANDIDATE_GROUP'" [appName]="appName" + [searchGroupsControl]="candidateUserFormControl" (selectGroup)="onCandidateGroupSelect($event)" (removeGroup)="onCandidateGroupRemove($event)"> @@ -96,7 +98,7 @@