Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-03-20 13:07:03 +02:00
commit 3e4302bfe2
27 changed files with 495 additions and 2211 deletions

View File

@ -27,10 +27,6 @@ public class LockPersist {
public static final String _targetType = "targetType"; public static final String _targetType = "targetType";
private UUID lockedBy;
public static final String _lockedBy = "lockedBy";
private String hash; private String hash;
public static final String _hash = "hash"; public static final String _hash = "hash";
@ -59,14 +55,6 @@ public class LockPersist {
this.targetType = targetType; this.targetType = targetType;
} }
public UUID getLockedBy() {
return lockedBy;
}
public void setLockedBy(UUID lockedBy) {
this.lockedBy = lockedBy;
}
public String getHash() { public String getHash() {
return hash; return hash;
} }
@ -109,10 +97,7 @@ public class LockPersist {
.failOn(LockPersist._target).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._target}, LocaleContextHolder.getLocale())), .failOn(LockPersist._target).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._target}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getTargetType())) .must(() -> !this.isNull(item.getTargetType()))
.failOn(LockPersist._targetType).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._targetType}, LocaleContextHolder.getLocale())), .failOn(LockPersist._targetType).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._targetType}, LocaleContextHolder.getLocale()))
this.spec()
.must(() -> this.isValidGuid(item.getLockedBy()))
.failOn(LockPersist._lockedBy).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._lockedBy}, LocaleContextHolder.getLocale()))
); );
} }
} }

View File

