From 2a2c8a36839a1b96a94a2f677d7bf3a67dcab785 Mon Sep 17 00:00:00 2001 From: ryzhak Date: Fri, 26 Oct 2018 16:49:25 +0300 Subject: [PATCH] #14 disabled all controls in team page if not a team member --- .../group-member/group-member.component.html | 4 ++-- .../group-member/group-member.component.ts | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/dashboard/group-member/group-member.component.html b/src/app/dashboard/group-member/group-member.component.html index ccf4680..82ff6d6 100644 --- a/src/app/dashboard/group-member/group-member.component.html +++ b/src/app/dashboard/group-member/group-member.component.html @@ -10,7 +10,7 @@

Members of group DevZenTeam

- +
@@ -34,7 +34,7 @@

Members of group DevZenTeam

{{ web3Service.fromWei(member.dztBalance,"ether") }} {{ web3Service.fromWei(member.dztRepBalance,"ether") }} - + diff --git a/src/app/dashboard/group-member/group-member.component.ts b/src/app/dashboard/group-member/group-member.component.ts index 361de08..137e766 100644 --- a/src/app/dashboard/group-member/group-member.component.ts +++ b/src/app/dashboard/group-member/group-member.component.ts @@ -16,6 +16,7 @@ export class GroupMemberComponent implements OnInit { displayAddGroupMemberDialog = false; formGroupMember: FormGroup; + isTeamMember = false; loading = false; members: GroupMember[] = []; @@ -32,18 +33,26 @@ export class GroupMemberComponent implements OnInit { let sub; // if DevZenDaoService initialized then we don't need to wait for it to load the contracts if(this.devZenDaoService.isInitialized) { - sub = this.devZenDaoService.getGroupMembers(this.devZenDaoService.GROUP_DEV_ZEN_TEAM); + sub = forkJoin( + this.devZenDaoService.getGroupMembers(this.devZenDaoService.GROUP_DEV_ZEN_TEAM), + this.devZenDaoService.isTeamMember() + ); } else { // wait for the DevZenDaoService to be initialized sub = this.devZenDaoService.init.pipe( switchMap(() => { - return this.devZenDaoService.getGroupMembers(this.devZenDaoService.GROUP_DEV_ZEN_TEAM); + return forkJoin( + this.devZenDaoService.getGroupMembers(this.devZenDaoService.GROUP_DEV_ZEN_TEAM), + this.devZenDaoService.isTeamMember() + ); }) ); } sub.pipe( - switchMap(members => { + switchMap(data => { + const members = data[0]; + this.isTeamMember = data[1]; let requests = []; Object.keys(members).map( index => {