Updated to reflect renamed schemas
This commit is contained in:
parent
07b7248b4e
commit
02fbd0984e
overlord/src/app/user/user-detail
@ -25,11 +25,11 @@
|
||||
<mat-checkbox formControlName="lockedOut">Is Locked Out?</mat-checkbox>
|
||||
</div>
|
||||
<mat-divider></mat-divider>
|
||||
<div formArrayName="groups">
|
||||
<div fxLayout="row" *ngFor="let g of item.groups; index as i" [formGroupName]="i" fxLayout="row"
|
||||
<div formArrayName="roles">
|
||||
<div fxLayout="row" *ngFor="let r of item.roles; index as i" [formGroupName]="i" fxLayout="row"
|
||||
fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px">
|
||||
<mat-checkbox formControlName="group" fxFlex>{{g.name}}</mat-checkbox>
|
||||
<mat-checkbox formControlName="group" fxFlex>{{r.name}}</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -36,7 +36,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
name: '',
|
||||
password: '',
|
||||
lockedOut: '',
|
||||
groups: this.fb.array([])
|
||||
roles: this.fb.array([])
|
||||
});
|
||||
}
|
||||
|
||||
@ -52,10 +52,10 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
this.form.get('name').setValue(item.name);
|
||||
this.form.get('password').setValue('');
|
||||
this.form.get('lockedOut').setValue(item.lockedOut);
|
||||
this.form.setControl('groups', this.fb.array(
|
||||
item.groups.map(
|
||||
this.form.setControl('roles', this.fb.array(
|
||||
item.roles.map(
|
||||
x => this.fb.group({
|
||||
group: x.enabled
|
||||
role: x.enabled
|
||||
})
|
||||
)
|
||||
));
|
||||
@ -112,8 +112,8 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.name = formModel.name;
|
||||
this.item.password = formModel.password;
|
||||
this.item.lockedOut = formModel.lockedOut;
|
||||
const array = this.form.get('groups') as FormArray;
|
||||
this.item.groups.forEach((item, index) => {
|
||||
const array = this.form.get('roles') as FormArray;
|
||||
this.item.roles.forEach((item, index) => {
|
||||
item.enabled = array.controls[index].value.group;
|
||||
});
|
||||
return this.item;
|
||||
|
Loading…
x
Reference in New Issue
Block a user