@ -11,15 +11,15 @@ import { User } from "../user/user";
export interface DescriptionTemplate extends BaseEntity { export interface DescriptionTemplate extends BaseEntity {
label: string; label?: string;
description: string; description?: string;
groupId: Guid; groupId?: Guid;
version: string; version?: string;
language: string; language?: string;
type: DescriptionTemplateType; type?: DescriptionTemplateType;
status: DescriptionTemplateStatus; status?: DescriptionTemplateStatus;
definition: DescriptionTemplateDefinition; definition?: DescriptionTemplateDefinition;
users: UserDescriptionTemplate[]; users?: UserDescriptionTemplate[];
} }
export interface UserDescriptionTemplate extends BaseEntity { export interface UserDescriptionTemplate extends BaseEntity {
@ -34,21 +34,21 @@ export interface DescriptionTemplateDefinition {
export interface DescriptionTemplatePage { export interface DescriptionTemplatePage {
id: string; id?: string;
ordinal: number; ordinal?: number;
title: string; title?: string;
sections: DescriptionTemplateSection[]; sections?: DescriptionTemplateSection[];
} }
export interface DescriptionTemplateSection { export interface DescriptionTemplateSection {
id: string; id?: string;
ordinal: number; ordinal?: number;
defaultVisibility: boolean; defaultVisibility?: boolean;
multiplicity: boolean; multiplicity?: boolean;
title: string; title?: string;
description: string; description?: string;
sections: DescriptionTemplateSection[]; sections?: DescriptionTemplateSection[];
fieldSets: DescriptionTemplateFieldSet[]; fieldSets?: DescriptionTemplateFieldSet[];
} }
export interface DescriptionTemplateFieldSet { export interface DescriptionTemplateFieldSet {

View File

@ -18,5 +18,4 @@ export interface Lock {
export interface LockPersist extends BaseEntityPersist { export interface LockPersist extends BaseEntityPersist {
target: Guid; target: Guid;
targetType: LockTargetType; targetType: LockTargetType;
lockedBy: Guid;
} }

View File

@ -55,6 +55,11 @@ export class LockService {
.pipe(catchError((error: any) => throwError(error))); .pipe(catchError((error: any) => throwError(error)));
} }
touchLock(targetId: Guid): Observable<Boolean> {
return this.http.get<Boolean>(`${this.apiBase}/touch/${targetId}`)
.pipe(catchError((error: any) => throwError(error)));
}
unlockTarget(targetId: Guid): Observable<any> { unlockTarget(targetId: Guid): Observable<any> {
return this.http.delete(`${this.apiBase}/target/unlock/${targetId}`) return this.http.delete(`${this.apiBase}/target/unlock/${targetId}`)
.pipe(catchError((error: any) => throwError(error))); .pipe(catchError((error: any) => throwError(error)));

View File

@ -30,6 +30,7 @@ import { DescriptionTemplateListingComponent } from './listing/description-templ
import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/description-template-listing-filters.component"; import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/description-template-listing-filters.component";
import { ImportDescriptionTemplateDialogComponent } from './listing/import-description-template/import-description-template.dialog.component'; import { ImportDescriptionTemplateDialogComponent } from './listing/import-description-template/import-description-template.dialog.component';
import { DescriptionTemplateEditorReferenceTypeFieldComponent } from './editor/components/field-type/reference-type/description-template-editor-reference-type-field.component'; import { DescriptionTemplateEditorReferenceTypeFieldComponent } from './editor/components/field-type/reference-type/description-template-editor-reference-type-field.component';
import { DescriptionFormModule } from '@app/ui/description/editor/description-form/description-form.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -46,12 +47,7 @@ import { DescriptionTemplateEditorReferenceTypeFieldComponent } from './editor/c
CommonFormattingModule, CommonFormattingModule,
RichTextEditorModule, RichTextEditorModule,
// FormattingModule, DescriptionFormModule
// FormProgressIndicationModule,
// AngularStickyThingsModule,
// MatBadgeModule,
// DragulaModule,
// TransitionGroupModule,
], ],
declarations: [ declarations: [
DescriptionTemplateEditorComponent, DescriptionTemplateEditorComponent,

View File

@ -83,7 +83,6 @@
<!-- PREVIEW --> <!-- PREVIEW -->
{{firstField?.value | json}}
<div class="col-12 previewer"> <div class="col-12 previewer">
<div *ngIf="hasFocus" class="d-flex mb-3" style="justify-content: space-between;"> <div *ngIf="hasFocus" class="d-flex mb-3" style="justify-content: space-between;">
<span class="previewer-text">{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}}</span> <span class="previewer-text">{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}}</span>
@ -97,10 +96,10 @@
</span> </span>
</div> </div>
<div [id]="'preview_container'+ form.get('id').value" class="w-100" style="margin-right: -15px; margin-left: -15px;"> <div [id]="'preview_container'+ form.get('id').value" class="w-100" style="margin-right: -15px; margin-left: -15px;">
<div *ngIf="previewForm && showPreview && firstField?.get('data')?.get('fieldType')?.value" [@fade-in-fast]> <div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="row" [@fade-in-fast]>
<!-- Check what we need to do with this. --> <div class="col">
<!-- <app-description-form-section-inner [form]="previewForm" [tableView]="form.getRawValue().multiplicity?.tableView" [datasetProfileId]="datasetProfileId"> <app-description-form-field-set class="w-100" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet"></app-description-form-field-set>
</app-description-form-section-inner> --> </div>
</div> </div>
</div> </div>

View File

@ -1,25 +1,27 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { AbstractControl, UntypedFormArray, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { AbstractControl, UntypedFormArray, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox'; import { MatCheckboxChange } from '@angular/material/checkbox';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { ValidationType } from '@app/core/common/enum/validation-type'; import { ValidationType } from '@app/core/common/enum/validation-type';
import { import {
DescriptionTemplateSelectOption,
DescriptionTemplateExternalDatasetData, DescriptionTemplateExternalDatasetData,
DescriptionTemplateField, DescriptionTemplateField,
DescriptionTemplateRadioBoxData, DescriptionTemplateFieldSet,
DescriptionTemplateUploadData,
DescriptionTemplateSelectData,
DescriptionTemplateLabelData,
DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateLabelAndMultiplicityData,
DescriptionTemplateReferenceTypeData DescriptionTemplateLabelData,
DescriptionTemplateRadioBoxData,
DescriptionTemplateReferenceTypeData,
DescriptionTemplateSelectData,
DescriptionTemplateSelectOption,
DescriptionTemplateUploadData
} from '@app/core/model/description-template/description-template'; } from '@app/core/model/description-template/description-template';
import { ConfigurationService } from "@app/core/services/configuration/configuration.service"; import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { TransitionGroupComponent } from "@app/ui/transition-group/transition-group.component"; import { TransitionGroupComponent } from "@app/ui/transition-group/transition-group.component";
import { BaseComponent } from '@common/base/base.component'; import { BaseComponent } from '@common/base/base.component';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
@ -28,7 +30,10 @@ import { debounceTime, delay, map, takeUntil, tap } from 'rxjs/operators';
import { GENERAL_ANIMATIONS } from '../../animations/animations'; import { GENERAL_ANIMATIONS } from '../../animations/animations';
import { EditorCustomValidators } from '../../custom-validators/editor-custom-validators'; import { EditorCustomValidators } from '../../custom-validators/editor-custom-validators';
import { DescriptionTemplateFieldEditorModel, DescriptionTemplateRuleEditorModel, DescriptionTemplateSectionEditorModel } from '../../description-template-editor.model'; import { DescriptionTemplateFieldEditorModel, DescriptionTemplateRuleEditorModel, DescriptionTemplateSectionEditorModel } from '../../description-template-editor.model';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { DescriptionTemplateFieldSetPersist } from '@app/core/model/description-template/description-template-persist';
import { DescriptionEditorModel, DescriptionPropertyDefinitionEditorModel } from '@app/ui/description/editor/description-editor.model';
import { Description } from '@app/core/model/description/description';
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
@Component({ @Component({
selector: 'app-description-template-editor-composite-field-component', selector: 'app-description-template-editor-composite-field-component',
@ -57,7 +62,9 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
showAdditionalInfo: boolean = false; showAdditionalInfo: boolean = false;
showExtendedDescription: boolean = false; showExtendedDescription: boolean = false;
previewForm: UntypedFormGroup = null; //Preview
previewFieldSet: DescriptionTemplateFieldSet = null;
previewPropertiesFormGroup: UntypedFormGroup = null;
// isComposite = false; // isComposite = false;
// isMultiplicityEnabled = false; // isMultiplicityEnabled = false;
descriptionTemplateFieldTypeEnum = DescriptionTemplateFieldType; descriptionTemplateFieldTypeEnum = DescriptionTemplateFieldType;
@ -71,7 +78,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
private language: TranslateService, private language: TranslateService,
public enumUtils: EnumUtils, public enumUtils: EnumUtils,
public datasetProfileService: DescriptionTemplateService, public datasetProfileService: DescriptionTemplateService,
private configurationService: ConfigurationService private configurationService: ConfigurationService,
) { ) {
super(); super();
} }
@ -153,7 +160,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
} }
this.showPreview = false; this.showPreview = false;
this.previewDirty = true; this.previewDirty = true;
this.previewForm = updatedForm; // this.previewForm = updatedForm;
return previewContainer; return previewContainer;
}), }),
delay(100), delay(100),
@ -182,81 +189,95 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
if (this.previewDirty) return ''; if (this.previewDirty) return '';
else return 'updated'; else return 'updated';
} }
private reloadPreview(updatedForm: UntypedFormGroup) { // private reloadPreview(updatedForm: UntypedFormGroup) {
setTimeout(() => { // setTimeout(() => {
const previewContainer = document.getElementById('preview_container' + this.form.get('id').value); // const previewContainer = document.getElementById('preview_container' + this.form.get('id').value);
// let clientHeight = -1; // // let clientHeight = -1;
if (previewContainer) { // if (previewContainer) {
// console.log(previewContainer); // // console.log(previewContainer);
const clientHeight = previewContainer.clientHeight; // const clientHeight = previewContainer.clientHeight;
// console.log(clientHeight); // // console.log(clientHeight);
if (clientHeight) { // if (clientHeight) {
previewContainer.style.height = clientHeight.toString() + 'px'; // previewContainer.style.height = clientHeight.toString() + 'px';
// console.log('height:' ,previewContainer.style.height); // // console.log('height:' ,previewContainer.style.height);
} // }
} // }
this.showPreview = false; // this.showPreview = false;
this.previewDirty = true; // this.previewDirty = true;
this.previewForm = updatedForm; // this.previewForm = updatedForm;
setTimeout(() => { // setTimeout(() => {
this.showPreview = true; // this.showPreview = true;
this.previewDirty = false; // this.previewDirty = false;
if (previewContainer) { // if (previewContainer) {
setTimeout(() => { // setTimeout(() => {
if (previewContainer) { // if (previewContainer) {
previewContainer.style.height = 'auto'; // previewContainer.style.height = 'auto';
} // }
}); // });
} // }
}); // });
}); // });
} // }
previewSubject$: Subject<DescriptionTemplateSectionEditorModel> = new Subject<DescriptionTemplateSectionEditorModel>(); previewSubject$: Subject<DescriptionTemplateSectionEditorModel> = new Subject<DescriptionTemplateSectionEditorModel>();
private generatePreviewForm() { private generatePreviewForm() {
// const formValue: DescriptionTemplateFieldSet = this.form.getRawValue(); const formValue: DescriptionTemplateFieldSetPersist = this.form.getRawValue();
// const fields: FieldDefinition[] = formValue.fields.map(editorField => this._fieldToFieldDefinition(editorField));
const fields: DescriptionTemplateField[] = formValue.fields.map(editorField => {
return {
id: editorField.id,
ordinal: editorField.ordinal,
numbering: '',
schematics: editorField.schematics,
defaultValue: editorField.defaultValue,
visibilityRules: editorField.visibilityRules,
validations: editorField.validations,
includeInExport: editorField.includeInExport,
data: editorField.data
}
});
// const compositeField: CompositeField = { const fieldSet: DescriptionTemplateFieldSet = {
// id: formValue.id, id: formValue.id,
// additionalInformation: formValue.additionalInformation, ordinal: formValue.ordinal,
// extendedDescription: formValue.extendedDescription, numbering: '',
// numbering: '', title: formValue.title,
// title: formValue.title, description: formValue.description,
// ordinal: formValue.ordinal, extendedDescription: formValue.extendedDescription,
// description: formValue.description, additionalInformation: formValue.additionalInformation,
// hasCommentField: formValue.hasCommentField, multiplicity: {
// commentFieldValue: '', max: formValue.multiplicity.max, min: formValue.multiplicity.min,
// multiplicity: { placeholder: formValue.multiplicity.placeholder, tableView: formValue.multiplicity.tableView
// max: formValue.multiplicity.max, min: formValue.multiplicity.min, },
// placeholder: formValue.multiplicity.placeholder, tableView: formValue.multiplicity.tableView hasCommentField: formValue.hasCommentField,
// }, fields: fields
// multiplicityItems: null, }
// fields: fields.map(editorField => {
// const model = new DatasetDescriptionFieldEditorModel().fromModel(editorField);
// if (model.data.fieldType === DescriptionTemplateFieldType.CheckBox) {
// model.value = model.value ? "true" : "false";//patch
// }
// return model;
// })
// }
const mockDescription: Description = {
descriptionTemplate: {
definition: {
pages: [
{
sections: [{
fieldSets: [fieldSet]
}]
}
]
}
}
}
// const section = new DatasetDescriptionSectionEditorModel(); const descriptionEditorModel = new DescriptionEditorModel().fromModel(mockDescription, mockDescription.descriptionTemplate);
// section.title = ''; this.previewPropertiesFormGroup = descriptionEditorModel.properties.fieldSets.get(fieldSet.id).buildForm() as UntypedFormGroup;
// section.numbering = ''; this.previewFieldSet = fieldSet;
// const compositeForm = new DatasetDescriptionCompositeFieldEditorModel().fromModel(compositeField)
// section.compositeFields = [compositeForm];
// this.previewSubject$.next(section); // this.previewSubject$.next(section);
} }

View File

@ -26,7 +26,6 @@
</div> </div>
</div> </div>
{{this.form.get('data').get('sources').value | json}}
<div *ngFor="let singleForm of this.form.get('data').get('sources')?.controls; let i = index" class="row"> <div *ngFor="let singleForm of this.form.get('data').get('sources')?.controls; let i = index" class="row">
<mat-form-field class="col-md-6"> <mat-form-field class="col-md-6">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label> <mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label>

View File

@ -13,8 +13,11 @@ import { VisibilityRulesService } from '@app/ui/description/editor/description-f
export class FinalPreviewComponent implements OnInit { export class FinalPreviewComponent implements OnInit {
@Input() descriptionTempaltePersist = null;
visibilityRules: Rule[] = [];
@Input() formGroup = null; @Input() formGroup = null;
@Input() visibilityRules: Rule[] = [];
constructor(private visibilityRulesService: VisibilityRulesService) { constructor(private visibilityRulesService: VisibilityRulesService) {
} }

View File

@ -71,22 +71,9 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
usersMap: Map<Guid, User> = new Map<Guid, User>(); usersMap: Map<Guid, User> = new Map<Guid, User>();
userFormControl = new FormControl(); userFormControl = new FormControl();
//Preview
// selectedSystemFields: Array<DescriptionTemplateSystemFieldType> = []; previewFieldSet: DescriptionTemplate = null;
// descriptionTemplateSectionFieldCategory = DescriptionTemplateSectionFieldCategory; previewPropertiesFormGroup: UntypedFormGroup = null;
// descriptionTemplateSystemFieldType = DescriptionTemplateSystemFieldType;
// public descriptionTemplateSystemFieldTypeEnum = this.enumUtils.getEnumValues(DescriptionTemplateSystemFieldType);
// descriptionTemplateExtraFieldDataType = DescriptionTemplateExtraFieldDataType;
// public descriptionTemplateExtraFieldDataTypeEnum = this.enumUtils.getEnumValues(DescriptionTemplateExtraFieldDataType);
// blueprintsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
// filterFn: this.filterDescriptionTempaltes.bind(this),
// initialItems: (excludedItems: any[]) => this.filterDescriptionTempaltes('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
// displayFn: (item: DatasetProfileModel) => item.label,
// titleFn: (item: DatasetProfileModel) => item.label,
// subtitleFn: (item: DatasetProfileModel) => item.description,
// popupItemActionIcon: 'visibility'
// };
protected get canDelete(): boolean { protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDescriptionTemplate); return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDescriptionTemplate);
@ -185,12 +172,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
buildForm() { buildForm() {
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDescriptionTemplate)); this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDescriptionTemplate));
//this.selectedSystemFields = this.selectedSystemFieldDisabled();
this.descriptionTemplateEditorService.setValidationErrorModel(this.editorModel.validationErrorModel); this.descriptionTemplateEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
// DescriptionTemplateEditorModel.reApplyDefinitionValidators({
// formGroup: this.formGroup,
// validationErrorModel: this.editorModel.validationErrorModel
// });
if (this.editorModel.status == DescriptionTemplateStatus.Finalized || this.isDeleted) { if (this.editorModel.status == DescriptionTemplateStatus.Finalized || this.isDeleted) {
this.formGroup.disable(); this.formGroup.disable();
} }
@ -321,10 +303,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
onMatStepperSelectionChange(event: StepperSelectionEvent) { onMatStepperSelectionChange(event: StepperSelectionEvent) {
if (event.selectedIndex === (this.steps.length - 1)) {//preview selected if (event.selectedIndex === (this.steps.length - 1)) {//preview selected
// this.generatePreviewForm();//TODO LAZY LOADING IN THE TEMPLATE this.generatePreviewForm();
// this.getPreview();
} else { } else {
// this.previewForm = null;
// this.formGroup = null; // this.formGroup = null;
} }
this.formGroup.markAsUntouched(); this.formGroup.markAsUntouched();
@ -373,6 +353,72 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
} }
} }
//
//
// Preview
//
//
generatePreviewForm() {
// const formValue: DescriptionTemplatePersist = this.formGroup.getRawValue();
// const fields: DescriptionTemplateField[] = formValue.fields.map(editorField => {
// return {
// id: editorField.id,
// ordinal: editorField.ordinal,
// numbering: '',
// schematics: editorField.schematics,
// defaultValue: editorField.defaultValue,
// visibilityRules: editorField.visibilityRules,
// validations: editorField.validations,
// includeInExport: editorField.includeInExport,
// data: editorField.data
// }
// });
// const fieldSet: DescriptionTemplateFieldSet = {
// id: formValue.id,
// ordinal: formValue.ordinal,
// numbering: '',
// title: formValue.title,
// description: formValue.description,
// extendedDescription: formValue.extendedDescription,
// additionalInformation: formValue.additionalInformation,
// multiplicity: {
// max: formValue.multiplicity.max, min: formValue.multiplicity.min,
// placeholder: formValue.multiplicity.placeholder, tableView: formValue.multiplicity.tableView
// },
// hasCommentField: formValue.hasCommentField,
// fields: fields
// }
// const mockDescription: Description = {
// descriptionTemplate: {
// definition: {
// pages: [
// {
// sections: [{
// fieldSets: [fieldSet]
// }]
// }
// ]
// }
// }
// }
// const descriptionEditorModel = new DescriptionEditorModel().fromModel(mockDescription, mockDescription.descriptionTemplate);
// this.previewPropertiesFormGroup = descriptionEditorModel.properties.fieldSets.get(fieldSet.id).buildForm() as UntypedFormGroup;
// this.previewFieldSet = fieldSet;
// let data = this.form.getRawValue();
// this.datasetProfileService.preview(data).subscribe(x => {
// this.datasetWizardModel = new DatasetWizardEditorModel().fromModel({
// datasetProfileDefinition: x
// });
// this.updateVisibilityRules();
// this.formGroup = <FormGroup>this.datasetWizardModel.buildForm().get('datasetProfileDefinition');
// });
}
// //
// //
// Table of Contents // Table of Contents
@ -1207,7 +1253,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
checkFormValidation() { checkFormValidation() {
this.colorizeInvalid = true; this.colorizeInvalid = true;
// this.printMyErrors(this.form);
} }
get progressStyle() { get progressStyle() {
@ -1226,565 +1271,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
const selectedIndex = this.stepper.selectedIndex + 1; const selectedIndex = this.stepper.selectedIndex + 1;
return (selectedIndex / this.stepper.steps.length) * 100; return (selectedIndex / this.stepper.steps.length) * 100;
} }
// //
// //
// // Sections
// //
// //
// addSection(): void {
// const section: DescriptionTemplateDefinitionSectionEditorModel = new DescriptionTemplateDefinitionSectionEditorModel();
// section.id = Guid.create();
// section.ordinal = (this.formGroup.get('definition').get('sections') as FormArray).controls.length + 1;
// section.hasTemplates = false;
// (this.formGroup.get('definition').get('sections') as FormArray).push(section.buildForm()); //TODO: dtziotzios validation path
// }
// removeSection(sectionIndex: number): void {
// (this.formGroup.get('definition').get('sections') as FormArray).removeAt(sectionIndex);
// (this.formGroup.get('definition').get('sections') as FormArray).controls.forEach((section, index) => {
// section.get('ordinal').setValue(index + 1);
// });
// }
// dropSections(event: CdkDragDrop<string[]>) {
// const sectionsFormArray = (this.formGroup.get('definition').get('sections') as FormArray);
// moveItemInArray(sectionsFormArray.controls, event.previousIndex, event.currentIndex);
// sectionsFormArray.updateValueAndValidity();
// sectionsFormArray.controls.forEach((section, index) => {
// section.get('ordinal').setValue(index + 1);
// });
// }
// //
// //
// // Fields
// //
// //
// systemFieldDisabled(systemField: DescriptionTemplateSystemFieldType) {
// return (this.formGroup.get('definition').get('sections') as FormArray)?.controls.some(x => (x.get('fields') as FormArray).controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === systemField));
// // for (let section in (this.formGroup.get('definition').get('sections')as FormArray)?.controls) {
// // if (i != sectionIndex) {
// // for (let f of this.fieldsArray(i).controls) {
// // if ((f.get('category').value == FieldCategory.System || f.get('category').value == DescriptionTemplateSectionFieldCategory.System) && f.get('type').value == systemField) {
// // return true;
// // }
// // }
// // }
// // i++;
// // }
// // return false;
// }
// selectedSystemFieldDisabled(): Array<DescriptionTemplateSystemFieldType> {
// return (this.formGroup.get('definition').get('sections') as FormArray)?.controls.flatMap(x => (x.get('fields') as FormArray).controls.map(y => (y as UntypedFormGroup).get('systemFieldType')?.value as DescriptionTemplateSystemFieldType));
// }
// addSystemField(sectionIndex: number, systemFieldType: DescriptionTemplateSystemFieldType): void {
// const field: FieldInSectionEditorModel = new FieldInSectionEditorModel();
// field.id = Guid.create();
// field.ordinal = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length + 1;
// field.category = DescriptionTemplateSectionFieldCategory.System;
// field.systemFieldType = systemFieldType;
// field.required = (systemFieldType == DescriptionTemplateSystemFieldType.TEXT || systemFieldType == DescriptionTemplateSystemFieldType.Description) ? true : false;
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(field.buildForm()); //TODO: dtziotzios validation path
// }
// removeSystemField(sectionIndex: number, fieldIndex: number): void {
// const formArray = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray);
// formArray.removeAt(fieldIndex);
// formArray.controls.forEach((section, index) => {
// section.get('ordinal').setValue(index + 1);
// });
// }
// addExtraField(sectionIndex: number): void {
// const field: FieldInSectionEditorModel = new FieldInSectionEditorModel();
// field.id = Guid.create();
// field.ordinal = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length + 1;
// field.category = DescriptionTemplateSectionFieldCategory.Extra;
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(field.buildForm()); //TODO: dtziotzios validation path
// }
// removeExtraField(sectionIndex: number, fieldIndex: number): void {
// const formArray = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray);
// formArray.removeAt(fieldIndex);
// formArray.controls.forEach((section, index) => {
// section.get('ordinal').setValue(index + 1);
// });
// }
// dropFields(event: CdkDragDrop<string[]>, sectionIndex: number) {
// const fieldsFormArray = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray);
// moveItemInArray(fieldsFormArray.controls, event.previousIndex, event.currentIndex);
// fieldsFormArray.updateValueAndValidity();
// fieldsFormArray.controls.forEach((section, index) => {
// section.get('ordinal').setValue(index + 1);
// });
// }
// //
// //
// // Autocomplete configuration
// //
// //
// filterDescriptionTempaltes(value: string): Observable<DatasetProfileModel[]> {
// const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label'] });
// const criteria = new DatasetProfileCriteria();
// criteria.like = value;
// request.criteria = criteria;
// return this.dmpService.searchDescriptionTemplates(request);
// }
// onRemoveDescritionTemplate(event, sectionIndex: number) {
// const descriptionTemplateFormArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray;
// const foundIndex = descriptionTemplateFormArray.controls.findIndex(blueprint => blueprint.get('descriptionTemplateId').value === event.id);
// if (foundIndex !== -1) {
// descriptionTemplateFormArray.removeAt(foundIndex);
// }
// }
// onSelectDescritionTemplate(item, sectionIndex) {
// const descriptionTemplate: DescriptionTemplatesInSectionEditorModel = new DescriptionTemplatesInSectionEditorModel();
// descriptionTemplate.id = Guid.create();
// descriptionTemplate.descriptionTemplateId = item.id;
// descriptionTemplate.label = item.label;
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray).push(descriptionTemplate.buildForm()); //TODO: dtziotzios validation path
// }
// ngAfterViewInit() {
// this.route.params
// .pipe(takeUntil(this._destroyed))
// .subscribe((params: Params) => {
// this.descriptionTemplateId = params['id'];
// const cloneId = params['cloneid'];
// if (this.descriptionTemplateId != null) {
// this.isNew = false;
// this.descriptionTemplateService.getSingleBlueprint(this.descriptionTemplateId).pipe(map(data => data as any))
// .pipe(takeUntil(this._destroyed))
// .subscribe(data => {
// this.descriptionTemplateEditor = new DescriptionTemplateEditor().fromModel(data);
// this.formGroup = this.descriptionTemplateEditor.buildForm();
// this.buildSystemFields();
// this.fillDescriptionTemplatesInMultAutocomplete();
// if (this.descriptionTemplateEditor.status == DescriptionTemplateStatus.Finalized) {
// this.formGroup.disable();
// this.viewOnly = true
// }
// // this.breadCrumbs = observableOf([{
// // parentComponentName: 'DescriptionTemplateListingComponent',
// // label: this.language.instant('NAV-BAR.TEMPLATE'),
// // url: '/description-templates/' + this.descriptionTemplateId
// // }]);
// });
// } else if (cloneId != null) {
// this.isClone = true;
// this.descriptionTemplateService.clone(cloneId).pipe(map(data => data as any), takeUntil(this._destroyed))
// .subscribe(
// data => {
// this.descriptionTemplateEditor = new DescriptionTemplateEditor().fromModel(data);
// this.descriptionTemplateEditor.id = null;
// this.descriptionTemplateEditor.status = DescriptionTemplateStatus.Draft;
// this.formGroup = this.descriptionTemplateEditor.buildForm();
// this.buildSystemFields();
// this.fillDescriptionTemplatesInMultAutocomplete();
// },
// error => this.onCallbackError(error)
// );
// } else {
// this.descriptionTemplateEditorModel = new DescriptionTemplateEditorModel();
// this.descriptionTemplateEditor = new DescriptionTemplateEditor();
// setTimeout(() => {
// // this.formGroup = this.descriptionTemplateModel.buildForm();
// // this.addField();
// this.descriptionTemplateEditor.status = DescriptionTemplateStatus.Draft;
// this.formGroup = this.descriptionTemplateEditor.buildForm();
// });
// // this.breadCrumbs = observableOf([{
// // parentComponentName: 'DescriptionTemplateListingComponent',
// // label: this.language.instant('NAV-BAR.TEMPLATE'),
// // url: '/description-templates/' + this.descriptionTemplateId
// // }]);
// }
// });
// }
// buildSystemFields() {
// const sections = this.sectionsArray().controls.length;
// for (let i = 0; i < sections; i++) {
// let systemFieldsInSection = new Array();
// this.fieldsArray(i).controls.forEach((field) => {
// if ((field.get('category').value == FieldCategory.System || field.get('category').value == DescriptionTemplateSectionFieldCategory.System)) {
// systemFieldsInSection.push(this.fieldList.find(f => f.type == field.get('type').value).type);
// }
// })
// this.systemFieldListPerSection.push(systemFieldsInSection);
// }
// }
// fillDescriptionTemplatesInMultAutocomplete() {
// const sections = this.sectionsArray().controls.length;
// for (let i = 0; i < sections; i++) {
// let descriptionTemplatesInSection = new Array<DatasetProfileModel>();
// this.descriptionTemplatesArray(i).controls.forEach((template) => {
// descriptionTemplatesInSection.push({ id: template.value.descriptionTemplateId, label: template.value.label, description: "" });
// })
// this.descriptionTemplatesPerSection.push(descriptionTemplatesInSection);
// }
// }
// checkForProfiles(event, sectionIndex: number) {
// if (event.checked === false) {
// this.descriptionTemplatesPerSection[sectionIndex] = new Array<DatasetProfileModel>();
// this.descriptionTemplatesArray(sectionIndex).clear();
// }
// }
// sectionsArray(): UntypedFormArray {
// //return this.descriptionTemplatesFormGroup.get('sections') as FormArray;
// return this.formGroup.get('definition').get('sections') as UntypedFormArray;
// }
// fieldsArray(sectionIndex: number): UntypedFormArray {
// return this.sectionsArray().at(sectionIndex).get('fields') as UntypedFormArray;
// }
// removeField(sectionIndex: number, fieldIndex: number): void {
// this.fieldsArray(sectionIndex).removeAt(fieldIndex);
// }
// systemFieldsArray(sectionIndex: number): UntypedFormArray {
// return this.sectionsArray().at(sectionIndex).get('systemFields') as UntypedFormArray;
// }
// initSystemField(systemField?: SystemFieldType): UntypedFormGroup {
// return this.fb.group({
// id: this.fb.control(Guid.create().toString()),
// type: this.fb.control(systemField),
// label: this.fb.control(''),
// placeholder: this.fb.control(''),
// description: this.fb.control(''),
// required: this.fb.control(true),
// ordinal: this.fb.control('')
// });
// }
// addSystemField(sectionIndex: number, systemField?: SystemFieldType): void {
// this.addField(sectionIndex, FieldCategory.System, systemField);
// }
// transfromEnumToString(type: SystemFieldType): string {
// return this.fieldList.find(f => f.type == type).label;
// }
// selectedFieldType(type: SystemFieldType, sectionIndex: number): void {
// let index = this.systemFieldListPerSection[sectionIndex].indexOf(type);
// if (index == -1) {
// this.systemFieldListPerSection[sectionIndex].push(type);
// this.addSystemField(sectionIndex, type);
// }
// else {
// this.systemFieldListPerSection[sectionIndex].splice(index, 1);
// this.removeSystemField(sectionIndex, type);
// }
// }
// descriptionTemplatesArray(sectionIndex: number): UntypedFormArray {
// return this.sectionsArray().at(sectionIndex).get('descriptionTemplates') as UntypedFormArray;
// }
// addDescriptionTemplate(descriptionTemplate, sectionIndex: number): void {
// this.descriptionTemplatesArray(sectionIndex).push(this.fb.group({
// label: this.fb.control(descriptionTemplate.value)
// }));
// }
// removeDescriptionTemplate(sectionIndex: number, templateIndex: number): void {
// this.descriptionTemplatesArray(sectionIndex).removeAt(templateIndex);
// }
// extraFieldsArray(sectionIndex: number): UntypedFormArray {
// return this.sectionsArray().at(sectionIndex).get('extraFields') as UntypedFormArray;
// }
// getExtraFieldTypes(): Number[] {
// let keys: string[] = Object.keys(ExtraFieldType);
// keys = keys.slice(0, keys.length / 2);
// const values: Number[] = keys.map(Number);
// return values;
// }
// getExtraFieldTypeValue(extraFieldType: ExtraFieldType): string {
// switch (extraFieldType) {
// case ExtraFieldType.TEXT: return 'Text';
// case ExtraFieldType.RICH_TEXT: return 'Rich Text';
// case ExtraFieldType.DATE: return 'Date';
// case ExtraFieldType.NUMBER: return 'Number';
// }
// }
// moveItemInFormArray(formArray: UntypedFormArray, fromIndex: number, toIndex: number): void {
// const dir = toIndex > fromIndex ? 1 : -1;
// const item = formArray.at(fromIndex);
// for (let i = fromIndex; i * dir < toIndex * dir; i = i + dir) {
// const current = formArray.at(i + dir);
// formArray.setControl(i, current);
// }
// formArray.setControl(toIndex, item);
// }
// // clearForm(): void{
// // this.descriptionTemplatesFormGroup.reset();
// // }
// // onPreviewTemplate(event, sectionIndex: number) {
// // const dialogRef = this.dialog.open(DatasetPreviewDialogComponent, {
// // width: '590px',
// // minHeight: '200px',
// // restoreFocus: false,
// // data: {
// // template: event
// // },
// // panelClass: 'custom-modalbox'
// // });
// // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
// // if (result) {
// // let blueprints = this.sectionsArray().at(sectionIndex).get('descriptionTemplates').value;//this.formGroup.get('blueprints').value;
// // const blueprint: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor();
// // blueprint.id = Guid.create().toString();
// // blueprint.descriptionTemplateId = event.id;
// // blueprint.label = event.label;
// // blueprints.push(blueprint.buildForm());
// // this.sectionsArray().at(sectionIndex).get('descriptionTemplates').setValue(blueprints);//this.formGroup.get('blueprints').setValue(blueprints);
// // this.blueprintsAutoCompleteConfiguration = {
// // filterFn: this.filterProfiles.bind(this),
// // initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
// // displayFn: (item) => item['label'],
// // titleFn: (item) => item['label'],
// // subtitleFn: (item) => item['description'],
// // popupItemActionIcon: 'visibility'
// // };
// // }
// // });
// // }
// checkValidity() {
// this.formService.touchAllFormFields(this.formGroup);
// if (!this.isFormValid()) { return false; }
// let errorMessages = [];
// if (!this.hasTitle()) {
// errorMessages.push("Title should be set.");
// }
// if (!this.hasDescription()) {
// errorMessages.push("Description should be set.");
// }
// if (!this.hasDescriptionTemplates()) {
// errorMessages.push("At least one section should have description templates.");
// }
// if (errorMessages.length > 0) {
// this.showValidationErrorsDialog(undefined, errorMessages);
// return false;
// }
// return true;
// }
// formSubmit(): void {
// if (this.checkValidity())
// this.onSubmit();
// }
// public isFormValid() {
// return this.formGroup.valid;
// }
// hasTitle(): boolean {
// const descriptionTemplate: DescriptionTemplatePersist = this.formGroup.value;
// return descriptionTemplate.definition.sections.some(section => section.fields.some(field => (field.category === DescriptionTemplateSectionFieldCategory.System || field.category as unknown === DescriptionTemplateSectionFieldCategory.System) && field.systemFieldType === DescriptionTemplateSystemFieldType.TEXT));
// }
// hasDescription(): boolean {
// const descriptionTemplate: DescriptionTemplatePersist = this.formGroup.value;
// return descriptionTemplate.definition.sections.some(section => section.fields.some(field => (field.category === DescriptionTemplateSectionFieldCategory.System || field.category as unknown === DescriptionTemplateSectionFieldCategory.System) && field.systemFieldType === DescriptionTemplateSystemFieldType.Description));
// }
// hasDescriptionTemplates(): boolean {
// const descriptionTemplate: DescriptionTemplatePersist = this.formGroup.value;
// return descriptionTemplate.definition.sections.some(section => section.hasTemplates == true);
// }
// private showValidationErrorsDialog(projectOnly?: boolean, errmess?: string[]) {
// const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, {
// disableClose: true,
// autoFocus: false,
// restoreFocus: false,
// data: {
// errorMessages: errmess,
// projectOnly: projectOnly
// },
// });
// }
// onSubmit(): void {
// this.descriptionTemplateService.createBlueprint(this.formGroup.value)
// .pipe(takeUntil(this._destroyed))
// .subscribe(
// complete => this.onCallbackSuccess(),
// error => this.onCallbackError(error)
// );
// }
// 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(['/description-templates']);
// }
// onCallbackError(errorResponse: any) {
// this.setErrorModel(errorResponse.error);
// this.formService.validateAllFormFields(this.formGroup);
// }
// public setErrorModel(validationErrorModel: ValidationErrorModel) {
// Object.keys(validationErrorModel).forEach(item => {
// (<any>this.descriptionTemplateEditor.validationErrorModel)[item] = (<any>validationErrorModel)[item];
// });
// }
public cancel(): void { public cancel(): void {
this.router.navigate(['/description-templates']); this.router.navigate(['/description-templates']);
} }
// // addField() {
// // (<FormArray>this.formGroup.get('definition').get('fields')).push(new DescriptionTemplateFieldEditorModel().buildForm());
// // }
// // removeField(index: number) {
// // (<FormArray>this.formGroup.get('definition').get('fields')).controls.splice(index, 1);
// // }
// getDescriptionTemplateFieldDataTypeValues(): Number[] {
// let keys: string[] = Object.keys(DescriptionTemplateFieldDataType);
// keys = keys.slice(0, keys.length / 2);
// const values: Number[] = keys.map(Number);
// return values;
// }
// getDescriptionTemplateFieldDataTypeWithLanguage(fieldType: DescriptionTemplateFieldDataType): string {
// let result = '';
// this.language.get(this.enumUtils.toDescriptionTemplateFieldDataTypeString(fieldType))
// .pipe(takeUntil(this._destroyed))
// .subscribe((value: string) => {
// result = value;
// });
// return result;
// }
// getDescriptionTemplateFieldTypeValues(): Number[] {
// let keys: string[] = Object.keys(DescriptionTemplateType);
// keys = keys.slice(0, keys.length / 2);
// const values: Number[] = keys.map(Number);
// return values;
// }
// getDescriptionTemplateFieldTypeWithLanguage(blueprintType: DescriptionTemplateType): string {
// let result = '';
// this.language.get(this.enumUtils.toDescriptionTemplateTypeString(blueprintType))
// .pipe(takeUntil(this._destroyed))
// .subscribe((value: string) => {
// result = value;
// });
// return result;
// }
// delete() {
// this.dialog.open(ConfirmationDialogComponent, {
// data: {
// isDeleteConfirmation: true,
// confirmButton: this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.CONFIRM-BUTTON'),
// cancelButton: this.language.instant("DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.CANCEL-BUTTON"),
// message: this.language.instant("DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.MESSAGE")
// }
// })
// .afterClosed()
// .subscribe(
// confirmed => {
// if (confirmed) {
// if (this.formGroup.get('status').value == DescriptionTemplateStatus.Draft) {
// // this.formGroup.get('status').setValue(DescriptionTemplateStatus.Deleted);
// this.descriptionTemplateService.createBlueprint(this.formGroup.value)
// .pipe(takeUntil(this._destroyed))
// .subscribe(
// complete => this.onCallbackSuccess(),
// error => this.onCallbackError(error)
// );
// }
// else {
// // this.descriptionTemplateService.delete(this.descriptionTemplateId)
// // .pipe(takeUntil(this._destroyed))
// // .subscribe(
// // complete => this.onCallbackSuccess(),
// // error => {
// // if (error.error.statusCode == 674) {
// // this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DESCRIPTION-TEMPLATE-DELETE'), SnackBarNotificationLevel.Error);
// // } else {
// // this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error);
// // }
// // }
// // );
// }
// }
// }
// )
// }
// finalize() {
// if (this.checkValidity()) {
// this.formGroup.get('status').setValue(DescriptionTemplateStatus.Finalized);
// this.formSubmit();
// }
// }
// downloadXML(): void {
// const blueprintId = this.formGroup.get('id').value;
// if (blueprintId == null) return;
// this.descriptionTemplateService.downloadXML(blueprintId)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/xml' });
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// });
// }
} }

