Merge pull request #1868 from tdonohue/fix_1867

Fixes Community "Assign Roles" page
This commit is contained in:
Tim Donohue
2022-09-29 08:23:01 -05:00
committed by GitHub
3 changed files with 24 additions and 20 deletions

View File

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

View File

@@ -78,8 +78,9 @@ describe('CommunityRolesComponent', () => {
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')))
.toBeTruthy();
done();
});
});

View File

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