This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch audit in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/audit by this push: new 1506b6b roles data structure changed 1506b6b is described below commit 1506b6b54554c007bd6eeb6c4dd29fb061d649d3 Author: Dmytro_Gnatyshyn <di1...@ukr.net> AuthorDate: Tue Jun 16 09:01:05 2020 +0300 roles data structure changed --- .../app/administration/roles/roles.component.ts | 36 ++++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts index 0efcb44..8e0dcc9 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts @@ -142,7 +142,7 @@ export class RolesComponent implements OnInit { this.manageRolesGroups({ action, type, value: { name: item.group, - roleIds: this.extractIds(this.roles, selectedRoles), + roles: this.extractIds(this.roles, selectedRoles), users: item.users || [] } }); @@ -154,6 +154,7 @@ export class RolesComponent implements OnInit { } public manageRolesGroups($event) { + console.log($event); switch ($event.action) { case 'create': this.rolesService.setupNewGroup($event.value).subscribe(() => { @@ -165,13 +166,13 @@ export class RolesComponent implements OnInit { case 'update': this.rolesService.updateGroup($event.value).subscribe(() => { this.toastr.success(`Group data is updated successfully!`, 'Success!'); - if (!$event.value.roleIds.includes('admin' || 'projectAdmin')) { - this.applicationSecurityService.isLoggedIn().subscribe(() => { - this.getEnvironmentHealthStatus(); - }); - } else { + // if (!$event.value.roleIds.includes('admin' || 'projectAdmin')) { + // this.applicationSecurityService.isLoggedIn().subscribe(() => { + // this.getEnvironmentHealthStatus(); + // }); + // } else { this.openManageRolesDialog(); - } + // } }, (re) => this.toastr.error('Failed group data updating!', 'Oops!')); break; @@ -195,12 +196,27 @@ export class RolesComponent implements OnInit { } public extractIds(sourceList, target) { - return sourceList.reduce((acc, item) => { - target.includes(item.description) && acc.push(item._id); + const map = new Map(); + const mapped = sourceList.reduce((acc, item) => { + target.includes(item.description) && acc.set( item._id, item.description); return acc; - }, []); + }, map); + + return this.mapToObj(mapped); + } + + mapToObj(inputMap) { + const obj = {}; + + inputMap.forEach(function(value, key) { + obj[key] = value; + }); + + return obj; } + + public updateGroupData(groups) { this.groupsData = groups.map(v => { if (!v.users) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org