View File

@ -1,3 +1,4 @@
<div class="row">
<div class="col"> <div class="col">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.SYSTEM-TARGET' | translate}}</mat-label> <mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.SYSTEM-TARGET' | translate}}</mat-label>
@ -23,3 +24,4 @@
<mat-error *ngIf="form.get('trimRegex').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.get('trimRegex').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
</div>

View File

@ -1,5 +1,5 @@
<div class="prefilling-source-editor"> <div class="prefilling-source-editor">
<div class="col-md-8 offset-md-2 colums-gapped" *ngIf="formGroup"> <div class="col-md-10 offset-md-1 colums-gapped" *ngIf="formGroup">
<div class="row justify-content-between align-items-center"> <div class="row justify-content-between align-items-center">
<div class="col"> <div class="col">
@ -61,9 +61,11 @@
</button> </button>
</div> </div>
</div> </div>
<div class="col-auto" > <div class="row">
<div class="col-9">
<app-prefilling-source-field-component [form]="field"></app-prefilling-source-field-component> <app-prefilling-source-field-component [form]="field"></app-prefilling-source-field-component>
<div class="col"> </div>
<div class="col-3">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.FIXED-VALUE' | translate}}</mat-label> <mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.FIXED-VALUE' | translate}}</mat-label>
<input matInput type="text" name="fixedValue" [formControl]="field.get('fixedValue')"> <input matInput type="text" name="fixedValue" [formControl]="field.get('fixedValue')">
@ -98,8 +100,8 @@
</button> </button>
</div> </div>
</div> </div>
<div class="col-auto" > <div class="row">
<div class="col"> <div class="col-3">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label> <mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
<input matInput type="text" name="code" [formControl]="field.get('code')"> <input matInput type="text" name="code" [formControl]="field.get('code')">
@ -107,13 +109,14 @@
<mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="col-9">
<app-prefilling-source-field-component [form]="field"></app-prefilling-source-field-component> <app-prefilling-source-field-component [form]="field"></app-prefilling-source-field-component>
</div> </div>
</div> </div>
</div> </div>
</div>
<button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button> <button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
<button mat-button class="action-btn" *ngIf="formGroup.get('definition').get('fields').value != ''" <button mat-button class="action-btn" *ngIf="formGroup.get('definition').get('fields').value != ''" type="button" (click)="submitFields()" [disabled]="!formGroup.get('definition').get('fields').valid">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.SUBMIT-FIELDS' | translate}}</button>
type="button" (click)="submitFields()" [disabled]="!formGroup.get('definition').get('fields').valid">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.SUBMIT-FIELDS' | translate}}</button>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -104,7 +104,6 @@
</div> </div>
<!-- <div class="row content"> <!-- <div class="row content">
{{annotations | json}}
<div class="col-12"> <div class="col-12">
<h1 mat-dialog-title class="title p-0">{{'NAV-BAR.START-NEW-DMP' | translate}}</h1> <h1 mat-dialog-title class="title p-0">{{'NAV-BAR.START-NEW-DMP' | translate}}</h1>
</div> </div>

