mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1594] Fix partial group name of a valid group should not be valid, fix form-cloud able to search when people/group widget is readonly (#5417)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<form>
|
||||
<mat-form-field class="adf-cloud-group">
|
||||
<mat-label
|
||||
<mat-label *ngIf="!isReadonly()"
|
||||
id="adf-group-cloud-title-id">{{ (title || 'ADF_CLOUD_GROUPS.SEARCH-GROUP') | translate }}</mat-label>
|
||||
<mat-chip-list #groupChipList [disabled]="isReadonly() || isValidationLoading()" data-automation-id="adf-cloud-group-chip-list" class="apa-group-chip-list">
|
||||
<mat-chip
|
||||
@@ -16,7 +16,7 @@
|
||||
cancel
|
||||
</mat-icon>
|
||||
</mat-chip>
|
||||
<input matInput
|
||||
<input *ngIf="!isReadonly()" matInput
|
||||
[formControl]="searchGroupsControl"
|
||||
[matAutocomplete]="auto"
|
||||
[matChipInputFor]="groupChipList"
|
||||
|
@@ -119,7 +119,6 @@ describe('GroupCloudComponent', () => {
|
||||
it('should selectedGroup and groupsChanged emit, update selected groups when a group is selected', (done) => {
|
||||
const group = { name: 'groupname' };
|
||||
fixture.detectChanges();
|
||||
spyOn(component, 'hasGroupIdOrName').and.returnValue(true);
|
||||
const selectEmitSpy = spyOn(component.selectGroup, 'emit');
|
||||
const changedGroupsSpy = spyOn(component.changedGroups, 'emit');
|
||||
component.onSelect(group);
|
||||
@@ -540,7 +539,6 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
it('should check validation only for the first group and emit warning when group is invalid - single mode', (done) => {
|
||||
spyOn(identityGroupService, 'findGroupsByName').and.returnValue(Promise.resolve([]));
|
||||
spyOn(component, 'hasGroupIdOrName').and.returnValue(false);
|
||||
|
||||
const expectedWarning = {
|
||||
message: 'INVALID_PRESELECTED_GROUPS',
|
||||
|
@@ -266,7 +266,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
await Promise.all(preselectedGroupsToValidate.map(async (group: IdentityGroupModel) => {
|
||||
try {
|
||||
const validationResult = await this.searchGroup(group.name);
|
||||
if (!this.hasGroupIdOrName(validationResult)) {
|
||||
if (this.isPreselectedGroupInvalid(group, validationResult)) {
|
||||
this.invalidGroups.push(group);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -380,8 +380,12 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.searchGroupsSubject.next(this.searchGroups);
|
||||
}
|
||||
|
||||
hasGroupIdOrName(group: IdentityGroupModel): boolean {
|
||||
return group && (group.id !== undefined || group.name !== undefined);
|
||||
isPreselectedGroupInvalid(preselectedGroup: IdentityGroupModel, validatedGroup: IdentityGroupModel): boolean {
|
||||
if (validatedGroup && validatedGroup.name !== undefined) {
|
||||
return preselectedGroup.name !== validatedGroup.name;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
isSingleMode(): boolean {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<form>
|
||||
<mat-form-field class="adf-people-cloud">
|
||||
<mat-label id="adf-people-cloud-title-id">{{ title | translate }}</mat-label>
|
||||
<mat-label *ngIf="!isReadonly()" id="adf-people-cloud-title-id">{{ title | translate }}</mat-label>
|
||||
<mat-chip-list #userMultipleChipList [disabled]="isReadonly() || isValidationLoading()" data-automation-id="adf-cloud-people-chip-list">
|
||||
<mat-chip
|
||||
*ngFor="let user of selectedUsers"
|
||||
@@ -16,7 +16,7 @@
|
||||
cancel
|
||||
</mat-icon>
|
||||
</mat-chip>
|
||||
<input matInput
|
||||
<input *ngIf="!isReadonly()" matInput
|
||||
[formControl]="searchUserCtrl"
|
||||
[matAutocomplete]="auto"
|
||||
[matChipInputFor]="userMultipleChipList"
|
||||
|
Reference in New Issue
Block a user