-import { Component, Input } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { FormArray, FormControl, NgForm, Validators } from '@angular/forms';
import { I18n } from '@ngx-translate/i18n-polyfill';
templateUrl: './nfs-form-client.component.html',
styleUrls: ['./nfs-form-client.component.scss']
})
-export class NfsFormClientComponent {
+export class NfsFormClientComponent implements OnInit {
@Input()
form: CdFormGroup;
+ @Input()
+ clients: any[];
+
nfsSquash: any[] = this.nfsService.nfsSquash;
nfsAccessType: any[] = this.nfsService.nfsAccessType;
icons = Icons;
constructor(private nfsService: NfsService, private i18n: I18n) {}
+ ngOnInit() {
+ _.forEach(this.clients, (client) => {
+ const fg = this.addClient();
+ fg.patchValue(client);
+ });
+ }
+
getNoAccessTypeDescr() {
if (this.form.getValue('access_type')) {
return `${this.form.getValue('access_type')} ${this.i18n('(inherited from global config)')}`;
return client.getValue(control);
}
- resolveModel(clients: any[]) {
- _.forEach(clients, (client) => {
- const fg = this.addClient();
- fg.patchValue(client);
- });
- }
-
trackByFn(index: number) {
return index;
}
@ViewChild('nfsClients', { static: true })
nfsClients: NfsFormClientComponent;
+ clients: any[] = [];
+
permission: Permission;
nfsForm: CdFormGroup;
isEdit = false;
this.nfsForm.patchValue(res);
this.setPathValidation();
- this.nfsClients.resolveModel(res.clients);
+ this.clients = res.clients;
}
resolveDaemons(daemons: Record<string, any>) {