View File

@ -138,7 +138,6 @@
[validationErrorModel]="editorModel.validationErrorModel" [validationErrorModel]="editorModel.validationErrorModel"
(fieldsetFocusChange)="fieldsetIdWithFocus = $event"></app-description-form> (fieldsetFocusChange)="fieldsetIdWithFocus = $event"></app-description-form>
</div> </div>
{{formGroup?.value | json}}
</div> </div>
</form> </form>
</div> </div>

View File

@ -31,13 +31,13 @@
</button> </button>
</div> </div>
</div> </div>
<div *ngIf="(fieldSet.multiplicity.max - 1) > (propertiesFormGroup.get('items').length)" class="col-12 mt-1 ml-0 mr-0 addOneFieldButton"> <div *ngIf="(fieldSet?.multiplicity?.max - 1) > (propertiesFormGroup.get('items').length)" class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<span class="d-inline-flex align-items-center" [ngClass]="propertiesFormGroup.disabled ? '' : 'pointer'" (click)="addMultiplicityField()"> <span class="d-inline-flex align-items-center" [ngClass]="propertiesFormGroup.disabled ? '' : 'pointer'" (click)="addMultiplicityField()">
<button mat-icon-button color="primary" [disabled]="propertiesFormGroup.disabled"> <button mat-icon-button color="primary" [disabled]="propertiesFormGroup.disabled">
<mat-icon>add_circle</mat-icon> <mat-icon>add_circle</mat-icon>
</button> </button>
<span class="mt-1" *ngIf="fieldSet.multiplicity.placeholder">{{fieldSet.multiplicity.placeholder}}</span> <span class="mt-1" *ngIf="fieldSet?.multiplicity?.placeholder">{{fieldSet.multiplicity.placeholder}}</span>
<span class="mt-1" *ngIf="!fieldSet.multiplicity.placeholder">{{('DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' + (fieldSet.multiplicity.tableView?'-TABLEVIEW':'')) | translate}}</span> <span class="mt-1" *ngIf="!fieldSet?.multiplicity?.placeholder">{{('DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' + (fieldSet.multiplicity.tableView?'-TABLEVIEW':'')) | translate}}</span>
</span> </span>
</div> </div>
</div> </div>

