Skip to content

Commit

Permalink
fix(admin-ui): Fix role editor Channel value display
Browse files Browse the repository at this point in the history
  • Loading branch information
oneyed authored Jan 18, 2021
1 parent b114428 commit c258975
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[clearable]="false"
[searchable]="false"
[disabled]="disabled"
[compareWith]="compareFn"
(focus)="focussed()"
(change)="valueChanged($event)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DEFAULT_CHANNEL_CODE } from '@vendure/common/lib/shared-constants';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { CurrentUserChannel } from '../../../common/generated-types';
import { Channel, CurrentUserChannel } from '../../../common/generated-types';
import { DataService } from '../../../data/providers/data.service';

@Component({
Expand Down Expand Up @@ -80,4 +80,8 @@ export class ChannelAssignmentControlComponent implements OnInit, ControlValueAc
this.onChange([value ? value.id : undefined]);
}
}

compareFn(c1: Channel, c2: Channel): boolean {
return c1 && c2 ? c1.id === c2.id : c1 === c2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class RoleDetailComponent extends BaseDetailComponent<Role> implements On
this.detailForm.patchValue({
description: role.description,
code: role.code,
channelIds: role.channels.map(c => c.id),
channelIds: role.channels,
permissions: role.permissions,
});
// This was required to get the channel selector component to
Expand Down

0 comments on commit c258975

Please sign in to comment.