Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.loadingProfiles = true;
this.profileService.find()
.subscribe((res: PartialList) => {
this.profiles = res.data;
this.loadingProfiles = false;
});
if (!this.selectedUser.picture) {
this.picturePreview = 'assets/images/faces/avatar.png';
} else {
this.picturePreview = environment.web_url + 'users/picture/' + this.selectedUser.id + '?v=' + Math.random();
}
// Initialize the form group object
this.form = this._fb.group({
email: [
this.selectedUser ? this.selectedUser.email : '',
[Validators.required, Validators.maxLength(255)]
],
name: [
this.selectedUser ? this.selectedUser.name : '',
[Validators.required, Validators.maxLength(255)]
],
password: [
'',
this.selectedUser && this.selectedUser.id ? [] : [Validators.required]
],
password_confirmation: [
'',
this.selectedUser && this.selectedUser.id ? [] : [Validators.required]
]
});
}
createValidators(config: ITdDynamicElementConfig): ValidatorFn {
let validator: ValidatorFn;
if (config.required) {
validator = Validators.required;
}
if (config.max || config.max === 0) {
validator = Validators.compose([validator, Validators.max(parseFloat(config.max))]);
}
if (config.min || config.min === 0) {
validator = Validators.compose([validator, Validators.min(parseFloat(config.min))]);
}
if (config.maxLength || config.maxLength === 0) {
validator = Validators.compose([validator, Validators.maxLength(parseFloat(config.maxLength))]);
}
if (config.minLength || config.minLength === 0) {
validator = Validators.compose([validator, Validators.minLength(parseFloat(config.minLength))]);
}
// Add provided custom validators to the validator function
if (config.validators) {
config.validators.forEach((validatorConfig: ITdDynamicElementValidator) => {
validator = Validators.compose([validator, validatorConfig.validator]);
});
}
return validator;
}
}
constructor(
private portService: PortService,
private formBuilder: FormBuilder
) {
this.ports = this.portService.getPorts();
this.portsControl = this.formBuilder.control([], [
Validators.required, Validators.minLength(1), Validators.maxLength(3)
]);
this.form = this.formBuilder.group({
ports: this.portsControl
});
}
protected dialogRef: MatDialogRef,
protected injector: Injector,
private formBuilder: FormBuilder,
private shareService: ShareService,
private translatePipe: TranslatePipe,
private renderer: Renderer2
) {
super(data, dialogRef, injector);
this.selectedContent = data;
this.sharedContentForm = this.formBuilder.group({
share_name: new FormControl('', [
Validators.required,
Validators.minLength(5),
Validators.maxLength(100),
]),
recipients: this.formBuilder.array([], [ Validators.required ]),
expire_date: new FormControl(''),
recipientsSearch: new FormControl('')
});
}
setupForm() {
this.freightOptions = Object.keys(FreightLabels)
.map(value => {
return {value, text: FreightLabels[value]}
});
this.form = this.formBuilder.group({
title: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(200)]],
author: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(200)]],
categoryId: ['', [Validators.required]],
freightOption: ['', [Validators.required]],
imageBytes: ['', [Validators.required]],
synopsis: ['', [Validators.maxLength(2000)]],
});
this.title = this.form.get('title');
this.author = this.form.get('author');
this.categoryId = this.form.get('categoryId');
this.freightOption = this.form.get('freightOption');
this.imageBytes = this.form.get('imageBytes');
this.synopsis = this.form.get('synopsis');
}
autoScaleBorderDistX: [0.0, [Validators.required]],
autoScaleBorderDistY: [0.0, [Validators.required]],
penMoveType: [],
engravePosInParameter: [false, [Validators.required]],
engravePosUp: [0.0, [Validators.required]],
engravePosDown: [0.0, [Validators.required]],
moveSpeed: [0.0, [Validators.required]],
engraveDownSpeed: [0.0],
scaleX: [0.0],
scaleY: [0.0],
ofsX: [0.0],
ofsY: [0.0],
laserFirstOnCommand: ['', [Validators.maxLength(512)]],
laserOnCommand: ['', [Validators.maxLength(512)]],
laserOffCommand: ['', [Validators.maxLength(512)]],
laserLastOffCommand: ['', [Validators.maxLength(512)]],
laserSize: [0.0],
laserAccDist: [0.0],
smoothType: [],
convertType: [],
smoothMinAngle: [0.0],
smoothMinLineLength: [0.0],
smoothMaxError: [0.0],
cutterSize: [1.0],
imageWriteToFileName: ['', [Validators.maxLength(512)]],
grayThreshold: [0.0],
createForm() {
this.snippetForm = this.formBuilder.group({
title: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(140)]],
description: ['',
[Validators.required, Validators.minLength(10), Validators.maxLength(400)]],
language: this.formBuilder.group({
name: ['', Validators.required],
version: '',
}),
keywords: ['', Validators.required],
files: this.formBuilder.array([this.createFile()])
});
}
constructor(
formBuilder: FormBuilder
) {
super(formBuilder.group({
email: ['',
[
Validators.email,
Validators.required,
Validators.maxLength(100)
]
],
displayName: ['',
[
Validators.required,
Validators.maxLength(100)
]
],
password: ['',
[
Validators.required
]
],
passwordConfirm: ['',
[
ValidatorsEx.match('password', 'Passwords must be the same.')