View File

@ -58,15 +58,15 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
} }
ngOnInit() { ngOnInit() {
this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { // this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
// console.log('getElementVisibilityMapObservable form field'); // // console.log('getElementVisibilityMapObservable form field');
if (x[this.fieldSet.id]) { // if (x[this.fieldSet.id]) {
this.isVisibleByVisibilityService = x[this.fieldSet.id]; // this.isVisibleByVisibilityService = x[this.fieldSet.id];
// this.changeDetector.markForCheck(); // // this.changeDetector.markForCheck();
} else { // } else {
this.isVisibleByVisibilityService = false; // this.isVisibleByVisibilityService = false;
} // }
}); // });
// if (this.tocentry) { // if (this.tocentry) {
// this.form = this.tocentry.form as UntypedFormGroup; // this.form = this.tocentry.form as UntypedFormGroup;
// } // }

View File

@ -7,7 +7,6 @@
<h5 *ngIf="fieldSet.extendedDescription && !isChild" class="col-12"> <h5 *ngIf="fieldSet.extendedDescription && !isChild" class="col-12">
<i>{{fieldSet.extendedDescription}}</i> <i>{{fieldSet.extendedDescription}}</i>
</h5> </h5>
{{propertiesFormGroup.value | json}}
<mat-form-field *ngSwitchCase="descriptionTemplateFieldTypeEnum.FREE_TEXT" class="col-12"> <mat-form-field *ngSwitchCase="descriptionTemplateFieldTypeEnum.FREE_TEXT" class="col-12">
<input matInput [formControl]="propertiesFormGroup?.get(field.id).get('textValue')" placeholder="{{(field.data.label) + (isRequired? ' *': '')}}" [required]="isRequired"> <input matInput [formControl]="propertiesFormGroup?.get(field.id).get('textValue')" placeholder="{{(field.data.label) + (isRequired? ' *': '')}}" [required]="isRequired">
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}</mat-error> <mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}</mat-error>
@ -16,9 +15,6 @@
</mat-form-field> </mat-form-field>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12">
{{field.id}}
{{field.data.multipleSelect}}
{{propertiesFormGroup?.get(field.id).value | json}}
<ng-container *ngIf="field.data.multipleSelect"> <ng-container *ngIf="field.data.multipleSelect">
<app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('references')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field.data.referenceType" [multiple]="true" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component> <app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('references')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field.data.referenceType" [multiple]="true" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component>
</ng-container> </ng-container>

