make description reference persist and ui fixes
This commit is contained in:
parent
8206602387
commit
7ec9c0b3c6
|
@ -134,4 +134,14 @@ public class ErrorThesaurusProperties {
|
|||
public void setDmpBlueprintHasNoDescriptionTemplates(ErrorDescription dmpBlueprintHasNoDescriptionTemplates) {
|
||||
this.dmpBlueprintHasNoDescriptionTemplates = dmpBlueprintHasNoDescriptionTemplates;
|
||||
}
|
||||
|
||||
private ErrorDescription dmpDescriptionTemplateCanNotRemove;
|
||||
|
||||
public ErrorDescription getDmpDescriptionTemplateCanNotRemove() {
|
||||
return dmpDescriptionTemplateCanNotRemove;
|
||||
}
|
||||
|
||||
public void setDmpDescriptionTemplateCanNotRemove(ErrorDescription dmpDescriptionTemplateCanNotRemove) {
|
||||
this.dmpDescriptionTemplateCanNotRemove = dmpDescriptionTemplateCanNotRemove;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DescriptionReferenceDataCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDescriptionReference);
|
||||
this.authService.authorizeForce(Permission.BrowseDescriptionReference, Permission.DeferredAffiliation);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -203,12 +203,12 @@ public class DescriptionPersist {
|
|||
this.spec()
|
||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||
.must(() -> !this.isNull(item.getProperties()))
|
||||
.failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())),
|
||||
this.refSpec()
|
||||
.iff(() -> !this.isNull(item.getProperties()))
|
||||
.on(DescriptionPersist._properties)
|
||||
.over(item.getProperties())
|
||||
.using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition))
|
||||
.failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale()))
|
||||
// this.refSpec()
|
||||
// .iff(() -> !this.isNull(item.getProperties()))
|
||||
// .on(DescriptionPersist._properties)
|
||||
// .over(item.getProperties())
|
||||
// .using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition))
|
||||
// this.navSpec()
|
||||
// .iff(() -> !this.isNull(item.getTags()))
|
||||
// .on(DescriptionPersist._tags)
|
||||
|
|
|
@ -32,6 +32,9 @@ public class FieldPersist {
|
|||
private List<ReferencePersist> references;
|
||||
public static final String _references = "references";
|
||||
|
||||
private ReferencePersist reference;
|
||||
public static final String _reference = "reference";
|
||||
|
||||
private ExternalIdentifierPersist externalIdentifier;
|
||||
public static final String _externalIdentifier = "externalIdentifier";
|
||||
|
||||
|
@ -67,6 +70,14 @@ public class FieldPersist {
|
|||
this.references = references;
|
||||
}
|
||||
|
||||
public ReferencePersist getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(ReferencePersist reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public ExternalIdentifierPersist getExternalIdentifier() {
|
||||
return externalIdentifier;
|
||||
}
|
||||
|
@ -138,6 +149,11 @@ public class FieldPersist {
|
|||
.on(FieldPersist._references)
|
||||
.over(item.getReferences())
|
||||
.using((itm) -> this.validatorFactory.validator(ReferencePersist.ReferencePersistValidator.class)),
|
||||
this.refSpec()
|
||||
.iff(() -> FieldType.isReferenceType(fieldType) && !this.isNull(item.getReference()))
|
||||
.on(FieldPersist._reference)
|
||||
.over(item.getReference())
|
||||
.using(() -> this.validatorFactory.validator(ReferencePersist.ReferencePersistValidator.class)),
|
||||
this.refSpec()
|
||||
.iff(() -> FieldType.isExternalIdentifierType(fieldType) && !this.isNull(item.getExternalIdentifier()))
|
||||
.on(FieldPersist._externalIdentifier)
|
||||
|
|
|
@ -218,6 +218,7 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
|||
else if (item.prefix(DescriptionReference._reference)) return DescriptionReferenceEntity._referenceId;
|
||||
else if (item.match(DescriptionReference._createdAt)) return DescriptionReferenceEntity._createdAt;
|
||||
else if (item.match(DescriptionReference._updatedAt)) return DescriptionReferenceEntity._updatedAt;
|
||||
else if (item.prefix(DescriptionReference._data)) return DescriptionReferenceEntity._data;
|
||||
else if (item.match(DescriptionReference._hash)) return DescriptionReferenceEntity._updatedAt;
|
||||
else if (item.match(DescriptionReference._isActive)) return DescriptionReferenceEntity._isActive;
|
||||
else return null;
|
||||
|
@ -231,6 +232,7 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
|||
item.setReferenceId(QueryBase.convertSafe(tuple, columns, DescriptionReferenceEntity._referenceId, UUID.class));
|
||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DescriptionReferenceEntity._createdAt, Instant.class));
|
||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DescriptionReferenceEntity._updatedAt, Instant.class));
|
||||
item.setData(QueryBase.convertSafe(tuple, columns, DescriptionReferenceEntity._data, String.class));
|
||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, DescriptionReferenceEntity._isActive, IsActive.class));
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -502,7 +502,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
List<DescriptionReferencePersist> descriptionReferencePersists = new ArrayList<>();
|
||||
if (persist.getFieldSets() != null && !persist.getFieldSets().isEmpty()){
|
||||
for (PropertyDefinitionFieldSetPersist propertyDefinitionFieldSetPersist: persist.getFieldSets().values()) {
|
||||
if (this.conventionService.isListNullOrEmpty( propertyDefinitionFieldSetPersist.getItems())) {
|
||||
if (!this.conventionService.isListNullOrEmpty( propertyDefinitionFieldSetPersist.getItems())) {
|
||||
for (PropertyDefinitionFieldSetItemPersist definitionFieldSetItemPersist : propertyDefinitionFieldSetPersist.getItems()) {
|
||||
if (definitionFieldSetItemPersist.getFields() != null && !definitionFieldSetItemPersist.getFields().isEmpty()) {
|
||||
for (String key : definitionFieldSetItemPersist.getFields().keySet()) {
|
||||
|
@ -518,7 +518,8 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
}
|
||||
|
||||
private void BuildDescriptionReferencePersist(String fieldId, FieldPersist fieldPersist, List<DescriptionReferencePersist> descriptionReferencePersists) {
|
||||
if (this.conventionService.isListNullOrEmpty(fieldPersist.getReferences())) {
|
||||
if (fieldPersist.getReference() != null) fieldPersist.getReferences().add(fieldPersist.getReference());
|
||||
if (!this.conventionService.isListNullOrEmpty(fieldPersist.getReferences())) {
|
||||
for (ReferencePersist referencePersist : fieldPersist.getReferences()) {
|
||||
DescriptionReferencePersist descriptionReferencePersist = new DescriptionReferencePersist();
|
||||
descriptionReferencePersist.setData(new DescriptionReferenceDataPersist());
|
||||
|
|
|
@ -188,6 +188,8 @@ public class DmpServiceImpl implements DmpService {
|
|||
|
||||
this.patchAndSaveReferences(this.buildDmpReferencePersists(model.getProperties()), data.getId(), definition);
|
||||
|
||||
if (isUpdate) this.checkIfDescriptionTemplateIsUse(model.getDescriptionTemplates(), model.getId());
|
||||
|
||||
this.patchAndSaveTemplates(data.getId(), model.getDescriptionTemplates());
|
||||
|
||||
if (!isUpdate && userScope.isSet()) {
|
||||
|
@ -210,6 +212,17 @@ public class DmpServiceImpl implements DmpService {
|
|||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||
}
|
||||
|
||||
private void checkIfDescriptionTemplateIsUse (List<DmpDescriptionTemplatePersist> descriptionTemplates, UUID id){
|
||||
List<DmpDescriptionTemplateEntity> existingDmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(id).isActive(IsActive.Active).collect();
|
||||
|
||||
List<DmpDescriptionTemplateEntity> removedDescriptionTemplates = existingDmpDescriptionTemplates.stream().filter(x -> descriptionTemplates.stream().noneMatch(y -> y.getDescriptionTemplateGroupId().equals(x.getDescriptionTemplateGroupId()))).collect(Collectors.toList());
|
||||
DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).isActive(IsActive.Active).dmpIds(id).descriptionTemplateGroupIds(removedDescriptionTemplates.stream().map(x -> x.getDescriptionTemplateGroupId()).collect(Collectors.toList()));
|
||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpDescriptionTemplateSubQuery(dmpDescriptionTemplateQuery).isActive(IsActive.Active);
|
||||
|
||||
if (query != null && query.count() > 0) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotRemove().getCode(), this.errors.getDmpDescriptionTemplateCanNotRemove().getMessage());
|
||||
|
||||
}
|
||||
|
||||
private DmpUserPersist createOwnerPersist() {
|
||||
DmpUserPersist persist = new DmpUserPersist();
|
||||
persist.setRole(DmpUserRole.Owner);
|
||||
|
|
|
@ -43,6 +43,7 @@ public class Field {
|
|||
tempTextListValue = persist.getTextListValue();
|
||||
if (persist.getExternalIdentifier() != null) this.externalIdentifier = new ExternalIdentifier(persist.getExternalIdentifier());
|
||||
else this.externalIdentifier = null;
|
||||
if (persist.getReference() != null) persist.getReferences().add(persist.getReference());
|
||||
if (persist.getReferences() != null && !persist.getReferences().isEmpty()){
|
||||
tempTextListValue = persist.getReferences().stream().filter(x-> x.getId() != null).map(x-> x.getId().toString()).toList();
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class LockController {
|
|||
|
||||
@DeleteMapping("{id}/{target}")
|
||||
@Transactional
|
||||
public void delete(@PathVariable("id") UUID id, @PathVariable("id") UUID target) throws MyForbiddenException, InvalidApplicationException {
|
||||
public void delete(@PathVariable("id") UUID id, @PathVariable("target") UUID target) throws MyForbiddenException, InvalidApplicationException {
|
||||
logger.debug(new MapLogEntry("retrieving" + Lock.class.getSimpleName()).And("id", id));
|
||||
|
||||
this.lockService.deleteAndSave(id, target);
|
||||
|
|
|
@ -53,3 +53,6 @@ error-thesaurus:
|
|||
dmp-blueprint-new-version-conflict:
|
||||
code: 121
|
||||
message: version to update not the latest
|
||||
dmp-description-template-can-not-remove:
|
||||
code: 122
|
||||
message: Can not remove description template that is already in use.
|
||||
|
|
|
@ -43,8 +43,8 @@ export class LockService {
|
|||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
delete(id: Guid): Observable<Lock> {
|
||||
const url = `${this.apiBase}/${id}`;
|
||||
delete(id: Guid, target: Guid): Observable<Lock> {
|
||||
const url = `${this.apiBase}/${id}/${target}`;
|
||||
|
||||
return this.http
|
||||
.delete<Lock>(url).pipe(
|
||||
|
|
|
@ -16,6 +16,7 @@ import { nameof } from 'ts-simple-nameof';
|
|||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
|
||||
@Injectable()
|
||||
export class ReferenceService {
|
||||
|
@ -150,6 +151,7 @@ export class ReferenceService {
|
|||
nameof<Reference>(x => x.hash),
|
||||
nameof<Reference>(x => x.label),
|
||||
nameof<Reference>(x => x.type),
|
||||
[nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||
nameof<Reference>(x => x.description),
|
||||
[nameof<Reference>(x => x.definition), nameof<Definition>(x => x.fields), nameof<Field>(x => x.code)].join('.'),
|
||||
[nameof<Reference>(x => x.definition), nameof<Definition>(x => x.fields), nameof<Field>(x => x.dataType)].join('.'),
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<mat-icon>more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item (click)="deleteType(row.id)">
|
||||
<button mat-menu-item (click)="deleteType(row.id, row.target)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
{{'LOCK-LISTING.ACTIONS.DELETE' | translate}}
|
||||
</button>
|
||||
|
|
|
@ -147,7 +147,7 @@ export class LockListingComponent extends BaseListingComponent<Lock, LockLookup>
|
|||
return this.lockService.query(this.lookup);
|
||||
}
|
||||
|
||||
public deleteType(id: Guid) {
|
||||
public deleteType(id: Guid, target: Guid) {
|
||||
if (id) {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
|
@ -159,7 +159,7 @@ export class LockListingComponent extends BaseListingComponent<Lock, LockLookup>
|
|||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.lockService.delete(id).pipe(takeUntil(this._destroyed))
|
||||
this.lockService.delete(id, target).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
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';
|
||||
|
@ -26,10 +27,10 @@ export class DescriptionBaseFieldsEditorComponent extends BaseComponent {
|
|||
) { super(); }
|
||||
|
||||
ngOnInit() {
|
||||
const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.description.dmpDescriptionTemplate.sectionId);
|
||||
const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.description.dmpDescriptionTemplate.sectionId && x.isActive == IsActive.Active);
|
||||
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) {
|
||||
if (this.description.descriptionTemplate && currentVersionsOfDescriptionTemplates.find(x => x.id == this.description?.descriptionTemplate?.id) == null) {
|
||||
this.availableDescriptionTemplates.push(this.description.descriptionTemplate)
|
||||
}
|
||||
this.availableDescriptionTemplates.push(...currentVersionsOfDescriptionTemplates);
|
||||
|
|
|
@ -414,7 +414,7 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
|
|||
textValue: string;
|
||||
textListValue: string[];
|
||||
dateValue: Date;
|
||||
references: ReferencePersist[];
|
||||
references: ReferencePersist[] = [];
|
||||
reference: ReferencePersist;
|
||||
externalIdentifier?: DescriptionExternalIdentifierEditorModel = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel);
|
||||
|
||||
|
@ -429,9 +429,26 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
|
|||
this.textValue = item.textValue;
|
||||
this.textListValue = item.textListValue;
|
||||
this.dateValue = item.dateValue;
|
||||
//TODO: refactor reference type
|
||||
// this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => x.reference);
|
||||
|
||||
// this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference;
|
||||
if(descriptionReferences){
|
||||
descriptionReferences.forEach(descriptionReference => {
|
||||
if(descriptionReference.data.fieldId == descriptionTemplateField?.id && descriptionReference.isActive == IsActive.Active){
|
||||
this.references.push({
|
||||
id: descriptionReference.reference.id,
|
||||
label: descriptionReference.reference.label,
|
||||
reference: descriptionReference.reference.reference,
|
||||
source: descriptionReference.reference.source,
|
||||
typeId: null,
|
||||
description: descriptionReference.reference.source,
|
||||
definition: descriptionReference.reference.definition,
|
||||
abbreviation: descriptionReference.reference.abbreviation,
|
||||
sourceType: descriptionReference.reference.sourceType
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier);
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
|||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template';
|
||||
import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionTag } from '@app/core/model/description/description';
|
||||
import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionReferenceData, DescriptionTag } 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';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
|
@ -57,6 +57,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
|||
|
||||
[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.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
|
||||
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.comment)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.ordinal)].join('.'),
|
||||
|
@ -65,14 +66,24 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
|||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.dateValue)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.externalIdentifier), nameof<DescriptionExternalIdentifier>(x => x.identifier)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.externalIdentifier), nameof<DescriptionExternalIdentifier>(x => x.type)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.references), nameof<Reference>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.references), nameof<Reference>(x => x.label)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.references), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.references), nameof<Reference>(x => x.reference)].join('.'),
|
||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.references), nameof<Reference>(x => x.isActive)].join('.'),
|
||||
|
||||
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'),
|
||||
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'),
|
||||
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.data), nameof<DescriptionReferenceData>(x => x.fieldId)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.sourceType)].join('.'),
|
||||
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.isActive)].join('.'),
|
||||
|
||||
nameof<Description>(x => x.createdAt),
|
||||
nameof<Description>(x => x.hash),
|
||||
nameof<Description>(x => x.isActive)
|
||||
|
@ -85,6 +96,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
|||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.label)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.version)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.groupId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.isActive)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),
|
||||
|
@ -147,6 +159,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
|||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.version)].join('.'),
|
||||
|
|
|
@ -46,10 +46,10 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
|
|||
|
||||
item.blueprint.definition.sections.forEach(section => {
|
||||
if (section.hasTemplates) {
|
||||
const sectionTempaltesFromDmp = item.dmpDescriptionTemplates?.filter(x => x.sectionId == section.id) || [];
|
||||
const sectionTempaltesFromDmp = item.dmpDescriptionTemplates?.filter(x => x.sectionId == section.id && x.isActive == IsActive.Active) || [];
|
||||
|
||||
if (sectionTempaltesFromDmp.length > 0) {
|
||||
item.dmpDescriptionTemplates?.filter(x => x.sectionId == section.id).forEach(dmpDescriptionTemplate => {
|
||||
sectionTempaltesFromDmp?.filter(x => x.sectionId == section.id).forEach(dmpDescriptionTemplate => {
|
||||
this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(
|
||||
{
|
||||
sectionId: section.id,
|
||||
|
@ -57,7 +57,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
|
|||
}));
|
||||
});
|
||||
} else if (section.descriptionTemplates?.length > 0) {
|
||||
section.descriptionTemplates.forEach(blueprintDefinedDescriptionTemplate => {
|
||||
sectionTempaltesFromDmp.forEach(blueprintDefinedDescriptionTemplate => {
|
||||
this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(
|
||||
{
|
||||
sectionId: section.id,
|
||||
|
@ -297,7 +297,7 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist {
|
|||
// TODO check typeId field
|
||||
if(dmpReferences){
|
||||
dmpReferences.forEach(dmpReference => {
|
||||
if(dmpReference.data.blueprintFieldId == this.fieldId){
|
||||
if(dmpReference.data.blueprintFieldId == this.fieldId && dmpReference.isActive == IsActive.Active){
|
||||
this.references.push({
|
||||
data: dmpReference.data,
|
||||
reference: {
|
||||
|
|
|
@ -82,6 +82,7 @@ export class DmpEditorResolver extends BaseEditorResolver {
|
|||
|
||||
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
||||
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
|
||||
|
||||
|
||||
// nameof<Dmp>(x => x.id),
|
||||
|
|
Loading…
Reference in New Issue