fix: new es bug fixes (#1477)

* fix: displayname on members

* fix: user grant update

* fix: user grant id

* console grantid

Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
Fabi
2021-03-25 18:12:24 +01:00
committed by GitHub
co-authored by Max Peintner
parent a4763b1e4c
commit 31b542015e
13 changed files with 181 additions and 211 deletions
@@ -60,7 +60,7 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
public projectRoleOptions: Role.AsObject[] = [];
public routerLink: any = [''];
public loadedGrantId: string = '';
public loadedId: string = '';
public loadedProjectId: string = '';
public grantToEdit: string = '';
@@ -173,7 +173,7 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
}
public loadGrantOptions(grant: UserGrant.AsObject): void {
this.grantToEdit = grant.grantId;
this.grantToEdit = grant.id;
if (grant.projectGrantId && grant.projectId) {
this.getGrantRoleOptions(grant.projectGrantId, grant.projectId);
} else if (grant.projectId) {
@@ -181,11 +181,11 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
}
}
private getGrantRoleOptions(grantId: string, projectId: string): void {
console.log(projectId, grantId);
this.mgmtService.getGrantedProjectByID(projectId, grantId).then(resp => {
private getGrantRoleOptions(id: string, projectId: string): void {
console.log(projectId, id);
this.mgmtService.getGrantedProjectByID(projectId, id).then(resp => {
if (resp.grantedProject) {
this.loadedGrantId = grantId;
this.loadedId = id;
this.grantRoleOptions = resp.grantedProject?.grantedRoleKeysList;
}
}).catch(error => {
@@ -202,7 +202,7 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
}
updateRoles(grant: UserGrant.AsObject, selectionChange: MatSelectChange): void {
this.userService.updateUserGrant(grant.grantId, grant.userId, selectionChange.value)
this.userService.updateUserGrant(grant.id, grant.userId, selectionChange.value)
.then(() => {
this.toast.showInfo('GRANTS.TOAST.UPDATED', true);
}).catch(error => {
@@ -211,11 +211,11 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
}
deleteGrantSelection(): void {
this.userService.bulkRemoveUserGrant(this.selection.selected.map(grant => grant.grantId)).then(() => {
this.userService.bulkRemoveUserGrant(this.selection.selected.map(grant => grant.id)).then(() => {
this.toast.showInfo('GRANTS.TOAST.BULKREMOVED', true);
const data = this.dataSource.grantsSubject.getValue();
this.selection.selected.forEach((item) => {
const index = data.findIndex(i => i.grantId === item.grantId);
const index = data.findIndex(i => i.id === item.id);
if (index > -1) {
data.splice(index, 1);
this.dataSource.grantsSubject.next(data);