Merge pull request #4986 from pengpengshui/leftNav

Filter out existimg members when add a new member #4364
This commit is contained in:
pengpengshui 2018-05-21 18:19:39 +08:00 committed by GitHub
commit d16cddda04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -50,6 +50,7 @@ import { MemberService } from '../member.service';
})
export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
@Input() memberList: Member[] = [];
member: Member = new Member();
addMemberOpened: boolean;
@ -85,6 +86,7 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
private ref: ChangeDetectorRef) { }
ngOnInit(): void {
let resolverData = this.route.snapshot.parent.data;
let hasProjectAdminRole: boolean;
if (resolverData) {
@ -120,8 +122,8 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
// username autocomplete
if (this.userLists && this.userLists.length) {
this.selectUserName = [];
this.userLists.filter(data => {
if (data.username.startsWith(cont.value)) {
this.userLists.forEach(data => {
if (data.username.startsWith(cont.value) && !this.memberList.find(mem => mem.entity_name === data.username)) {
if (this.selectUserName.length < 10) {
this.selectUserName.push(data.username);
}

View File

@ -45,5 +45,5 @@
</clr-dg-footer>
</clr-datagrid>
</div>
<add-member [projectId]="projectId" (added)="addedMember($event)"></add-member>
<add-member [projectId]="projectId" [memberList]="members" (added)="addedMember($event)"></add-member>
</div>