2019-09-23 10:17:03 +02:00
|
|
|
|
2019-10-15 12:38:51 +02:00
|
|
|
import { of as observableOf, Observable } from 'rxjs';
|
2019-09-23 10:17:03 +02:00
|
|
|
import { HttpErrorResponse } from '@angular/common/http';
|
2019-01-18 18:03:45 +01:00
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
|
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
2019-09-23 10:17:03 +02:00
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { MatHorizontalStepper } from '@angular/material/stepper';
|
2019-01-18 18:03:45 +01:00
|
|
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
import { map, takeUntil } from 'rxjs/operators';
|
2019-02-25 17:46:16 +01:00
|
|
|
import * as FileSaver from 'file-saver';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
|
|
|
import { DatasetProfileEditorModel } from '@app/ui/admin/dataset-profile/editor/dataset-profile-editor-model';
|
|
|
|
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
|
|
|
|
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
|
|
|
import { DatasetProfileService } from '@app/core/services/dataset-profile/dataset-profile.service';
|
|
|
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
|
|
|
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
|
|
|
import { DatasetProfile } from '@app/core/model/admin/dataset-profile/dataset-profile';
|
|
|
|
import { DatasetProfileEnum } from '@app/core/common/enum/dataset-profile';
|
|
|
|
import { SectionEditorModel } from '@app/ui/admin/dataset-profile/admin/section-editor-model';
|
|
|
|
import { PageEditorModel } from '@app/ui/admin/dataset-profile/admin/page-editor-model';
|
|
|
|
import { DatasetStatus } from '@app/core/common/enum/dataset-status';
|
|
|
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
2020-06-03 11:13:31 +02:00
|
|
|
import { LanguageInfo } from '@app/core/model/language-info';
|
|
|
|
import { LanguageInfoService } from '@app/core/services/culture/language-info-service';
|
2020-09-22 10:27:10 +02:00
|
|
|
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
2019-04-16 12:49:09 +02:00
|
|
|
|
|
|
|
const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.json');
|
2019-01-18 18:03:45 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-dataset-profile-editor-component',
|
|
|
|
templateUrl: './dataset-profile-editor.component.html',
|
|
|
|
styleUrls: ['./dataset-profile-editor.component.scss']
|
|
|
|
})
|
|
|
|
export class DatasetProfileEditorComponent extends BaseComponent implements OnInit {
|
|
|
|
|
|
|
|
isNew = true;
|
2019-09-16 17:46:19 +02:00
|
|
|
isNewVersion = false;
|
|
|
|
isClone = false;
|
2019-01-18 18:03:45 +01:00
|
|
|
isDeleted = false;
|
|
|
|
dataModel: DatasetProfileEditorModel;
|
|
|
|
form: FormGroup;
|
|
|
|
previewerFormGroup: FormGroup;
|
|
|
|
private datasetProfileId: string;
|
2019-03-26 15:30:33 +01:00
|
|
|
newVersionId: string;
|
2019-01-18 18:03:45 +01:00
|
|
|
dataWizardModel: DatasetWizardModel;
|
2019-05-23 11:40:24 +02:00
|
|
|
breadCrumbs: Observable<BreadcrumbItem[]>;
|
2019-09-23 10:17:03 +02:00
|
|
|
@ViewChild('stepper', { static: false }) stepper: MatHorizontalStepper;
|
2019-02-11 13:04:45 +01:00
|
|
|
viewOnly = false;
|
2020-09-22 10:27:10 +02:00
|
|
|
nestedCount: number[] = [];
|
|
|
|
nestedIndex: number = 0;
|
|
|
|
errorMessages: string[] = [];
|
2019-02-06 12:10:44 +01:00
|
|
|
|
2019-01-18 18:03:45 +01:00
|
|
|
constructor(
|
|
|
|
private datasetProfileService: DatasetProfileService,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private router: Router,
|
|
|
|
private logger: LoggingService,
|
|
|
|
private uiNotificationService: UiNotificationService,
|
2019-02-06 12:10:44 +01:00
|
|
|
private language: TranslateService,
|
2020-06-03 11:13:31 +02:00
|
|
|
private dialog: MatDialog,
|
|
|
|
private languageInfoService: LanguageInfoService
|
2019-01-18 18:03:45 +01:00
|
|
|
) {
|
|
|
|
super();
|
|
|
|
// this.profileID = route.snapshot.params['id'];
|
|
|
|
// this.cloneId = route.snapshot.params['cloneid'];
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((paramMap: ParamMap) => {
|
|
|
|
this.datasetProfileId = paramMap.get('id');
|
|
|
|
const cloneId = paramMap.get('cloneid');
|
2019-03-26 15:30:33 +01:00
|
|
|
this.newVersionId = paramMap.get('newversionid');
|
2019-01-18 18:03:45 +01:00
|
|
|
|
|
|
|
if (this.datasetProfileId != null) {
|
|
|
|
this.isNew = false;
|
|
|
|
this.datasetProfileService.getDatasetProfileById(this.datasetProfileId)
|
|
|
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2019-10-15 12:38:51 +02:00
|
|
|
data => {
|
|
|
|
try {
|
|
|
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
|
|
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
|
|
|
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
|
|
|
this.form = this.dataModel.buildForm(true, skipDisable);
|
|
|
|
this.viewOnly = true;
|
|
|
|
} else {
|
|
|
|
this.form = this.dataModel.buildForm();
|
|
|
|
}
|
|
|
|
this.prepareForm();
|
2020-09-14 13:31:20 +02:00
|
|
|
} catch (error) {
|
2019-10-15 12:38:51 +02:00
|
|
|
this.logger.error('Could not parse MasterItem: ' + data);
|
2020-09-14 13:31:20 +02:00
|
|
|
console.log(error)
|
2019-10-15 12:38:51 +02:00
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
2019-01-18 18:03:45 +01:00
|
|
|
}
|
2019-10-15 12:38:51 +02:00
|
|
|
},
|
|
|
|
error => this.onCallbackError(error)
|
2019-01-18 18:03:45 +01:00
|
|
|
);
|
2019-10-15 12:38:51 +02:00
|
|
|
this.breadCrumbs = observableOf([{
|
|
|
|
parentComponentName: 'DatasetProfileListingComponent',
|
|
|
|
label: this.language.instant('NAV-BAR.TEMPLATE'),
|
|
|
|
url: '/dataset-profiles/' + this.datasetProfileId
|
|
|
|
}]);
|
2019-01-18 18:03:45 +01:00
|
|
|
} else if (cloneId != null) {
|
2019-09-16 17:46:19 +02:00
|
|
|
this.isClone = true;
|
2019-01-18 18:03:45 +01:00
|
|
|
this.datasetProfileService.clone(cloneId)
|
|
|
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2019-10-15 12:38:51 +02:00
|
|
|
data => {
|
|
|
|
try {
|
|
|
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
|
|
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
|
|
|
this.dataModel.status = DatasetProfileEnum.SAVED;
|
|
|
|
this.form = this.dataModel.buildForm();
|
|
|
|
this.prepareForm();
|
|
|
|
} catch {
|
|
|
|
this.logger.error('Could not parse MasterItem: ' + data);
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error => this.onCallbackError(error)
|
2019-03-26 15:30:33 +01:00
|
|
|
);
|
|
|
|
} else if (this.newVersionId != null) {
|
2019-09-16 17:46:19 +02:00
|
|
|
this.isNewVersion = true;
|
2019-03-26 15:30:33 +01:00
|
|
|
this.datasetProfileService.getDatasetProfileById(this.newVersionId)
|
|
|
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2019-10-15 12:38:51 +02:00
|
|
|
data => {
|
|
|
|
try {
|
|
|
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
|
|
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
|
|
|
this.form = this.dataModel.buildForm();
|
|
|
|
this.form.get('version').setValue(this.form.get('version').value + 1);
|
|
|
|
this.form.controls['label'].disable();
|
2019-10-16 16:45:08 +02:00
|
|
|
this.form.controls['description'].disable();
|
2020-06-03 11:13:31 +02:00
|
|
|
this.form.controls['language'].disable();
|
2019-10-15 12:38:51 +02:00
|
|
|
this.prepareForm();
|
|
|
|
} catch {
|
|
|
|
this.logger.error('Could not parse MasterItem: ' + data);
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error => this.onCallbackError(error)
|
2019-01-18 18:03:45 +01:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
this.dataModel = new DatasetProfileEditorModel();
|
|
|
|
this.form = this.dataModel.buildForm();
|
2019-02-11 13:04:45 +01:00
|
|
|
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
|
|
|
this.form.disable();
|
|
|
|
this.viewOnly = true;
|
|
|
|
}
|
2019-01-18 18:03:45 +01:00
|
|
|
this.addSection();
|
|
|
|
this.addPage();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
prepareForm() {
|
|
|
|
this.form.valueChanges
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(change => {
|
|
|
|
// this.datasetProfileService.preview(this.form.value)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(dataset => {
|
|
|
|
// const datasetModel = new DatasetWizardModel();
|
|
|
|
// datasetModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(dataset, DatasetProfileDefinitionModel);
|
|
|
|
// this.dataWizardModel = datasetModel;
|
|
|
|
// this.previewerFormGroup = <FormGroup>this.dataWizardModel.buildForm().get('datasetProfileDefinition');
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
this.form.updateValueAndValidity();
|
|
|
|
}
|
|
|
|
|
|
|
|
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
|
|
|
if (!isMultiplicityEnabled) {
|
|
|
|
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
|
|
|
|
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
addSection() {
|
|
|
|
const section: SectionEditorModel = new SectionEditorModel();
|
|
|
|
this.dataModel.sections.push(section);
|
|
|
|
(<FormArray>this.form.get('sections')).push(section.buildForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
addPage() {
|
|
|
|
const page: PageEditorModel = new PageEditorModel(this.dataModel.pages.length);
|
|
|
|
this.dataModel.pages.push(page);
|
|
|
|
(<FormArray>this.form.get('pages')).push(page.buildForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
DeleteSection(index) {
|
|
|
|
this.dataModel.sections.splice(index, 1);
|
|
|
|
(<FormArray>this.form.get('sections')).removeAt(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
onSubmit() {
|
2019-02-15 11:26:14 +01:00
|
|
|
let data = this.form.value;
|
2019-01-18 18:03:45 +01:00
|
|
|
if (this.datasetProfileId) {
|
|
|
|
this.datasetProfileService.updateForm(this.datasetProfileId, data)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(() => {
|
|
|
|
this.router.navigate(['/dataset-profiles']);
|
|
|
|
});
|
2019-03-26 15:30:33 +01:00
|
|
|
} else if (this.newVersionId) {
|
2020-01-20 17:09:03 +01:00
|
|
|
data.label = this.form.get('label').value;
|
|
|
|
data.description = this.form.get('description').value;
|
2019-03-26 15:30:33 +01:00
|
|
|
this.datasetProfileService.newVersion(this.newVersionId, data)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(() => {
|
|
|
|
this.router.navigate(['/dataset-profiles']);
|
|
|
|
},
|
2019-10-15 12:38:51 +02:00
|
|
|
error => this.onCallbackErrorNewVersion(error)
|
2019-03-26 15:30:33 +01:00
|
|
|
);
|
2019-01-18 18:03:45 +01:00
|
|
|
} else {
|
2019-06-25 11:16:37 +02:00
|
|
|
this.form.get('status').setValue(DatasetStatus.Draft);
|
2019-02-15 11:26:14 +01:00
|
|
|
data = this.form.value;
|
2019-01-18 18:03:45 +01:00
|
|
|
this.datasetProfileService.createForm(data)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(() => {
|
|
|
|
this.router.navigate(['/dataset-profiles']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-11 13:04:45 +01:00
|
|
|
finalize() {
|
|
|
|
//const data = this.form.value;
|
|
|
|
this.form.get('status').setValue(DatasetProfileEnum.FINALIZED);
|
|
|
|
|
|
|
|
this.onSubmit();
|
|
|
|
}
|
|
|
|
|
2019-11-22 16:06:47 +01:00
|
|
|
updateFinalized() {
|
|
|
|
this.datasetProfileService.updateForm(this.datasetProfileId, this.form.getRawValue())
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(() => {
|
|
|
|
this.router.navigate(['/dataset-profiles']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
showUpdateButton() {
|
|
|
|
return !this.isNew && this.dataModel.status === DatasetProfileEnum.FINALIZED;
|
|
|
|
}
|
|
|
|
|
2019-01-18 18:03:45 +01:00
|
|
|
isStepActive(step: number) {
|
|
|
|
return this.stepper && this.stepper.selectedIndex === step;
|
|
|
|
}
|
|
|
|
|
|
|
|
onCallbackSuccess(): void {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
|
|
|
this.router.navigate(['/master-items']);
|
|
|
|
}
|
|
|
|
|
2019-03-26 15:30:33 +01:00
|
|
|
onCallbackErrorNewVersion(errorResponse: HttpErrorResponse) {
|
|
|
|
this.uiNotificationService.snackBarNotification(errorResponse.error.message, SnackBarNotificationLevel.Error);
|
|
|
|
}
|
|
|
|
|
2019-01-18 18:03:45 +01:00
|
|
|
onCallbackError(errorResponse: HttpErrorResponse) {
|
|
|
|
// const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
|
|
|
|
// if (error.statusCode === 400) {
|
|
|
|
// this.masterItem.validationErrorModel.fromJSONObject(errorResponse.error);
|
|
|
|
// this.formService.validateAllFormFields(this.formGroup);
|
|
|
|
// } else {
|
|
|
|
this.uiNotificationService.snackBarNotification(errorResponse.message, SnackBarNotificationLevel.Warning);
|
|
|
|
// }
|
|
|
|
}
|
2019-02-06 12:10:44 +01:00
|
|
|
|
|
|
|
// DELETE Function
|
|
|
|
public delete(): void {
|
|
|
|
if (this.datasetProfileId && !this.isNew) {
|
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
2019-09-27 10:09:29 +02:00
|
|
|
restoreFocus: false,
|
2019-02-06 12:10:44 +01:00
|
|
|
data: {
|
|
|
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
|
|
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
2019-06-26 11:24:06 +02:00
|
|
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
|
|
|
isDeleteConfirmation: true
|
2019-02-06 12:10:44 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result) {
|
2019-02-25 17:49:26 +01:00
|
|
|
//this.form.get('status').setValue(DatasetProfileEnum.DELETED);
|
2019-02-25 17:46:16 +01:00
|
|
|
this.datasetProfileService.delete(this.datasetProfileId, this.form.value)
|
2019-02-06 12:10:44 +01:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2019-10-15 12:38:51 +02:00
|
|
|
complete => {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
|
|
|
|
this.router.navigate(['/dataset-profiles']);
|
|
|
|
},
|
|
|
|
error => {
|
|
|
|
this.onCallbackError(error);
|
|
|
|
if (error.error.statusCode == 674) {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Error);
|
|
|
|
} else {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error);
|
|
|
|
}
|
2019-02-25 17:46:16 +01:00
|
|
|
}
|
2019-02-06 12:10:44 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-02-25 17:46:16 +01:00
|
|
|
|
|
|
|
downloadXML(): void {
|
|
|
|
this.datasetProfileService.downloadXML(this.datasetProfileId)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/xml' });
|
|
|
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
|
|
|
|
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getFilenameFromContentDispositionHeader(header: string): string {
|
|
|
|
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);
|
|
|
|
|
|
|
|
const matches = header.match(regex);
|
|
|
|
let filename: string;
|
|
|
|
for (let i = 0; i < matches.length; i++) {
|
|
|
|
const match = matches[i];
|
|
|
|
if (match.includes('filename="')) {
|
|
|
|
filename = match.substring(10, match.length - 1);
|
|
|
|
break;
|
|
|
|
} else if (match.includes('filename=')) {
|
|
|
|
filename = match.substring(9);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return filename;
|
|
|
|
}
|
2020-06-03 11:13:31 +02:00
|
|
|
|
|
|
|
getLanguageInfos(): LanguageInfo[] {
|
|
|
|
return this.languageInfoService.getLanguageInfoValues();
|
|
|
|
}
|
2020-09-22 10:27:10 +02:00
|
|
|
|
|
|
|
checkFormValidation() {
|
|
|
|
if (!this.form.valid) {
|
|
|
|
this.nestedIndex = -1;
|
|
|
|
this.form.markAllAsTouched();
|
|
|
|
this.printErrors(this.form);
|
|
|
|
this.showValidationErrorsDialog();
|
|
|
|
this.nestedCount = [];
|
|
|
|
this.nestedIndex = 0;
|
|
|
|
this.errorMessages = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printErrors(rootform: FormGroup) {
|
|
|
|
if (!rootform.valid) {
|
|
|
|
Object.keys(rootform.controls).forEach(key => {
|
|
|
|
const errors = rootform.get(key).errors;
|
|
|
|
if (errors !== null) {
|
|
|
|
let numbering: string = '';
|
|
|
|
for (let j = 0; j < this.nestedCount.length; j++) {
|
|
|
|
numbering += this.nestedCount[j];
|
|
|
|
if (j < this.nestedIndex) {
|
|
|
|
numbering += '.';
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Object.keys(errors).forEach(keyError => {
|
|
|
|
if (typeof errors[keyError] === 'boolean') {
|
|
|
|
this.errorMessages.push(numbering + ' ' + key + ' is ' + keyError);
|
|
|
|
} else {
|
2020-11-04 15:55:45 +01:00
|
|
|
this.errorMessages.push(numbering + ' ' + key + ': ' + keyError + ': ' + JSON.stringify(errors[keyError]));
|
2020-09-22 10:27:10 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
if (rootform.get(key) instanceof FormGroup) {
|
|
|
|
this.printErrors(<FormGroup>rootform.get(key));
|
|
|
|
} else if (rootform.get(key) instanceof FormArray) {
|
|
|
|
this.nestedIndex++;
|
|
|
|
this.nestedCount[this.nestedIndex] = 0;
|
|
|
|
for (let childForm of (<FormArray>rootform.get(key)).controls) {
|
|
|
|
this.nestedCount[this.nestedIndex]++;
|
|
|
|
this.printErrors(<any>childForm);
|
|
|
|
}
|
|
|
|
this.nestedCount[this.nestedIndex] = 0;
|
|
|
|
this.nestedIndex--;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private showValidationErrorsDialog(projectOnly?: boolean) {
|
|
|
|
const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, {
|
|
|
|
disableClose: true,
|
2020-09-25 13:03:04 +02:00
|
|
|
autoFocus: false,
|
|
|
|
restoreFocus: false,
|
2020-09-22 10:27:10 +02:00
|
|
|
data: {
|
|
|
|
errorMessages: this.errorMessages,
|
|
|
|
projectOnly: projectOnly
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2019-01-18 18:03:45 +01:00
|
|
|
}
|