diff --git a/console/src/app/app.component.html b/console/src/app/app.component.html index 8440c1f7c0..bc345db41f 100644 --- a/console/src/app/app.component.html +++ b/console/src/app/app.component.html @@ -59,7 +59,7 @@ {{ 'MENU.PERSONAL_INFO' | translate }} -
+
@@ -71,7 +71,7 @@ {{org?.name ? org.name : 'MENU.ORGANIZATION' | translate}} -
+
@@ -85,7 +85,7 @@ {{ 'MENU.GRANTEDPROJECT' | translate }} -
+
diff --git a/console/src/app/modules/changes/changes.component.html b/console/src/app/modules/changes/changes.component.html index a7e2d199be..7495397e94 100644 --- a/console/src/app/modules/changes/changes.component.html +++ b/console/src/app/modules/changes/changes.component.html @@ -11,5 +11,5 @@
- {{errorMessage}} + {{'CHANGES.BOTTOM' | translate}} \ No newline at end of file diff --git a/console/src/app/modules/changes/changes.component.scss b/console/src/app/modules/changes/changes.component.scss index 7a6fd9773c..adfb2dd9a9 100644 --- a/console/src/app/modules/changes/changes.component.scss +++ b/console/src/app/modules/changes/changes.component.scss @@ -39,8 +39,8 @@ justify-content: center; } - .err-container { - font-size: 14px; - color: rgb(201,51,71); + .end-container { + font-size: 12px; + color: #81868a; } } diff --git a/console/src/app/modules/changes/changes.component.ts b/console/src/app/modules/changes/changes.component.ts index 56a877c026..32de463e86 100644 --- a/console/src/app/modules/changes/changes.component.ts +++ b/console/src/app/modules/changes/changes.component.ts @@ -19,7 +19,6 @@ export class ChangesComponent implements OnInit { @Input() public changeType: ChangeType = ChangeType.USER; @Input() public id: string = ''; @Input() public sortDirectionAsc: boolean = true; - public errorMessage: string = ''; public bottom: boolean = false; // Source data @@ -118,7 +117,6 @@ export class ChangesComponent implements OnInit { catchError(err => { console.error(err); this._loading.next(false); - this.errorMessage = decodeURI(err.message); this.bottom = true; return of([]); }), diff --git a/console/src/app/modules/project-contributors/project-contributors.component.html b/console/src/app/modules/project-contributors/project-contributors.component.html index c9e572aa63..a33ea92402 100644 --- a/console/src/app/modules/project-contributors/project-contributors.component.html +++ b/console/src/app/modules/project-contributors/project-contributors.component.html @@ -7,11 +7,15 @@
- + + +
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 e81099a67f..97513f4608 100644 --- a/console/src/app/modules/project-contributors/project-contributors.component.ts +++ b/console/src/app/modules/project-contributors/project-contributors.component.ts @@ -56,6 +56,7 @@ export class ProjectContributorsComponent implements OnInit { finalize(() => this.loadingSubject.next(false)), ).subscribe(members => { this.membersSubject.next(members); + console.log(members); }); } } 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 5d44939e8d..5cc0f73213 100644 --- a/console/src/app/modules/project-members/project-members-datasource.ts +++ b/console/src/app/modules/project-members/project-members-datasource.ts @@ -42,6 +42,7 @@ export class ProjectMembersDataSource extends DataSource finalize(() => this.loadingSubject.next(false)), ).subscribe(members => { this.membersSubject.next(members); + console.log(members); }); } } 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 eefbf080fb..84a3f2cb5d 100644 --- a/console/src/app/modules/project-members/project-members.component.html +++ b/console/src/app/modules/project-members/project-members.component.html @@ -60,6 +60,13 @@ + + + {{ 'PROJECT.MEMBER.USERID' | translate }} + + {{member.userId}} + + {{ 'PROJECT.MEMBER.FIRSTNAME' | translate }} 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 2a6bb16647..fd6a1d1967 100644 --- a/console/src/app/modules/project-members/project-members.component.ts +++ b/console/src/app/modules/project-members/project-members.component.ts @@ -1,13 +1,15 @@ import { SelectionModel } from '@angular/cdk/collections'; import { AfterViewInit, Component, ViewChild } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; import { MatTable } from '@angular/material/table'; import { ActivatedRoute } from '@angular/router'; import { tap } from 'rxjs/operators'; -import { ProjectMember, ProjectType, ProjectView } from 'src/app/proto/generated/management_pb'; +import { ProjectMember, ProjectType, ProjectView, User } from 'src/app/proto/generated/management_pb'; import { ProjectService } from 'src/app/services/project.service'; 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({ @@ -25,9 +27,11 @@ export class ProjectMembersComponent implements AfterViewInit { public selection: SelectionModel = new SelectionModel(true, []); /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ - public displayedColumns: string[] = ['select', 'firstname', 'lastname', 'username', 'email', 'roles']; + public displayedColumns: string[] = ['select', 'userId', 'firstname', 'lastname', 'username', 'email', 'roles']; - constructor(private projectService: ProjectService, + constructor( + private projectService: ProjectService, + private dialog: MatDialog, private toast: ToastService, private route: ActivatedRoute) { this.route.params.subscribe(params => { @@ -88,33 +92,29 @@ export class ProjectMembersComponent implements AfterViewInit { } public openAddMember(): void { + const dialogRef = this.dialog.open(MemberCreateDialogComponent, { + data: { + creationType: CreationType.PROJECT_OWNED, + projectId: this.project.projectId, + }, + width: '400px', + }); - // TODO - // const dialogRef = this.dialog.open(ProjectMemberCreateDialogComponent, { - // data: { - // creationType: this.project.type === - // ProjectType.PROJECTTYPE_GRANTED ? CreationType.PROJECT_GRANTED : - // ProjectType.PROJECTTYPE_OWNED ? CreationType.PROJECT_OWNED : undefined, - // projectId: this.project.id, - // }, - // width: '400px', - // }); + dialogRef.afterClosed().subscribe(resp => { + if (resp) { + const users: User.AsObject[] = resp.users; + const roles: string[] = resp.roles; - // dialogRef.afterClosed().subscribe(resp => { - // if (resp) { - // const users: User.AsObject[] = resp.users; - // const roles: string[] = resp.roles; - - // if (users && users.length && roles && roles.length) { - // Promise.all(users.map(user => { - // return this.projectService.AddProjectMember(this.project.id, user.id, roles); - // })).then(() => { - // this.toast.showError('members added'); - // }).catch(error => { - // this.toast.showError(error.message); - // }); - // } - // } - // }); + if (users && users.length && roles && roles.length) { + Promise.all(users.map(user => { + return this.projectService.AddProjectMember(this.project.projectId, user.id, roles); + })).then(() => { + this.toast.showError('members added'); + }).catch(error => { + this.toast.showError(error.message); + }); + } + } + }); } } diff --git a/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.html b/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.html index f414d805d5..aa01af076d 100644 --- a/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.html +++ b/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.html @@ -7,7 +7,7 @@ - {{selectedProject.name}} + {{selectedProject?.name ? selectedProject.name + ' (owned)' : selectedProject?.projectName ? selectedProject.projectName + ' (granted)': ''}} cancel - {{project.name}} + {{project?.name ? project.name + ' (owned)' : project?.projectName ? project.projectName + ' (granted)': ''}} diff --git a/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.ts b/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.ts index 2b44d82ff7..c1ac7997a9 100644 --- a/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.ts +++ b/console/src/app/modules/search-project-autocomplete/search-project-autocomplete.component.ts @@ -3,13 +3,13 @@ import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@ import { FormControl } from '@angular/forms'; import { MatAutocomplete, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete'; import { MatChipInputEvent } from '@angular/material/chips'; -import { from } from 'rxjs'; +import { from, merge } from 'rxjs'; import { debounceTime, switchMap, tap } from 'rxjs/operators'; import { - Project, ProjectGrantView, ProjectSearchKey, ProjectSearchQuery, + ProjectView, SearchMethod, } from 'src/app/proto/generated/management_pb'; import { ProjectService } from 'src/app/services/project.service'; @@ -26,14 +26,18 @@ export class SearchProjectAutocompleteComponent { public separatorKeysCodes: number[] = [ENTER, COMMA]; public myControl: FormControl = new FormControl(); public names: string[] = []; - public projects: Array = []; - public filteredProjects: Array = []; + public projects: Array = []; + public filteredProjects: Array = []; public isLoading: boolean = false; @ViewChild('nameInput') public nameInput!: ElementRef; @ViewChild('auto') public matAutocomplete!: MatAutocomplete; @Input() public singleOutput: boolean = false; - @Output() public selectionChanged: EventEmitter - = new EventEmitter(); + @Output() public selectionChanged: EventEmitter< + ProjectGrantView.AsObject[] + | ProjectGrantView.AsObject + | ProjectView.AsObject + | ProjectView.AsObject[] + > = new EventEmitter(); constructor(private projectService: ProjectService) { this.myControl.valueChanges .pipe( @@ -44,17 +48,22 @@ export class SearchProjectAutocompleteComponent { query.setKey(ProjectSearchKey.PROJECTSEARCHKEY_PROJECT_NAME); query.setValue(value); query.setMethod(SearchMethod.SEARCHMETHOD_CONTAINS); - return from(this.projectService.SearchGrantedProjects(10, 0, [query])); + return merge( + from(this.projectService.SearchGrantedProjects(10, 0, [query])), + from(this.projectService.SearchProjects(10, 0, [query])), + ); }), // finalize(() => this.isLoading = false), ).subscribe((projects) => { this.isLoading = false; this.filteredProjects = projects.toObject().resultList; + console.log(this.filteredProjects); }); } - public displayFn(project?: Project.AsObject): string | undefined { - return project ? `${project.name}` : undefined; + public displayFn(project?: any): string | undefined { + return (project && project.projectName) ? `${project.projectName}` : + (project && project.name) ? `${project.name}` : undefined; } public add(event: MatChipInputEvent): void { @@ -64,8 +73,10 @@ export class SearchProjectAutocompleteComponent { if ((value || '').trim()) { const index = this.filteredProjects.findIndex((project) => { - if (project.projectName) { + if (project?.projectName) { return project.projectName === value; + } else if (project?.name) { + return project.name === value; } }); if (index > -1) { @@ -92,22 +103,19 @@ export class SearchProjectAutocompleteComponent { } public selected(event: MatAutocompleteSelectedEvent): void { - const index = this.filteredProjects.findIndex((project) => project === event.option.value); - if (index !== -1) { - if (this.singleOutput) { - this.selectionChanged.emit(this.filteredProjects[index]); + console.log(event.option.value); + if (this.singleOutput) { + this.selectionChanged.emit(event.option.value); + } else { + if (this.projects && this.projects.length > 0) { + this.projects.push(event.option.value); } else { - if (this.projects && this.projects.length > 0) { - this.projects.push(this.filteredProjects[index]); - } else { - this.projects = [this.filteredProjects[index]]; - } - this.selectionChanged.emit(this.projects); - - this.nameInput.nativeElement.value = ''; - this.myControl.setValue(null); + this.projects = [event.option.value]; } + this.selectionChanged.emit(this.projects); + this.nameInput.nativeElement.value = ''; + this.myControl.setValue(null); } } } diff --git a/console/src/app/pages/orgs/org-create/org-create.component.html b/console/src/app/pages/orgs/org-create/org-create.component.html index 266e41b919..60f7c00aa7 100644 --- a/console/src/app/pages/orgs/org-create/org-create.component.html +++ b/console/src/app/pages/orgs/org-create/org-create.component.html @@ -164,7 +164,7 @@
-
diff --git a/console/src/app/pages/orgs/org-create/org-create.component.ts b/console/src/app/pages/orgs/org-create/org-create.component.ts index cf6dc19191..c2fb172c49 100644 --- a/console/src/app/pages/orgs/org-create/org-create.component.ts +++ b/console/src/app/pages/orgs/org-create/org-create.component.ts @@ -68,7 +68,7 @@ export class OrgCreateComponent { this.orgForm = this.fb.group({ name: ['', [Validators.required]], - domain: ['', [Validators.required]], + domain: [''], }); this.orgService.GetPasswordComplexityPolicy().then(data => { this.policy = data.toObject(); diff --git a/console/src/app/pages/orgs/org-grid/org-grid.component.html b/console/src/app/pages/orgs/org-grid/org-grid.component.html index e4b4ad51a5..409aa581fa 100644 --- a/console/src/app/pages/orgs/org-grid/org-grid.component.html +++ b/console/src/app/pages/orgs/org-grid/org-grid.component.html @@ -37,7 +37,7 @@ -
+
add Add new organization
diff --git a/console/src/app/pages/project-grant-create/project-grant-create.component.html b/console/src/app/pages/project-grant-create/project-grant-create.component.html index 1e8afdcab5..195ef8b654 100644 --- a/console/src/app/pages/project-grant-create/project-grant-create.component.html +++ b/console/src/app/pages/project-grant-create/project-grant-create.component.html @@ -11,7 +11,7 @@

{{'PROJECT.GRANT.CREATE.SEL_ORG' | translate}}

-
+ {{'PROJECT.GRANT.CREATE.SEL_ORG' | translate}} diff --git a/console/src/app/pages/project-grant-create/project-grant-create.component.ts b/console/src/app/pages/project-grant-create/project-grant-create.component.ts index 5e1bcd3839..e749d66750 100644 --- a/console/src/app/pages/project-grant-create/project-grant-create.component.ts +++ b/console/src/app/pages/project-grant-create/project-grant-create.component.ts @@ -42,15 +42,19 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy { this.routeSubscription.unsubscribe(); } - public searchOrg(domain: any): void { - this.orgService.getOrgByDomainGlobal(domain.value).then((ret) => { + public searchOrg(domain: string): void { + console.log(domain); + this.orgService.getOrgByDomainGlobal(domain).then((ret) => { const tmp = ret.toObject(); + console.log(ret.toObject()); this.authService.GetActiveOrg().then((org) => { + console.log(org); if (tmp !== org) { this.org = tmp; } }); this.org = ret.toObject(); + console.log(this.org); }).catch(error => { this.toast.showError(error.message); }); diff --git a/console/src/app/pages/user-create/user-create.component.html b/console/src/app/pages/user-create/user-create.component.html index 7533095e35..9d641f14b4 100644 --- a/console/src/app/pages/user-create/user-create.component.html +++ b/console/src/app/pages/user-create/user-create.component.html @@ -90,7 +90,7 @@ {{ 'USER.VALIDATION.REQUIRED' | translate }} - +