Update community-roles.component to align with collection-roles

This commit is contained in:
Tim Donohue
2022-09-28 13:30:42 -05:00
parent 695ce3ab9e
commit 0235cc2fe8
3 changed files with 24 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
<ds-comcol-role <ds-comcol-role
*ngFor="let comcolRole of getComcolRoles$() | async" *ngFor="let comcolRole of comcolRoles$ | async"
[dso]="community$ | async" [dso]="community$ | async"
[comcolRole]="comcolRole" [comcolRole]="comcolRole"
> >

View File

@@ -78,8 +78,9 @@ describe('CommunityRolesComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should display a community admin role component', () => { it('should display a community admin role component', (done) => {
expect(de.query(By.css('ds-comcol-role .community-admin'))) expect(de.query(By.css('ds-comcol-role .community-admin')))
.toBeTruthy(); .toBeTruthy();
done();
}); });
}); });

View File

@@ -19,28 +19,14 @@ export class CommunityRolesComponent implements OnInit {
dsoRD$: Observable<RemoteData<Community>>; dsoRD$: Observable<RemoteData<Community>>;
/** /**
* The community to manage, as an observable. * The different roles for the community, as an observable.
*/ */
get community$(): Observable<Community> { comcolRoles$: Observable<HALLink[]>;
return this.dsoRD$.pipe(
getFirstSucceededRemoteData(),
getRemoteDataPayload(),
);
}
/** /**
* The different roles for the community. * The community to manage, as an observable.
*/ */
getComcolRoles$(): Observable<HALLink[]> { community$: Observable<Community>;
return this.community$.pipe(
map((community) => [
{
name: 'community-admin',
href: community._links.adminGroup.href,
},
]),
);
}
constructor( constructor(
protected route: ActivatedRoute, protected route: ActivatedRoute,
@@ -52,5 +38,22 @@ export class CommunityRolesComponent implements OnInit {
first(), first(),
map((data) => data.dso), map((data) => data.dso),
); );
this.community$ = this.dsoRD$.pipe(
getFirstSucceededRemoteData(),
getRemoteDataPayload(),
);
/**
* The different roles for the community.
*/
this.comcolRoles$ = this.community$.pipe(
map((community) => [
{
name: 'community-admin',
href: community._links.adminGroup.href,
},
]),
);
} }
} }