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