From 4926509de0a49681f7c5018d8be42584946c227f Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Fri, 11 Sep 2020 14:24:41 +0200 Subject: [PATCH] feat(console): refresh roles, user-grants and project-members based on previous navigation (#728) * feat: refresh roles, user-grants, project-members * refresh keys * user grants on granted projects * refresh on member changes * membership refresh * lint --- console/src/app/app.module.ts | 2 ++ .../project-members.component.ts | 9 ++++++- .../project-roles.component.html | 3 ++- .../refresh-table/refresh-table.component.ts | 11 ++++++++ .../user-grants/user-grants.component.html | 10 +++---- .../user-grants/user-grants.component.ts | 1 + .../iam/iam-members/iam-members.component.ts | 6 +++++ console/src/app/pages/iam/iam.component.ts | 3 +++ .../orgs/org-detail/org-detail.component.ts | 3 +++ .../orgs/org-members/org-members.component.ts | 9 ++++++- .../granted-project-detail.component.html | 3 ++- .../granted-project-detail.component.ts | 3 +++ .../owned-project-detail.component.html | 3 ++- .../owned-project-detail.component.ts | 3 +++ .../project-grants.component.html | 3 ++- .../project-grants.component.ts | 1 + .../machine-keys/machine-keys.component.ts | 5 +++- .../membership-detail.component.ts | 12 +++++++++ .../memberships/memberships.component.html | 5 ++++ .../memberships/memberships.component.scss | 9 +++++++ .../memberships/memberships.component.ts | 12 +++++++++ .../user-table/user-table.component.html | 3 ++- .../user-table/user-table.component.ts | 1 + console/src/app/services/refresh.service.ts | 27 +++++++++++++++++++ 24 files changed, 134 insertions(+), 13 deletions(-) create mode 100644 console/src/app/services/refresh.service.ts diff --git a/console/src/app/app.module.ts b/console/src/app/app.module.ts index b8814ac06e..9988422c53 100644 --- a/console/src/app/app.module.ts +++ b/console/src/app/app.module.ts @@ -38,6 +38,7 @@ import { GrpcService } from './services/grpc.service'; import { AuthInterceptor } from './services/interceptors/auth.interceptor'; import { GRPC_INTERCEPTORS } from './services/interceptors/grpc-interceptor'; import { OrgInterceptor } from './services/interceptors/org.interceptor'; +import { RefreshService } from './services/refresh.service'; import { StatehandlerProcessorService, StatehandlerProcessorServiceImpl } from './services/statehandler-processor.service'; import { StatehandlerService, StatehandlerServiceImpl } from './services/statehandler.service'; import { StorageService } from './services/storage.service'; @@ -154,6 +155,7 @@ const authConfig: AuthConfig = { multi: true, useClass: OrgInterceptor, }, + RefreshService, GrpcService, GrpcAuthService, { provide: 'windowObject', useValue: window }, diff --git a/console/src/app/modules/project-members/project-members.component.ts b/console/src/app/modules/project-members/project-members.component.ts index fba241f101..47f985ffef 100644 --- a/console/src/app/modules/project-members/project-members.component.ts +++ b/console/src/app/modules/project-members/project-members.component.ts @@ -103,7 +103,11 @@ export class ProjectMembersComponent { this.toast.showError(error); }); } - })); + })).then(() => { + setTimeout(() => { + this.changePage(); + }, 1000); + }); } public isAllSelected(): boolean { @@ -141,6 +145,9 @@ export class ProjectMembersComponent { user.id, roles); } })).then(() => { + setTimeout(() => { + this.changePage(); + }, 1000); this.toast.showInfo('PROJECT.TOAST.MEMBERSADDED', true); }).catch(error => { this.toast.showError(error); diff --git a/console/src/app/modules/project-roles/project-roles.component.html b/console/src/app/modules/project-roles/project-roles.component.html index e5895ddda8..8fed3f14b4 100644 --- a/console/src/app/modules/project-roles/project-roles.component.html +++ b/console/src/app/modules/project-roles/project-roles.component.html @@ -1,5 +1,6 @@ + emitRefreshOnPreviousRoute="/projects/{{projectId}}/roles/create" [selection]="selection" + [loading]="dataSource?.loading$ | async" [timestamp]="dataSource?.viewTimestamp"> + + \ No newline at end of file diff --git a/console/src/app/pages/users/user-detail/memberships/memberships.component.scss b/console/src/app/pages/users/user-detail/memberships/memberships.component.scss index db9eb3d0a9..ee148887b5 100644 --- a/console/src/app/pages/users/user-detail/memberships/memberships.component.scss +++ b/console/src/app/pages/users/user-detail/memberships/memberships.component.scss @@ -48,6 +48,15 @@ margin: 0 8px 0 -15px; } + .fill-space { + flex: 1; + } + + .refresh-img { + float: left; + margin: 0 8px 0 -15px; + } + .avatar-circle { float: left; margin: 0 8px 0 -12px; diff --git a/console/src/app/pages/users/user-detail/memberships/memberships.component.ts b/console/src/app/pages/users/user-detail/memberships/memberships.component.ts index 1b19f55a84..68b3d7ece6 100644 --- a/console/src/app/pages/users/user-detail/memberships/memberships.component.ts +++ b/console/src/app/pages/users/user-detail/memberships/memberships.component.ts @@ -100,6 +100,9 @@ export class MembershipsComponent implements OnInit { return this.adminService.AddIamMember(user.id, roles); })).then(() => { this.toast.showInfo('IAM.TOAST.MEMBERADDED', true); + setTimeout(() => { + this.loadManager(this.user.id); + }, 1000); }).catch(error => { this.toast.showError(error); }); @@ -115,6 +118,9 @@ export class MembershipsComponent implements OnInit { return this.mgmtService.AddMyOrgMember(user.id, roles); })).then(() => { this.toast.showInfo('ORG.TOAST.MEMBERADDED', true); + setTimeout(() => { + this.loadManager(this.user.id); + }, 1000); }).catch(error => { this.toast.showError(error); }); @@ -134,6 +140,9 @@ export class MembershipsComponent implements OnInit { roles, ).then(() => { this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true); + setTimeout(() => { + this.loadManager(this.user.id); + }, 1000); }).catch(error => { this.toast.showError(error); }); @@ -150,6 +159,9 @@ export class MembershipsComponent implements OnInit { return this.mgmtService.AddProjectMember(response.projectId, user.id, roles) .then(() => { this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true); + setTimeout(() => { + this.loadManager(this.user.id); + }, 1000); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/pages/users/user-list/user-table/user-table.component.html b/console/src/app/pages/users/user-list/user-table/user-table.component.html index 5af6f9be8b..fa71bb35aa 100644 --- a/console/src/app/pages/users/user-list/user-table/user-table.component.html +++ b/console/src/app/pages/users/user-list/user-table/user-table.component.html @@ -1,5 +1,6 @@ + [timestamp]="userResult?.viewTimestamp" [selection]="selection" + [emitRefreshOnPreviousRoute]="refreshOnPreviousRoute">