From 4f3ccbfad027823c369c938e7dbb5312cd66d9b3 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Thu, 16 Jul 2020 15:13:36 +0200 Subject: [PATCH] fix(console): cleanup structure, role guard, paginated requests, cleanup policies, toast i18n, view timestamp, preloading strategy, maennchenfindings, fix passwordchange (#483) * routes, move grid to list comopnent * rename app list component, move to project sub * add owned-project-detail child module * seperate pipes * set password validators only if needed * create org initialize without pwd * no caps * self xss message * fix user table * fix project member paginator * fix project members pagination, user grant pag * move project grants, fix imports * fix owned project detail imports * use pipe and directives * ng content bindings, rem custom schemas * i18n, fix error toast parameter * toast i18n * side background * fix: sequence, add timestamp * audit * fix metanav background * org domain label * cleanup policy component * shorten user grant roles, mk cols visible as bind * move user components, show otp only if available * preload modules * fix password change * fix org create buttons * class css --- console/package-lock.json | 21 +- console/package.json | 1 + console/src/app/app-routing.module.ts | 68 ++++-- console/src/app/app.component.html | 220 +++++++++--------- console/src/app/app.component.scss | 2 +- console/src/app/app.component.ts | 14 -- console/src/app/app.module.ts | 4 + console/src/app/guards/role.guard.ts | 2 +- .../member-create-dialog.component.ts | 2 - .../src/app/modules/card/card.component.html | 2 +- .../app/modules/changes/changes.component.ts | 1 - .../src/app/modules/changes/changes.module.ts | 9 +- .../meta-layout/meta-layout.component.html | 2 +- .../project-contributors.component.ts | 4 +- .../project-members-datasource.ts | 3 +- .../project-members.component.html | 7 +- .../project-members.component.ts | 22 +- .../project-members/project-members.module.ts | 4 +- .../project-roles/project-roles.component.ts | 6 +- .../project-roles/project-roles.module.ts | 6 +- .../shared/shared.module.ts} | 10 +- .../user-grants/user-grants-datasource.ts | 6 +- .../user-grants/user-grants.component.html | 12 +- .../user-grants/user-grants.component.ts | 39 ++-- .../modules/user-grants/user-grants.module.ts | 6 +- .../src/app/pages/home/home.component.html | 11 +- console/src/app/pages/home/home.module.ts | 2 + .../iam-contributors.component.ts | 2 +- .../iam/iam-members/iam-members.component.ts | 6 +- .../src/app/pages/iam/iam-routing.module.ts | 10 + .../iam/iam-views/iam-views.component.html | 9 +- .../iam/iam-views/iam-views.component.scss | 6 +- .../iam/iam-views/iam-views.component.ts | 2 +- console/src/app/pages/iam/iam.component.html | 4 +- console/src/app/pages/iam/iam.module.ts | 13 +- .../org-contributors.component.ts | 2 +- .../orgs/org-create/org-create.component.html | 16 +- .../orgs/org-create/org-create.component.scss | 30 +-- .../orgs/org-create/org-create.component.ts | 4 +- .../orgs/org-create/org-create.module.ts | 4 +- .../add-domain-dialog.component.html | 4 +- .../orgs/org-detail/org-detail.component.html | 4 +- .../pages/orgs/org-grid/org-grid.component.ts | 2 - .../orgs/org-members/org-members.component.ts | 6 +- console/src/app/pages/orgs/orgs.module.ts | 6 +- .../password-policy.component.html | 10 +- .../password-policy.component.ts | 74 +++--- .../apps/app-create/app-create.component.ts | 5 +- .../apps/app-detail/app-detail.component.html | 4 +- .../apps/app-detail/app-detail.component.ts | 6 +- .../app/pages/projects/apps/apps.module.ts | 3 +- .../granted-project-detail.component.html | 23 +- .../granted-project-detail.component.ts | 1 - .../granted-project-grid.component.html | 0 .../granted-project-grid.component.scss | 0 .../granted-project-grid.component.spec.ts | 0 .../granted-project-grid.component.ts | 0 .../granted-project-list.component.ts | 8 +- .../granted-projects-routing.module.ts | 6 +- .../granted-projects.module.ts | 13 +- .../application-grid.component.html} | 0 .../application-grid.component.scss} | 0 .../application-grid.component.spec.ts} | 10 +- .../application-grid.component.ts} | 8 +- .../applications/applications-datasource.ts} | 0 .../applications/applications.component.html} | 4 - .../applications/applications.component.scss} | 0 .../applications.component.spec.ts | 34 +++ .../applications/applications.component.ts} | 10 +- .../owned-project-detail-routing.module.ts | 23 ++ .../owned-project-detail.component.html | 21 +- .../owned-project-detail.component.ts | 8 +- .../owned-project-detail.module.ts | 64 +++++ .../project-grants-datasource.ts | 1 - .../project-grants.component.html | 0 .../project-grants.component.scss | 0 .../project-grants.component.spec.ts | 0 .../project-grants.component.ts | 3 +- .../owned-project-grid.component.html | 0 .../owned-project-grid.component.scss | 0 .../owned-project-grid.component.spec.ts | 0 .../owned-project-grid.component.ts | 0 .../owned-project-list.component.html | 12 +- .../owned-project-list.component.ts | 8 +- .../owned-projects-routing.module.ts | 72 +++--- .../owned-projects/owned-projects.module.ts | 36 +-- .../project-applications.component.spec.ts | 34 --- .../project-grant-detail.component.ts | 2 +- .../project-grant-detail.module.ts | 4 - .../project-grant-members.component.ts | 9 +- .../project-create.component.ts | 4 +- .../project-grant-create.module.ts | 4 +- .../project-role-create.component.html | 11 +- .../project-role-create.component.ts | 1 + .../app/pages/signedout/signedout.module.ts | 2 + .../user-grant-create.component.ts | 25 +- .../user-grant-create.module.ts | 7 +- .../user-create/user-create.component.ts | 4 +- .../auth-user-detail.component.html | 4 +- .../auth-user-detail.component.ts | 12 +- .../auth-user-mfa.component.html | 3 +- .../auth-user-mfa/auth-user-mfa.component.ts | 5 + .../theme-setting.component.html | 0 .../theme-setting.component.scss | 0 .../theme-setting.component.spec.ts | 0 .../theme-setting/theme-setting.component.ts | 0 .../password/password.component.ts | 12 +- .../user-detail/user-detail-routing.module.ts | 7 +- .../users/user-detail/user-detail.module.ts | 19 +- .../user-detail/user-detail.component.html | 9 +- .../user-mfa/user-mfa.component.html | 0 .../user-mfa/user-mfa.component.scss | 0 .../user-mfa/user-mfa.component.spec.ts | 0 .../user-mfa/user-mfa.component.ts | 0 .../users/user-list/user-list.component.ts | 6 +- .../pages/users/user-list/user-list.module.ts | 2 + .../app/pages/users/users-routing.module.ts | 27 --- console/src/app/pipes/has-role-pipe.module.ts | 18 ++ console/src/app/pipes/has-role.pipe.ts | 4 +- ...odule.ts => localized-date-pipe.module.ts} | 8 +- console/src/app/pipes/localized-date.pipe.ts | 1 - .../pipes/timestamp-to-date-pipe.module.ts | 18 ++ console/src/assets/i18n/de.json | 35 ++- console/src/assets/i18n/en.json | 37 ++- console/src/styles.scss | 4 +- 125 files changed, 807 insertions(+), 614 deletions(-) rename console/src/app/{pages/users/users.module.ts => modules/shared/shared.module.ts} (53%) rename console/src/app/pages/projects/granted-projects/{ => granted-project-list}/granted-project-grid/granted-project-grid.component.html (100%) rename console/src/app/pages/projects/granted-projects/{ => granted-project-list}/granted-project-grid/granted-project-grid.component.scss (100%) rename console/src/app/pages/projects/granted-projects/{ => granted-project-list}/granted-project-grid/granted-project-grid.component.spec.ts (100%) rename console/src/app/pages/projects/granted-projects/{ => granted-project-list}/granted-project-grid/granted-project-grid.component.ts (100%) rename console/src/app/pages/projects/owned-projects/{project-application-grid/project-application-grid.component.html => owned-project-detail/application-grid/application-grid.component.html} (100%) rename console/src/app/pages/projects/owned-projects/{project-application-grid/project-application-grid.component.scss => owned-project-detail/application-grid/application-grid.component.scss} (100%) rename console/src/app/pages/projects/owned-projects/{project-application-grid/project-application-grid.component.spec.ts => owned-project-detail/application-grid/application-grid.component.spec.ts} (55%) rename console/src/app/pages/projects/owned-projects/{project-application-grid/project-application-grid.component.ts => owned-project-detail/application-grid/application-grid.component.ts} (85%) rename console/src/app/pages/projects/owned-projects/{project-applications/project-applications-datasource.ts => owned-project-detail/applications/applications-datasource.ts} (100%) rename console/src/app/pages/projects/owned-projects/{project-applications/project-applications.component.html => owned-project-detail/applications/applications.component.html} (92%) rename console/src/app/pages/projects/owned-projects/{project-applications/project-applications.component.scss => owned-project-detail/applications/applications.component.scss} (100%) create mode 100644 console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.spec.ts rename console/src/app/pages/projects/owned-projects/{project-applications/project-applications.component.ts => owned-project-detail/applications/applications.component.ts} (88%) create mode 100644 console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail-routing.module.ts create mode 100644 console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.module.ts rename console/src/app/pages/projects/owned-projects/{ => owned-project-detail}/project-grants/project-grants-datasource.ts (98%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-detail}/project-grants/project-grants.component.html (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-detail}/project-grants/project-grants.component.scss (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-detail}/project-grants/project-grants.component.spec.ts (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-detail}/project-grants/project-grants.component.ts (97%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-list}/owned-project-grid/owned-project-grid.component.html (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-list}/owned-project-grid/owned-project-grid.component.scss (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-list}/owned-project-grid/owned-project-grid.component.spec.ts (100%) rename console/src/app/pages/projects/owned-projects/{ => owned-project-list}/owned-project-grid/owned-project-grid.component.ts (100%) delete mode 100644 console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.spec.ts rename console/src/app/pages/users/user-detail/{ => auth-user-detail}/theme-setting/theme-setting.component.html (100%) rename console/src/app/pages/users/user-detail/{ => auth-user-detail}/theme-setting/theme-setting.component.scss (100%) rename console/src/app/pages/users/user-detail/{ => auth-user-detail}/theme-setting/theme-setting.component.spec.ts (100%) rename console/src/app/pages/users/user-detail/{ => auth-user-detail}/theme-setting/theme-setting.component.ts (100%) rename console/src/app/pages/users/user-detail/{ => user-detail}/user-mfa/user-mfa.component.html (100%) rename console/src/app/pages/users/user-detail/{ => user-detail}/user-mfa/user-mfa.component.scss (100%) rename console/src/app/pages/users/user-detail/{ => user-detail}/user-mfa/user-mfa.component.spec.ts (100%) rename console/src/app/pages/users/user-detail/{ => user-detail}/user-mfa/user-mfa.component.ts (100%) delete mode 100644 console/src/app/pages/users/users-routing.module.ts create mode 100644 console/src/app/pipes/has-role-pipe.module.ts rename console/src/app/pipes/{pipes.module.ts => localized-date-pipe.module.ts} (61%) create mode 100644 console/src/app/pipes/timestamp-to-date-pipe.module.ts diff --git a/console/package-lock.json b/console/package-lock.json index 1b7628de0e..c510b8c1d3 100644 --- a/console/package-lock.json +++ b/console/package-lock.json @@ -9381,9 +9381,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash.camelcase": { "version": "4.3.0", @@ -10167,6 +10167,21 @@ "tslib": "^2.0.0" } }, + "ngx-quicklink": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/ngx-quicklink/-/ngx-quicklink-0.2.3.tgz", + "integrity": "sha512-a7yxNKNdkuL87GWuPAknxYyo+jRm7KTjHN7Ni8ohNQrVfPzV3c6UV4QWg88Hxi0gJC4wF3vEG3uviDnj5wJRaw==", + "requires": { + "tslib": "^1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" + } + } + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", diff --git a/console/package.json b/console/package.json index 0afaf5bb55..b7a9fe0582 100644 --- a/console/package.json +++ b/console/package.json @@ -35,6 +35,7 @@ "grpc-web": "^1.2.0", "moment": "^2.27.0", "ngx-moment": "^5.0.0", + "ngx-quicklink": "^0.2.3", "prettier-stylelint": "^0.4.2", "rxjs": "~6.6.0", "ts-protoc-gen": "^0.12.0", diff --git a/console/src/app/app-routing.module.ts b/console/src/app/app-routing.module.ts index eeb7415e4b..c9c313d8f5 100644 --- a/console/src/app/app-routing.module.ts +++ b/console/src/app/app-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { QuicklinkStrategy } from 'ngx-quicklink'; import { AuthGuard } from './guards/auth.guard'; import { RoleGuard } from './guards/role.guard'; @@ -30,15 +31,30 @@ const routes: Routes = [ }, { path: 'users', - loadChildren: () => import('./pages/users/users.module').then(m => m.UsersModule), canActivate: [AuthGuard], + children: [ + { + path: 'all', + loadChildren: () => import('src/app/pages/users/user-list/user-list.module') + .then(m => m.UserListModule), + canActivate: [RoleGuard], + data: { + roles: ['user.read'], + }, + }, + { + path: '', + loadChildren: () => import('src/app/pages/users/user-detail/user-detail.module') + .then(m => m.UserDetailModule), + }, + ], }, { path: 'iam', loadChildren: () => import('./pages/iam/iam.module').then(m => m.IamModule), canActivate: [AuthGuard, RoleGuard], data: { - roles: ['iam.read'], + roles: ['iam.read', 'iam.write'], }, }, { @@ -49,27 +65,30 @@ const routes: Routes = [ roles: ['org.read'], }, }, - { - path: 'grant-create/project/:projectid/grant/:grantid', - loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') - .then(m => m.UserGrantCreateModule), - }, - { - path: 'grant-create/project/:projectid', - loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') - .then(m => m.UserGrantCreateModule), - }, - { - path: 'grant-create/user/:userid', - loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') - .then(m => m.UserGrantCreateModule), - }, { path: 'grant-create', - loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') - .then(m => m.UserGrantCreateModule), + canActivate: [AuthGuard], + children: [ + { + path: 'project/:projectid/grant/:grantid', + loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') + .then(m => m.UserGrantCreateModule), + canActivate: [RoleGuard], + data: { + roles: ['project.grant.user.grant.write'], + }, + }, + { + path: 'project/:projectid', + loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') + .then(m => m.UserGrantCreateModule), + canActivate: [RoleGuard], + data: { + roles: ['project.user.grant.write'], + }, + }, + ], }, - { path: 'signedout', loadChildren: () => import('./pages/signedout/signedout.module').then(m => m.SignedoutModule), @@ -81,7 +100,14 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [ + RouterModule.forRoot( + routes, + { + preloadingStrategy: QuicklinkStrategy, + }, + ), + ], exports: [RouterModule], }) export class AppRoutingModule { } diff --git a/console/src/app/app.component.html b/console/src/app/app.component.html index 9f60282476..8d939c48b3 100644 --- a/console/src/app/app.component.html +++ b/console/src/app/app.component.html @@ -1,130 +1,130 @@ - - - - - - - - + + + + + + + + + - - - - - - - - - + + - - - -
- - - - -
-
+ + + + + - - -
- - - - -
+ + +
{{'MENU.IAMADMIN' | translate}}
- -
- -
-
- +
+ +
+ + + \ No newline at end of file diff --git a/console/src/app/app.component.scss b/console/src/app/app.component.scss index dc1fcff92e..eba4bd6d98 100644 --- a/console/src/app/app.component.scss +++ b/console/src/app/app.component.scss @@ -76,7 +76,7 @@ height: calc(100vh - 60px); width: 100%; - .side { + .sidenav { width: 300px; border-right: none; diff --git a/console/src/app/app.component.ts b/console/src/app/app.component.ts index 0fe48b9925..820ee0f07d 100644 --- a/console/src/app/app.component.ts +++ b/console/src/app/app.component.ts @@ -134,10 +134,6 @@ export class AppComponent implements OnDestroy { public orgLoading: boolean = false; public showProjectSection: boolean = false; - public showOrgSection: boolean = false; - public showUserSection: boolean = false; - public iamreadwrite: boolean = false; - private authSub: Subscription = new Subscription(); private orgSub: Subscription = new Subscription(); @@ -207,13 +203,10 @@ export class AppComponent implements OnDestroy { this.orgSub = this.authService.activeOrgChanged.subscribe(org => { this.org = org; - this.loadPermissions(); }); this.authSub = this.authService.authenticationChanged.subscribe((authenticated) => { if (authenticated) { - // this.userService.GetMyzitadelPermissions().pipe(take(1)).subscribe(perm => console.log(perm.toObject())); - this.loadPermissions(); this.authService.GetActiveOrg().then(org => { this.org = org; }); @@ -235,13 +228,6 @@ export class AppComponent implements OnDestroy { this.orgSub.unsubscribe(); } - public loadPermissions(): void { - this.userService.isAllowed(['iam.read', 'iam.write'], true).subscribe(allowed => this.iamreadwrite = allowed); - this.userService.isAllowed(['org.read']).subscribe(allowed => this.showOrgSection = allowed); - this.userService.isAllowed(['project.read']).subscribe(allowed => this.showProjectSection = allowed); - this.userService.isAllowed(['user.read']).subscribe(allowed => this.showUserSection = allowed); - } - public loadOrgs(): void { this.orgLoading = true; this.userService.SearchMyProjectOrgs(10, 0).then(res => { diff --git a/console/src/app/app.module.ts b/console/src/app/app.module.ts index bb7065177a..67f7629a45 100644 --- a/console/src/app/app.module.ts +++ b/console/src/app/app.module.ts @@ -18,6 +18,7 @@ import { ServiceWorkerModule } from '@angular/service-worker'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { AuthConfig, OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; +import { QuicklinkModule } from 'ngx-quicklink'; import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; @@ -27,6 +28,7 @@ import { OutsideClickModule } from './directives/outside-click/outside-click.mod import { AccountsCardModule } from './modules/accounts-card/accounts-card.module'; import { AvatarModule } from './modules/avatar/avatar.module'; import { SignedoutComponent } from './pages/signedout/signedout.component'; +import { HasRolePipeModule } from './pipes/has-role-pipe.module'; import { AuthUserService } from './services/auth-user.service'; import { AuthService } from './services/auth.service'; import { GrpcService } from './services/grpc.service'; @@ -86,6 +88,7 @@ const authConfig: AuthConfig = { deps: [HttpClient], }, }), + QuicklinkModule, AccountsCardModule, HasRoleModule, BrowserAnimationsModule, @@ -96,6 +99,7 @@ const authConfig: AuthConfig = { MatSidenavModule, MatCardModule, OutsideClickModule, + HasRolePipeModule, MatProgressBarModule, MatToolbarModule, MatMenuModule, diff --git a/console/src/app/guards/role.guard.ts b/console/src/app/guards/role.guard.ts index 3ed531a60a..0c5d52029f 100644 --- a/console/src/app/guards/role.guard.ts +++ b/console/src/app/guards/role.guard.ts @@ -15,6 +15,6 @@ export class RoleGuard implements CanActivate { route: ActivatedRouteSnapshot, state: RouterStateSnapshot, ): Observable { - return this.userService.isAllowed(route.data['roles']); + return this.userService.isAllowed(route.data['roles'], true); } } diff --git a/console/src/app/modules/add-member-dialog/member-create-dialog.component.ts b/console/src/app/modules/add-member-dialog/member-create-dialog.component.ts index 0164cf348d..f64c3027e9 100644 --- a/console/src/app/modules/add-member-dialog/member-create-dialog.component.ts +++ b/console/src/app/modules/add-member-dialog/member-create-dialog.component.ts @@ -33,8 +33,6 @@ export class MemberCreateDialogComponent { this.creationType = data.creationType; this.projectId = data.projectId; - console.log(this.creationType); - if (this.creationType === CreationType.PROJECT_GRANTED) { this.projectService.GetProjectGrantMemberRoles().then(resp => { this.memberRoleOptions = resp.toObject().rolesList; diff --git a/console/src/app/modules/card/card.component.html b/console/src/app/modules/card/card.component.html index 81031c29f7..5687b09a47 100644 --- a/console/src/app/modules/card/card.component.html +++ b/console/src/app/modules/card/card.component.html @@ -3,7 +3,7 @@

{{title}}

- + - +
\ No newline at end of file diff --git a/console/src/app/modules/project-contributors/project-contributors.component.ts b/console/src/app/modules/project-contributors/project-contributors.component.ts index 7d9ee045c1..ab6a0ddc8a 100644 --- a/console/src/app/modules/project-contributors/project-contributors.component.ts +++ b/console/src/app/modules/project-contributors/project-contributors.component.ts @@ -85,7 +85,7 @@ export class ProjectContributorsComponent implements OnInit { case ProjectType.PROJECTTYPE_OWNED: return this.projectService.AddProjectMember(this.project.projectId, user.id, roles) .then(() => { - this.toast.showInfo('members added'); + this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true); }).catch(error => { this.toast.showError(error); }); @@ -96,7 +96,7 @@ export class ProjectContributorsComponent implements OnInit { user.id, roles, ).then(() => { - this.toast.showInfo('members added'); + this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/modules/project-members/project-members-datasource.ts b/console/src/app/modules/project-members/project-members-datasource.ts index d19be7a57a..2229275b7d 100644 --- a/console/src/app/modules/project-members/project-members-datasource.ts +++ b/console/src/app/modules/project-members/project-members-datasource.ts @@ -25,8 +25,7 @@ export class ProjectMembersDataSource extends DataSource const offset = pageIndex * pageSize; this.loadingSubject.next(true); - console.log(grantId); - // TODO + const promise: Promise | undefined = projectType === ProjectType.PROJECTTYPE_OWNED ? this.projectService.SearchProjectMembers(projectId, pageSize, offset) : diff --git a/console/src/app/modules/project-members/project-members.component.html b/console/src/app/modules/project-members/project-members.component.html index f1d541ab9c..65dde6d16f 100644 --- a/console/src/app/modules/project-members/project-members.component.html +++ b/console/src/app/modules/project-members/project-members.component.html @@ -98,7 +98,7 @@ {{ 'PROJECT.GRANT.TITLE' | translate }} {{ 'ROLES.'+role | translate }} @@ -113,8 +113,9 @@ - +
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 2516738813..ed3df8b80e 100644 --- a/console/src/app/modules/project-members/project-members.component.ts +++ b/console/src/app/modules/project-members/project-members.component.ts @@ -1,7 +1,7 @@ import { SelectionModel } from '@angular/cdk/collections'; import { Component, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { MatPaginator } from '@angular/material/paginator'; +import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatSelectChange } from '@angular/material/select'; import { MatTable } from '@angular/material/table'; import { ActivatedRoute } from '@angular/router'; @@ -13,12 +13,14 @@ import { ToastService } from 'src/app/services/toast.service'; import { CreationType, MemberCreateDialogComponent } from '../add-member-dialog/member-create-dialog.component'; import { ProjectMembersDataSource } from './project-members-datasource'; + @Component({ selector: 'app-project-members', templateUrl: './project-members.component.html', styleUrls: ['./project-members.component.scss'], }) export class ProjectMembersComponent { + public INITIALPAGESIZE: number = 25; public project!: ProjectView.AsObject | ProjectGrantView.AsObject; public projectType: ProjectType = ProjectType.PROJECTTYPE_OWNED; public disabled: boolean = false; @@ -50,15 +52,19 @@ export class ProjectMembersComponent { this.project = project.toObject(); this.projectName = this.project.name; this.dataSource = new ProjectMembersDataSource(this.projectService); - this.dataSource.loadMembers(this.project.projectId, this.projectType, 0, 25); + this.dataSource.loadMembers(this.project.projectId, this.projectType, 0, this.INITIALPAGESIZE); }); } else if (this.projectType === ProjectType.PROJECTTYPE_GRANTED) { - console.log(params.projectid, params.grantid); this.projectService.GetGrantedProjectByID(params.projectid, params.grantid).then(project => { this.project = project.toObject(); this.projectName = this.project.projectName; this.dataSource = new ProjectMembersDataSource(this.projectService); - this.dataSource.loadMembers(this.project.projectId, this.projectType, 0, 25, this.grantId); + this.dataSource.loadMembers(this.project.projectId, + this.projectType, + 0, + this.INITIALPAGESIZE, + this.grantId, + ); }); } }); @@ -149,7 +155,7 @@ export class ProjectMembersComponent { if (this.projectType === ProjectType.PROJECTTYPE_OWNED) { this.projectService.ChangeProjectMember(this.project.projectId, member.userId, selectionChange.value) .then((newmember: ProjectMember) => { - this.toast.showInfo('Member changed'); + this.toast.showInfo('PROJECT.TOAST.MEMBERCHANGED', true); }).catch(error => { this.toast.showError(error); }); @@ -157,10 +163,14 @@ export class ProjectMembersComponent { this.projectService.ChangeProjectGrantMember(this.project.projectId, this.grantId, member.userId, selectionChange.value) .then((newmember: ProjectMember) => { - this.toast.showInfo('Member changed'); + this.toast.showInfo('PROJECT.TOAST.MEMBERCHANGED', true); }).catch(error => { this.toast.showError(error); }); } } + + public changePage(event: PageEvent): void { + this.dataSource.loadMembers(this.project.projectId, this.projectType, event.pageIndex, event.pageSize, this.grantId); + } } diff --git a/console/src/app/modules/project-members/project-members.module.ts b/console/src/app/modules/project-members/project-members.module.ts index 24d996ac5c..157deb33a4 100644 --- a/console/src/app/modules/project-members/project-members.module.ts +++ b/console/src/app/modules/project-members/project-members.module.ts @@ -15,7 +15,7 @@ import { MatTableModule } from '@angular/material/table'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; import { ProjectMembersRoutingModule } from './project-members-routing.module'; import { ProjectMembersComponent } from './project-members.component'; @@ -42,7 +42,7 @@ import { ProjectMembersComponent } from './project-members.component'; MatProgressSpinnerModule, FormsModule, TranslateModule, - PipesModule, + HasRolePipeModule, ], }) export class ProjectMembersModule { } diff --git a/console/src/app/modules/project-roles/project-roles.component.ts b/console/src/app/modules/project-roles/project-roles.component.ts index d7d255407c..40e5edfaea 100644 --- a/console/src/app/modules/project-roles/project-roles.component.ts +++ b/console/src/app/modules/project-roles/project-roles.component.ts @@ -93,7 +93,7 @@ export class ProjectRolesComponent implements AfterViewInit, OnInit { }); this.selection.clear(); }).catch(error => { - this.toast.showError(error?.message || 'Error'); + this.toast.showError(error); }); } @@ -105,8 +105,8 @@ export class ProjectRolesComponent implements AfterViewInit, OnInit { this.dataSource.rolesSubject.value.splice(index, 1); this.dataSource.rolesSubject.next(this.dataSource.rolesSubject.value); }) - .catch(data => { - this.toast.showError(data.message); + .catch(error => { + this.toast.showError(error); }); } diff --git a/console/src/app/modules/project-roles/project-roles.module.ts b/console/src/app/modules/project-roles/project-roles.module.ts index b1de8f3416..132c9cbd29 100644 --- a/console/src/app/modules/project-roles/project-roles.module.ts +++ b/console/src/app/modules/project-roles/project-roles.module.ts @@ -15,7 +15,8 @@ import { MatTooltipModule } from '@angular/material/tooltip'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; +import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe.module'; import { ProjectRoleDetailComponent } from './project-role-detail/project-role-detail.component'; import { ProjectRolesComponent } from './project-roles.component'; @@ -39,9 +40,10 @@ import { ProjectRolesComponent } from './project-roles.component'; MatCheckboxModule, RouterModule, MatTooltipModule, - PipesModule, + HasRolePipeModule, TranslateModule, MatMenuModule, + TimestampToDatePipeModule, ], exports: [ ProjectRolesComponent, diff --git a/console/src/app/pages/users/users.module.ts b/console/src/app/modules/shared/shared.module.ts similarity index 53% rename from console/src/app/pages/users/users.module.ts rename to console/src/app/modules/shared/shared.module.ts index 9a4242bbdc..46caec729e 100644 --- a/console/src/app/pages/users/users.module.ts +++ b/console/src/app/modules/shared/shared.module.ts @@ -1,13 +1,15 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; - -import { UsersRoutingModule } from './users-routing.module'; +import { QuicklinkModule } from 'ngx-quicklink'; @NgModule({ declarations: [], imports: [ CommonModule, - UsersRoutingModule, + QuicklinkModule, + ], + exports: [ + QuicklinkModule, ], }) -export class UsersModule { } +export class SharedModule { } diff --git a/console/src/app/modules/user-grants/user-grants-datasource.ts b/console/src/app/modules/user-grants/user-grants-datasource.ts index 2fdef56a42..e532c87d91 100644 --- a/console/src/app/modules/user-grants/user-grants-datasource.ts +++ b/console/src/app/modules/user-grants/user-grants-datasource.ts @@ -6,6 +6,7 @@ import { UserGrantSearchKey, UserGrantSearchQuery, UserGrantSearchResponse, + UserGrantView, } from 'src/app/proto/generated/management_pb'; import { MgmtUserService } from 'src/app/services/mgmt-user.service'; @@ -18,7 +19,7 @@ export enum UserGrantContext { export class UserGrantsDataSource extends DataSource { public totalResult: number = 0; - public grantsSubject: BehaviorSubject = new BehaviorSubject([]); + public grantsSubject: BehaviorSubject = new BehaviorSubject([]); private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); @@ -82,7 +83,6 @@ export class UserGrantsDataSource extends DataSource { catchError(() => of([])), finalize(() => this.loadingSubject.next(false)), ).subscribe(grants => { - console.log(grants); this.grantsSubject.next(grants); }); } @@ -93,7 +93,7 @@ export class UserGrantsDataSource extends DataSource { * the returned stream emits new items. * @returns A stream of the items to be rendered. */ - public connect(): Observable { + public connect(): Observable { return this.grantsSubject.asObservable(); } diff --git a/console/src/app/modules/user-grants/user-grants.component.html b/console/src/app/modules/user-grants/user-grants.component.html index f63ea2dede..100bab6a44 100644 --- a/console/src/app/modules/user-grants/user-grants.component.html +++ b/console/src/app/modules/user-grants/user-grants.component.html @@ -25,7 +25,6 @@ - + {{grant.orgName}} @@ -81,7 +80,8 @@ {{'PROJECT.GRANT.NOROLES' | translate}} - {{role}} + {{ (role.length>8)? (role | slice:0:8)+'..':(role) }} - - - - - + + + + + + - +
{{'PROJECT.STATE.TITLE' | translate}}: @@ -42,5 +43,5 @@ - +
\ No newline at end of file diff --git a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts index 0738152ded..fbef42ebd6 100644 --- a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts +++ b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts @@ -91,7 +91,6 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy { if (this.projectId && this.grantId) { this.projectService.GetGrantedProjectByID(this.projectId, this.grantId).then(proj => { this.project = proj.toObject(); - console.log('granted-project', this.project); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.html b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.html similarity index 100% rename from console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.html rename to console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.html diff --git a/console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.scss b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.scss similarity index 100% rename from console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.scss rename to console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.scss diff --git a/console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.spec.ts b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.spec.ts similarity index 100% rename from console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.spec.ts rename to console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.spec.ts diff --git a/console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.ts b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.ts similarity index 100% rename from console/src/app/pages/projects/granted-projects/granted-project-grid/granted-project-grid.component.ts rename to console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-grid/granted-project-grid.component.ts diff --git a/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-list.component.ts b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-list.component.ts index bdafbe8956..1de46ea09f 100644 --- a/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-list.component.ts +++ b/console/src/app/pages/projects/granted-projects/granted-project-list/granted-project-list.component.ts @@ -106,9 +106,9 @@ export class GrantedProjectListComponent implements OnInit, OnDestroy { }); Promise.all(promises).then(() => { - this.toast.showInfo('Reactivated selected projects successfully'); + this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true); }).catch(error => { - this.toast.showInfo(error.message); + this.toast.showError(error); }); } @@ -119,9 +119,9 @@ export class GrantedProjectListComponent implements OnInit, OnDestroy { }); Promise.all(promises).then(() => { - this.toast.showInfo('Deactivated selected projects Successfully'); + this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true); }).catch(error => { - this.toast.showInfo(error.message); + this.toast.showError(error); }); } } diff --git a/console/src/app/pages/projects/granted-projects/granted-projects-routing.module.ts b/console/src/app/pages/projects/granted-projects/granted-projects-routing.module.ts index da4692670f..f602fc505c 100644 --- a/console/src/app/pages/projects/granted-projects/granted-projects-routing.module.ts +++ b/console/src/app/pages/projects/granted-projects/granted-projects-routing.module.ts @@ -25,6 +25,7 @@ const routes: Routes = [ path: ':projectid/grant/:grantid/members', data: { type: ProjectType.PROJECTTYPE_GRANTED, + roles: ['project.grant.member.read'], }, loadChildren: () => import('src/app/modules/project-members/project-members.module') .then(m => m.ProjectMembersModule), @@ -37,7 +38,10 @@ const routes: Routes = [ { path: ':projectid/roles/create', loadChildren: () => import('../project-role-create/project-role-create.module').then(m => m.ProjectRoleCreateModule), - + canActivate: [RoleGuard], + data: { + roles: ['project.write'], + }, }, { path: ':projectid/grants/create', diff --git a/console/src/app/pages/projects/granted-projects/granted-projects.module.ts b/console/src/app/pages/projects/granted-projects/granted-projects.module.ts index 956f52a673..61eb12770c 100644 --- a/console/src/app/pages/projects/granted-projects/granted-projects.module.ts +++ b/console/src/app/pages/projects/granted-projects/granted-projects.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -21,11 +21,13 @@ import { ChangesModule } from 'src/app/modules/changes/changes.module'; import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module'; import { ProjectContributorsModule } from 'src/app/modules/project-contributors/project-contributors.module'; import { ProjectRolesModule } from 'src/app/modules/project-roles/project-roles.module'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { UserGrantsModule } from 'src/app/modules/user-grants/user-grants.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; +import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe.module'; import { GrantedProjectDetailComponent } from './granted-project-detail/granted-project-detail.component'; -import { GrantedProjectGridComponent } from './granted-project-grid/granted-project-grid.component'; +import { GrantedProjectGridComponent } from './granted-project-list/granted-project-grid/granted-project-grid.component'; import { GrantedProjectListComponent } from './granted-project-list/granted-project-list.component'; import { GrantedProjectsRoutingModule } from './granted-projects-routing.module'; import { GrantedProjectsComponent } from './granted-projects.component'; @@ -63,9 +65,10 @@ import { GrantedProjectsComponent } from './granted-projects.component'; CardModule, MatTooltipModule, MatSortModule, - PipesModule, + HasRolePipeModule, TranslateModule, + TimestampToDatePipeModule, + SharedModule, ], - schemas: [NO_ERRORS_SCHEMA], }) export class GrantedProjectsModule { } diff --git a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.html rename to console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.html diff --git a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.scss b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.scss similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.scss rename to console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.scss diff --git a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.spec.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.spec.ts similarity index 55% rename from console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.spec.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.spec.ts index 7fbf65396d..942d60320b 100644 --- a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.spec.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProjectApplicationGridComponent } from './project-application-grid.component'; +import { ApplicationGridComponent } from './application-grid.component'; describe('AppGridComponent', () => { - let component: ProjectApplicationGridComponent; - let fixture: ComponentFixture; + let component: ApplicationGridComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ProjectApplicationGridComponent], + declarations: [ApplicationGridComponent], }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(ProjectApplicationGridComponent); + fixture = TestBed.createComponent(ApplicationGridComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.ts similarity index 85% rename from console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.ts index 99c594adb1..52de0ab6b3 100644 --- a/console/src/app/pages/projects/owned-projects/project-application-grid/project-application-grid.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/application-grid/application-grid.component.ts @@ -5,11 +5,11 @@ import { Application } from 'src/app/proto/generated/management_pb'; import { ProjectService } from 'src/app/services/project.service'; @Component({ - selector: 'app-project-application-grid', - templateUrl: './project-application-grid.component.html', - styleUrls: ['./project-application-grid.component.scss'], + selector: 'app-application-grid', + templateUrl: './application-grid.component.html', + styleUrls: ['./application-grid.component.scss'], }) -export class ProjectApplicationGridComponent implements OnInit { +export class ApplicationGridComponent implements OnInit { @Input() public projectId: string = ''; @Input() public disabled: boolean = false; @Output() public changeView: EventEmitter = new EventEmitter(); diff --git a/console/src/app/pages/projects/owned-projects/project-applications/project-applications-datasource.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications-datasource.ts similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-applications/project-applications-datasource.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications-datasource.ts diff --git a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html similarity index 92% rename from console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.html rename to console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html index 9c8516eda6..3b6cde9b42 100644 --- a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html @@ -10,10 +10,6 @@
- diff --git a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.scss b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.scss similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.scss rename to console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.scss diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.spec.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.spec.ts new file mode 100644 index 0000000000..e3b074bfff --- /dev/null +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.spec.ts @@ -0,0 +1,34 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatPaginatorModule } from '@angular/material/paginator'; +import { MatSortModule } from '@angular/material/sort'; +import { MatTableModule } from '@angular/material/table'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; + +import { ApplicationsComponent } from './applications.component'; + +describe('ProjectApplicationsComponent', () => { + let component: ApplicationsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ApplicationsComponent], + imports: [ + NoopAnimationsModule, + MatPaginatorModule, + MatSortModule, + MatTableModule, + ], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ApplicationsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should compile', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts similarity index 88% rename from console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts index c1397bf40f..bee747f5ff 100644 --- a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts @@ -9,15 +9,15 @@ import { Application } from 'src/app/proto/generated/management_pb'; import { ProjectService } from 'src/app/services/project.service'; import { ToastService } from 'src/app/services/toast.service'; -import { ProjectApplicationsDataSource } from './project-applications-datasource'; +import { ProjectApplicationsDataSource } from './applications-datasource'; @Component({ - selector: 'app-project-applications', - templateUrl: './project-applications.component.html', - styleUrls: ['./project-applications.component.scss'], + selector: 'app-applications', + templateUrl: './applications.component.html', + styleUrls: ['./applications.component.scss'], }) -export class ProjectApplicationsComponent implements AfterViewInit, OnInit { +export class ApplicationsComponent implements AfterViewInit, OnInit { @Input() public projectId: string = ''; @Input() public disabled: boolean = false; @ViewChild(MatPaginator) public paginator!: MatPaginator; diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail-routing.module.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail-routing.module.ts new file mode 100644 index 0000000000..5a41936e11 --- /dev/null +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { RoleGuard } from 'src/app/guards/role.guard'; + +import { OwnedProjectDetailComponent } from './owned-project-detail.component'; + +const routes: Routes = [ + { + path: '', + component: OwnedProjectDetailComponent, + data: { + animation: 'HomePage', + roles: ['project.read'], + }, + canActivate: [RoleGuard], + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class OwnedProjectDetailRoutingModule { } diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html index 3a7c37cb34..c022f44f55 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html @@ -43,18 +43,17 @@ - + (changeView)="grid = false" [projectId]="projectId"> - +
- - +
+
@@ -83,15 +82,15 @@ description="{{'GRANTS.PROJECT.DESCRIPTION' | translate }}"> + [allowCreate]="project?.state == ProjectState.PROJECTSTATE_ACTIVE && (['user.grant.write'] | hasRole | async)" + [allowDelete]="project?.state == ProjectState.PROJECTSTATE_ACTIVE && (['user.grant.delete'] | hasRole | async)">
- +
{{'PROJECT.STATE.TITLE' | translate}}: @@ -111,5 +110,5 @@ - +
\ No newline at end of file diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.ts index e430a48062..a1dd1a3e74 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.ts @@ -114,7 +114,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy { dialogRef.afterClosed().subscribe(resp => { if (resp) { this.projectService.ReactivateProject(this.projectId).then(() => { - this.toast.showInfo('Reactivated Project'); + this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true); this.project.state = ProjectState.PROJECTSTATE_ACTIVE; }).catch(error => { this.toast.showError(error); @@ -135,7 +135,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy { dialogRef.afterClosed().subscribe(resp => { if (resp) { this.projectService.DeactivateProject(this.projectId).then(() => { - this.toast.showInfo('Deactivated Project'); + this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true); this.project.state = ProjectState.PROJECTSTATE_INACTIVE; }).catch(error => { this.toast.showError(error); @@ -147,9 +147,9 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy { public saveProject(): void { this.projectService.UpdateProject(this.project.projectId, this.project.name).then(() => { - this.toast.showInfo('Project updated'); + this.toast.showInfo('PROJECT.TOAST.UPDATED', true); }).catch(error => { - this.toast.showInfo(error.message); + this.toast.showError(error); }); } diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.module.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.module.ts new file mode 100644 index 0000000000..dcffe4b264 --- /dev/null +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.module.ts @@ -0,0 +1,64 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatPaginatorModule } from '@angular/material/paginator'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatSelectModule } from '@angular/material/select'; +import { MatTableModule } from '@angular/material/table'; +import { MatTabsModule } from '@angular/material/tabs'; +import { TranslateModule } from '@ngx-translate/core'; +import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; +import { CardModule } from 'src/app/modules/card/card.module'; +import { ChangesModule } from 'src/app/modules/changes/changes.module'; +import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module'; +import { ProjectContributorsModule } from 'src/app/modules/project-contributors/project-contributors.module'; +import { ProjectRolesModule } from 'src/app/modules/project-roles/project-roles.module'; +import { UserGrantsModule } from 'src/app/modules/user-grants/user-grants.module'; +import { WarnDialogModule } from 'src/app/modules/warn-dialog/warn-dialog.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; +import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe.module'; + +import { ApplicationGridComponent } from './application-grid/application-grid.component'; +import { ApplicationsComponent } from './applications/applications.component'; +import { OwnedProjectDetailRoutingModule } from './owned-project-detail-routing.module'; +import { OwnedProjectDetailComponent } from './owned-project-detail.component'; +import { ProjectGrantsComponent } from './project-grants/project-grants.component'; + +@NgModule({ + declarations: [ + OwnedProjectDetailComponent, + ApplicationGridComponent, + ApplicationsComponent, + ProjectGrantsComponent, + ], + imports: [ + CommonModule, + FormsModule, + OwnedProjectDetailRoutingModule, + TranslateModule, + HasRoleModule, + MatTabsModule, + MatButtonModule, + MatIconModule, + ProjectContributorsModule, + WarnDialogModule, + ProjectRolesModule, + HasRolePipeModule, + UserGrantsModule, + TimestampToDatePipeModule, + MatTableModule, + MatFormFieldModule, + CardModule, + MatPaginatorModule, + MatCheckboxModule, + MatSelectModule, + MatProgressSpinnerModule, + ChangesModule, + MetaLayoutModule, + ], +}) +export class OwnedProjectDetailModule { } diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants-datasource.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants-datasource.ts similarity index 98% rename from console/src/app/pages/projects/owned-projects/project-grants/project-grants-datasource.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants-datasource.ts index 2ddad1209d..21bea8ee92 100644 --- a/console/src/app/pages/projects/owned-projects/project-grants/project-grants-datasource.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants-datasource.ts @@ -29,7 +29,6 @@ export class ProjectGrantsDataSource extends DataSource { catchError(() => of([])), finalize(() => this.loadingSubject.next(false)), ).subscribe(grants => { - console.log(grants); this.grantsSubject.next(grants); }); } diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.html similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html rename to console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.html diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.scss b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.scss similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.scss rename to console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.scss diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.spec.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.spec.ts similarity index 100% rename from console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.spec.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.spec.ts diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.ts similarity index 97% rename from console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts rename to console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.ts index 36d19c0140..47b372160c 100644 --- a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/project-grants/project-grants.component.ts @@ -75,14 +75,13 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit { public getRoleOptions(projectId: string): void { this.projectService.SearchProjectRoles(projectId, 100, 0).then(resp => { this.memberRoleOptions = resp.toObject().resultList; - console.log(resp.toObject()); }); } updateRoles(grant: ProjectGrant.AsObject, selectionChange: MatSelectChange): void { this.projectService.UpdateProjectGrant(grant.id, grant.projectId, selectionChange.value) .then((newgrant: ProjectGrant) => { - this.toast.showInfo('Grant updated!'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTCHANGED', true); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.html b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.html similarity index 100% rename from console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.html rename to console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.html diff --git a/console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.scss b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.scss similarity index 100% rename from console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.scss rename to console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.scss diff --git a/console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.spec.ts b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.spec.ts similarity index 100% rename from console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.spec.ts rename to console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.spec.ts diff --git a/console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.ts similarity index 100% rename from console/src/app/pages/projects/owned-projects/owned-project-grid/owned-project-grid.component.ts rename to console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-grid/owned-project-grid.component.ts diff --git a/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.html b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.html index 58f9eb3140..47247d8ae7 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.html @@ -1,5 +1,5 @@ + [items]="ownedProjectList || []" (newClicked)="addProject()">
@@ -20,16 +20,6 @@
-
- - -
add{{ 'ACTIONS.NEW' | translate }} diff --git a/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.ts index 92a95d5a3f..2123e30856 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-list/owned-project-list.component.ts @@ -108,9 +108,9 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy { }); Promise.all(promises).then(() => { - this.toast.showInfo('Reactivated selected projects successfully'); + this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true); }).catch(error => { - this.toast.showInfo(error.message); + this.toast.showError(error); }); } @@ -121,9 +121,9 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy { }); Promise.all(promises).then(() => { - this.toast.showInfo('Deactivated selected projects Successfully'); + this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true); }).catch(error => { - this.toast.showInfo(error.message); + this.toast.showError(error); }); } } diff --git a/console/src/app/pages/projects/owned-projects/owned-projects-routing.module.ts b/console/src/app/pages/projects/owned-projects/owned-projects-routing.module.ts index d3ddcb5391..113db2595e 100644 --- a/console/src/app/pages/projects/owned-projects/owned-projects-routing.module.ts +++ b/console/src/app/pages/projects/owned-projects/owned-projects-routing.module.ts @@ -1,10 +1,8 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { AuthGuard } from 'src/app/guards/auth.guard'; import { RoleGuard } from 'src/app/guards/role.guard'; import { ProjectType } from 'src/app/proto/generated/management_pb'; -import { OwnedProjectDetailComponent } from './owned-project-detail/owned-project-detail.component'; import { OwnedProjectsComponent } from './owned-projects.component'; const routes: Routes = [ @@ -16,42 +14,60 @@ const routes: Routes = [ { path: 'create', loadChildren: () => import('../project-create/project-create.module').then(m => m.ProjectCreateModule), - canActivate: [AuthGuard, RoleGuard], + canActivate: [RoleGuard], data: { roles: ['project.write'], }, }, { path: ':id', - component: OwnedProjectDetailComponent, - data: { animation: 'HomePage' }, - }, - { - path: ':projectid/members', data: { - type: ProjectType.PROJECTTYPE_OWNED, + animation: 'HomePage', + roles: ['project.read'], }, - loadChildren: () => import('src/app/modules/project-members/project-members.module') - .then(m => m.ProjectMembersModule), + canActivate: [RoleGuard], + loadChildren: () => import('./owned-project-detail/owned-project-detail.module') + .then(m => m.OwnedProjectDetailModule), }, { - path: ':projectid/apps', - data: { animation: 'AddPage' }, - loadChildren: () => import('src/app/pages/projects/apps/apps.module').then(m => m.AppsModule), - }, - { - path: ':projectid/roles/create', - loadChildren: () => import('../project-role-create/project-role-create.module').then(m => m.ProjectRoleCreateModule), - }, - { - path: ':projectid/grants/create', - loadChildren: () => import('../project-grant-create/project-grant-create.module') - .then(m => m.ProjectGrantCreateModule), - }, - { - path: ':projectid/grant/:grantid', - loadChildren: () => import('./project-grant-detail/project-grant-detail.module') - .then(m => m.ProjectGrantDetailModule), + path: ':projectid', + children: [ + { + path: 'members', + data: { + type: ProjectType.PROJECTTYPE_OWNED, + roles: ['project.member.read'], + }, + canActivate: [RoleGuard], + loadChildren: () => import('src/app/modules/project-members/project-members.module') + .then(m => m.ProjectMembersModule), + }, + { + path: 'apps', + data: { + animation: 'AddPage', + roles: ['project.app.read'], + }, + canActivate: [RoleGuard], + loadChildren: () => import('src/app/pages/projects/apps/apps.module') + .then(m => m.AppsModule), + }, + { + path: 'roles/create', + loadChildren: () => import('../project-role-create/project-role-create.module') + .then(m => m.ProjectRoleCreateModule), + }, + { + path: 'grants/create', + loadChildren: () => import('../project-grant-create/project-grant-create.module') + .then(m => m.ProjectGrantCreateModule), + }, + { + path: 'grant/:grantid', + loadChildren: () => import('./project-grant-detail/project-grant-detail.module') + .then(m => m.ProjectGrantDetailModule), + }, + ], }, ]; diff --git a/console/src/app/pages/projects/owned-projects/owned-projects.module.ts b/console/src/app/pages/projects/owned-projects/owned-projects.module.ts index 9524504985..448eff2475 100644 --- a/console/src/app/pages/projects/owned-projects/owned-projects.module.ts +++ b/console/src/app/pages/projects/owned-projects/owned-projects.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -10,47 +10,33 @@ import { MatInputModule } from '@angular/material/input'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { MatSelectModule } from '@angular/material/select'; import { MatSortModule } from '@angular/material/sort'; import { MatTableModule } from '@angular/material/table'; -import { MatTabsModule } from '@angular/material/tabs'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; import { AvatarModule } from 'src/app/modules/avatar/avatar.module'; import { CardModule } from 'src/app/modules/card/card.module'; -import { ChangesModule } from 'src/app/modules/changes/changes.module'; -import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module'; -import { ProjectContributorsModule } from 'src/app/modules/project-contributors/project-contributors.module'; -import { ProjectRolesModule } from 'src/app/modules/project-roles/project-roles.module'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { UserGrantsModule } from 'src/app/modules/user-grants/user-grants.module'; -import { WarnDialogModule } from 'src/app/modules/warn-dialog/warn-dialog.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; +import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe.module'; -import { OwnedProjectDetailComponent } from './owned-project-detail/owned-project-detail.component'; -import { OwnedProjectGridComponent } from './owned-project-grid/owned-project-grid.component'; +import { OwnedProjectGridComponent } from './owned-project-list/owned-project-grid/owned-project-grid.component'; import { OwnedProjectListComponent } from './owned-project-list/owned-project-list.component'; import { OwnedProjectsRoutingModule } from './owned-projects-routing.module'; import { OwnedProjectsComponent } from './owned-projects.component'; -import { ProjectApplicationGridComponent } from './project-application-grid/project-application-grid.component'; -import { ProjectApplicationsComponent } from './project-applications/project-applications.component'; -import { ProjectGrantsComponent } from './project-grants/project-grants.component'; @NgModule({ declarations: [ OwnedProjectsComponent, OwnedProjectListComponent, OwnedProjectGridComponent, - OwnedProjectDetailComponent, - ProjectApplicationGridComponent, - ProjectApplicationsComponent, - ProjectGrantsComponent, ], imports: [ CommonModule, OwnedProjectsRoutingModule, UserGrantsModule, - ProjectContributorsModule, FormsModule, ReactiveFormsModule, TranslateModule, @@ -61,24 +47,18 @@ import { ProjectGrantsComponent } from './project-grants/project-grants.componen MatPaginatorModule, MatFormFieldModule, MatInputModule, - ChangesModule, MatChipsModule, MatIconModule, MatButtonModule, - WarnDialogModule, MatProgressSpinnerModule, - MetaLayoutModule, MatProgressBarModule, - ProjectRolesModule, - MatTabsModule, MatCheckboxModule, CardModule, - MatSelectModule, MatTooltipModule, MatSortModule, - PipesModule, - TranslateModule, + HasRolePipeModule, + TimestampToDatePipeModule, + SharedModule, ], - schemas: [NO_ERRORS_SCHEMA], }) export class OwnedProjectsModule { } diff --git a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.spec.ts b/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.spec.ts deleted file mode 100644 index 997c404a01..0000000000 --- a/console/src/app/pages/projects/owned-projects/project-applications/project-applications.component.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatPaginatorModule } from '@angular/material/paginator'; -import { MatSortModule } from '@angular/material/sort'; -import { MatTableModule } from '@angular/material/table'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -import { ProjectApplicationsComponent } from './project-applications.component'; - -describe('ProjectApplicationsComponent', () => { - let component: ProjectApplicationsComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ProjectApplicationsComponent], - imports: [ - NoopAnimationsModule, - MatPaginatorModule, - MatSortModule, - MatTableModule, - ], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ProjectApplicationsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should compile', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.component.ts b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.component.ts index 56faeda908..a102a91794 100644 --- a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.component.ts +++ b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.component.ts @@ -80,7 +80,7 @@ export class ProjectGrantDetailComponent { updateRoles(selectionChange: MatSelectChange): void { this.projectService.UpdateProjectGrant(this.grant.id, this.grant.projectId, selectionChange.value) .then((newgrant: ProjectGrant) => { - this.toast.showInfo('Grant updated!'); + this.toast.showInfo('PROJECT.TOAST.GRANTUPDATED'); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.module.ts b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.module.ts index 0c4c779db0..13a2e45eff 100644 --- a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.module.ts +++ b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-detail.module.ts @@ -9,8 +9,6 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { MatSelectModule } from '@angular/material/select'; -import { MatSortModule } from '@angular/material/sort'; import { MatTableModule } from '@angular/material/table'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; @@ -36,8 +34,6 @@ import { ProjectGrantMembersModule } from './project-grant-members/project-grant MatTableModule, MatPaginatorModule, MatFormFieldModule, - MatSelectModule, - MatSortModule, MatTooltipModule, ReactiveFormsModule, MatProgressSpinnerModule, diff --git a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-members/project-grant-members.component.ts b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-members/project-grant-members.component.ts index e857cf11cc..7c2c704070 100644 --- a/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-members/project-grant-members.component.ts +++ b/console/src/app/pages/projects/owned-projects/project-grant-detail/project-grant-members/project-grant-members.component.ts @@ -87,7 +87,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit { public removeProjectMemberSelection(): void { Promise.all(this.selection.selected.map(member => { return this.projectService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => { - this.toast.showInfo('Removed successfully'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERREMOVED', true); }).catch(error => { this.toast.showError(error); }); @@ -96,7 +96,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit { public removeMember(member: ProjectMember.AsObject): void { this.projectService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => { - this.toast.showInfo('Member removed successfully'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERREMOVED', true); }).catch(error => { this.toast.showError(error); }); @@ -134,8 +134,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit { dataToAdd.rolesKeyList, ); })).then(() => { - console.log('this'); - this.toast.showInfo('Project Grant Member successfully added!'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERADDED', true); }).catch(error => { this.toast.showError(error); }); @@ -146,7 +145,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit { updateRoles(member: ProjectMember.AsObject, selectionChange: MatSelectChange): void { this.projectService.ChangeProjectGrantMember(this.projectId, this.grantId, member.userId, selectionChange.value) .then((newmember: ProjectMember) => { - this.toast.showInfo('Member updated!'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERCHANGED', true); }).catch(error => { this.toast.showError(error); }); diff --git a/console/src/app/pages/projects/project-create/project-create.component.ts b/console/src/app/pages/projects/project-create/project-create.component.ts index f2224667a0..e573000e65 100644 --- a/console/src/app/pages/projects/project-create/project-create.component.ts +++ b/console/src/app/pages/projects/project-create/project-create.component.ts @@ -30,8 +30,8 @@ export class ProjectCreateComponent implements OnInit { .then((data: Project) => { this.router.navigate(['projects', data.getId()]); }) - .catch(data => { - this.toast.showError(data.message); + .catch(error => { + this.toast.showError(error); }); } diff --git a/console/src/app/pages/projects/project-grant-create/project-grant-create.module.ts b/console/src/app/pages/projects/project-grant-create/project-grant-create.module.ts index 583f8515c0..1622a3beb9 100644 --- a/console/src/app/pages/projects/project-grant-create/project-grant-create.module.ts +++ b/console/src/app/pages/projects/project-grant-create/project-grant-create.module.ts @@ -13,7 +13,7 @@ import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; import { CardModule } from 'src/app/modules/card/card.module'; import { ProjectRolesModule } from 'src/app/modules/project-roles/project-roles.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; import { ProjectGrantCreateRoutingModule } from './project-grant-create-routing.module'; import { ProjectGrantCreateComponent } from './project-grant-create.component'; @@ -33,7 +33,7 @@ import { ProjectGrantCreateComponent } from './project-grant-create.component'; ProjectRolesModule, MatIconModule, MatTooltipModule, - PipesModule, + HasRolePipeModule, ReactiveFormsModule, MatProgressSpinnerModule, FormsModule, diff --git a/console/src/app/pages/projects/project-role-create/project-role-create.component.html b/console/src/app/pages/projects/project-role-create/project-role-create.component.html index f59cf06190..c1b959912c 100644 --- a/console/src/app/pages/projects/project-role-create/project-role-create.component.html +++ b/console/src/app/pages/projects/project-role-create/project-role-create.component.html @@ -9,8 +9,8 @@

{{'PROJECT.ROLE.ADDDESCRIPTION' | translate}}

-
@@ -18,8 +18,6 @@ {{ 'PROJECT.ROLE.KEY' | translate }} - {{ 'PROJECT.ROLE.DISPLAY_NAME' | translate }} @@ -29,15 +27,14 @@ {{ 'PROJECT.ROLE.GROUP' | translate }} -
- diff --git a/console/src/app/pages/projects/project-role-create/project-role-create.component.ts b/console/src/app/pages/projects/project-role-create/project-role-create.component.ts index 85e6981c33..3b4cf59f4f 100644 --- a/console/src/app/pages/projects/project-role-create/project-role-create.component.ts +++ b/console/src/app/pages/projects/project-role-create/project-role-create.component.ts @@ -84,6 +84,7 @@ export class ProjectRoleCreateComponent implements OnInit, OnDestroy { } public addRole(): void { + console.log(this.formArray.value); const rolesToAdd: ProjectRoleAdd[] = this.formArray.value.map((element: any) => { const role = new ProjectRoleAdd(); role.setKey(element.key); diff --git a/console/src/app/pages/signedout/signedout.module.ts b/console/src/app/pages/signedout/signedout.module.ts index 8830b816c2..4394648dc5 100644 --- a/console/src/app/pages/signedout/signedout.module.ts +++ b/console/src/app/pages/signedout/signedout.module.ts @@ -1,5 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { SignedoutRoutingModule } from './signedout-routing.module'; @@ -8,6 +9,7 @@ import { SignedoutRoutingModule } from './signedout-routing.module'; imports: [ CommonModule, SignedoutRoutingModule, + SharedModule, ], }) export class SignedoutModule { } diff --git a/console/src/app/pages/user-grant-create/user-grant-create.component.ts b/console/src/app/pages/user-grant-create/user-grant-create.component.ts index 613208b0fb..eae2811a9d 100644 --- a/console/src/app/pages/user-grant-create/user-grant-create.component.ts +++ b/console/src/app/pages/user-grant-create/user-grant-create.component.ts @@ -50,19 +50,11 @@ export class UserGrantCreateComponent implements OnDestroy { this.grantId = grantid; this.userId = userid; - console.log('usergrantcreate'); - - // if (this.userId) { - // this.context = UserGrantContext.USER; - // } else - if (this.projectId && !this.grantId) { this.context = UserGrantContext.OWNED_PROJECT; } else if (this.projectId && this.grantId) { this.context = UserGrantContext.GRANTED_PROJECT; - console.log(this.grantId, this.projectId); this.projectService.GetGrantedProjectByID(this.projectId, this.grantId).then(resp => { - console.log(resp.toObject()); this.grantRolesKeyList = resp.toObject().roleKeysList; }).catch(error => { this.toast.showError(error); @@ -81,25 +73,13 @@ export class UserGrantCreateComponent implements OnDestroy { public addGrant(): void { switch (this.context) { - // case UserGrantContext.USER: - // this.userService.CreateUserGrant( - // this.projectId, - // this.userId, - // this.rolesList, - // ).then((data: UserGrant) => { - // this.toast.showInfo('User Grant added'); - // this.close(); - // }).catch(error => { - // this.toast.showError(error); - // }); - // break; case UserGrantContext.OWNED_PROJECT: this.userService.CreateProjectUserGrant( this.projectId, this.userId, this.rolesList, ).then((data: UserGrant) => { - this.toast.showInfo('Project User Grant added'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTADDED', true); this.close(); }).catch(error => { this.toast.showError(error); @@ -113,13 +93,12 @@ export class UserGrantCreateComponent implements OnDestroy { this.userId, this.rolesList, ).then((data: UserGrant) => { - this.toast.showInfo('Project Grant User Grant added'); + this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTUSERGRANTADDED', true); this.close(); }).catch(error => { this.toast.showError(error); }); break; - } } diff --git a/console/src/app/pages/user-grant-create/user-grant-create.module.ts b/console/src/app/pages/user-grant-create/user-grant-create.module.ts index c51581679a..ece016600e 100644 --- a/console/src/app/pages/user-grant-create/user-grant-create.module.ts +++ b/console/src/app/pages/user-grant-create/user-grant-create.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; @@ -10,6 +10,7 @@ import { SearchProjectAutocompleteModule, } from 'src/app/modules/search-project-autocomplete/search-project-autocomplete.module'; import { SearchUserAutocompleteModule } from 'src/app/modules/search-user-autocomplete/search-user-autocomplete.module'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { ProjectRolesModule } from '../../modules/project-roles/project-roles.module'; import { UserGrantCreateRoutingModule } from './user-grant-create-routing.module'; @@ -31,9 +32,7 @@ import { UserGrantCreateComponent } from './user-grant-create.component'; SearchProjectAutocompleteModule, SearchUserAutocompleteModule, ProjectRolesModule, - ], - schemas: [ - CUSTOM_ELEMENTS_SCHEMA, + SharedModule, ], }) export class UserGrantCreateModule { } diff --git a/console/src/app/pages/users/user-create/user-create.component.ts b/console/src/app/pages/users/user-create/user-create.component.ts index c8443ea9cc..941ded7776 100644 --- a/console/src/app/pages/users/user-create/user-create.component.ts +++ b/console/src/app/pages/users/user-create/user-create.component.ts @@ -89,8 +89,8 @@ export class UserCreateComponent implements OnDestroy { this.toast.showInfo('USER.TOAST.CREATED', true); this.router.navigate(['users', data.getId()]); }) - .catch(data => { - this.toast.showError(data.message); + .catch(error => { + this.toast.showError(error); }); } diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html index 1aece1f0f4..2cfb455fd0 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html @@ -129,7 +129,7 @@
- +
Preferred Loginname: @@ -138,5 +138,5 @@
- +
\ No newline at end of file diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts index b55dcc4563..3941d2a330 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts @@ -69,8 +69,8 @@ export class AuthUserDetailComponent implements OnDestroy { this.toast.showInfo('USER.TOAST.SAVED', true); this.user = Object.assign(this.user, data.toObject()); }) - .catch(data => { - this.toast.showError(data.message); + .catch(error => { + this.toast.showError(error); }); } @@ -144,8 +144,8 @@ export class AuthUserDetailComponent implements OnDestroy { this.toast.showInfo('USER.TOAST.PHONESAVED', true); this.user.phone = data.toObject().phone; this.phoneEditState = false; - }).catch(data => { - this.toast.showError(data); + }).catch(error => { + this.toast.showError(error); this.phoneEditState = false; }); } @@ -153,8 +153,8 @@ export class AuthUserDetailComponent implements OnDestroy { private async getData(): Promise { this.userService.GetMyUser().then(user => { this.user = user.toObject(); - }).catch(err => { - this.toast.showError(err); + }).catch(error => { + this.toast.showError(error); }); } diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html index 9cfc6af175..15372d025e 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html @@ -15,7 +15,8 @@

{{error}}

-
diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts index 9b7d0fffee..5eb26319b4 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts @@ -21,6 +21,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy { public MFAState: any = MFAState; public error: string = ''; + public otpAvailable: boolean = false; constructor(private userService: AuthUserService, private toast: ToastService, private dialog: MatDialog) { } public ngOnInit(): void { @@ -55,6 +56,10 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy { public getOTP(): void { this.userService.GetMyMfas().then(mfas => { this.mfaSubject.next(mfas.toObject().mfasList); + const index = mfas.toObject().mfasList.findIndex(mfa => mfa.type === MfaType.MFATYPE_OTP); + if (index === -1) { + this.otpAvailable = true; + } }).catch(error => { console.error(error); this.error = error.message; diff --git a/console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.html similarity index 100% rename from console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.html rename to console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.html diff --git a/console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.scss b/console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.scss similarity index 100% rename from console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.scss rename to console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.scss diff --git a/console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.spec.ts b/console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.spec.ts similarity index 100% rename from console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.spec.ts rename to console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.spec.ts diff --git a/console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.ts similarity index 100% rename from console/src/app/pages/users/user-detail/theme-setting/theme-setting.component.ts rename to console/src/app/pages/users/user-detail/auth-user-detail/theme-setting/theme-setting.component.ts diff --git a/console/src/app/pages/users/user-detail/password/password.component.ts b/console/src/app/pages/users/user-detail/password/password.component.ts index 9db217ba44..1819bce456 100644 --- a/console/src/app/pages/users/user-detail/password/password.component.ts +++ b/console/src/app/pages/users/user-detail/password/password.component.ts @@ -84,7 +84,7 @@ export class PasswordComponent implements OnInit { }); } else { this.passwordForm = this.fb.group({ - currentPassword: ['', validators], + currentPassword: ['', Validators.required], newPassword: ['', validators], confirmPassword: ['', [...validators, passwordConfirmValidator]], }); @@ -96,8 +96,8 @@ export class PasswordComponent implements OnInit { this.mgmtUserService.SetInitialPassword(userId, this.password.value).then((data: any) => { this.toast.showInfo('USER.TOAST.INITIALPASSWORDSET', true); window.history.back(); - }).catch(data => { - this.toast.showError(data.message); + }).catch(error => { + this.toast.showError(error); }); } } @@ -110,8 +110,8 @@ export class PasswordComponent implements OnInit { .ChangeMyPassword(this.currentPassword.value, this.newPassword.value).then((data: any) => { this.toast.showInfo('USER.TOAST.PASSWORDCHANGED', true); window.history.back(); - }).catch(data => { - this.toast.showError(data.message); + }).catch(error => { + this.toast.showError(error); }); } } @@ -125,7 +125,7 @@ export class PasswordComponent implements OnInit { } public get currentPassword(): AbstractControl | null { - return this.passwordForm.get('newPassword'); + return this.passwordForm.get('currentPassword'); } public get confirmPassword(): AbstractControl | null { diff --git a/console/src/app/pages/users/user-detail/user-detail-routing.module.ts b/console/src/app/pages/users/user-detail/user-detail-routing.module.ts index d74d40c6c9..02469dc87e 100644 --- a/console/src/app/pages/users/user-detail/user-detail-routing.module.ts +++ b/console/src/app/pages/users/user-detail/user-detail-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard } from 'src/app/guards/auth.guard'; import { RoleGuard } from 'src/app/guards/role.guard'; import { AuthUserDetailComponent } from './auth-user-detail/auth-user-detail.component'; @@ -10,15 +11,17 @@ const routes: Routes = [ { path: 'me', component: AuthUserDetailComponent, + canActivate: [AuthGuard], }, { path: 'me/password', component: PasswordComponent, + canActivate: [AuthGuard], }, { path: ':id', component: UserDetailComponent, - canActivate: [RoleGuard], + canActivate: [AuthGuard, RoleGuard], data: { roles: ['user.read'], }, @@ -26,7 +29,7 @@ const routes: Routes = [ { path: ':id/password', component: PasswordComponent, - canActivate: [RoleGuard], + canActivate: [AuthGuard, RoleGuard], data: { roles: ['user.write'], }, diff --git a/console/src/app/pages/users/user-detail/user-detail.module.ts b/console/src/app/pages/users/user-detail/user-detail.module.ts index 441b363c62..2c8002a131 100644 --- a/console/src/app/pages/users/user-detail/user-detail.module.ts +++ b/console/src/app/pages/users/user-detail/user-detail.module.ts @@ -1,12 +1,15 @@ import { CommonModule } from '@angular/common'; -import { CUSTOM_ELEMENTS_SCHEMA, NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; +import { MatPaginatorModule } from '@angular/material/paginator'; import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatTableModule } from '@angular/material/table'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; import { QRCodeModule } from 'angularx-qrcode'; @@ -14,19 +17,20 @@ import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; import { CardModule } from 'src/app/modules/card/card.module'; import { ChangesModule } from 'src/app/modules/changes/changes.module'; import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { UserGrantsModule } from 'src/app/modules/user-grants/user-grants.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module'; import { AuthUserDetailComponent } from './auth-user-detail/auth-user-detail.component'; import { AuthUserMfaComponent } from './auth-user-detail/auth-user-mfa/auth-user-mfa.component'; import { CodeDialogComponent } from './auth-user-detail/code-dialog/code-dialog.component'; import { DialogOtpComponent } from './auth-user-detail/dialog-otp/dialog-otp.component'; +import { ThemeSettingComponent } from './auth-user-detail/theme-setting/theme-setting.component'; import { DetailFormModule } from './detail-form/detail-form.module'; import { PasswordComponent } from './password/password.component'; -import { ThemeSettingComponent } from './theme-setting/theme-setting.component'; import { UserDetailRoutingModule } from './user-detail-routing.module'; import { UserDetailComponent } from './user-detail/user-detail.component'; -import { UserMfaComponent } from './user-mfa/user-mfa.component'; +import { UserMfaComponent } from './user-detail/user-mfa/user-mfa.component'; @NgModule({ declarations: [ @@ -49,18 +53,21 @@ import { UserMfaComponent } from './user-mfa/user-mfa.component'; MatDialogModule, QRCodeModule, MetaLayoutModule, - PipesModule, + HasRolePipeModule, MatFormFieldModule, UserGrantsModule, MatInputModule, MatButtonModule, MatIconModule, CardModule, + MatProgressSpinnerModule, MatProgressBarModule, MatTooltipModule, HasRoleModule, TranslateModule, + MatTableModule, + MatPaginatorModule, + SharedModule, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], }) export class UserDetailModule { } diff --git a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.html b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.html index c0e7ce6b3e..0732c932e5 100644 --- a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.html +++ b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.html @@ -143,12 +143,13 @@ - + - +
Preferred Loginname: @@ -157,5 +158,5 @@
- +
\ No newline at end of file diff --git a/console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.html b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html similarity index 100% rename from console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.html rename to console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html diff --git a/console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.scss b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.scss similarity index 100% rename from console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.scss rename to console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.scss diff --git a/console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.spec.ts b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.spec.ts similarity index 100% rename from console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.spec.ts rename to console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.spec.ts diff --git a/console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.ts b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts similarity index 100% rename from console/src/app/pages/users/user-detail/user-mfa/user-mfa.component.ts rename to console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts diff --git a/console/src/app/pages/users/user-list/user-list.component.ts b/console/src/app/pages/users/user-list/user-list.component.ts index c276b0833d..045125b77d 100644 --- a/console/src/app/pages/users/user-list/user-list.component.ts +++ b/console/src/app/pages/users/user-list/user-list.component.ts @@ -51,14 +51,14 @@ export class UserListComponent implements OnDestroy { } public changePage(event: PageEvent): void { - this.getData(event.pageSize, event.pageIndex); + this.getData(event.pageSize, event.pageIndex * event.pageSize); } public deactivateSelectedUsers(): void { Promise.all(this.selection.selected.map(value => { return this.userService.DeactivateUser(value.id); })).then(() => { - this.toast.showInfo('Selected Users deactivated'); + this.toast.showInfo('USER.TOAST.SELECTEDDEACTIVATED', true); this.getData(10, 0); }); } @@ -67,7 +67,7 @@ export class UserListComponent implements OnDestroy { Promise.all(this.selection.selected.map(value => { return this.userService.ReactivateUser(value.id); })).then(() => { - this.toast.showInfo('Selected Users reactivated'); + this.toast.showInfo('USER.TOAST.SELECTEDREACTIVATED', true); this.getData(10, 0); }); } diff --git a/console/src/app/pages/users/user-list/user-list.module.ts b/console/src/app/pages/users/user-list/user-list.module.ts index f6bcac1122..6bdc5d8ca8 100644 --- a/console/src/app/pages/users/user-list/user-list.module.ts +++ b/console/src/app/pages/users/user-list/user-list.module.ts @@ -13,6 +13,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { HasRoleModule } from 'src/app/directives/has-role/has-role.module'; import { AvatarModule } from 'src/app/modules/avatar/avatar.module'; import { CardModule } from 'src/app/modules/card/card.module'; +import { SharedModule } from 'src/app/modules/shared/shared.module'; import { UserListRoutingModule } from './user-list-routing.module'; import { UserListComponent } from './user-list.component'; @@ -39,6 +40,7 @@ import { UserListComponent } from './user-list.component'; MatCheckboxModule, MatTooltipModule, TranslateModule, + SharedModule, ], exports: [ UserListComponent, diff --git a/console/src/app/pages/users/users-routing.module.ts b/console/src/app/pages/users/users-routing.module.ts deleted file mode 100644 index 1774b7acec..0000000000 --- a/console/src/app/pages/users/users-routing.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { RoleGuard } from 'src/app/guards/role.guard'; - -import { AuthGuard } from '../../guards/auth.guard'; - -const routes: Routes = [ - { - path: 'all', - loadChildren: () => import('src/app/pages/users/user-list/user-list.module').then(m => m.UserListModule), - canActivate: [AuthGuard, RoleGuard], - data: { - roles: ['user.read'], - }, - }, - { - path: '', - loadChildren: () => import('src/app/pages/users/user-detail/user-detail.module').then(m => m.UserDetailModule), - canActivate: [AuthGuard], - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class UsersRoutingModule { } diff --git a/console/src/app/pipes/has-role-pipe.module.ts b/console/src/app/pipes/has-role-pipe.module.ts new file mode 100644 index 0000000000..c1a7a90761 --- /dev/null +++ b/console/src/app/pipes/has-role-pipe.module.ts @@ -0,0 +1,18 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; + +import { HasRolePipe } from './has-role.pipe'; + + +@NgModule({ + declarations: [ + HasRolePipe, + ], + imports: [ + CommonModule, + ], + exports: [ + HasRolePipe, + ], +}) +export class HasRolePipeModule { } diff --git a/console/src/app/pipes/has-role.pipe.ts b/console/src/app/pipes/has-role.pipe.ts index a684b71241..502e1f1b06 100644 --- a/console/src/app/pipes/has-role.pipe.ts +++ b/console/src/app/pipes/has-role.pipe.ts @@ -1,16 +1,16 @@ import { Pipe, PipeTransform } from '@angular/core'; +import { Observable } from 'rxjs'; import { AuthUserService } from '../services/auth-user.service'; @Pipe({ name: 'hasRole', - pure: false, }) export class HasRolePipe implements PipeTransform { constructor(private authUserService: AuthUserService) { } - public transform(values: string[], each: boolean = false): any { + public transform(values: string[], each: boolean = false): Observable { return this.authUserService.isAllowed(values, each); } } diff --git a/console/src/app/pipes/pipes.module.ts b/console/src/app/pipes/localized-date-pipe.module.ts similarity index 61% rename from console/src/app/pipes/pipes.module.ts rename to console/src/app/pipes/localized-date-pipe.module.ts index 30e205d375..fc20976312 100644 --- a/console/src/app/pipes/pipes.module.ts +++ b/console/src/app/pipes/localized-date-pipe.module.ts @@ -2,16 +2,12 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { MomentModule } from 'ngx-moment'; -import { HasRolePipe } from './has-role.pipe'; import { LocalizedDatePipe } from './localized-date.pipe'; -import { TimestampToDatePipe } from './timestamp-to-date.pipe'; @NgModule({ declarations: [ LocalizedDatePipe, - TimestampToDatePipe, - HasRolePipe, ], imports: [ CommonModule, @@ -19,8 +15,6 @@ import { TimestampToDatePipe } from './timestamp-to-date.pipe'; ], exports: [ LocalizedDatePipe, - TimestampToDatePipe, - HasRolePipe, ], }) -export class PipesModule { } +export class LocalizedDatePipeModule { } diff --git a/console/src/app/pipes/localized-date.pipe.ts b/console/src/app/pipes/localized-date.pipe.ts index 91d32755bf..a561650e1e 100644 --- a/console/src/app/pipes/localized-date.pipe.ts +++ b/console/src/app/pipes/localized-date.pipe.ts @@ -4,7 +4,6 @@ import { TranslateService } from '@ngx-translate/core'; @Pipe({ name: 'localizedDate', - pure: false, }) export class LocalizedDatePipe implements PipeTransform { diff --git a/console/src/app/pipes/timestamp-to-date-pipe.module.ts b/console/src/app/pipes/timestamp-to-date-pipe.module.ts new file mode 100644 index 0000000000..505334a36a --- /dev/null +++ b/console/src/app/pipes/timestamp-to-date-pipe.module.ts @@ -0,0 +1,18 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; + +import { TimestampToDatePipe } from './timestamp-to-date.pipe'; + + +@NgModule({ + declarations: [ + TimestampToDatePipe, + ], + imports: [ + CommonModule, + ], + exports: [ + TimestampToDatePipe, + ], +}) +export class TimestampToDatePipeModule { } diff --git a/console/src/assets/i18n/de.json b/console/src/assets/i18n/de.json index a2e557fdd8..5d87bb40e2 100644 --- a/console/src/assets/i18n/de.json +++ b/console/src/assets/i18n/de.json @@ -209,7 +209,9 @@ "PASSWORDNOTIFICATIONSENT":"Passwortänderung mittgeteilt!", "PASSWORDCHANGED":"Passwort geändert!", "REACTIVATED":"User reaktiviert!", - "DEACTIVATED":"User deaktiviert!" + "DEACTIVATED":"User deaktiviert!", + "SELECTEDREACTIVATED":"Selektierte User reaktiviert!", + "SELECTEDDEACTIVATED":"Selektierte User deaktiviert!" } }, "IAM": { @@ -229,6 +231,16 @@ "SEQUENCE":"Sequenz", "ACTIONS":"Aktionen", "CLEAR":"Aufräumen" + }, + "TOAST":{ + "MEMBERREMOVED":"Manager entfernt!", + "MEMBERSADDED": "Manager hinzugefügt!", + "MEMBERADDED": "Manager hinzugefügt!", + "MEMBERCHANGED":"Manager geändert!", + "ROLEREMOVED":"Rolle entfernt!", + "ROLECHANGED":"Rolle verändert!", + "REACTIVATED":"Reaktiviert!", + "DEACTIVATED":"Deaktiviert!" } }, "ORG": { @@ -322,7 +334,9 @@ "DEACTIVATED":"Organisation deaktiviert!", "REACTIVATED":"Organisation reaktiviert!", "DOMAINADDED":"Domain hinzugefügt!", - "DOMAINREMOVED":"Domain entfernt!" + "DOMAINREMOVED":"Domain entfernt!", + "MEMBERADDED":"Manager hinzugefügt!", + "MEMBERREMOVED":"Manager entfernt!" } }, "ORG_DETAIL": { @@ -444,17 +458,27 @@ "PROJECTNAME":"Projekt Name", "GRANTEDORG": "Berechtigte Organisation", "GRANTEDORGDOMAIN": "Domain", + "RESOURCEOWNER":"Resource Owner", "GRANTEDORGNAME":"Org. Name", "CREATIONDATE": "Erstelldatum", "CHANGEDATE": "Letzte Änderung", "ROLENAMESLIST": "Rollen", - "NOROLES":"Keine Rollen" + "NOROLES":"Keine Rollen", + "TOAST":{ + "PROJECTGRANTUSERGRANTADDED":"Project Berechtigung erstellt!", + "PROJECTGRANTADDED":"Projekt Berechtigung erstellt", + "PROJECTGRANTCHANGED":"Projekt Berechtigung geändert!", + "PROJECTGRANTMEMBERADDED":"Berechtigungsmanager hinzugefügt!", + "PROJECTGRANTMEMBERCHANGED":"Berechtigungsmanager verändert!", + "PROJECTGRANTMEMBERREMOVED":"Berechtigungsmanager entfernt!" + } }, "APP": { "TITLE": "Applikationen", "NAME": "Name" }, "ROLE": { + "ADDNEWLINE":"Zusätzliche Rolle hinzufügen", "KEY":"Key", "TITLE": "Rollen", "DESCRIPTION":"Definiere Rollen, die du bei der Erstellung eines Projekt-Grants vergeben kannst", @@ -488,10 +512,13 @@ "MEMBERREMOVED":"Manager entfernt!", "MEMBERSADDED": "Manager hinzugefügt!", "MEMBERADDED": "Manager hinzugefügt!", + "MEMBERCHANGED":"Manager geändert!", "ROLEREMOVED":"Rolle entfernt!", "ROLECHANGED":"Rolle verändert!", "REACTIVATED":"Reaktiviert!", - "DEACTIVATED":"Deaktiviert!" + "DEACTIVATED":"Deaktiviert!", + "UPDATED":"Projekt gespeichert!", + "GRANTUPDATED":"Berechtigung verändert!" } }, "APP": { diff --git a/console/src/assets/i18n/en.json b/console/src/assets/i18n/en.json index 35c638c444..b3d6fc6179 100644 --- a/console/src/assets/i18n/en.json +++ b/console/src/assets/i18n/en.json @@ -209,7 +209,9 @@ "PASSWORDNOTIFICATIONSENT":"Password Change Notification sent", "PASSWORDCHANGED":"Password changed successfully!", "REACTIVATED":"User reactivated", - "DEACTIVATED":"User deactivated" + "DEACTIVATED":"User deactivated", + "SELECTEDREACTIVATED":"Selected Users reactivated", + "SELECTEDDEACTIVATED":"Selected Users deactivated" } }, "IAM": { @@ -229,6 +231,16 @@ "SEQUENCE":"Sequence", "ACTIONS":"Actions", "CLEAR":"Clear" + }, + "TOAST":{ + "MEMBERREMOVED":"Manager removed!", + "MEMBERSADDED": "Managers added!", + "MEMBERADDED": "Manager added!", + "MEMBERCHANGED":"Manager changed!", + "ROLEREMOVED":"Role removed!", + "ROLECHANGED":"Role changed!", + "REACTIVATED":"Reaktiviert!", + "DEACTIVATED":"Deaktiviert!" } }, "ORG": { @@ -322,7 +334,9 @@ "DEACTIVATED":"Organization deactivated!", "REACTIVATED":"Organization reactivated!", "DOMAINADDED":"Added domain!", - "DOMAINREMOVED":"Removed domain!" + "DOMAINREMOVED":"Removed domain!", + "MEMBERADDED":"Manager added!", + "MEMBERREMOVED":"Manager removed!" } }, "ORG_DETAIL": { @@ -442,17 +456,27 @@ "PROJECTNAME":"Project Name", "GRANTEDORG": "Granted Organisation", "GRANTEDORGDOMAIN": "Domain", + "RESOURCEOWNER":"Resource Owner", "GRANTEDORGNAME":"Org. Name", "CREATIONDATE": "Creation Date", "CHANGEDATE": "Last Modified", "ROLENAMESLIST": "Roles", - "NOROLES":"No roles" + "NOROLES":"No roles", + "TOAST": { + "PROJECTGRANTUSERGRANTADDED":"Project Grant created!", + "PROJECTGRANTADDED":"Project Grant created!", + "PROJECTGRANTCHANGED":"Project Grant changed!", + "PROJECTGRANTMEMBERADDED":"Grant Manager added!", + "PROJECTGRANTMEMBERCHANGED":"Grant Manager changed!", + "PROJECTGRANTMEMBERREMOVED":"Grant Manager removed!" + } }, "APP": { "TITLE": "Applications", "NAME": "Name" }, "ROLE": { + "ADDNEWLINE":"Add additional role", "KEY":"Key", "TITLE": "Roles", "DESCRIPTION":"Define some roles which can be used to create project-grants", @@ -486,10 +510,13 @@ "MEMBERREMOVED":"Manager removed!", "MEMBERSADDED": "Managers added!", "MEMBERADDED": "Manager added!", + "MEMBERCHANGED":"Manager changed!", "ROLEREMOVED":"Role removed!", "ROLECHANGED":"Role changed!", - "REACTIVATED":"Reaktiviert!", - "DEACTIVATED":"Deaktiviert!" + "REACTIVATED":"Reactivated!", + "DEACTIVATED":"Deactivated!", + "UPDATED":"Project changed!", + "GRANTUPDATED":"Grant changed!" } }, "APP": { diff --git a/console/src/styles.scss b/console/src/styles.scss index c30554e55e..3006849eba 100644 --- a/console/src/styles.scss +++ b/console/src/styles.scss @@ -121,7 +121,7 @@ $custom-typography: mat-typography-config( @include angular-material-theme($light-theme); color: #202124; - .side, .main-container { + .sidenav, .main-container { background-color: white; transition: background-color .5s ease-in-out; } @@ -149,7 +149,7 @@ $custom-typography: mat-typography-config( @include component-themes($dark-theme); @include angular-material-theme($dark-theme); - .side, .main-container { + .sidenav, .main-container { background-color: #212224; transition: background-color .5s ease-in-out; }
{{ 'PROJECT.GRANT.GRANTEDORGDOMAIN' | translate }} - {{grant.orgDomain}} {{grant.orgName}}