View File

@ -97,15 +97,15 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
ngOnInit() { ngOnInit() {
this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { // this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
// console.log('getElementVisibilityMapObservable form field set'); // // console.log('getElementVisibilityMapObservable form field set');
if (x[this.field.id]) { // if (x[this.field.id]) {
this.visible = x[this.field.id]; // this.visible = x[this.field.id];
} else { // } else {
this.visible = true; // this.visible = true;
} // }
}); // });
//TODO: validate that this logic is correct. Validation contenxt path might need to be fixed. //TODO: validate that this logic is correct. Validation contenxt path might need to be fixed.
// if (this.propertiesFormGroup.get(this.field.id).get('value') == null) { // if (this.propertiesFormGroup.get(this.field.id).get('value') == null) {

View File

@ -35,7 +35,8 @@ import { DescriptionFormComponent } from './description-form.component';
FormFieldSetEditorDialogComponent FormFieldSetEditorDialogComponent
], ],
exports: [ exports: [
DescriptionFormComponent DescriptionFormComponent,
DescriptionFormFieldSetComponent
], ],
providers: [ providers: [
] ]

View File

@ -21,4 +21,3 @@
</table-of-contents-internal> </table-of-contents-internal>
</div> </div>
</div> </div>
{{hiddenEntries | json}}

