Skip to content

Commit

Permalink
fix(admin-ui): Correctly render channels in Role detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jun 29, 2020
1 parent f7de47f commit cfb3c03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DataService } from '../../../data/providers/data.service';
selector: 'vdr-channel-assignment-control',
templateUrl: './channel-assignment-control.component.html',
styleUrls: ['./channel-assignment-control.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.Default,
providers: [
{
provide: NG_VALUE_ACCESSOR,
Expand All @@ -37,7 +37,7 @@ export class ChannelAssignmentControlComponent implements OnInit, ControlValueAc
.userStatus()
.single$.pipe(
map(({ userStatus }) =>
userStatus.channels.filter(c =>
userStatus.channels.filter((c) =>
this.includeDefaultChannel ? true : c.code !== DEFAULT_CHANNEL_CODE,
),
),
Expand Down Expand Up @@ -70,7 +70,7 @@ export class ChannelAssignmentControlComponent implements OnInit, ControlValueAc

valueChanged(value: CurrentUserChannel[] | CurrentUserChannel | undefined) {
if (Array.isArray(value)) {
this.onChange(value.map(c => c.id));
this.onChange(value.map((c) => c.id));
} else {
this.onChange([value ? value.id : undefined]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class RoleDetailComponent extends BaseDetailComponent<Role> implements On
ngOnInit() {
this.init();
this.role$ = this.entity$;
// setTimeout(() => this.changeDetector.markForCheck(), 2000);
}

ngOnDestroy(): void {
Expand Down Expand Up @@ -134,6 +135,10 @@ export class RoleDetailComponent extends BaseDetailComponent<Role> implements On
for (const permission of Object.keys(this.permissions)) {
this.permissions[permission] = role.permissions.includes(permission as Permission);
}
// This was required to get the channel selector component to
// correctly display its contents. A while spent debugging the root
// cause did not yield a solution, therefore this next line.
this.changeDetector.detectChanges();
}

private getSelectedPermissions(): Permission[] {
Expand Down

0 comments on commit cfb3c03

Please sign in to comment.