diff options
author | Martin Stockhammer <martin_s@apache.org> | 2021-01-17 19:43:34 +0100 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2021-01-17 19:43:34 +0100 |
commit | 3313a6cee8bc30e0a9b87c83998cfb219bce7306 (patch) | |
tree | 38428d2861ed37244ea5b5ef6845c9bb0035f933 | |
parent | 043042238ad847883e773636fbac57dde1ace36a (diff) | |
download | archiva-3313a6cee8bc30e0a9b87c83998cfb219bce7306.tar.gz archiva-3313a6cee8bc30e0a9b87c83998cfb219bce7306.zip |
Adding list update after group assignment
2 files changed, 14 insertions, 6 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html index 47ac7c0e8..13e387dab 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html @@ -293,7 +293,7 @@ <div class="invalid-feedback" *ngIf="groupSearchFailed">{{'roles.edit.groupSearchFailed'|translate}}</div> </div> - <button class="btn btn-primary" (click)="assignGroupRole()">{{'roles.edit.assignButton'|translate}}</button> + <button class="btn btn-primary" id="addGroupButton" (click)="assignGroupRole()">{{'roles.edit.assignButton'|translate}}</button> </form> </ng-template> </ngb-panel> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts index 59f8feae2..6dac7090a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts @@ -20,11 +20,11 @@ import {AfterContentInit, Component, EventEmitter, OnInit, Output, ViewChild} fr import {ActivatedRoute} from "@angular/router"; import {FormBuilder, Validators} from "@angular/forms"; import {RoleService} from "@app/services/role.service"; -import {catchError, concatAll, debounceTime, distinctUntilChanged, filter, map, switchMap, tap} from "rxjs/operators"; +import {catchError, concatAll, debounceTime, distinctUntilChanged, filter, map, startWith, switchMap, tap} from "rxjs/operators"; import {Role} from '@app/model/role'; import {ErrorResult} from "@app/model/error-result"; import {EditBaseComponent} from "@app/modules/shared/edit-base.component"; -import {EMPTY, forkJoin, Observable, of, zip} from 'rxjs'; +import {EMPTY, forkJoin, fromEvent, Observable, of, zip} from 'rxjs'; import {RoleUpdate} from "@app/model/role-update"; import {EntityService} from "@app/model/entity-service"; import {User} from '@app/model/user'; @@ -34,9 +34,10 @@ import {UserInfo} from '@app/model/user-info'; import {HttpResponse} from "@angular/common/http"; import {PaginatedEntitiesComponent} from "@app/modules/shared/paginated-entities/paginated-entities.component"; import {ToastService} from "@app/services/toast.service"; -import {GroupService} from "@app/services/group.service"; import {GroupMapping} from "@app/model/group-mapping"; import { Group } from '@app/model/group'; +import { ElementRef } from '@angular/core'; +import { GroupService } from '@app/services/group.service'; @Component({ selector: 'app-manage-roles-edit', @@ -70,6 +71,8 @@ export class ManageRolesEditComponent extends EditBaseComponent<Role> implements @Output() roleIdEvent: EventEmitter<string> = new EventEmitter<string>(true); + groupAddEvent: EventEmitter<any> = new EventEmitter<any>(true); + private roleMappings$; constructor(private route: ActivatedRoute, public roleService: RoleService, private userService: UserService, @@ -255,7 +258,7 @@ export class ManageRolesEditComponent extends EditBaseComponent<Role> implements switchMap(term => this.groupService.query( term, 0, 10).pipe( tap(() => this.groupSearchFailed = false), - map(pagedResult=> + map(( pagedResult : PagedResult<Group>) => pagedResult.data), catchError(() => { this.groupSearchFailed = true; @@ -358,6 +361,7 @@ export class ManageRolesEditComponent extends EditBaseComponent<Role> implements this.result = response.body; this.showSuccess('roles.edit.success.assignGroup',{'role_id':this.editRole.id,'group_name':groupName}) this.groupSearchModel='' + this.groupAddEvent.emit(groupName); }); } } @@ -366,7 +370,11 @@ export class ManageRolesEditComponent extends EditBaseComponent<Role> implements getMappedGroups(roleId:string) : Observable<string[]> { console.log("Get mapped groups "+roleId); if (roleId!=null && roleId.length>0) { - return this.groupService.getGroupMappings().pipe( + return this.groupAddEvent.pipe( + startWith(0), + switchMap(()=> + this.groupService.getGroupMappings() + ), map((gMapArray: GroupMapping[]) => { console.log("Array " + gMapArray + " - " + gMapArray.length); let result = []; |