View File

@ -290,14 +290,13 @@
</div> </div>
</div> </div>
<div class="col-12 card" *ngIf="section.hasTemplates"> <div class="col-12 card" *ngIf="section.hasTemplates">
{{formGroup.get('descriptionTemplates').get(section.id).value | json}}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="input-form"> <div class="input-form">
<div class="heading">{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}</div> <div class="heading">{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}</div>
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}</mat-label> <mat-label>{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}</mat-label>
<app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('descriptionTemplates').get(section.id)" [configuration]="descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration" (optionRemoved)="onRemoveDescriptionTemplate($event, i)" (optionActionClicked)="onPreviewDescriptionTemplate($event, i)" (optionSelected)="onDescriptionTemplateSelected($event, i)"> <app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}}" [hidePlaceholder]="true" required='true' [formControl]="formGroup.get('descriptionTemplates').get(section.id)" [configuration]="descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration" (optionRemoved)="onRemoveDescriptionTemplate($event, i)" (optionActionClicked)="onPreviewDescriptionTemplate($event, i)">
</app-multiple-auto-complete> </app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('backendError')">{{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}}</mat-error> <mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('backendError')">{{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="formGroup.get('descriptionTemplates').get(section.id).hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>

View File

@ -124,13 +124,8 @@ export class DmpEditorResolver extends BaseEditorResolver {
...DmpEditorResolver.lookupFields() ...DmpEditorResolver.lookupFields()
]; ];
const id = route.paramMap.get('id'); const id = route.paramMap.get('id');
// const cloneid = route.paramMap.get('cloneid');
if (id != null) { if (id != null) {
return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed)); return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
} }
//TODO: check this
// else if (cloneid != null) {
// return this.descriptionService.clone(Guid.parse(cloneid), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
// }
} }
} }

