import { Component, OnInit } from '@angular/core';
-import { FormControl, ValidatorFn, Validators } from '@angular/forms';
+import { UntypedFormControl, ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import _ from 'lodash';
desc: $localize`Deep flatten`,
requires: null,
allowEnable: false,
- allowDisable: true
+ allowDisable: true,
+ helperHtml: $localize`Feature can be disabled but can't be re-enabled later`
},
layering: {
desc: $localize`Layering`,
requires: null,
allowEnable: false,
- allowDisable: false
+ allowDisable: false,
+ helperHtml: $localize`Feature flag can't be manipulated after the image is created. Disabling this option will also disable the Protect and Clone actions on Snapshot`
},
'exclusive-lock': {
desc: $localize`Exclusive lock`,
createForm() {
this.rbdForm = new CdFormGroup(
{
- parent: new FormControl(''),
- name: new FormControl('', {
+ parent: new UntypedFormControl(''),
+ name: new UntypedFormControl('', {
validators: [Validators.required, Validators.pattern(/^[^@/]+?$/)]
}),
- pool: new FormControl(null, {
+ pool: new UntypedFormControl(null, {
validators: [Validators.required]
}),
- namespace: new FormControl(null),
- useDataPool: new FormControl(false),
- dataPool: new FormControl(null),
- size: new FormControl(null, {
+ namespace: new UntypedFormControl(null),
+ useDataPool: new UntypedFormControl(false),
+ dataPool: new UntypedFormControl(null),
+ size: new UntypedFormControl(null, {
updateOn: 'blur'
}),
- obj_size: new FormControl(this.defaultObjectSize),
+ obj_size: new UntypedFormControl(this.defaultObjectSize),
features: new CdFormGroup(
this.featuresList.reduce((acc: object, e) => {
- acc[e.key] = new FormControl({ value: false, disabled: !!e.initDisabled });
+ acc[e.key] = new UntypedFormControl({ value: false, disabled: !!e.initDisabled });
return acc;
}, {})
),
- mirroring: new FormControl(''),
- schedule: new FormControl('', {
+ mirroring: new UntypedFormControl(''),
+ schedule: new UntypedFormControl('', {
validators: [Validators.pattern(/^([0-9]+)d|([0-9]+)h|([0-9]+)m$/)] // check schedule interval to be in format - 1d or 1h or 1m
}),
- mirroringMode: new FormControl(''),
- stripingUnit: new FormControl(this.defaultStripingUnit),
- stripingCount: new FormControl(this.defaultStripingCount, {
+ mirroringMode: new UntypedFormControl(''),
+ stripingUnit: new UntypedFormControl(this.defaultStripingUnit),
+ stripingCount: new UntypedFormControl(this.defaultStripingCount, {
updateOn: 'blur'
})
},
this.rbdForm.get('deep-flatten').disable();
this.rbdForm.get('layering').disable();
this.rbdForm.get('exclusive-lock').disable();
+ } else {
+ if (!this.rbdForm.get('deep-flatten').value) {
+ this.rbdForm.get('deep-flatten').disable();
+ }
+ this.rbdForm.get('layering').disable();
}
});
}