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

This commit is contained in:
Efstratios Giannopoulos 2024-01-19 14:55:38 +02:00
commit 409b96f518
27 changed files with 178 additions and 152 deletions

View File

@ -146,7 +146,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
},
DescriptionTemplate::getGroupId);
} else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id, DescriptionTemplate._groupId);
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).versionStatuses(DescriptionTemplateVersionStatus.Current).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getGroupId);
}

View File

@ -67,7 +67,7 @@ public class DefinitionPersist {
this.spec()
.must(() -> !this.isNull(item.getSections()))
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
this.refSpec()
this.navSpec()
.iff(() -> !this.isNull(item.getSections()))
.on(DefinitionPersist._sections)
.over(item.getSections())
@ -75,7 +75,7 @@ public class DefinitionPersist {
this.spec()
.must(() -> !this.isNull(item.getPages()))
.failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())),
this.refSpec()
this.navSpec()
.iff(() -> !this.isNull(item.getPages()))
.on(DefinitionPersist._pages)
.over(item.getPages())

View File

@ -1,6 +1,7 @@
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { Guid } from '@common/types/guid';
import { User } from '../user/user';
import { BaseEntityPersist } from '@common/base/base-entity.model';
export interface Lock {
id: Guid;
@ -14,10 +15,8 @@ export interface Lock {
// Persist
export interface LockPersist {
id: Guid;
export interface LockPersist extends BaseEntityPersist {
target: Guid;
targetType: LockTargetType;
lockedBy: User;
hash: String;
lockedBy: Guid;
}

View File

@ -242,7 +242,6 @@ export class AuthService extends BaseService {
scope: this.installationConfiguration.keycloak.scope,
})
.then(() => {
console.log('Keycloak Login');
this.keycloakService.keycloakEvents$.subscribe({
next: (e) => {
if (

View File

@ -1,15 +1,20 @@
import { ChangeDetectionStrategy, Component, Input } from "@angular/core";
import { FormControl } from "@angular/forms";
import { AngularEditorConfig } from "@kolkov/angular-editor";
@Component({
selector: 'rich-text-editor-component',
template: `
<div class="editor-wrapper" [class]="wrapperClasses" [formGroup]="parentFormGroup">
<angular-editor class="full-width editor" [ngClass]="editable ? '': 'disabled'" [id]="id"
[config]="editorConfig" [formControlName]="controlName"
<div class="editor-wrapper" [class]="wrapperClasses">
<!-- <angular-editor class="full-width editor" [ngClass]="editable ? '': 'disabled'" [id]="id"
[config]="editorConfig" [formControl]="form"
placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
(paste)="pasteWithoutFormatting($event)"></angular-editor>
<mat-icon *ngIf="parentFormGroup.get(controlName).value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon>
<mat-icon *ngIf="form.value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon> -->
<mat-form-field class="full-width editor">
<mat-label>{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}</mat-label>
<textarea matInput [formControl]="form" rows="5" placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"></textarea>
</mat-form-field>
</div>
`,
styleUrls: ['./rich-text-editor.component.scss'],
@ -17,8 +22,7 @@ import { AngularEditorConfig } from "@kolkov/angular-editor";
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RichTextEditorComponent {
@Input() parentFormGroup;
@Input() controlName;
@Input() form: FormControl;
@Input() id: string = "editor1";
@Input() placeholder: string = "Enter text";
@Input() required: boolean = false;

View File

@ -14,12 +14,12 @@
<div style="position: relative;" class="col-12" *ngIf="hasFocus" [@fade-in]>
<div *ngIf="showDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'description'" [id]="'editor1'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'" [wrapperClasses]="'row'">
<rich-text-editor-component [form]="form.get('description')" [id]="'editor1'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'" [wrapperClasses]="'row'">
</rich-text-editor-component>
</div>
<div *ngIf="showExtendedDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'extendedDescription'" [id]="'editor2'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'" [wrapperClasses]="'row'">
<rich-text-editor-component [form]="form.get('extendedDescription')" [id]="'editor2'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'" [wrapperClasses]="'row'">
</rich-text-editor-component>
</div>
<div class="row" *ngIf="showAdditionalInfo">

View File

@ -10,7 +10,7 @@
<div class="heading col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION' | translate}} </div>
<div class="hint col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION-HINT' | translate}}</div>
<div class="col-12">
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'description'"
<rich-text-editor-component [form]="form.get('description')"
[placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.SECTION.FIELDS.DESCRIPTION'">
</rich-text-editor-component>
</div>

View File

@ -76,7 +76,7 @@
<!-- <div class="hint">{{'DMP-EDITOR.MAIN-INFO.HINT' | translate}}</div> -->
<div class="hint">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-HINT'| translate}}</div>
<div class="full-width basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error>

View File

@ -31,8 +31,10 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
if (item) {
super.fromModel(item);
this.label = item.label;
this.status = item.status;
this.description = item.description;
this.language = item.language;
this.type = item.type?.id;
this.status = item.status;
this.definition = new DescriptionTemplateDefinitionEditorModel().fromModel(item.definition);
if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel().fromModel(x))); }
}

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
@ -22,8 +23,12 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
nameof<DescriptionTemplate>(x => x.label),
nameof<DescriptionTemplate>(x => x.status),
nameof<DescriptionTemplate>(x => x.description),
nameof<DescriptionTemplate>(x => x.language),
nameof<DescriptionTemplate>(x => x.status),
[nameof<DescriptionTemplate>(x => x.type), nameof<DescriptionTemplateType>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.type), nameof<DescriptionTemplateType>(x => x.name)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),

View File

@ -52,7 +52,7 @@
<div class="col-12">
<h3>{{'REFERENCE-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3>
<div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'REFERENCE-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'REFERENCE-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>

View File

@ -47,7 +47,7 @@
<div class="col-12">
<h3>{{'TENANT-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3>
<div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'TENANT-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'TENANT-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>

View File

@ -49,10 +49,9 @@
<div class="profile-form">
<mat-form-field class="w-100">
<mat-select placeholder="{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE-PLACEHOLDER'| translate}}" [required]="true" [compareWith]="compareWith" [formControl]="formGroup.get('descriptionTemplateId')">
<mat-option *ngFor="let descriptionTemplate of availableDescriptionTemplates" [value]="descriptionTemplate.id">
<div (click)="checkMinMax($event, descriptionTemplate)">
{{descriptionTemplate.label}}
</div>
<mat-option *ngFor="let descriptionTemplate of availableDescriptionTemplates" [value]="descriptionTemplate.id" class="multiline-mat-option">
<div>{{descriptionTemplate.label}}</div>
<div>{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE-VERSION'| translate}} {{descriptionTemplate.version}}</div>
</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.get('descriptionTemplateId').hasError('backendError')">{{formGroup.get('descriptionTemplateId').getError('backendError').message}}</mat-error>

View File

@ -1,4 +1,5 @@
.description-base-fields-editor {
.intro {
text-align: left;
font-weight: 400;
@ -68,6 +69,11 @@
}
}
.multiline-mat-option.mat-option {
white-space: normal;
line-height: normal;
}
::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important;
}

View File

@ -3,7 +3,7 @@ import { UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description } from '@app/core/model/description/description';
import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp } from '@app/core/model/dmp/dmp';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { DescriptionService } from '@app/core/services/description/description.service';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
@ -18,24 +18,21 @@ import { takeUntil } from 'rxjs/operators';
export class DescriptionBaseFieldsEditorComponent extends BaseComponent {
@Input() formGroup: UntypedFormGroup;
@Input() availableDescriptionTemplates: DescriptionTemplate[] = [];
@Input() description: Description;
availableDescriptionTemplates: DescriptionTemplate[] = [];
viewOnly = false; //TODO: not used.
constructor(
private dmpBlueprintService: DmpBlueprintService,
private descriptionTemplateService: DescriptionTemplateService,
) { super(); }
ngOnInit() {
const section: DmpBlueprintDefinitionSection = this.dmpBlueprintService.getSection(this.description.dmp.blueprint, this.description.dmpDescriptionTemplate.sectionId);
const descriptionTemplateIds = section ? section.descriptionTemplates.map(x => x.descriptionTemplateId) : [];
if (descriptionTemplateIds && descriptionTemplateIds.length > 0) {
this.descriptionTemplateService.query(this.descriptionTemplateService.buildAutocompleteLookup(null, null, descriptionTemplateIds))
.pipe(takeUntil(this._destroyed)).subscribe(queryResult => {
this.availableDescriptionTemplates = queryResult.items;
});
const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId === this.description.dmpDescriptionTemplate.sectionId);
const currentVersionsOfDescriptionTemplates = dmpDescriptionTemplates.map(x => x.currentDescriptionTemplate);
//Check if the used tempalte in included in the current list. If not add it.
if (currentVersionsOfDescriptionTemplates.find(x => x.id === this.description.descriptionTemplate.id) == null) {
this.availableDescriptionTemplates.push(this.description.descriptionTemplate)
}
this.availableDescriptionTemplates.push(...currentVersionsOfDescriptionTemplates);
}
public compareWith(object1: any, object2: any) {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateWordListData } from '@app/core/model/description-template/description-template';
import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
@ -43,10 +43,19 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.version)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.version)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),
@ -89,6 +98,10 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.value)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.multiList)].join('.'),
[nameof<Description>(x => x.properties), nameof<PropertyDefinition>(x => x.fields), nameof<DescriptionField>(x => x.key)].join('.'),

View File

@ -1,5 +1,7 @@
<div *ngIf="fieldSet && isVisibleByVisibilityService && !tableRow" class="dynamic-form-composite-field row">
<div *ngIf="fieldSet.fields.length === 1 && this.visibilityRulesService.isVisibleMap[fieldSet.fields.id] ?? true" class="col-12">
<!-- <div *ngIf="fieldSet && isVisibleByVisibilityService && !tableRow" class="dynamic-form-composite-field row"> -->
<div *ngIf="fieldSet && !tableRow" class="dynamic-form-composite-field row">
<!-- <div *ngIf="fieldSet.fields.length === 1 && this.visibilityRulesService.isVisibleMap[fieldSet.fields.id] ?? true" class="col-12"> -->
<div *ngIf="fieldSet.fields.length === 1" class="col-12">
<div class="row">
<div *ngIf="showTitle" class="col-12">
<app-form-composite-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-form-composite-title>
@ -23,7 +25,8 @@
</div>
<div class="col align-self-center">
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
<ng-container *ngIf="this.visibilityRulesService.isVisibleMap[field.id] ?? true">
<!-- <ng-container *ngIf="this.visibilityRulesService.isVisibleMap[field.id] ?? true"> -->
<ng-container>
<div class="row">
<h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5>
</div>
@ -38,6 +41,9 @@
</div>
</div>
</div>
<div *ngIf="fieldSet.hasCommentField && propertiesFormGroup.get('commentFieldValue'+fieldSet.id)?.get('value')" class="col-12">
<rich-text-editor-component [form]="propertiesFormGroup.get('commentFieldValue'+fieldSet.id).get('value')" [id]="'editor1'" [placeholder]="'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate" [wrapperClasses]="'mb-2'" [editable]="!propertiesFormGroup.get('commentFieldValue'+fieldSet.id).disabled"></rich-text-editor-component>
</div>
</div>
<ng-container *ngIf="fieldSet && isVisibleByVisibilityService && tableRow">
<ng-container *ngFor="let field of fieldSet.fields;">

View File

@ -40,7 +40,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
ngOnInit() {
this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
console.log('getElementVisibilityMapObservable form field');
// console.log('getElementVisibilityMapObservable form field');
if (x[this.fieldSet.id]) {
this.isVisibleByVisibilityService = x[this.fieldSet.id];
// this.changeDetector.markForCheck();

View File

@ -1,5 +1,6 @@
<div *ngIf="field && visible" [id]="field.id"
[ngSwitch]="this.field?.data?.fieldType" class="dynamic-form-field row">
{{field.id | json}}
<!-- <h5 *ngIf="fieldSet.title && !isChild">{{fieldSet.title}}</h5> -->
<mat-icon *ngIf="fieldSet.additionalInformation && !isChild" matTooltip="{{fieldSet.additionalInformation}}">info</mat-icon>

View File

@ -113,7 +113,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
ngOnInit() {
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]) {
this.visible = x[this.field.id];

View File

@ -44,7 +44,7 @@ export class VisibilityRulesService {
}
public checkElementVisibility(id: string): boolean {
console.log('checkElementVisibility: ' + id);
//console.log('checkElementVisibility: ' + id);
return true;
// if (this.visibilityRuleContext.rules.filter(item => item.targetControlId === id).length === 0) { return true; }
// console.log(this.elementVisibilityMap.has(id) ? this.elementVisibilityMap.get(id) : false);
@ -59,7 +59,7 @@ export class VisibilityRulesService {
}
public updateValueAndVisibility(id: string, value: any) {
console.log('updateValueAndVisibility: ' + id + ' value: ' + value);
//console.log('updateValueAndVisibility: ' + id + ' value: ' + value);
const visibilityRules = this.visibilityRuleContext.rules.filter(item => item.sourceVisibilityRules.filter(source => source.sourceControlId === id).length > 0);
if (visibilityRules.length > 0) {
visibilityRules.forEach(item => this.evaluateVisibility(item, value, id));
@ -68,7 +68,7 @@ export class VisibilityRulesService {
}
private evaluateVisibility(visibilityRule: VisibilityRule, value: any, sourceId: string) {// source controlId is the same
console.log('evaluateVisibility: ' + visibilityRule + ' value: ' + value + ' sourceId: ' + sourceId);
//console.log('evaluateVisibility: ' + visibilityRule + ' value: ' + value + ' sourceId: ' + sourceId);
const targetId = visibilityRule.targetControlId;
const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>();
@ -133,7 +133,7 @@ export class VisibilityRulesService {
private _computeVisibility(targetId: string): boolean {
console.log('_computeVisibility: ' + targetId);
//console.log('_computeVisibility: ' + targetId);
const visibilityMap = this.elementComputationalMap.get(targetId);
const values = visibilityMap.values();
@ -159,7 +159,7 @@ export class VisibilityRulesService {
}
private resetVisibilityRules() {
console.log('resetVisibilityRules: ');
//console.log('resetVisibilityRules: ');
this.isVisibleMap = {};
this.elementComputationalMap.clear();
@ -169,7 +169,7 @@ export class VisibilityRulesService {
}
private _populateComputationMap(): void {
console.log('_populateComputationMap: ');
//console.log('_populateComputationMap: ');
// this.visibilityRuleContext.rules.forEach(rule => {
// const targetId = rule.targetControlId;
// const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>();
@ -232,7 +232,7 @@ export class VisibilityRulesService {
}
private resetControlWithId(formControl: AbstractControl, id: string) {
console.log('resetControlWithId: ' + id);
//'resetControlWithId: ' + id);
//TODO: implement this
// if (formControl instanceof UntypedFormGroup) {
// if ((formControl as UntypedFormGroup).contains('id') && (formControl as UntypedFormGroup).contains('value') && (formControl as UntypedFormGroup).get('id').value === id) {
@ -253,7 +253,7 @@ export class VisibilityRulesService {
}
private resetFieldFormGroup(formGroup: UntypedFormGroup) {
console.log('resetFieldFormGroup: ' + formGroup);
//console.log('resetFieldFormGroup: ' + formGroup);
//TODO: implement this
// const renderStyle = formGroup.getRawValue().viewStyle.renderStyle;
// if (renderStyle === DatasetProfileFieldViewStyle.Validation || renderStyle === DatasetProfileFieldViewStyle.DatasetIdentifier) {
@ -265,7 +265,7 @@ export class VisibilityRulesService {
}
private resetCompositeFieldFormGroup(formGroup: UntypedFormGroup) {
console.log('resetCompositeFieldFormGroup: ' + formGroup);
//console.log('resetCompositeFieldFormGroup: ' + formGroup);
//TODO: implement this
// (formGroup.get('fields') as UntypedFormArray).controls.forEach((element: UntypedFormGroup) => {
// this.resetFieldFormGroup(element);
@ -285,7 +285,7 @@ export class VisibilityRulesService {
return this._changeMade$.asObservable();
}
public getVisibilityDependency(targetId: string): VisibilityRuleSource[] | null {
console.log('getVisibilityDependency: ' + targetId);
//console.log('getVisibilityDependency: ' + targetId);
return this.visibilityRuleContext.rules.reduce((hasDependency, rule) => {
if (hasDependency) return hasDependency;
@ -323,7 +323,7 @@ export class VisibilityRulesService {
//removes rule that has the specific id either as a source either as a target
public removeAllIdReferences(id: string): void {
console.log('removeAllIdReferences: ' + id);
//console.log('removeAllIdReferences: ' + id);
// * Remove from visibility rues and visibility rules context
@ -376,7 +376,7 @@ export class VisibilityRulesService {
public addNewRule(rule: Rule, currentVisibility = this.DEFAULTVISIBILITY): void {
console.log('addNewRule: ' + rule + ' currentVisibility: ' + currentVisibility);
//console.log('addNewRule: ' + rule + ' currentVisibility: ' + currentVisibility);
const targetId = rule.targetField;
const sourceId = rule.sourceField;
@ -404,7 +404,7 @@ export class VisibilityRulesService {
* return true if no rule found
*/
public checkTargetVisibilityProvidedBySource(sourceId: string, targetId: string): boolean {
console.log('checkTargetVisibilityProvidedBySource: ' + sourceId + ' targetId: ' + targetId);
//console.log('checkTargetVisibilityProvidedBySource: ' + sourceId + ' targetId: ' + targetId);
const computationalMap = this.elementComputationalMap.get(targetId);
if (computationalMap) {
@ -415,13 +415,13 @@ export class VisibilityRulesService {
}
public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] {
console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate);
//console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate);
const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.sections);
return result;
}
public getVisibilityRulesFromDescriptionTempalteSections(sections: DescriptionTemplateSection[]): Rule[] {
console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections);
//console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections);
const result: Rule[] = [];
sections.forEach(section => {
@ -444,7 +444,7 @@ export class VisibilityRulesService {
class MapWithDefault extends Map<string, boolean> {
get(key) {
console.log('MapWithDefault');
//console.log('MapWithDefault');
if (!this.has(key)) {
this.set(key, true);
}

View File

@ -23,7 +23,7 @@
</div>
<div class="col-12 hint">{{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div>
<div class="col-12 basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
</rich-text-editor-component>
</div>
</div>

View File

@ -47,7 +47,7 @@
<div class="row">
<div class="heading2 col-12">{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}} *</div>
<div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" placeholder="{{'DMP-EDITOR.PLACEHOLDER.DESCRIPTION' | translate}}" [required]="true">
<rich-text-editor-component [form]="formGroup.get('description')" placeholder="{{'DMP-EDITOR.PLACEHOLDER.DESCRIPTION' | translate}}" [required]="true">
</rich-text-editor-component>
</div>
</div>
@ -146,7 +146,7 @@
</mat-form-field>
</div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.HTML_TEXT">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
</rich-text-editor-component>
</div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.RESEARCHERS">
@ -216,7 +216,7 @@
<ng-container *ngFor="let control of extraFieldsArray().controls; let extraFieldIndex = index;">
<ng-container [formGroupName]="extraFieldIndex">
<ng-container *ngIf="control.get('id').value === field.id">
<rich-text-editor-component [parentFormGroup]="control" [controlName]="'value'" [placeholder]="field.placeholder" [required]="field.required">
<rich-text-editor-component [form]="control.get('value')" [placeholder]="field.placeholder" [required]="field.required">
</rich-text-editor-component>
</ng-container>
</ng-container>

View File

@ -40,6 +40,8 @@ import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { LockPersist } from '@app/core/model/lock/lock.model';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
@Component({
selector: 'app-dmp-editor',
@ -126,7 +128,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
this.lockStatus = lockStatus;
if (this.item.status === DmpStatus.Finalized || lockStatus) {
this.formGroup.disable();
// this.viewOnly = true;
}
if (lockStatus) {
this.dialog.open(PopupNotificationDialogComponent, {
@ -139,22 +140,16 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
if (!lockStatus && !isNullOrUndefined(this.authService.currentAccountIsAuthenticated())) {
// TODO: lock it.
// const lockedBy: UserInfoListingModel = {
// email: this.authService.getUserProfileEmail(),
// id: this.authService.userId()?.toString(),
// name: this.authService.getPrincipalName(),
// role: 0 //TODO
// //role: this.authService.getRoles()?.at(0)
// const lockPersist: LockPersist = {
// target: itemId,
// targetType: LockTargetType.Dmp,
// lockedBy: this.authService.userId()
// }
// this.lock = new LockModel(data.id, lockedBy);
// this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => {
// this.lockService.persist(lockPersist).pipe(takeUntil(this._destroyed)).subscribe(async result => {
// this.lock.id = Guid.parse(result);
// interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock());
// });
}
// this.loadDescriptionProfiles();
// this.registerFormListeners();
});
}
});

View File

@ -23,7 +23,7 @@
</div>
<div class="col-12 hint">{{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div>
<div class="col-12 basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
</rich-text-editor-component>
</div>
</div>

View File

@ -1042,7 +1042,8 @@
"TAGS-PLACEHOLDER": "New Tag...",
"DESCRIPTION-HINT": "Briefly describe the context and purpose of the Description",
"DESCRIPTION-TEMPLATE": "Template",
"DESCRIPTION-TEMPLATE-PLACEHOLDER": "Description Template"
"DESCRIPTION-TEMPLATE-PLACEHOLDER": "Description Template",
"DESCRIPTION-TEMPLATE-VERSION": "Version"
}
},
"ACTIONS": {