View File

@ -4,10 +4,10 @@ import { RouterModule, Routes } from '@angular/router';
import { AppPermission } from '@app/core/common/enum/permission.enum'; import { AppPermission } from '@app/core/common/enum/permission.enum';
import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service'; import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service';
// import { DmpOverviewComponent } from './overview/description-overview.component'; // import { DmpOverviewComponent } from './overview/description-overview.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { AuthGuard } from '@app/core/auth-guard.service'; import { AuthGuard } from '@app/core/auth-guard.service';
import { DmpEditorResolver } from './dmp-editor.resolver'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { DmpEditorComponent } from './dmp-editor.component'; import { DmpEditorComponent } from './dmp-editor.component';
import { DmpEditorResolver } from './dmp-editor.resolver';
const routes: Routes = [ const routes: Routes = [
{ {
@ -36,22 +36,8 @@ const routes: Routes = [
...BreadcrumbService.generateRouteDataConfiguration({ ...BreadcrumbService.generateRouteDataConfiguration({
title: 'BREADCRUMBS.EDIT-DMP' title: 'BREADCRUMBS.EDIT-DMP'
}) })
// ,
// authContext: {
// permissions: [AppPermission.EditDmp]
// }
} }
}, }
// {
// path: 'edit/:id',
// component: DmpEditorBlueprintComponent,
// data: {
// breadcrumb: true,
// title: 'GENERAL.TITLES.DMP-EDIT'
// },
// canDeactivate: [CanDeactivateGuard]
// },
]; ];

View File

@ -1,4 +1,3 @@
<div class="col-12">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
@ -47,7 +46,8 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row" *ngIf="formGroup.get('type').value == externalFetcherSourceType.API"> <div class="col-12" *ngIf="formGroup.get('type').value == externalFetcherSourceType.API">
<div class="row">
<div class="col-6"> <div class="col-6">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label> <mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label>
@ -156,7 +156,8 @@
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.AUTHENTICATION' | translate}} <h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.AUTHENTICATION' | translate}}
<mat-checkbox [formControl]="formGroup.get('auth').get('enabled')"></mat-checkbox> <mat-checkbox [formControl]="formGroup.get('auth').get('enabled')"></mat-checkbox>
</h3> </h3>
<div class="row" *ngIf="formGroup.get('auth').get('enabled').value == true"> <div class="col-12" *ngIf="formGroup.get('auth').get('enabled').value == true">
<div class="row">
<div class="col-6"> <div class="col-6">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label> <mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label>
@ -202,6 +203,7 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
</div>
<!-- Queries info --> <!-- Queries info -->
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.QUERIES' | translate}} <h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.QUERIES' | translate}}
<button mat-button type="button" class="action-btn" (click)="addQuery()" [disabled]="formGroup.disabled">{{'REFERENCE-TYPE-EDITOR.ACTIONS.ADD-QUERY' | translate}}</button> <button mat-button type="button" class="action-btn" (click)="addQuery()" [disabled]="formGroup.disabled">{{'REFERENCE-TYPE-EDITOR.ACTIONS.ADD-QUERY' | translate}}</button>
@ -317,6 +319,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Options --> <!-- Options -->
<div class="row" *ngIf="formGroup.get('type').value == externalFetcherSourceType.STATIC"> <div class="row" *ngIf="formGroup.get('type').value == externalFetcherSourceType.STATIC">
<div class="col-12"> <div class="col-12">
@ -355,4 +358,3 @@
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@ -1,6 +1,6 @@
<div class="sidebar-wrapper"> <div class="sidebar-wrapper">
<mat-list class="nav mat-list" *ngFor="let groupMenuItem of groupMenuItems; let firstGroup = first; let i = index" [class.nav-list-item]="showItem(groupMenuItem)" [ngClass]="{'flex-grow-1': i == groupMenuItems.length - 2}"> <mat-list class="nav mat-list" *ngFor="let groupMenuItem of groupMenuItems; let firstGroup = first; let i = index" [class.nav-list-item]="showItem(groupMenuItem)" [class.nav-list-item-hidden]="!showItem(groupMenuItem)" [ngClass]="{'flex-grow-1': i == groupMenuItems.length - 2}">
<div *ngIf="showItem(groupMenuItem);"> <div *ngIf="showItem(groupMenuItem);">
<hr *ngIf="!firstGroup"> <hr *ngIf="!firstGroup">
<mat-list-item routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" *ngFor="let groupMenuRoute of groupMenuItem.routes; let first = first" class="nav-item" [ngClass]="{'mt-4': first && firstGroup}"> <mat-list-item routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" *ngFor="let groupMenuRoute of groupMenuItem.routes; let first = first" class="nav-item" [ngClass]="{'mt-4': first && firstGroup}">

View File

@ -12,6 +12,10 @@ $mat-card-header-size: 30px !default;
// margin-top: 20px; // margin-top: 20px;
} }
.nav-list-item-hidden {
display: none !important;
}
.login { .login {
margin-top: 15px !important; margin-top: 15px !important;
} }