some frontend changes for reference type refactor
This commit is contained in:
parent
80096e9164
commit
9f5002802b
|
@ -95,7 +95,7 @@ public class ReferenceController {
|
|||
|
||||
|
||||
@PostMapping("search")
|
||||
public List<Reference> searchReferenceWithDefinition(@RequestBody ReferenceDefinitionSearchLookup lookup) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException {
|
||||
public List<Reference> search(@RequestBody ReferenceDefinitionSearchLookup lookup) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException {
|
||||
logger.debug("search with db definition {}", Reference.class.getSimpleName());
|
||||
|
||||
this.censorFactory.censor(ReferenceCensor.class).censor(lookup.getProject(), null);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
export enum DescriptionTemplateFieldType {
|
||||
EXTERNAL_SELECT = "externalSelect",
|
||||
SELECT = "select",
|
||||
BOOLEAN_DECISION = "booleanDecision",
|
||||
RADIO_BOX = "radiobox",
|
||||
INTERNAL_DMP_ENTRIES = "internalDmpEntities", //Delete
|
||||
INTERNAL_DMP_ENTRIES_RESEARCHERS = "internalDmpResearchers",
|
||||
INTERNAL_DMP_ENTRIES_DMPS = "internalDmpDmps",
|
||||
INTERNAL_ENTRIES_DESCRIPTIONS = "internalDmpDescriptions",
|
||||
CHECK_BOX = "checkBox",
|
||||
|
@ -14,18 +11,23 @@ export enum DescriptionTemplateFieldType {
|
|||
UPLOAD = "upload",
|
||||
DATE_PICKER = "datePicker",
|
||||
EXTERNAL_DATASETS = "externalDatasets",
|
||||
DATA_REPOSITORIES = "dataRepositories",
|
||||
JOURNAL_REPOSITORIES = "journalRepositories",
|
||||
PUB_REPOSITORIES = "pubRepositories",
|
||||
LICENSES = "licenses",
|
||||
TAXONOMIES = "taxonomies",
|
||||
PUBLICATIONS = "publications",
|
||||
REGISTRIES = "registries",
|
||||
SERVICES = "services",
|
||||
REFERENCE_TYPES = "referenceTypes",
|
||||
TAGS = "tags",
|
||||
RESEARCHERS = "researchers",
|
||||
ORGANIZATIONS = "organizations",
|
||||
DATASET_IDENTIFIER = "datasetIdentifier",
|
||||
CURRENCY = "currency",
|
||||
VALIDATION = "validation"
|
||||
|
||||
//EXTERNAL_SELECT = "externalSelect",
|
||||
// INTERNAL_DMP_ENTRIES_RESEARCHERS = "internalDmpResearchers",
|
||||
// DATA_REPOSITORIES = "dataRepositories",
|
||||
// JOURNAL_REPOSITORIES = "journalRepositories",
|
||||
// PUB_REPOSITORIES = "pubRepositories",
|
||||
// LICENSES = "licenses",
|
||||
// TAXONOMIES = "taxonomies",
|
||||
// PUBLICATIONS = "publications",
|
||||
// REGISTRIES = "registries",
|
||||
// SERVICES = "services",
|
||||
|
||||
// RESEARCHERS = "researchers",
|
||||
// ORGANIZATIONS = "organizations",
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
export enum DmpBlueprintFieldCategory {
|
||||
System = 0,
|
||||
Extra = 1,
|
||||
ReferenceType = 2
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
export enum DmpBlueprintSectionFieldCategory {
|
||||
SYSTEM = 0,
|
||||
EXTRA = 1
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
export enum DmpBlueprintSystemFieldType {
|
||||
TEXT = 0,
|
||||
HTML_TEXT = 1,
|
||||
RESEARCHERS = 2,
|
||||
ORGANIZATIONS = 3,
|
||||
LANGUAGE = 4,
|
||||
CONTACT = 5,
|
||||
FUNDER = 6,
|
||||
GRANT = 7,
|
||||
PROJECT = 8,
|
||||
LICENSE = 9,
|
||||
ACCESS_RIGHTS = 10
|
||||
Title = 0,
|
||||
Description = 1,
|
||||
// RESEARCHERS = 2,
|
||||
// ORGANIZATIONS = 3,
|
||||
Language = 2,
|
||||
Contact = 3,
|
||||
// FUNDER = 6,
|
||||
// GRANT = 7,
|
||||
// PROJECT = 8,
|
||||
// LICENSE = 9,
|
||||
AccessRights = 4
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
export enum ReferenceType {
|
||||
Taxonomies = 0,
|
||||
Licenses = 1,
|
||||
Publications = 2,
|
||||
Journals = 3,
|
||||
PubRepositories = 4,
|
||||
DataRepositories = 5,
|
||||
Registries = 6,
|
||||
Services = 7,
|
||||
Project = 8,
|
||||
Funder = 9,
|
||||
Datasets = 10,
|
||||
Organizations = 11,
|
||||
Grants = 12,
|
||||
Researcher = 13
|
||||
}
|
|
@ -101,12 +101,12 @@ export interface DescriptionTemplateBaseFieldDataPersist {
|
|||
// Field Types
|
||||
//
|
||||
|
||||
export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
|
||||
type: DescriptionTemplateFieldDataExternalDatasetType;
|
||||
export interface DescriptionTemplateReferenceTypeFieldPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
|
||||
referenceTypeId: Guid;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
|
||||
sources: DescriptionTemplateExternalSelectSourcePersist[];
|
||||
export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
|
||||
type: DescriptionTemplateFieldDataExternalDatasetType;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateLabelAndMultiplicityDataPersist extends DescriptionTemplateBaseFieldDataPersist {
|
||||
|
@ -132,34 +132,11 @@ export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplat
|
|||
//
|
||||
// Others
|
||||
//
|
||||
export interface DescriptionTemplateExternalSelectSourcePersist {
|
||||
url: string;
|
||||
method: string;
|
||||
optionsRoot: string;
|
||||
sourceBinding: DescriptionTemplateExternalSelectSourceBindingPersist;
|
||||
hasAuth: boolean;
|
||||
auth: DescriptionTemplateExternalSelectAuthDataPersist
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectAuthDataPersist {
|
||||
url: string;
|
||||
method: string;
|
||||
body: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateSelectOptionPersist {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectSourceBindingPersist {
|
||||
label: string;
|
||||
value: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateRadioBoxOptionPersist {
|
||||
label: string;
|
||||
value: string;
|
||||
|
|
|
@ -107,8 +107,8 @@ export interface DescriptionTemplateExternalDatasetData extends DescriptionTempl
|
|||
type?: DescriptionTemplateFieldDataExternalDatasetType;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectData extends DescriptionTemplateLabelAndMultiplicityData {
|
||||
sources: DescriptionTemplateExternalSelectSource[];
|
||||
export interface DescriptionTemplateReferenceTypeData extends DescriptionTemplateLabelAndMultiplicityData {
|
||||
referenceTypeId?: Guid;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData {
|
||||
|
@ -128,28 +128,6 @@ export interface DescriptionTemplateUploadData extends DescriptionTemplateBaseFi
|
|||
//
|
||||
// Others
|
||||
//
|
||||
export interface DescriptionTemplateExternalSelectSource {
|
||||
url: string;
|
||||
method: string;
|
||||
optionsRoot: string;
|
||||
sourceBinding: DescriptionTemplateExternalSelectSourceBinding;
|
||||
hasAuth: boolean;
|
||||
auth: DescriptionTemplateExternalSelectAuthData
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectAuthData {
|
||||
url: string;
|
||||
method: string;
|
||||
body: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateExternalSelectSourceBinding {
|
||||
label: string;
|
||||
value: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface DescriptionTemplateSelectOption {
|
||||
label: string;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { DmpBlueprintFieldCategory } from "@app/core/common/enum/dmp-blueprint-field-category";
|
||||
import { DmpBlueprintExtraFieldDataType } from "@app/core/common/enum/dmp-blueprint-field-type";
|
||||
import { DmpBlueprintSectionFieldCategory } from "@app/core/common/enum/dmp-blueprint-section-field-category";
|
||||
import { DmpBlueprintStatus } from "@app/core/common/enum/dmp-blueprint-status";
|
||||
import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/dmp-blueprint-system-field-type";
|
||||
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
||||
import { Guid } from "@common/types/guid";
|
||||
import { ReferenceType } from "../reference-type/reference-type";
|
||||
|
||||
|
||||
export interface DmpBlueprint extends BaseEntity {
|
||||
|
@ -38,9 +39,7 @@ export interface DescriptionTemplatesInSection {
|
|||
|
||||
export interface FieldInSection {
|
||||
id: Guid;
|
||||
category: DmpBlueprintSectionFieldCategory;
|
||||
dataType: DmpBlueprintExtraFieldDataType;
|
||||
systemFieldType: DmpBlueprintSystemFieldType;
|
||||
category: DmpBlueprintFieldCategory;
|
||||
label: string;
|
||||
placeholder: string;
|
||||
description: string;
|
||||
|
@ -48,6 +47,18 @@ export interface FieldInSection {
|
|||
ordinal: number;
|
||||
}
|
||||
|
||||
export interface SystemFieldInSection extends FieldInSection {
|
||||
systemFieldType: DmpBlueprintSystemFieldType;
|
||||
}
|
||||
|
||||
export interface ExtraFieldInSection extends FieldInSection {
|
||||
dataType: DmpBlueprintExtraFieldDataType;
|
||||
}
|
||||
|
||||
export interface ReferenceTypeFieldInSection extends FieldInSection {
|
||||
referenceType: ReferenceType;
|
||||
}
|
||||
|
||||
//
|
||||
// Persist
|
||||
//
|
||||
|
@ -86,12 +97,22 @@ export interface DescriptionTemplatesInSectionPersist {
|
|||
|
||||
export interface FieldInSectionPersist {
|
||||
id: Guid;
|
||||
category: DmpBlueprintSectionFieldCategory;
|
||||
dataType: DmpBlueprintExtraFieldDataType;
|
||||
systemFieldType: DmpBlueprintSystemFieldType;
|
||||
category: DmpBlueprintFieldCategory;
|
||||
label: string;
|
||||
placeholder: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
ordinal: number;
|
||||
}
|
||||
|
||||
export interface SystemFieldInSectionPersist extends FieldInSectionPersist {
|
||||
systemFieldType: DmpBlueprintSystemFieldType;
|
||||
}
|
||||
|
||||
export interface ExtraFieldInSectionPersist extends FieldInSectionPersist {
|
||||
dataType: DmpBlueprintExtraFieldDataType;
|
||||
}
|
||||
|
||||
export interface ReferenceTypeFieldInSectionPersist extends FieldInSectionPersist {
|
||||
referenceTypeId: Guid;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
import { ReferenceFieldDataType } from "@app/core/common/enum/reference-field-data-type";
|
||||
import { ReferenceSourceType } from "@app/core/common/enum/reference-source-type";
|
||||
import { ReferenceType } from "@app/core/common/enum/reference-type";
|
||||
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
||||
import { ReferenceType } from "../reference-type/reference-type";
|
||||
import { Guid } from "@common/types/guid";
|
||||
|
||||
export interface Reference extends BaseEntity {
|
||||
label: string;
|
||||
|
@ -47,7 +48,7 @@ export interface FetcherReference {
|
|||
|
||||
export interface ReferencePersist extends BaseEntityPersist {
|
||||
label: string;
|
||||
type: ReferenceType;
|
||||
typeId: Guid;
|
||||
description: string;
|
||||
definition: DefinitionPersist;
|
||||
reference: string;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { DatePipe } from "@angular/common";
|
||||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
import { DescriptionTemplateFieldType } from "../common/enum/description-template-field-type";
|
||||
import { Reference } from "../model/reference/reference";
|
||||
|
||||
@Pipe({
|
||||
name: 'fieldValue'
|
||||
|
@ -33,7 +34,6 @@ export class FieldValuePipe implements PipeTransform {
|
|||
return this.date.transform(controlValue.value, 'dd/MM/yyyy');
|
||||
case DescriptionTemplateFieldType.FREE_TEXT:
|
||||
return value;
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
|
||||
case DescriptionTemplateFieldType.SELECT:
|
||||
if (value && controlValue.data.options && !controlValue.data.multipleSelect) {
|
||||
return controlValue.data.options.find(option => value == option.value).label;
|
||||
|
@ -48,20 +48,11 @@ export class FieldValuePipe implements PipeTransform {
|
|||
break;
|
||||
case DescriptionTemplateFieldType.TEXT_AREA:
|
||||
return value;
|
||||
case DescriptionTemplateFieldType.REGISTRIES:
|
||||
case DescriptionTemplateFieldType.SERVICES:
|
||||
case DescriptionTemplateFieldType.RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS:
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES:
|
||||
return (value as Reference)?.label;
|
||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.TAXONOMIES:
|
||||
case DescriptionTemplateFieldType.LICENSES:
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS:
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
return this.parseJson(value);
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||
return this.parseJson(value, 'label');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Lookup } from "@common/model/lookup";
|
||||
import { RecentActivityOrder } from "../common/enum/recent-activity-order";
|
||||
import { ReferenceType } from "../common/enum/reference-type";
|
||||
|
||||
export class RecentActivityItemLookup implements RecentActivityItemFilter {
|
||||
like: string;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { Lookup } from "@common/model/lookup";
|
||||
import { ReferenceType } from "../common/enum/reference-type";
|
||||
import { Guid } from "@common/types/guid";
|
||||
|
||||
export class ReferenceSearchLookup extends Lookup{
|
||||
export class ReferenceSearchLookup extends Lookup {
|
||||
like: string;
|
||||
type: ReferenceType;
|
||||
referenceTypeId: Guid;
|
||||
key: string;
|
||||
|
||||
constructor() {
|
||||
|
@ -13,7 +12,7 @@ export class ReferenceSearchLookup extends Lookup{
|
|||
}
|
||||
|
||||
|
||||
export class ReferenceSearchDefinitionLookup extends Lookup{
|
||||
export class ReferenceSearchDefinitionLookup extends Lookup {
|
||||
like: string;
|
||||
referenceTypeId: Guid;
|
||||
key: string;
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Lookup } from '@common/model/lookup';
|
|||
import { Guid } from '@common/types/guid';
|
||||
import { IsActive } from '../common/enum/is-active.enum';
|
||||
import { ReferenceSourceType } from '../common/enum/reference-source-type';
|
||||
import { ReferenceType } from '../common/enum/reference-type';
|
||||
|
||||
export class ReferenceLookup extends Lookup implements ReferenceFilter {
|
||||
ids: Guid[];
|
||||
|
@ -10,7 +9,7 @@ export class ReferenceLookup extends Lookup implements ReferenceFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
sourceTypes: ReferenceSourceType[];
|
||||
types: ReferenceType[];
|
||||
typeIds: Guid[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -23,5 +22,5 @@ export interface ReferenceFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
sourceTypes: ReferenceSourceType[];
|
||||
types: ReferenceType[];
|
||||
typeIds: Guid[];
|
||||
}
|
||||
|
|
|
@ -129,4 +129,12 @@ export class ReferenceTypeService {
|
|||
|
||||
return fields;
|
||||
}
|
||||
|
||||
public getResearcherReferenceType(): Guid {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getGrantReferenceType(): Guid {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
||||
import { Definition, Field, Reference, ReferencePersist } from '@app/core/model/reference/reference';
|
||||
import { ReferenceSearchDefinitionLookup, ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
|
||||
|
@ -36,13 +35,13 @@ export class ReferenceService {
|
|||
return this.http.post<QueryResult<Reference>>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
search(q: ReferenceSearchLookup): Observable<Reference[]> {
|
||||
const url = `${this.apiBase}/search`;
|
||||
return this.http.post<Reference[]>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
}
|
||||
// search(q: ReferenceSearchLookup): Observable<Reference[]> {
|
||||
// const url = `${this.apiBase}/search`;
|
||||
// return this.http.post<Reference[]>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
// }
|
||||
|
||||
searchWithDefinition(q: ReferenceSearchDefinitionLookup): Observable<Reference[]> {
|
||||
const url = `${this.apiBase}/search-with-db-definition`;
|
||||
const url = `${this.apiBase}/search`;
|
||||
return this.http.post<Reference[]>(url, q).pipe(catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
|
@ -74,29 +73,29 @@ export class ReferenceService {
|
|||
//
|
||||
// Autocomplete Commons - Query
|
||||
//
|
||||
public getSingleAutocompleteQueryConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
|
||||
public getSingleAutocompleteQueryConfiguration(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (data?: any) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes, searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
initialItems: (data?: any) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes, searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
valueAssign: (item: Reference) => item.id,
|
||||
};
|
||||
};
|
||||
|
||||
public getMultipleAutoCompleteQueryConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
|
||||
public getMultipleAutoCompleteQueryConfiguration(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteQueryLookup(types, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)),
|
||||
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteQueryLookup(referenceTypeIds, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
valueAssign: (item: Reference) => item.id,
|
||||
};
|
||||
}
|
||||
|
||||
private buildAutocompleteQueryLookup(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
private buildAutocompleteQueryLookup(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
const lookup: ReferenceLookup = new ReferenceLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||
|
@ -108,7 +107,7 @@ export class ReferenceService {
|
|||
nameof<Reference>(x => x.label),
|
||||
]
|
||||
};
|
||||
if (types && types.length > 0) { lookup.types = types; }
|
||||
if (referenceTypeIds && referenceTypeIds.length > 0) { lookup.typeIds = referenceTypeIds; }
|
||||
if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; }
|
||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||
|
@ -118,22 +117,22 @@ export class ReferenceService {
|
|||
//
|
||||
// Autocomplete Commons - Search
|
||||
//
|
||||
public getSingleAutocompleteSearchConfiguration(type: ReferenceType): SingleAutoCompleteConfiguration {
|
||||
public getSingleAutocompleteSearchConfiguration(typeId: Guid): SingleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (data?: any) => this.search(this.buildAutocompleteSearchLookup(type)).pipe(map(x => x)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.search(this.buildAutocompleteSearchLookup(type, searchQuery)).pipe(map(x => x)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([type], null, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
initialItems: (data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId)).pipe(map(x => x)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([typeId], null, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
valueAssign: (item: Reference) => item.id,
|
||||
};
|
||||
};
|
||||
|
||||
public getMultipleAutoCompleteSearchConfiguration(type: ReferenceType): MultipleAutoCompleteConfiguration {
|
||||
public getMultipleAutoCompleteSearchConfiguration(typeId: Guid): MultipleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (excludedItems: any[], data?: any) => this.search(this.buildAutocompleteSearchLookup(type, null)).pipe(map(x => x)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.search(this.buildAutocompleteSearchLookup(type, searchQuery)).pipe(map(x => x)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([type], null, null, null, selectedItems?.map(x => x.id))).pipe(map(x => x.items)),
|
||||
initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, null)).pipe(map(x => x)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([typeId], null, null, null, selectedItems?.map(x => x.id))).pipe(map(x => x.items)),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
|
||||
|
@ -142,7 +141,7 @@ export class ReferenceService {
|
|||
};
|
||||
}
|
||||
|
||||
private buildAutocompleteSearchLookup(type: ReferenceType, like?: string): ReferenceSearchLookup {
|
||||
private buildAutocompleteSearchLookup(typeId: Guid, like?: string): ReferenceSearchLookup {
|
||||
const lookup: ReferenceSearchLookup = new ReferenceSearchLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
lookup.project = {
|
||||
|
@ -161,13 +160,13 @@ export class ReferenceService {
|
|||
nameof<Reference>(x => x.sourceType),
|
||||
]
|
||||
};
|
||||
lookup.type = type;
|
||||
lookup.referenceTypeId = typeId;
|
||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||
return lookup;
|
||||
}
|
||||
|
||||
private buildAutocompleteSearchSelectedItemsLookup(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
private buildAutocompleteSearchSelectedItemsLookup(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
const lookup: ReferenceLookup = new ReferenceLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||
|
@ -188,7 +187,7 @@ export class ReferenceService {
|
|||
nameof<Reference>(x => x.sourceType),
|
||||
]
|
||||
};
|
||||
if (types && types.length > 0) { lookup.types = types; }
|
||||
if (referenceTypeIds && referenceTypeIds.length > 0) { lookup.typeIds = referenceTypeIds; }
|
||||
if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; }
|
||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||
|
@ -202,16 +201,16 @@ export class ReferenceService {
|
|||
//
|
||||
//
|
||||
|
||||
hasRerefenceOfTypes(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): boolean {
|
||||
return this.getReferencesForTypes(dmpReferences, referenceTypes)?.length > 0;
|
||||
hasRerefenceOfTypes(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): boolean {
|
||||
return this.getReferencesForTypes(dmpReferences, referenceTypeIds)?.length > 0;
|
||||
}
|
||||
|
||||
getReferencesForTypes(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): DmpReference[] {
|
||||
return dmpReferences?.filter(x => referenceTypes?.includes(x?.reference?.type));
|
||||
getReferencesForTypes(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference[] {
|
||||
return dmpReferences?.filter(x => referenceTypeIds?.includes(x?.reference?.type?.id));
|
||||
}
|
||||
|
||||
getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): DmpReference {
|
||||
return this.getReferencesForTypes(dmpReferences, referenceTypes)?.find(Boolean);
|
||||
getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference {
|
||||
return this.getReferencesForTypes(dmpReferences, referenceTypeIds)?.find(Boolean);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import { NotificationType } from '@app/core/common/enum/notification-type';
|
|||
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
||||
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
|
||||
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { ReferenceTypeExternalApiHTTPMethodType } from '@app/core/common/enum/reference-type-external-api-http-method-type';
|
||||
import { ReferenceTypeSourceType } from '@app/core/common/enum/reference-type-source-type';
|
||||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||
|
@ -37,6 +36,7 @@ import { DmpBlueprintType } from '../../common/enum/dmp-blueprint-type';
|
|||
import { DmpStatus } from '../../common/enum/dmp-status';
|
||||
import { ValidationType } from '../../common/enum/validation-type';
|
||||
import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type';
|
||||
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
||||
|
||||
@Injectable()
|
||||
export class EnumUtils {
|
||||
|
@ -133,17 +133,11 @@ export class EnumUtils {
|
|||
|
||||
toDmpBlueprintSystemFieldTypeString(status: DmpBlueprintSystemFieldType): string {
|
||||
switch (status) {
|
||||
case DmpBlueprintSystemFieldType.TEXT: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.TEXT');
|
||||
case DmpBlueprintSystemFieldType.HTML_TEXT: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.HTML_TEXT');
|
||||
case DmpBlueprintSystemFieldType.RESEARCHERS: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.RESEARCHERS');
|
||||
case DmpBlueprintSystemFieldType.ORGANIZATIONS: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.ORGANIZATIONS');
|
||||
case DmpBlueprintSystemFieldType.LANGUAGE: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.LANGUAGE');
|
||||
case DmpBlueprintSystemFieldType.CONTACT: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.CONTACT');
|
||||
case DmpBlueprintSystemFieldType.FUNDER: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.FUNDER');
|
||||
case DmpBlueprintSystemFieldType.GRANT: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.GRANT');
|
||||
case DmpBlueprintSystemFieldType.PROJECT: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.PROJECT');
|
||||
case DmpBlueprintSystemFieldType.LICENSE: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.LICENSE');
|
||||
case DmpBlueprintSystemFieldType.ACCESS_RIGHTS: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.ACCESS_RIGHTS');
|
||||
case DmpBlueprintSystemFieldType.Title: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.TITLE');
|
||||
case DmpBlueprintSystemFieldType.Description: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.DESCRIPTION');
|
||||
case DmpBlueprintSystemFieldType.Language: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.LANGUAGE');
|
||||
case DmpBlueprintSystemFieldType.Contact: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.CONTACT');
|
||||
case DmpBlueprintSystemFieldType.AccessRights: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.ACCESS_RIGHTS');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,11 +152,9 @@ export class EnumUtils {
|
|||
|
||||
toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType): string {
|
||||
switch (status) {
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-SELECT');
|
||||
case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT');
|
||||
case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION');
|
||||
case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX');
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-RESEARCHERS');
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS');
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DATASETS');
|
||||
case DescriptionTemplateFieldType.CHECK_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CHECKBOX');
|
||||
|
@ -172,17 +164,8 @@ export class EnumUtils {
|
|||
case DescriptionTemplateFieldType.UPLOAD: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.UPLOAD');
|
||||
case DescriptionTemplateFieldType.DATE_PICKER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATE-PICKER');
|
||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-DATASETS');
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATA-REPOSITORIES');
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.JOURNALS-REPOSITORIES');
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.PUB-REPOSITORIES');
|
||||
case DescriptionTemplateFieldType.LICENSES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.LICENSES');
|
||||
case DescriptionTemplateFieldType.TAXONOMIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TAXONOMIES');
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.PUBLICATIONS');
|
||||
case DescriptionTemplateFieldType.REGISTRIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.REGISTRIES');
|
||||
case DescriptionTemplateFieldType.SERVICES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SERVICES');
|
||||
case DescriptionTemplateFieldType.TAGS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TAGS');
|
||||
case DescriptionTemplateFieldType.RESEARCHERS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RESEARCHERS');
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.ORGANIZATIONS');
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.REFERENCE-TYPES');
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATASET-IDENTIFIER');
|
||||
case DescriptionTemplateFieldType.CURRENCY: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CURRENCY');
|
||||
case DescriptionTemplateFieldType.VALIDATION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.VALIDATION');
|
||||
|
@ -218,26 +201,6 @@ export class EnumUtils {
|
|||
}
|
||||
}
|
||||
|
||||
toReferenceTypeString(status: ReferenceType): string {
|
||||
switch (status) {
|
||||
case ReferenceType.Taxonomies: return this.language.instant('TYPES.REFERENCE-TYPE.TAXONOMY');
|
||||
case ReferenceType.Licenses: return this.language.instant('TYPES.REFERENCE-TYPE.LICENCE');
|
||||
case ReferenceType.Publications: return this.language.instant('TYPES.REFERENCE-TYPE.PUBLICATION');
|
||||
case ReferenceType.Journals: return this.language.instant('TYPES.REFERENCE-TYPE.JOURNAL');
|
||||
case ReferenceType.PubRepositories: return this.language.instant('TYPES.REFERENCE-TYPE.PUB-REPOSITORY');
|
||||
case ReferenceType.DataRepositories: return this.language.instant('TYPES.REFERENCE-TYPE.DATA-REPOSITORY');
|
||||
case ReferenceType.Registries: return this.language.instant('TYPES.REFERENCE-TYPE.REGISTRY');
|
||||
case ReferenceType.Services: return this.language.instant('TYPES.REFERENCE-TYPE.SERVICE');
|
||||
case ReferenceType.Project: return this.language.instant('TYPES.REFERENCE-TYPE.PROJECT');
|
||||
case ReferenceType.Funder: return this.language.instant('TYPES.REFERENCE-TYPE.FUNDER');
|
||||
case ReferenceType.Datasets: return this.language.instant('TYPES.REFERENCE-TYPE.DATASET');
|
||||
case ReferenceType.Organizations: return this.language.instant('TYPES.REFERENCE-TYPE.ORGANISATION');
|
||||
case ReferenceType.Grants: return this.language.instant('TYPES.REFERENCE-TYPE.GRANT');
|
||||
case ReferenceType.Researcher: return this.language.instant('TYPES.REFERENCE-TYPE.RESEARCHER');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
toReferenceSourceTypeString(status: ReferenceSourceType): string {
|
||||
switch (status) {
|
||||
case ReferenceSourceType.Internal: return this.language.instant('TYPES.REFERENCE-SOURCE-TYPE.INTERNAL');
|
||||
|
@ -415,4 +378,14 @@ export class EnumUtils {
|
|||
case DescriptionTemplateExternalSelectAuthType.BEARER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-AUTH-TYPE.BEARER');
|
||||
}
|
||||
}
|
||||
|
||||
public toDmpBlueprintFieldCategoryString(value: DmpBlueprintFieldCategory): string {
|
||||
switch (value) {
|
||||
case DmpBlueprintFieldCategory.System: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.SYSTEM');
|
||||
case DmpBlueprintFieldCategory.Extra: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.EXTRA');
|
||||
case DmpBlueprintFieldCategory.ReferenceType: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.REFERENCE-TYPE');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import { DescriptionTemplateRoutingModule } from './description-template.routing
|
|||
import { DescriptionTemplateEditorCompositeFieldComponent } from './editor/components/composite-field/description-template-editor-composite-field.component';
|
||||
import { DescriptionTemplateEditorDefaultValueComponent } from './editor/components/default-value/description-template-editor-default-value.component';
|
||||
import { DescriptionTemplateEditorExternalDatasetsFieldComponent } from './editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component';
|
||||
import { DescriptionTemplateEditorExternalSelectFieldComponent } from './editor/components/field-type/external-select/description-template-editor-external-select-field.component';
|
||||
import { DescriptionTemplateEditorLabelAndMultiplicityFieldComponent } from './editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component';
|
||||
import { DescriptionTemplateEditorLabelFieldComponent } from './editor/components/field-type/label-field/description-template-editor-label-field.component';
|
||||
import { DescriptionTemplateEditorRadioBoxFieldComponent } from './editor/components/field-type/radio-box/description-template-editor-radio-box-field.component';
|
||||
|
@ -30,6 +29,7 @@ import { DescriptionTemplateTableOfContentsInternalSection } from './editor/tabl
|
|||
import { DescriptionTemplateListingComponent } from './listing/description-template-listing.component';
|
||||
import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/description-template-listing-filters.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';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -68,7 +68,7 @@ import { ImportDescriptionTemplateDialogComponent } from './listing/import-descr
|
|||
DescriptionTemplateEditorDefaultValueComponent,
|
||||
DescriptionTemplateEditorRuleComponent,
|
||||
|
||||
DescriptionTemplateEditorExternalSelectFieldComponent,
|
||||
DescriptionTemplateEditorReferenceTypeFieldComponent,
|
||||
DescriptionTemplateEditorSelectFieldComponent,
|
||||
DescriptionTemplateEditorLabelFieldComponent,
|
||||
DescriptionTemplateEditorLabelAndMultiplicityFieldComponent,
|
||||
|
|
|
@ -65,8 +65,7 @@
|
|||
<!-- FIELDS -->
|
||||
<div #inputs transition-group class="col-12" *ngIf="hasFocus" [@fade-in]>
|
||||
<div *ngFor="let field of fieldsArray.controls; let i=index;" class="row bg-white field-input mt-3" (click)="setTargetField(field)" transition-group-item>
|
||||
<app-description-template-editor-field-component class="col-12" [form]="field" [showOrdinal]="false" [viewOnly]="viewOnly" [expandView]="hasFocus" [canBeDeleted]="fieldsArray.length !=1"
|
||||
[validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath + '.fields[' + i + '].'" (delete)="deleteField(i)">
|
||||
<app-description-template-editor-field-component class="col-12" [form]="field" [showOrdinal]="false" [viewOnly]="viewOnly" [expandView]="hasFocus" [canBeDeleted]="fieldsArray.length !=1" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath + '.fields[' + i + '].'" (delete)="deleteField(i)">
|
||||
<div class="arrows mt-2">
|
||||
<ul class="list-unstyled list-inline d-flex align-items-center">
|
||||
<li *ngIf="canGoUp(i)" class="text-muted">
|
||||
|
@ -190,54 +189,14 @@
|
|||
APIs
|
||||
</button>
|
||||
<mat-action-list class="ml-4">
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.REGISTRIES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Registries icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.REGISTRIES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.SERVICES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Services icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.SERVICES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.RESEARCHERS)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Researchers icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.RESEARCHERS)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.ORGANIZATIONS)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Organizations icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.ORGANIZATIONS)}}
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.REFERENCE_TYPES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Reference types icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.REFERENCE_TYPES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="External Datasets icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="DataRepositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="PubRepositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="JournalRepositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.TAXONOMIES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Taxonomies icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.TAXONOMIES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.LICENSES)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Licenses icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.LICENSES)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.PUBLICATIONS)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
|
||||
</button>
|
||||
</mat-action-list>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
|
|
@ -5,7 +5,6 @@ import { MatDialog } from '@angular/material/dialog';
|
|||
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
|
||||
import { ValidationType } from '@app/core/common/enum/validation-type';
|
||||
import {
|
||||
DescriptionTemplateExternalSelectData,
|
||||
DescriptionTemplateSelectOption,
|
||||
DescriptionTemplateExternalDatasetData,
|
||||
DescriptionTemplateField,
|
||||
|
@ -13,7 +12,8 @@ import {
|
|||
DescriptionTemplateUploadData,
|
||||
DescriptionTemplateSelectData,
|
||||
DescriptionTemplateLabelData,
|
||||
DescriptionTemplateLabelAndMultiplicityData
|
||||
DescriptionTemplateLabelAndMultiplicityData,
|
||||
DescriptionTemplateReferenceTypeData
|
||||
} from '@app/core/model/description-template/description-template';
|
||||
import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
|
||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
|
@ -483,11 +483,10 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
} as DescriptionTemplateField;
|
||||
|
||||
switch (type) {
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
|
||||
const data: DescriptionTemplateExternalSelectData = {
|
||||
sources: [],
|
||||
multipleSelect: false,
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES: {
|
||||
const data: DescriptionTemplateReferenceTypeData = {
|
||||
label: '',
|
||||
multipleSelect: false,
|
||||
fieldType: type
|
||||
}
|
||||
field.data = data;
|
||||
|
@ -531,19 +530,12 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
|
||||
break;
|
||||
}
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: {
|
||||
//TODO: refactor
|
||||
break;
|
||||
}
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.LICENSES:
|
||||
case DescriptionTemplateFieldType.TAXONOMIES:
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS:
|
||||
case DescriptionTemplateFieldType.REGISTRIES:
|
||||
case DescriptionTemplateFieldType.SERVICES:
|
||||
case DescriptionTemplateFieldType.RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS: {
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: {
|
||||
const data: DescriptionTemplateLabelAndMultiplicityData = {
|
||||
label: '',
|
||||
multipleSelect: false,
|
||||
|
@ -573,7 +565,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
}
|
||||
}
|
||||
|
||||
(<UntypedFormArray>this.form.get('fields')).push(new DescriptionTemplateFieldEditorModel(this.validationErrorModel).fromModel(field).buildForm({rootPath: this.validationRootPath + '.fields[' + this.fieldsArray.length + ']'}));
|
||||
(<UntypedFormArray>this.form.get('fields')).push(new DescriptionTemplateFieldEditorModel(this.validationErrorModel).fromModel(field).buildForm({ rootPath: this.validationRootPath + '.fields[' + this.fieldsArray.length + ']' }));
|
||||
this.inputs.init();
|
||||
// fieldForm.get('viewStyle').get('renderStyle').updateValueAndValidity();
|
||||
// fieldForm.get('data').updateValueAndValidity();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||
import { DescriptionTemplateExternalSelectDataEditorModel, DescriptionTemplateExternalSelectSourceEditorModel } from '../../../description-template-editor.model';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { DescriptionTemplateExternalSelectHttpMethodType } from '@app/core/common/enum/description-template-external-select-http-method-type';
|
||||
import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type';
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<div class="row" *ngIf="form.get('data')">
|
||||
<h5 style="font-weight: bold" class="col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.REFERENCE-TYPE-TITLE'
|
||||
| translate}}</h5>
|
||||
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.MULTIPLE-SELECT' | translate}}
|
||||
</mat-checkbox>
|
||||
|
||||
<div class="col-6">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.LABEL' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}</mat-label>
|
||||
<app-single-auto-complete placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}" [required]="true" [form]="form.get('data').get('referenceTypeId')" [configuration]="referenceTypeService.singleAutocompleteConfiguration"></app-single-auto-complete>
|
||||
<mat-error *ngIf="form.get('data').get('referenceTypeId').hasError('backendError')">{{form.get('data').get('referenceTypeId').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('data').get('referenceTypeId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
.full-width {
|
||||
width: 100%;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-template-editor-reference-type-field-component',
|
||||
styleUrls: ['./description-template-editor-reference-type-field.component.scss'],
|
||||
templateUrl: './description-template-editor-reference-type-field.component.html'
|
||||
})
|
||||
export class DescriptionTemplateEditorReferenceTypeFieldComponent implements OnInit {
|
||||
|
||||
@Input() form: UntypedFormGroup;
|
||||
constructor(
|
||||
public referenceTypeService: ReferenceTypeService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
}
|
|
@ -88,54 +88,14 @@
|
|||
<!-- APIS -->
|
||||
|
||||
<mat-optgroup label="APIs">
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.REGISTRIES">
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Registries icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.REGISTRIES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.SERVICES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Services icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.SERVICES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.RESEARCHERS">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Researchers icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.RESEARCHERS)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.ORGANIZATIONS">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Organizations icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.ORGANIZATIONS)}}
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.REFERENCE_TYPES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="ExternalDatasets icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="DataRepositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="PubRepositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Journal Repositories icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.TAXONOMIES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Taxonomies icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.TAXONOMIES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.LICENSES">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="licenses icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.LICENSES)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.PUBLICATIONS">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT">
|
||||
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
|
||||
</mat-option>
|
||||
</mat-optgroup>
|
||||
<!-- TODO -->
|
||||
<mat-divider></mat-divider>
|
||||
|
@ -168,7 +128,7 @@
|
|||
|
||||
</mat-select>
|
||||
<mat-error *ngIf="this.form.get('data').get('fieldType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="form.get('data').get('fieldType').hasError('backendError')">{{form.get('data').get('fieldType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('data').get('fieldType').hasError('backendError')">{{form.get('data').get('fieldType').getError('backendError').message}}</mat-error>
|
||||
<!-- <mat-error>{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
|
||||
<!-- <mat-error *ngIf="this.form.hasError('inputTypeNotValid')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
|
||||
|
||||
|
@ -178,16 +138,15 @@
|
|||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}</mat-label>
|
||||
<app-multiple-auto-complete placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="this.form.get('schematics')" [configuration]="semanticsAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="form.get('schematics').hasError('backendError')">{{form.get('schematics').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('schematics').hasError('backendError')">{{form.get('schematics').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox [formControl]="this.form.get('includeInExport')" class="col-6" [disabled]="viewOnly">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXPORT' | translate}}
|
||||
<mat-error *ngIf="form.get('includeInExport').hasError('backendError')">{{form.get('includeInExport').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('includeInExport').hasError('backendError')">{{form.get('includeInExport').getError('backendError').message}}</mat-error>
|
||||
</mat-checkbox>
|
||||
|
||||
<!-- Default Value -->
|
||||
<app-description-template-editor-default-value-component *ngIf="form.get('data')?.get('fieldType')?.value" class="col-6" [fieldType]="form.get('data').get('fieldType').value" [form]="this.form.get('defaultValue')" [formArrayOptions]="form.get('data')?.get('options')" [comboBoxType]="this.form.get('data')?.get('type')?.value" [internalDmpEntitiesType]="this.form.get('data')?.get('type')?.value"
|
||||
[validationErrorModel]= "validationErrorModel" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.DEFAULT-VALUE' | translate}}">
|
||||
<app-description-template-editor-default-value-component *ngIf="form.get('data')?.get('fieldType')?.value" class="col-6" [fieldType]="form.get('data').get('fieldType').value" [form]="this.form.get('defaultValue')" [formArrayOptions]="form.get('data')?.get('options')" [comboBoxType]="this.form.get('data')?.get('type')?.value" [internalDmpEntitiesType]="this.form.get('data')?.get('type')?.value" [validationErrorModel]="validationErrorModel" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.DEFAULT-VALUE' | translate}}">
|
||||
</app-description-template-editor-default-value-component>
|
||||
<div class="col-12"></div>
|
||||
<div class="col-auto mb-4 mt-2">
|
||||
|
@ -208,12 +167,12 @@
|
|||
</div> -->
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value" >
|
||||
<div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value">
|
||||
|
||||
<app-description-template-editor-external-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12" [form]="form" [validationErrorModel]= "validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-external-select-field-component>
|
||||
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form" [validationErrorModel]= "validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-select-field-component>
|
||||
<app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form" [validationErrorModel]= "validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-radio-box-field-component>
|
||||
<app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form" [validationErrorModel]= "validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-upload-field-component>
|
||||
<app-description-template-editor-reference-type-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-reference-type-field-component>
|
||||
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-select-field-component>
|
||||
<app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-radio-box-field-component>
|
||||
<app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [rootPath]="validationRootPath"></app-description-template-editor-upload-field-component>
|
||||
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CHECK_BOX" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
|
@ -228,19 +187,8 @@
|
|||
|
||||
<app-description-template-editor-external-datasets-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12" [form]="form"></app-description-template-editor-external-datasets-field-component>
|
||||
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.LICENSES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAXONOMIES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUBLICATIONS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.REGISTRIES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SERVICES" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RESEARCHERS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
<app-description-template-editor-multiplicity-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.ORGANIZATIONS" class="col-12" [form]="form"></app-description-template-editor-multiplicity-field-component>
|
||||
|
||||
</div>
|
||||
</ng-container>
|
|
@ -8,10 +8,10 @@ import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-
|
|||
import { ValidationType } from '@app/core/common/enum/validation-type';
|
||||
import {
|
||||
DescriptionTemplateExternalDatasetData,
|
||||
DescriptionTemplateExternalSelectData,
|
||||
DescriptionTemplateLabelAndMultiplicityData,
|
||||
DescriptionTemplateLabelData,
|
||||
DescriptionTemplateRadioBoxData,
|
||||
DescriptionTemplateReferenceTypeData,
|
||||
DescriptionTemplateSelectData,
|
||||
DescriptionTemplateSelectOption,
|
||||
DescriptionTemplateUploadData
|
||||
|
@ -107,7 +107,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
|
||||
case DescriptionTemplateFieldType.RADIO_BOX:
|
||||
case DescriptionTemplateFieldType.SELECT:
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
|
||||
case DescriptionTemplateFieldType.CHECK_BOX:
|
||||
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||
return true;
|
||||
|
@ -126,10 +125,8 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
|
||||
const data: DescriptionTemplateExternalSelectData = {
|
||||
sources: [],
|
||||
multipleSelect: false,
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES: {
|
||||
const data: DescriptionTemplateLabelData = {
|
||||
label: '',
|
||||
fieldType: type
|
||||
}
|
||||
|
@ -174,19 +171,12 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
|
||||
break;
|
||||
}
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: {
|
||||
//TODO: refactor
|
||||
break;
|
||||
}
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.LICENSES:
|
||||
case DescriptionTemplateFieldType.TAXONOMIES:
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS:
|
||||
case DescriptionTemplateFieldType.REGISTRIES:
|
||||
case DescriptionTemplateFieldType.SERVICES:
|
||||
case DescriptionTemplateFieldType.RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS: {
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:{
|
||||
const data: DescriptionTemplateLabelAndMultiplicityData = {
|
||||
label: '',
|
||||
multipleSelect: false,
|
||||
|
|
|
@ -1254,7 +1254,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
// // 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) {
|
||||
// // if ((f.get('category').value == FieldCategory.System || f.get('category').value == DescriptionTemplateSectionFieldCategory.System) && f.get('type').value == systemField) {
|
||||
// // return true;
|
||||
// // }
|
||||
// // }
|
||||
|
@ -1272,9 +1272,9 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
// 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.category = DescriptionTemplateSectionFieldCategory.System;
|
||||
// field.systemFieldType = systemFieldType;
|
||||
// field.required = (systemFieldType == DescriptionTemplateSystemFieldType.TEXT || systemFieldType == DescriptionTemplateSystemFieldType.HTML_TEXT) ? true : false;
|
||||
// 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
|
||||
// }
|
||||
|
||||
|
@ -1290,7 +1290,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
// 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;
|
||||
// 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
|
||||
// }
|
||||
|
||||
|
@ -1410,7 +1410,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
// 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)) {
|
||||
// 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);
|
||||
// }
|
||||
// })
|
||||
|
@ -1471,7 +1471,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
// }
|
||||
|
||||
// addSystemField(sectionIndex: number, systemField?: SystemFieldType): void {
|
||||
// this.addField(sectionIndex, FieldCategory.SYSTEM, systemField);
|
||||
// this.addField(sectionIndex, FieldCategory.System, systemField);
|
||||
// }
|
||||
|
||||
// transfromEnumToString(type: SystemFieldType): string {
|
||||
|
@ -1615,12 +1615,12 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
|
||||
// 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));
|
||||
// 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.HTML_TEXT));
|
||||
// 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 {
|
||||
|
|
|
@ -4,8 +4,8 @@ import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-
|
|||
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
|
||||
import { DescriptionTemplateStatus } from "@app/core/common/enum/description-template-status";
|
||||
import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-description-template-role";
|
||||
import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateExternalSelectSourceBinding, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from "@app/core/model/description-template/description-template";
|
||||
import { DescriptionTemplateDefinitionPersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateExternalSelectAuthDataPersist, DescriptionTemplateExternalSelectDataPersist, DescriptionTemplateExternalSelectSourceBindingPersist, DescriptionTemplateExternalSelectSourcePersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateLabelDataPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateSelectDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, UserDescriptionTemplatePersist } from "@app/core/model/description-template/description-template-persist";
|
||||
import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection } from "@app/core/model/description-template/description-template";
|
||||
import { DescriptionTemplateDefinitionPersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateLabelDataPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateReferenceTypeFieldPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateSelectDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, UserDescriptionTemplatePersist } from "@app/core/model/description-template/description-template-persist";
|
||||
import { BaseEditorModel } from "@common/base/base-form-editor-model";
|
||||
import { BackendErrorValidator } from "@common/forms/validation/custom-validator";
|
||||
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
|
||||
|
@ -229,7 +229,7 @@ export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemp
|
|||
this.validationErrorModel
|
||||
).fromModel(item).buildForm({
|
||||
rootPath: `${rootPath}pages[${index}].`
|
||||
})
|
||||
})
|
||||
), context.getValidation('pages').validators
|
||||
),
|
||||
});
|
||||
|
@ -802,8 +802,8 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
|
||||
private getFieldEditorModel(fieldType: DescriptionTemplateFieldType): DescriptionTemplateLabelDataEditorModel {
|
||||
switch (fieldType) {
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
|
||||
return new DescriptionTemplateExternalSelectDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES:
|
||||
return new DescriptionTemplateReferenceTypeDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.RADIO_BOX:
|
||||
return new DescriptionTemplateRadioBoxDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.SELECT:
|
||||
|
@ -819,19 +819,8 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
case DescriptionTemplateFieldType.VALIDATION:
|
||||
return new DescriptionTemplateLabelDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
|
||||
case DescriptionTemplateFieldType.LICENSES:
|
||||
case DescriptionTemplateFieldType.TAXONOMIES:
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS:
|
||||
case DescriptionTemplateFieldType.REGISTRIES:
|
||||
case DescriptionTemplateFieldType.SERVICES:
|
||||
case DescriptionTemplateFieldType.RESEARCHERS:
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS:
|
||||
return new DescriptionTemplateLabelAndMultiplicityDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||
return new DescriptionTemplateExternalDatasetDataEditorModel(this.validationErrorModel);
|
||||
|
@ -864,7 +853,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
validationErrorModel: validationErrorModel
|
||||
});
|
||||
|
||||
if(formGroup?.get('data').get('fieldType').value != undefined){
|
||||
if (formGroup?.get('data').get('fieldType').value != undefined) {
|
||||
switch (formGroup?.get('data').get('fieldType').value) {
|
||||
case DescriptionTemplateFieldType.UPLOAD:
|
||||
DescriptionTemplateUploadDataEditorModel.reapplyUploadDataValidators({
|
||||
|
@ -887,8 +876,8 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
validationErrorModel: validationErrorModel
|
||||
});
|
||||
break;
|
||||
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
|
||||
DescriptionTemplateExternalSelectDataEditorModel.reapplyValidators({
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES:
|
||||
DescriptionTemplateReferenceTypeDataEditorModel.reapplyValidators({
|
||||
formGroup: formGroup?.get('data') as UntypedFormGroup,
|
||||
rootPath: `${rootPath}data.`,
|
||||
validationErrorModel: validationErrorModel
|
||||
|
@ -900,7 +889,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
validationErrorModel: validationErrorModel
|
||||
});
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1190,26 +1179,23 @@ export class DescriptionTemplateExternalDatasetDataEditorModel extends Descripti
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// External Select Field
|
||||
// Reference Types
|
||||
//
|
||||
//
|
||||
export class DescriptionTemplateExternalSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateExternalSelectDataPersist {
|
||||
multipleSelect: boolean = false;
|
||||
sources: DescriptionTemplateExternalSelectSourceEditorModel[] = [];
|
||||
export class DescriptionTemplateReferenceTypeDataEditorModel extends DescriptionTemplateLabelAndMultiplicityDataEditorModel implements DescriptionTemplateReferenceTypeFieldPersist {
|
||||
referenceTypeId: Guid;
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
constructor(
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
|
||||
) { super(validationErrorModel); }
|
||||
|
||||
fromModel(item: DescriptionTemplateExternalSelectDataPersist): DescriptionTemplateExternalSelectDataEditorModel {
|
||||
fromModel(item: DescriptionTemplateReferenceTypeData): DescriptionTemplateReferenceTypeDataEditorModel {
|
||||
if (item) {
|
||||
super.fromModel(item);
|
||||
this.multipleSelect = item.multipleSelect ?? false;
|
||||
if (item.sources) { item.sources.map(x => this.sources.push(new DescriptionTemplateExternalSelectSourceEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||
this.referenceTypeId = item.referenceTypeId;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -1221,21 +1207,14 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio
|
|||
}): UntypedFormGroup {
|
||||
let { context = null, disabled = false, rootPath } = params ?? {}
|
||||
if (context == null) {
|
||||
context = DescriptionTemplateExternalSelectDataEditorModel.createValidationContext({
|
||||
context = DescriptionTemplateReferenceTypeDataEditorModel.createValidationContext({
|
||||
validationErrorModel: this.validationErrorModel,
|
||||
rootPath
|
||||
});
|
||||
}
|
||||
|
||||
const formGroup = super.buildForm({ context, disabled, rootPath });
|
||||
formGroup.setControl('multipleSelect', new FormControl({ value: this.multipleSelect, disabled: disabled }, context.getValidation('multipleSelect').validators));
|
||||
formGroup.setControl('sources', this.formBuilder.array(
|
||||
(this.sources ?? []).map(
|
||||
(item, index) => item.buildForm({
|
||||
rootPath: `${rootPath}sources[${index}].`
|
||||
})
|
||||
), context.getValidation('sources').validators
|
||||
));
|
||||
formGroup.setControl('referenceTypeId', new FormControl({ value: this.referenceTypeId, disabled: disabled }, context.getValidation('referenceTypeId').validators));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
|
@ -1245,8 +1224,7 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio
|
|||
}): ValidationContext {
|
||||
const { rootPath = '', validationErrorModel } = params;
|
||||
const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel });
|
||||
baseContext.validation.push({ key: 'multipleSelect', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}multipleSelect`)] });
|
||||
baseContext.validation.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
baseContext.validation.push({ key: 'referenceTypeId', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}referenceTypeId`)] });
|
||||
return baseContext;
|
||||
}
|
||||
|
||||
|
@ -1257,285 +1235,12 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio
|
|||
}): void {
|
||||
|
||||
const { formGroup, rootPath, validationErrorModel } = params;
|
||||
const context = DescriptionTemplateExternalSelectDataEditorModel.createValidationContext({
|
||||
const context = DescriptionTemplateReferenceTypeDataEditorModel.createValidationContext({
|
||||
rootPath,
|
||||
validationErrorModel
|
||||
});
|
||||
|
||||
['multipleSelect'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
});
|
||||
|
||||
(formGroup.get('sources') as FormArray).controls?.forEach(
|
||||
(control, index) => DescriptionTemplateExternalSelectSourceEditorModel.reapplyValidators({
|
||||
formGroup: control as UntypedFormGroup,
|
||||
rootPath: `${rootPath}sources[${index}].`,
|
||||
validationErrorModel: validationErrorModel
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DescriptionTemplateExternalSelectSourceEditorModel implements DescriptionTemplateExternalSelectSourcePersist {
|
||||
url: string;
|
||||
method: string;
|
||||
optionsRoot: string;
|
||||
sourceBinding: DescriptionTemplateExternalSelectSourceBindingEditorModel = new DescriptionTemplateExternalSelectSourceBindingEditorModel(this.validationErrorModel);
|
||||
hasAuth: boolean;
|
||||
auth: DescriptionTemplateExternalSelectAuthDataEditorModel = new DescriptionTemplateExternalSelectAuthDataEditorModel(this.validationErrorModel);
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
constructor(
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
|
||||
) { }
|
||||
|
||||
fromModel(item: DescriptionTemplateExternalSelectSourcePersist): DescriptionTemplateExternalSelectSourceEditorModel {
|
||||
if (item) {
|
||||
this.url = item.url;
|
||||
this.sourceBinding = new DescriptionTemplateExternalSelectSourceBindingEditorModel(this.validationErrorModel).fromModel(item.sourceBinding);
|
||||
this.optionsRoot = item.optionsRoot;
|
||||
this.hasAuth = item.hasAuth;
|
||||
this.auth = new DescriptionTemplateExternalSelectAuthDataEditorModel(this.validationErrorModel).fromModel(item.auth);
|
||||
this.method = item.method;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(params?: {
|
||||
context?: ValidationContext,
|
||||
disabled?: boolean,
|
||||
rootPath?: string
|
||||
}): UntypedFormGroup {
|
||||
let { context = null, disabled = false, rootPath } = params ?? {}
|
||||
if (context == null) {
|
||||
context = DescriptionTemplateExternalSelectSourceEditorModel.createValidationContext({
|
||||
validationErrorModel: this.validationErrorModel,
|
||||
rootPath
|
||||
});
|
||||
}
|
||||
|
||||
return this.formBuilder.group({
|
||||
url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators],
|
||||
optionsRoot: [{ value: this.optionsRoot, disabled: disabled }, context.getValidation('optionsRoot').validators],
|
||||
hasAuth: [{ value: this.hasAuth, disabled: disabled }, context.getValidation('hasAuth').validators],
|
||||
method: [{ value: this.method, disabled: disabled }, context.getValidation('method').validators],
|
||||
sourceBinding: this.sourceBinding.buildForm({
|
||||
rootPath: `${rootPath}sourceBinding.`
|
||||
}),
|
||||
auth: this.auth.buildForm({
|
||||
rootPath: `${rootPath}auth.`
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
static createValidationContext(params: {
|
||||
rootPath?: string,
|
||||
validationErrorModel: ValidationErrorModel
|
||||
}): ValidationContext {
|
||||
const { rootPath = '', validationErrorModel } = params;
|
||||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'url', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}url`)] });
|
||||
baseValidationArray.push({ key: 'optionsRoot', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}optionsRoot`)] });
|
||||
baseValidationArray.push({ key: 'hasAuth', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasAuth`)] });
|
||||
baseValidationArray.push({ key: 'method', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}method`)] });
|
||||
baseValidationArray.push({ key: 'extendedDescription', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}extendedDescription`)] });
|
||||
baseValidationArray.push({ key: 'additionalInformation', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}additionalInformation`)] });
|
||||
baseValidationArray.push({ key: 'hasCommentField', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasCommentField`)] });
|
||||
baseValidationArray.push({ key: 'fields', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
}
|
||||
|
||||
static reapplyValidators(params: {
|
||||
formGroup: UntypedFormGroup,
|
||||
validationErrorModel: ValidationErrorModel,
|
||||
rootPath: string
|
||||
}): void {
|
||||
|
||||
const { formGroup, rootPath, validationErrorModel } = params;
|
||||
const context = DescriptionTemplateExternalSelectSourceEditorModel.createValidationContext({
|
||||
rootPath,
|
||||
validationErrorModel
|
||||
});
|
||||
|
||||
['url', 'optionsRoot', 'hasAuth', 'method'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
});
|
||||
|
||||
DescriptionTemplateExternalSelectSourceBindingEditorModel.reapplyValidators({
|
||||
formGroup: formGroup?.get('sourceBinding') as UntypedFormGroup,
|
||||
rootPath: `${rootPath}sourceBinding.`,
|
||||
validationErrorModel: validationErrorModel
|
||||
});
|
||||
|
||||
DescriptionTemplateExternalSelectAuthDataEditorModel.reapplyValidators({
|
||||
formGroup: formGroup?.get('auth') as UntypedFormGroup,
|
||||
rootPath: `${rootPath}auth.`,
|
||||
validationErrorModel: validationErrorModel
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class DescriptionTemplateExternalSelectSourceBindingEditorModel implements DescriptionTemplateExternalSelectSourceBindingPersist {
|
||||
label: string;
|
||||
value: string;
|
||||
source: string;
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
constructor(
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
|
||||
) { }
|
||||
|
||||
fromModel(item: DescriptionTemplateExternalSelectSourceBinding): DescriptionTemplateExternalSelectSourceBindingEditorModel {
|
||||
if (item) {
|
||||
this.label = item.label;
|
||||
this.value = item.value;
|
||||
this.source = item.source;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(params?: {
|
||||
context?: ValidationContext,
|
||||
disabled?: boolean,
|
||||
rootPath?: string
|
||||
}): UntypedFormGroup {
|
||||
let { context = null, disabled = false, rootPath } = params ?? {}
|
||||
if (context == null) {
|
||||
context = DescriptionTemplateExternalSelectSourceBindingEditorModel.createValidationContext({
|
||||
validationErrorModel: this.validationErrorModel,
|
||||
rootPath
|
||||
});
|
||||
}
|
||||
|
||||
return this.formBuilder.group({
|
||||
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
|
||||
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
|
||||
source: [{ value: this.source, disabled: disabled }, context.getValidation('source').validators],
|
||||
});
|
||||
}
|
||||
|
||||
static createValidationContext(params: {
|
||||
rootPath?: string,
|
||||
validationErrorModel: ValidationErrorModel
|
||||
}): ValidationContext {
|
||||
const { rootPath = '', validationErrorModel } = params;
|
||||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'label', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
|
||||
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
|
||||
baseValidationArray.push({ key: 'source', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}source`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
}
|
||||
|
||||
static reapplyValidators(params: {
|
||||
formGroup: UntypedFormGroup,
|
||||
validationErrorModel: ValidationErrorModel,
|
||||
rootPath: string
|
||||
}): void {
|
||||
|
||||
const { formGroup, rootPath, validationErrorModel } = params;
|
||||
const context = DescriptionTemplateExternalSelectSourceBindingEditorModel.createValidationContext({
|
||||
rootPath,
|
||||
validationErrorModel
|
||||
});
|
||||
|
||||
['label', 'value', 'source'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class DescriptionTemplateExternalSelectAuthDataEditorModel implements DescriptionTemplateExternalSelectAuthDataPersist {
|
||||
url: string;
|
||||
method: string;
|
||||
body: string;
|
||||
path: string;
|
||||
type: string;
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
constructor(
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
|
||||
) { }
|
||||
|
||||
fromModel(item: DescriptionTemplateExternalSelectAuthDataPersist): DescriptionTemplateExternalSelectAuthDataEditorModel {
|
||||
if (item) {
|
||||
this.url = item.url;
|
||||
this.method = item.method;
|
||||
this.body = item.body;
|
||||
this.path = item.path;
|
||||
this.type = item.type;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(params?: {
|
||||
context?: ValidationContext,
|
||||
disabled?: boolean,
|
||||
rootPath?: string
|
||||
}): UntypedFormGroup {
|
||||
let { context = null, disabled = false, rootPath } = params ?? {}
|
||||
if (context == null) {
|
||||
context = DescriptionTemplateExternalSelectAuthDataEditorModel.createValidationContext({
|
||||
validationErrorModel: this.validationErrorModel,
|
||||
rootPath
|
||||
});
|
||||
}
|
||||
|
||||
return this.formBuilder.group({
|
||||
url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators],
|
||||
method: [{ value: this.method, disabled: disabled }, context.getValidation('method').validators],
|
||||
body: [{ value: this.body, disabled: disabled }, context.getValidation('body').validators],
|
||||
path: [{ value: this.path, disabled: disabled }, context.getValidation('path').validators],
|
||||
type: [{ value: this.type, disabled: disabled }, context.getValidation('type').validators],
|
||||
});
|
||||
}
|
||||
|
||||
static createValidationContext(params: {
|
||||
rootPath?: string,
|
||||
validationErrorModel: ValidationErrorModel
|
||||
}): ValidationContext {
|
||||
const { rootPath = '', validationErrorModel } = params;
|
||||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'url', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}url`)] });
|
||||
baseValidationArray.push({ key: 'method', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}method`)] });
|
||||
baseValidationArray.push({ key: 'body', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}body`)] });
|
||||
baseValidationArray.push({ key: 'path', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}path`)] });
|
||||
baseValidationArray.push({ key: 'type', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}type`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
}
|
||||
|
||||
static reapplyValidators(params: {
|
||||
formGroup: UntypedFormGroup,
|
||||
validationErrorModel: ValidationErrorModel,
|
||||
rootPath: string
|
||||
}): void {
|
||||
|
||||
const { formGroup, rootPath, validationErrorModel } = params;
|
||||
const context = DescriptionTemplateExternalSelectAuthDataEditorModel.createValidationContext({
|
||||
rootPath,
|
||||
validationErrorModel
|
||||
});
|
||||
|
||||
['url', 'method', 'body', 'path', 'type'].forEach(keyField => {
|
||||
['referenceTypeId'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
|
@ -1586,7 +1291,7 @@ export class DescriptionTemplateRadioBoxDataEditorModel extends DescriptionTempl
|
|||
rootPath: `${rootPath}options[${index}].`
|
||||
})
|
||||
), context.getValidation('options').validators
|
||||
));
|
||||
));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
|
@ -1733,7 +1438,7 @@ export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplat
|
|||
rootPath: `${rootPath}options[${index}].`
|
||||
})
|
||||
), context.getValidation('options').validators
|
||||
));
|
||||
));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
|
@ -1894,7 +1599,7 @@ export class DescriptionTemplateUploadDataEditorModel extends DescriptionTemplat
|
|||
rootPath: `${rootPath}types[${index}].`
|
||||
})
|
||||
), context.getValidation('types').validators
|
||||
));
|
||||
));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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, DescriptionTemplateExternalSelectData, DescriptionTemplateBaseFieldData, DescriptionTemplateSelectOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateExternalDatasetData, DescriptionTemplateExternalSelectSource, DescriptionTemplateExternalSelectAuthData, DescriptionTemplateExternalSelectSourceBinding, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template';
|
||||
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } 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';
|
||||
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
|
||||
|
@ -70,20 +70,9 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
|
|||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.multipleSelect)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.label)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.multipleSelect)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateLabelAndMultiplicityData>(x => x.multipleSelect)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.url)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.method)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.optionsRoot)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.label)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.value)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.source)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.hasAuth)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.url)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.method)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.body)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.path)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.type)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceTypeId)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.maxFileSizeInMB)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.label)].join('.'),
|
||||
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.value)].join('.'),
|
||||
|
|
|
@ -85,19 +85,10 @@
|
|||
<mat-error *ngIf="section.get('description').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELDS' | translate}}</mat-label>
|
||||
<mat-select multiple [(ngModel)]="selectedSystemFields" [disabled]="formGroup.disabled" [ngModelOptions]="{standalone: true}" (selectionChange)= "addSystemField(sectionIndex, $event)">
|
||||
<mat-option *ngFor="let systemFieldType of dmpBlueprintSystemFieldTypeEnum" [disabled]="systemFieldDisabled(systemFieldType)" [value]="systemFieldType">{{enumUtils.toDmpBlueprintSystemFieldTypeString(systemFieldType)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button mat-button class="action-btn" type="button" (click)="addExtraField(sectionIndex)" [disabled]="formGroup.disabled">{{'DMP-BLUEPRINT-EDITOR.ACTIONS.ADD-EXTRA-FIELD' | translate}}</button>
|
||||
<button mat-button class="action-btn" type="button" (click)="addField(sectionIndex)" [disabled]="formGroup.disabled">{{'DMP-BLUEPRINT-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div cdkDropList class="col-12" (cdkDropListDropped)="dropFields($event, sectionIndex)">
|
||||
<div *ngFor="let field of section.get('fields').controls; let fieldIndex=index;" cdkDrag class="row align-items-center" [cdkDragDisabled]="formGroup.disabled">
|
||||
|
||||
|
@ -105,17 +96,27 @@
|
|||
<span style="font-size: 15px;">{{fieldIndex + 1}}</span>
|
||||
</div>
|
||||
<div class="col-auto d-flex"><mat-icon [ngClass]="{'drag-handle-disabled': formGroup.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon></div>
|
||||
<div class="col-auto" *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.SYSTEM">
|
||||
<div class="col-auto">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD' | translate}}</mat-label>
|
||||
<input matInput disabled value="{{enumUtils.toDmpBlueprintSystemFieldTypeString(field.get('systemFieldType').value)}}" type="text" name="name">
|
||||
<mat-error *ngIf="field.get('dataType').hasError('backendError')">{{field.get('dataType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('dataType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.CATEGORY' | translate}}</mat-label>
|
||||
<mat-select [formControl]="field.get('category')" [disabled]="field.disabled" (selectionChange)="fieldCategoryChanged(sectionIndex, fieldIndex)">
|
||||
<mat-option *ngFor="let fieldCategory of dmpBlueprintFieldCategoryEnum" [value]="fieldCategory">{{enumUtils.toDmpBlueprintFieldCategoryString(fieldCategory)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-auto" *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.EXTRA">
|
||||
<div class="col-auto" *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.System">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-DATA-TYPE' | translate}}</mat-label>
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD-TYPE' | translate}}</mat-label>
|
||||
<mat-select [formControl]="field.get('systemFieldType')" [disabled]="field.disabled">
|
||||
<mat-option *ngFor="let systemFieldType of dmpBlueprintSystemFieldTypeEnum" [disabled]="systemFieldDisabled(systemFieldType)" [value]="systemFieldType">{{enumUtils.toDmpBlueprintSystemFieldTypeString(systemFieldType)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('systemFieldType').hasError('backendError')">{{field.get('systemFieldType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('systemFieldType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-auto" *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.Extra">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.DATA-TYPE' | translate}}</mat-label>
|
||||
<mat-select [formControl]="field.get('dataType')">
|
||||
<mat-option *ngFor="let extraFieldDataType of dmpBlueprintExtraFieldDataTypeEnum" [value]="extraFieldDataType">
|
||||
{{enumUtils.toDmpBlueprintExtraFieldDataTypeString(extraFieldDataType)}}
|
||||
|
@ -125,7 +126,15 @@
|
|||
<mat-error *ngIf="field.get('dataType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-auto" *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.ReferenceType">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}</mat-label>
|
||||
<app-single-auto-complete placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}" [required]="true" [form]="field.get('referenceTypeId')" [configuration]="referenceTypeService.singleAutocompleteConfiguration"></app-single-auto-complete>
|
||||
<mat-error *ngIf="field.get('referenceTypeId').hasError('backendError')">{{field.get('referenceTypeId').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('referenceTypeId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col" *ngIf="field.get('category').value != null">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="text" name="label" [formControl]="field.get('label')">
|
||||
|
@ -133,7 +142,7 @@
|
|||
<mat-error *ngIf="field.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col" *ngIf="field.get('category').value != null">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="text" name="placeholder" [formControl]="field.get('placeholder')">
|
||||
|
@ -141,7 +150,7 @@
|
|||
<mat-error *ngIf="field.get('placeholder').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col" *ngIf="field.get('category').value != null">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-DESCRIPTION' | translate}}</mat-label>
|
||||
<input matInput type="text" name="description" [formControl]="field.get('description')">
|
||||
|
@ -149,18 +158,13 @@
|
|||
<mat-error *ngIf="field.get('description').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<mat-checkbox [disabled]="field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.TEXT || field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.HTML_TEXT" [formControl]="field.get('required')"><span>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-REQUIRED' | translate}}</span></mat-checkbox>
|
||||
<div class="col-auto" *ngIf="field.get('category').value != null">
|
||||
<mat-checkbox [disabled]="field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.Title || field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.Description" [formControl]="field.get('required')"><span>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-REQUIRED' | translate}}</span></mat-checkbox>
|
||||
<mat-error *ngIf="field.get('systemFieldType').hasError('backendError')">{{field.get('systemFieldType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('systemFieldType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</div>
|
||||
<div *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.SYSTEM" [hidden]="viewOnly" class="col-auto">
|
||||
<button mat-icon-button matTooltip="{{'DMP-BLUEPRINT-EDITOR.ACTIONS.REMOVE-SYSTEM-FIELD' | translate}}" (click)="removeSystemField(sectionIndex, fieldIndex)" [disabled]="formGroup.disabled">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.EXTRA" [hidden]="viewOnly" class="col-auto">
|
||||
<button mat-icon-button matTooltip="{{'DMP-BLUEPRINT-EDITOR.ACTIONS.REMOVE-EXTRA-FIELD' | translate}}" (click)="removeExtraField(sectionIndex, fieldIndex)" [disabled]="formGroup.disabled">
|
||||
<div [hidden]="viewOnly" class="col-auto">
|
||||
<button mat-icon-button matTooltip="{{'DMP-BLUEPRINT-EDITOR.ACTIONS.REMOVE-FIELD' | translate}}" (click)="removeField(sectionIndex, fieldIndex)" [disabled]="formGroup.disabled">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -174,7 +178,7 @@
|
|||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<mat-checkbox [formControl]="section.get('hasTemplates')" (change) = "removeAllDescriptionTemplates($event, sectionIndex)">
|
||||
<mat-checkbox [formControl]="section.get('hasTemplates')" (change)="removeAllDescriptionTemplates($event, sectionIndex)">
|
||||
{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
|
||||
<mat-error *ngIf="section.get('hasTemplates').hasError('backendError')">{{section.get('hasTemplates').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="section.get('hasTemplates').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
|
@ -185,7 +189,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div cdkDropList class="col-12" (cdkDropListDropped)="dropDescriptionTemplates($event, sectionIndex)">
|
||||
<div *ngFor="let descriptionTemplate of section.get('descriptionTemplates').controls; let descriptionTemplateIndex=index;" cdkDrag class="row align-items-center" [cdkDragDisabled]="formGroup.disabled">
|
||||
<div class="col-auto">
|
||||
|
@ -229,7 +233,7 @@
|
|||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<mat-error *ngIf="section.get('descriptionTemplates').hasError('backendError')">{{section.get('descriptionTemplates').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
|
|
@ -9,18 +9,23 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|||
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
||||
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-field-type';
|
||||
import { DmpBlueprintSectionFieldCategory } from '@app/core/common/enum/dmp-blueprint-section-field-category';
|
||||
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
|
||||
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { DmpBlueprint, DmpBlueprintPersist, NewVersionDmpBlueprintPersist } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { DmpBlueprint, DmpBlueprintPersist, NewVersionDmpBlueprintPersist, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { BaseEditor } from '@common/base/base-editor';
|
||||
import { FormService } from '@common/forms/form-service';
|
||||
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
||||
|
@ -31,15 +36,11 @@ import { Guid } from '@common/types/guid';
|
|||
import { TranslateService } from '@ngx-translate/core';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { DescriptionTemplatesInSectionEditorModel, DmpBlueprintDefinitionSectionEditorModel, DmpBlueprintEditorModel, FieldInSectionEditorModel } from './dmp-blueprint-editor.model';
|
||||
import { DescriptionTemplatePreviewDialogComponent } from '../../description-template/description-template-preview/description-template-preview-dialog.component';
|
||||
import { DmpBlueprintEditorModel } from './dmp-blueprint-editor.model';
|
||||
import { DmpBlueprintEditorResolver } from './dmp-blueprint-editor.resolver';
|
||||
import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service';
|
||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { DescriptionTemplatePreviewDialogComponent } from '../../description-template/description-template-preview/description-template-preview-dialog.component';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -56,15 +57,16 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
isDeleted = false;
|
||||
formGroup: UntypedFormGroup = null;
|
||||
showInactiveDetails = false;
|
||||
selectedSystemFields: Array<DmpBlueprintSystemFieldType> = [];
|
||||
dmpBlueprintSectionFieldCategory = DmpBlueprintSectionFieldCategory;
|
||||
|
||||
dmpBlueprintSectionFieldCategory = DmpBlueprintFieldCategory;
|
||||
dmpBlueprintSystemFieldType = DmpBlueprintSystemFieldType;
|
||||
public dmpBlueprintSystemFieldTypeEnum = this.enumUtils.getEnumValues<DmpBlueprintSystemFieldType>(DmpBlueprintSystemFieldType);
|
||||
dmpBlueprintExtraFieldDataType = DmpBlueprintExtraFieldDataType;
|
||||
public dmpBlueprintExtraFieldDataTypeEnum = this.enumUtils.getEnumValues<DmpBlueprintExtraFieldDataType>(DmpBlueprintExtraFieldDataType);
|
||||
public dmpBlueprintFieldCategoryEnum = this.enumUtils.getEnumValues<DmpBlueprintFieldCategory>(DmpBlueprintFieldCategory);
|
||||
descriptionTempalteGroupSingleAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup(null, null, null, this.getUsedDescriptionTemplateGroupIds())).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup(searchQuery, null, null, this.getUsedDescriptionTemplateGroupIds() ? this.getUsedDescriptionTemplateGroupIds(): null)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup(searchQuery, null, null, this.getUsedDescriptionTemplateGroupIds() ? this.getUsedDescriptionTemplateGroupIds() : null)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: DescriptionTemplate) => item.label,
|
||||
titleFn: (item: DescriptionTemplate) => item.label,
|
||||
|
@ -119,7 +121,8 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
private dmpBlueprintEditorService: DmpBlueprintEditorService,
|
||||
private fileUtils: FileUtils,
|
||||
private matomoService: MatomoService,
|
||||
public descriptionTemplateService: DescriptionTemplateService
|
||||
public descriptionTemplateService: DescriptionTemplateService,
|
||||
public referenceTypeService: ReferenceTypeService
|
||||
) {
|
||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService);
|
||||
}
|
||||
|
@ -171,7 +174,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
|
||||
buildForm() {
|
||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDmpBlueprint));
|
||||
this.selectedSystemFields = this.selectedSystemFieldDisabled();
|
||||
this.dmpBlueprintEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||
if (this.isFinalized || this.isDeleted) {
|
||||
this.formGroup.disable();
|
||||
|
@ -198,7 +200,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
}
|
||||
|
||||
persistEntity(onSuccess?: (response) => void): void {
|
||||
if (this.isNew && !this.isClone && !this.isNewVersion){
|
||||
if (this.isNew && !this.isClone && !this.isNewVersion) {
|
||||
const formData = this.formService.getValue(this.formGroup.value) as DmpBlueprintPersist;
|
||||
|
||||
this.dmpBlueprintService.persist(formData)
|
||||
|
@ -303,81 +305,13 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
// Fields
|
||||
//
|
||||
//
|
||||
systemFieldDisabled(systemField: DmpBlueprintSystemFieldType) {
|
||||
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 == DmpBlueprintSectionFieldCategory.SYSTEM) && f.get('type').value == systemField) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// i++;
|
||||
// }
|
||||
// return false;
|
||||
}
|
||||
|
||||
selectedSystemFieldDisabled(): Array<DmpBlueprintSystemFieldType> {
|
||||
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 DmpBlueprintSystemFieldType));
|
||||
}
|
||||
|
||||
addSystemField(sectionIndex: number, matSelect: MatSelectChange): void {
|
||||
let systemFieldTypes = matSelect.value as number[];
|
||||
let sectionsFormArray: FormArray = this.formGroup.get('definition').get('sections') as FormArray;
|
||||
let sectionFieldsFormArray: FormArray = sectionsFormArray.at(sectionIndex).get('fields') as FormArray;
|
||||
const fieldSize = sectionFieldsFormArray.length;
|
||||
systemFieldTypes = systemFieldTypes.filter(field => !sectionsFormArray.controls.some(x => (x.get('fields') as FormArray).controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === field)));
|
||||
for (let systemFieldType of systemFieldTypes) {
|
||||
sectionFieldsFormArray.push(this.editorModel.createChildSystemField(sectionIndex, fieldSize, systemFieldType));
|
||||
// const fieldSize = sectionFieldsFormArray.length;
|
||||
// if (fieldSize == 0) {
|
||||
// sectionFieldsFormArray.push(this.editorModel.createChildSystemField(sectionIndex, fieldSize, systemFieldType));
|
||||
// return;
|
||||
// } else {
|
||||
// if (!sectionFieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === systemFieldType)) {
|
||||
// sectionFieldsFormArray.push(this.editorModel.createChildSystemField(sectionIndex, fieldSize, systemFieldType));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
removeSystemField(sectionIndex: number, fieldIndex: number): void {
|
||||
const fieldsArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray;
|
||||
const systemFieldType = fieldsArray.at(fieldIndex).get('systemFieldType').value
|
||||
if(systemFieldType > -1) {
|
||||
if (this.selectedSystemFields.length == 1){
|
||||
this.selectedSystemFields = [];
|
||||
}else{
|
||||
const index = this.selectedSystemFields.indexOf(systemFieldType);
|
||||
if (index > -1) {
|
||||
this.selectedSystemFields.splice(index, 1);
|
||||
this.selectedSystemFields = [...this.selectedSystemFields];
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldsArray.removeAt(fieldIndex);
|
||||
fieldsArray.controls.forEach((section, index) => {
|
||||
section.get('ordinal').setValue(index + 1);
|
||||
});
|
||||
|
||||
DmpBlueprintEditorModel.reApplySectionValidators(
|
||||
{
|
||||
formGroup: this.formGroup,
|
||||
validationErrorModel: this.editorModel.validationErrorModel
|
||||
}
|
||||
);
|
||||
fieldsArray.markAsDirty();
|
||||
}
|
||||
|
||||
addExtraField(sectionIndex: number): void {
|
||||
addField(sectionIndex: number) {
|
||||
((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray)
|
||||
.push(this.editorModel.createChildExtraField(sectionIndex, ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length));
|
||||
|
||||
.push(this.editorModel.createChildField(sectionIndex, ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length));
|
||||
}
|
||||
|
||||
removeExtraField(sectionIndex: number, fieldIndex: number): void {
|
||||
removeField(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) => {
|
||||
|
@ -394,6 +328,21 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
(this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields').markAsDirty();
|
||||
}
|
||||
|
||||
systemFieldDisabled(systemField: DmpBlueprintSystemFieldType) {
|
||||
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));
|
||||
}
|
||||
|
||||
fieldCategoryChanged(sectionIndex: number, fieldIndex: number) {
|
||||
//Reapply validators
|
||||
DmpBlueprintEditorModel.reApplySectionValidators(
|
||||
{
|
||||
formGroup: this.formGroup,
|
||||
validationErrorModel: this.editorModel.validationErrorModel
|
||||
}
|
||||
);
|
||||
(this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields').markAsDirty();
|
||||
}
|
||||
|
||||
|
||||
dropFields(event: CdkDragDrop<string[]>, sectionIndex: number) {
|
||||
const fieldsFormArray = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray);
|
||||
|
@ -414,34 +363,34 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
|
||||
//Description Templates
|
||||
|
||||
removeAllDescriptionTemplates(matCheckBox: MatCheckboxChange, sectionIndex: number){
|
||||
if(matCheckBox.checked == false){
|
||||
removeAllDescriptionTemplates(matCheckBox: MatCheckboxChange, sectionIndex: number) {
|
||||
if (matCheckBox.checked == false) {
|
||||
const descriptionTemplateSize = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray).length;
|
||||
for (let i=0; i< descriptionTemplateSize; i++) this.removeDescriptionTemplate(sectionIndex, 0);
|
||||
for (let i = 0; i < descriptionTemplateSize; i++) this.removeDescriptionTemplate(sectionIndex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
addDescriptionTemplate(sectionIndex: number): void {
|
||||
const descriptionTempaltesArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray ;
|
||||
const descriptionTempaltesArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray;
|
||||
descriptionTempaltesArray.push(this.editorModel.createChildDescriptionTemplate(sectionIndex, ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray).length));
|
||||
}
|
||||
|
||||
getUsedDescriptionTemplateGroupIds(): Guid[]{
|
||||
getUsedDescriptionTemplateGroupIds(): Guid[] {
|
||||
let excludedGroupIds: Guid[] = [];
|
||||
(this.formGroup.get('definition').get('sections') as FormArray).controls.forEach((section, index) => {
|
||||
const descriptionTempaltesArray = (this.formGroup.get('definition').get('sections') as FormArray).at(index).get('descriptionTemplates') as FormArray;
|
||||
if (descriptionTempaltesArray.length > 1){
|
||||
if (descriptionTempaltesArray.length > 1) {
|
||||
descriptionTempaltesArray.controls.forEach((template, index) => {
|
||||
if(template.get('descriptionTemplateGroupId').value != undefined) excludedGroupIds.push(template.get('descriptionTemplateGroupId').value as Guid);
|
||||
if (template.get('descriptionTemplateGroupId').value != undefined) excludedGroupIds.push(template.get('descriptionTemplateGroupId').value as Guid);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return excludedGroupIds;
|
||||
}
|
||||
|
||||
removeDescriptionTemplate(sectionIndex: number, descriptionTemplateIndex: number): void {
|
||||
const descriptionTempaltesArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray;
|
||||
const descriptionTempaltesArray = (this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray;
|
||||
descriptionTempaltesArray.removeAt(descriptionTemplateIndex);
|
||||
|
||||
DmpBlueprintEditorModel.reApplySectionValidators(
|
||||
|
@ -523,12 +472,12 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
|
||||
hasTitle(): boolean {
|
||||
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category === DmpBlueprintSectionFieldCategory.SYSTEM || field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM) && field.systemFieldType === DmpBlueprintSystemFieldType.TEXT));
|
||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Title));
|
||||
}
|
||||
|
||||
hasDescription(): boolean {
|
||||
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category === DmpBlueprintSectionFieldCategory.SYSTEM || field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM) && field.systemFieldType === DmpBlueprintSystemFieldType.HTML_TEXT));
|
||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Description));
|
||||
}
|
||||
|
||||
hasDescriptionTemplates(): boolean {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { FormArray, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
|
||||
import { DmpBlueprintFieldCategory } from "@app/core/common/enum/dmp-blueprint-field-category";
|
||||
import { DmpBlueprintExtraFieldDataType } from "@app/core/common/enum/dmp-blueprint-field-type";
|
||||
import { DmpBlueprintSectionFieldCategory } from "@app/core/common/enum/dmp-blueprint-section-field-category";
|
||||
import { DmpBlueprintStatus } from "@app/core/common/enum/dmp-blueprint-status";
|
||||
import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/dmp-blueprint-system-field-type";
|
||||
import { DescriptionTemplatesInSection, DescriptionTemplatesInSectionPersist, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionPersist, DmpBlueprintDefinitionSection, DmpBlueprintDefinitionSectionPersist, DmpBlueprintPersist, FieldInSection, FieldInSectionPersist } from "@app/core/model/dmp-blueprint/dmp-blueprint";
|
||||
import { DescriptionTemplatesInSection, DescriptionTemplatesInSectionPersist, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionPersist, DmpBlueprintDefinitionSection, DmpBlueprintDefinitionSectionPersist, DmpBlueprintPersist, ExtraFieldInSection, FieldInSection, FieldInSectionPersist, ReferenceTypeFieldInSection, SystemFieldInSection } from "@app/core/model/dmp-blueprint/dmp-blueprint";
|
||||
import { BaseEditorModel } from "@common/base/base-form-editor-model";
|
||||
import { BackendErrorValidator } from "@common/forms/validation/custom-validator";
|
||||
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
|
||||
|
@ -67,22 +67,10 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep
|
|||
return section.buildForm({ rootPath: 'definition.sections[' + index + '].' });
|
||||
}
|
||||
|
||||
createChildSystemField(sectionIndex: number, index: number, systemFieldType: DmpBlueprintSystemFieldType): UntypedFormGroup {
|
||||
console.log(sectionIndex, index, systemFieldType.toString());
|
||||
createChildField(sectionIndex: number, index: number): UntypedFormGroup {
|
||||
const field: FieldInSectionEditorModel = new FieldInSectionEditorModel(this.validationErrorModel);
|
||||
field.id = Guid.create();
|
||||
field.ordinal = index + 1;
|
||||
field.category = DmpBlueprintSectionFieldCategory.SYSTEM;
|
||||
field.systemFieldType = systemFieldType;
|
||||
field.required = (systemFieldType == DmpBlueprintSystemFieldType.TEXT || systemFieldType == DmpBlueprintSystemFieldType.HTML_TEXT) ? true : false;
|
||||
return field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fields[' + index + '].' });
|
||||
}
|
||||
|
||||
createChildExtraField(sectionIndex: number, index: number): UntypedFormGroup {
|
||||
const field: FieldInSectionEditorModel = new FieldInSectionEditorModel(this.validationErrorModel);
|
||||
field.id = Guid.create();
|
||||
field.ordinal = index + 1;
|
||||
field.category = DmpBlueprintSectionFieldCategory.EXTRA;
|
||||
return field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fields[' + index + '].' });
|
||||
}
|
||||
|
||||
|
@ -311,14 +299,15 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
|||
|
||||
export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
||||
public id: Guid;
|
||||
public category: DmpBlueprintSectionFieldCategory;
|
||||
public dataType: DmpBlueprintExtraFieldDataType;
|
||||
public systemFieldType: DmpBlueprintSystemFieldType;
|
||||
public category: DmpBlueprintFieldCategory;
|
||||
public label: string;
|
||||
public placeholder: string;
|
||||
public description: string;
|
||||
public required: boolean = false;
|
||||
public ordinal: number;
|
||||
public dataType: DmpBlueprintExtraFieldDataType;
|
||||
public systemFieldType: DmpBlueprintSystemFieldType;
|
||||
public referenceTypeId: Guid;
|
||||
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
|
@ -329,13 +318,20 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
|||
fromModel(item: FieldInSection): FieldInSectionEditorModel {
|
||||
this.id = item.id;
|
||||
this.category = item.category;
|
||||
this.dataType = item.dataType;
|
||||
this.systemFieldType = item.systemFieldType;
|
||||
this.label = item.label;
|
||||
this.placeholder = item.placeholder;
|
||||
this.description = item.description;
|
||||
this.required = item.required;
|
||||
this.ordinal = item.ordinal;
|
||||
|
||||
if (this.category == DmpBlueprintFieldCategory.System) {
|
||||
this.systemFieldType = (item as SystemFieldInSection).systemFieldType;
|
||||
} else if (this.category == DmpBlueprintFieldCategory.Extra) {
|
||||
this.dataType = (item as ExtraFieldInSection).dataType;
|
||||
} else if (this.category == DmpBlueprintFieldCategory.ReferenceType) {
|
||||
this.referenceTypeId = (item as ReferenceTypeFieldInSection).referenceType?.id;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -356,14 +352,14 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
|||
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
|
||||
|
||||
category: [{ value: this.category, disabled: disabled }, context.getValidation('category').validators],
|
||||
dataType: [{ value: this.dataType, disabled: disabled }, context.getValidation('dataType').validators],
|
||||
systemFieldType: [{ value: this.systemFieldType, disabled: disabled }, context.getValidation('systemFieldType').validators],
|
||||
label: [{ value: this.label, disabled: disabled }, this.category === DmpBlueprintSectionFieldCategory.SYSTEM ? context.getValidation('label-system').validators : context.getValidation('label-extra').validators],
|
||||
label: [{ value: this.label, disabled: disabled }, this.category === DmpBlueprintFieldCategory.System ? context.getValidation('label-system').validators : context.getValidation('label-extra').validators],
|
||||
placeholder: [{ value: this.placeholder, disabled: disabled }, context.getValidation('placeholder').validators],
|
||||
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
|
||||
required: [{ value: this.required, disabled: disabled }, context.getValidation('required').validators],
|
||||
ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators],
|
||||
|
||||
dataType: [{ value: this.dataType, disabled: disabled }, context.getValidation('dataType').validators],
|
||||
systemFieldType: [{ value: this.systemFieldType, disabled: disabled }, context.getValidation('systemFieldType').validators],
|
||||
referenceTypeId: [{ value: this.referenceTypeId, disabled: disabled }, context.getValidation('referenceTypeId').validators],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -378,14 +374,15 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
|||
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] });
|
||||
|
||||
baseValidationArray.push({ key: 'category', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}category`)] });
|
||||
baseValidationArray.push({ key: 'dataType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}dataType`)] });
|
||||
baseValidationArray.push({ key: 'systemFieldType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}systemFieldType`)] });
|
||||
baseValidationArray.push({ key: 'label-system', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
|
||||
baseValidationArray.push({ key: 'label-extra', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
|
||||
baseValidationArray.push({ key: 'placeholder', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}placeholder`)] });
|
||||
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}description`)] });
|
||||
baseValidationArray.push({ key: 'required', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}required`)] });
|
||||
baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
|
||||
baseValidationArray.push({ key: 'dataType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}dataType`)] });
|
||||
baseValidationArray.push({ key: 'systemFieldType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}systemFieldType`)] });
|
||||
baseValidationArray.push({ key: 'referenceTypeId', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}referenceTypeId`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
@ -403,11 +400,20 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
|||
validationErrorModel
|
||||
});
|
||||
|
||||
['id', 'category', 'dataType', 'systemFieldType', , 'label', 'placeholder', 'description', 'required', 'ordinal'].forEach(keyField => {
|
||||
['id', 'category', 'dataType', 'systemFieldType', 'referenceTypeId', 'label', 'placeholder', 'description', 'required', 'ordinal'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
if (keyField == 'label') {
|
||||
control?.addValidators(context.has('label-system') ? context.getValidation('label-system').validators : context.getValidation('label-extra').validators);
|
||||
} else if (keyField == 'referenceTypeId') {
|
||||
if (formGroup.get('category').value == DmpBlueprintFieldCategory.ReferenceType) control?.addValidators([Validators.required, ...context.getValidation('referenceTypeId').validators]);
|
||||
else control?.addValidators([...context.getValidation('referenceTypeId').validators]);
|
||||
} else if (keyField == 'systemFieldType') {
|
||||
if (formGroup.get('category').value == DmpBlueprintFieldCategory.System) control?.addValidators([Validators.required, ...context.getValidation('systemFieldType').validators]);
|
||||
else control?.addValidators([...context.getValidation('systemFieldType').validators]);
|
||||
} else if (keyField == 'dataType') {
|
||||
if (formGroup.get('category').value == DmpBlueprintFieldCategory.Extra) control?.addValidators([Validators.required, ...context.getValidation('dataType').validators]);
|
||||
else control?.addValidators([...context.getValidation('dataType').validators]);
|
||||
} else {
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
||||
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
|
||||
|
@ -29,13 +30,16 @@ export class DmpBlueprintEditorResolver extends BaseEditorResolver {
|
|||
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.id)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.category)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.dataType)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.systemFieldType)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.label)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.placeholder)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.description)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.required)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.ordinal)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<SystemFieldInSection>(x => x.systemFieldType)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ExtraFieldInSection>(x => x.dataType)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.code)].join('.'),
|
||||
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
||||
|
|
|
@ -40,13 +40,10 @@
|
|||
<div class="col-4">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.TYPE' | translate}}</mat-label>
|
||||
<mat-select name="type" [formControl]="formGroup.get('type')" required>
|
||||
<mat-option *ngFor="let type of referenceTypeEnum" [value]="type">
|
||||
{{enumUtils.toReferenceTypeString(type)}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('type').hasError('backendError')">{{formGroup.get('type').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<app-single-auto-complete [required]="formGroup.get('typeId').required" [formControl]="formGroup.get('typeId')" placeholder="{{'REFERENCE-EDITOR.FIELDS.TYPE' | translate}}" [configuration]="referenceTypeService.singleAutocompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="formGroup.get('typeId').hasError('backendError')">{{formGroup.get('type').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('typeId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
|
@ -55,7 +52,7 @@
|
|||
<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>
|
||||
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>
|
||||
<mat-error>{{'GENERAL.VALIDATION.REQUIRED'| translate}}</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,7 +61,7 @@
|
|||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.SOURCE' | translate}}</mat-label>
|
||||
<input matInput type="text" name="source" [formControl]="formGroup.get('source')" required>
|
||||
<mat-error *ngIf="formGroup.get('source').hasError('backendError')">{{formGroup.get('source').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('source').hasError('backendError')">{{formGroup.get('source').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -75,8 +72,8 @@
|
|||
<mat-option *ngFor="let sourceType of referenceSourceTypeEnum" [value]="sourceType">
|
||||
{{enumUtils.toReferenceSourceTypeString(sourceType)}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('sourceType').hasError('backendError')">{{formGroup.get('sourceType').getError('backendError').message}}</mat-error>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('sourceType').hasError('backendError')">{{formGroup.get('sourceType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('sourceType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -84,7 +81,7 @@
|
|||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.REFERENCE' | translate}}</mat-label>
|
||||
<input matInput type="text" name="reference" [formControl]="formGroup.get('reference')" required>
|
||||
<mat-error *ngIf="formGroup.get('reference').hasError('backendError')">{{formGroup.get('reference').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('reference').hasError('backendError')">{{formGroup.get('reference').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -92,16 +89,16 @@
|
|||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.ABBREVIATION' | translate}}</mat-label>
|
||||
<input matInput type="text" name="abbreviation" [formControl]="formGroup.get('abbreviation')">
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').hasError('backendError')">{{formGroup.get('abbreviation').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').hasError('backendError')">{{formGroup.get('abbreviation').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Fields -->
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
{{'REFERENCE-EDITOR.FIELDS.FIELDS' | translate}}
|
||||
<button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'REFERENCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
|
||||
<button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'REFERENCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
|
||||
</h3>
|
||||
<div *ngFor="let field of formGroup.get('definition').get('fields').controls; let fieldIndex=index;" class="row mb-3">
|
||||
<div class="col-12">
|
||||
|
@ -115,12 +112,12 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" >
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
|
||||
<input matInput type="text" name="code" [formControl]="field.get('code')" required>
|
||||
<mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -131,8 +128,8 @@
|
|||
<mat-option *ngFor="let dataType of referenceFieldDataTypeEnum" [value]="dataType">
|
||||
{{enumUtils.toReferenceFieldDataTypeString(dataType)}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('dataType').hasError('backendError')">{{field.get('dataType').getError('backendError').message}}</mat-error>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('dataType').hasError('backendError')">{{field.get('dataType').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('dataType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -140,7 +137,7 @@
|
|||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||
<input matInput type="text" name="value" [formControl]="field.get('value')">
|
||||
<mat-error *ngIf="field.get('value').hasError('backendError')">{{field.get('value').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('value').hasError('backendError')">{{field.get('value').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -3,20 +3,22 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
|
||||
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
|
||||
import { Reference, ReferencePersist } from '@app/core/model/reference/reference';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { BaseEditor } from '@common/base/base-editor';
|
||||
import { FormService } from '@common/forms/form-service';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
|
@ -25,12 +27,9 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
|
|||
import { Guid } from '@common/types/guid';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { ReferenceEditorModel } from './reference-editor.model';
|
||||
import { ReferenceEditorResolver } from './reference-editor.resolver';
|
||||
import { ReferenceEditorService } from './reference-editor.service';
|
||||
import { FieldEditorModel, ReferenceEditorModel } from './reference-editor.model';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
|
||||
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -45,7 +44,6 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
|||
isDeleted = false;
|
||||
formGroup: UntypedFormGroup = null;
|
||||
showInactiveDetails = false;
|
||||
public referenceTypeEnum = this.enumUtils.getEnumValues(ReferenceType);
|
||||
public referenceSourceTypeEnum = this.enumUtils.getEnumValues(ReferenceSourceType);
|
||||
public referenceFieldDataTypeEnum = this.enumUtils.getEnumValues(ReferenceFieldDataType);
|
||||
|
||||
|
@ -85,7 +83,8 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
|||
private logger: LoggingService,
|
||||
private referenceEditorService: ReferenceEditorService,
|
||||
private fileUtils: FileUtils,
|
||||
private matomoService: MatomoService
|
||||
private matomoService: MatomoService,
|
||||
public referenceTypeService: ReferenceTypeService
|
||||
) {
|
||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService);
|
||||
}
|
||||
|
@ -190,7 +189,7 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
|||
// fields
|
||||
//
|
||||
addField(): void {
|
||||
(this.formGroup.get('definition').get('fields') as FormArray).push(this.editorModel.createChildField((this.formGroup.get('definition').get('fields') as FormArray).length));
|
||||
(this.formGroup.get('definition').get('fields') as FormArray).push(this.editorModel.createChildField((this.formGroup.get('definition').get('fields') as FormArray).length));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
|
||||
import { ReferenceFieldDataType } from "@app/core/common/enum/reference-field-data-type";
|
||||
import { ReferenceSourceType } from "@app/core/common/enum/reference-source-type";
|
||||
import { ReferenceType } from "@app/core/common/enum/reference-type";
|
||||
import { Definition, DefinitionPersist, Field, FieldPersist, Reference, ReferencePersist } from "@app/core/model/reference/reference";
|
||||
import { BaseEditorModel } from "@common/base/base-form-editor-model";
|
||||
import { BackendErrorValidator } from "@common/forms/validation/custom-validator";
|
||||
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
|
||||
import { Validation, ValidationContext } from "@common/forms/validation/validation-context";
|
||||
import { Guid } from "@common/types/guid";
|
||||
|
||||
export class ReferenceEditorModel extends BaseEditorModel implements ReferencePersist {
|
||||
label: string;
|
||||
type: ReferenceType;
|
||||
typeId: Guid;
|
||||
description: string;
|
||||
definition: DefinitionEditorModel = new DefinitionEditorModel();
|
||||
reference: string;
|
||||
|
@ -29,9 +29,9 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe
|
|||
if (item) {
|
||||
super.fromModel(item);
|
||||
this.label = item.label;
|
||||
this.type = item.type;
|
||||
this.typeId = item.type?.id;
|
||||
this.description = item.description;
|
||||
if (item.definition) this.definition = new DefinitionEditorModel(this.validationErrorModel).fromModel(item.definition);
|
||||
if (item.definition) this.definition = new DefinitionEditorModel(this.validationErrorModel).fromModel(item.definition);
|
||||
this.reference = item.reference;
|
||||
this.abbreviation = item.abbreviation;
|
||||
this.source = item.source;
|
||||
|
@ -46,16 +46,16 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe
|
|||
return this.formBuilder.group({
|
||||
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
|
||||
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
|
||||
type: [{ value: this.type, disabled: disabled }, context.getValidation('type').validators],
|
||||
typeId: [{ value: this.typeId, disabled: disabled }, context.getValidation('typeId').validators],
|
||||
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
|
||||
definition: this.definition.buildForm({
|
||||
rootPath: `definition.`
|
||||
}),
|
||||
}),
|
||||
reference: [{ value: this.reference, disabled: disabled }, context.getValidation('reference').validators],
|
||||
abbreviation: [{ value: this.abbreviation, disabled: disabled }, context.getValidation('abbreviation').validators],
|
||||
source: [{ value: this.source, disabled: disabled }, context.getValidation('source').validators],
|
||||
sourceType: [{ value: this.sourceType, disabled: disabled }, context.getValidation('sourceType').validators],
|
||||
|
||||
|
||||
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
|
||||
});
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe
|
|||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
|
||||
baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
|
||||
baseValidationArray.push({ key: 'type', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'type')] });
|
||||
baseValidationArray.push({ key: 'typeId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'typeId')] });
|
||||
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
|
||||
baseValidationArray.push({ key: 'reference', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'reference')] });
|
||||
baseValidationArray.push({ key: 'abbreviation', validators: [BackendErrorValidator(this.validationErrorModel, 'abbreviation')] });
|
||||
|
@ -98,7 +98,7 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe
|
|||
}
|
||||
|
||||
export class DefinitionEditorModel implements DefinitionPersist {
|
||||
fields: FieldEditorModel[]= [];
|
||||
fields: FieldEditorModel[] = [];
|
||||
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { Definition, Field, Reference } from '@app/core/model/reference/reference';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
||||
|
@ -20,7 +21,7 @@ export class ReferenceEditorResolver extends BaseEditorResolver {
|
|||
...BaseEditorResolver.lookupFields(),
|
||||
nameof<Reference>(x => x.id),
|
||||
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.reference),
|
||||
nameof<Reference>(x => x.abbreviation),
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
|
||||
<div>
|
||||
<mat-label>{{'REFERENCE-LISTING.FILTER.TYPE' | translate}}
|
||||
<mat-select multiple [(ngModel)]="internalFilters.types">
|
||||
<mat-option *ngFor="let referenceType of referenceTypeEnumValues" [value]="referenceType">{{enumUtils.toReferenceTypeString(referenceType)}}</mat-option>
|
||||
</mat-select>
|
||||
<app-single-auto-complete [(ngModel)]="internalFilters.typeIds" placeholder="{{'REFERENCE-LISTING.FILTER.TYPE' | translate}}" [configuration]="referenceTypeService.singleAutocompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
</mat-label>
|
||||
</div>
|
||||
|
||||
|
@ -49,4 +48,4 @@
|
|||
</mat-menu>
|
||||
|
||||
<app-expandable-search-field [(value)]=internalFilters.like (valueChange)="onSearchTermChange($event)" />
|
||||
</div>
|
||||
</div>
|
|
@ -1,10 +1,11 @@
|
|||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { ReferenceFilter } from '@app/core/query/reference.lookup';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
|
||||
@Component({
|
||||
|
@ -18,7 +19,6 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
@Output() filterChange = new EventEmitter<ReferenceFilter>();
|
||||
|
||||
referenceSourceTypeEnumValues = this.enumUtils.getEnumValues<ReferenceSourceType>(ReferenceSourceType)
|
||||
referenceTypeEnumValues = this.enumUtils.getEnumValues<ReferenceType>(ReferenceType);
|
||||
|
||||
// * State
|
||||
internalFilters: ReferenceListingFilters = this._getEmptyFilters();
|
||||
|
@ -26,6 +26,7 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
protected appliedFilterCount: number = 0;
|
||||
constructor(
|
||||
public enumUtils: EnumUtils,
|
||||
public referenceTypeService: ReferenceTypeService
|
||||
) { super(); }
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -50,12 +51,12 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
}
|
||||
|
||||
protected applyFilters(): void {
|
||||
const { isActive, like, types, sourceTypes } = this.internalFilters ?? {}
|
||||
const { isActive, like, typeIds, sourceTypes } = this.internalFilters ?? {}
|
||||
this.filterChange.emit({
|
||||
...this.filter,
|
||||
like,
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
|
||||
types,
|
||||
typeIds,
|
||||
sourceTypes
|
||||
})
|
||||
}
|
||||
|
@ -66,12 +67,12 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
return this._getEmptyFilters();
|
||||
}
|
||||
|
||||
let { excludedIds, ids, isActive, like, types, sourceTypes } = inputFilter;
|
||||
let { excludedIds, ids, isActive, like, typeIds, sourceTypes } = inputFilter;
|
||||
|
||||
return {
|
||||
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
||||
like: like,
|
||||
types: types,
|
||||
typeIds: typeIds,
|
||||
sourceTypes: sourceTypes
|
||||
}
|
||||
|
||||
|
@ -81,7 +82,7 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
return {
|
||||
isActive: true,
|
||||
like: null,
|
||||
types: null,
|
||||
typeIds: null,
|
||||
sourceTypes: null
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +103,6 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
interface ReferenceListingFilters {
|
||||
isActive: boolean;
|
||||
like: string;
|
||||
types: ReferenceType[];
|
||||
typeIds: Guid[];
|
||||
sourceTypes: ReferenceSourceType[];
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<span class="col-12">
|
||||
{{'REFERENCE-LISTING.FIELDS.TYPE' | translate}}:
|
||||
<small>
|
||||
{{enumUtils.toReferenceTypeString(item.type) | nullifyValue}}
|
||||
{{item?.type?.name | nullifyValue}}
|
||||
</small>
|
||||
</span>
|
||||
<br>
|
||||
|
|
|
@ -22,8 +22,8 @@ import { Observable } from 'rxjs';
|
|||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { ReferenceTypePipe } from '@common/formatting/pipes/reference-type.pipe';
|
||||
import { ReferenceSourceTypePipe } from '@common/formatting/pipes/reference-source-type.pipe';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
|
||||
@Component({
|
||||
templateUrl: './REFERENCE-LISTING.component.html',
|
||||
|
@ -110,7 +110,7 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
|
|||
prop: nameof<Reference>(x => x.type),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-LISTING.FIELDS.TYPE',
|
||||
pipe: this.pipeService.getPipe<ReferenceTypePipe>(ReferenceTypePipe)
|
||||
valueFunction: (item: Reference) => (item?.type?.name)
|
||||
},
|
||||
{
|
||||
prop: nameof<Reference>(x => x.createdAt),
|
||||
|
|
|
@ -845,7 +845,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
// // 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 == DescriptionSectionFieldCategory.SYSTEM) && f.get('type').value == systemField) {
|
||||
// // if ((f.get('category').value == FieldCategory.System || f.get('category').value == DescriptionSectionFieldCategory.System) && f.get('type').value == systemField) {
|
||||
// // return true;
|
||||
// // }
|
||||
// // }
|
||||
|
@ -863,9 +863,9 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
// 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 = DescriptionSectionFieldCategory.SYSTEM;
|
||||
// field.category = DescriptionSectionFieldCategory.System;
|
||||
// field.systemFieldType = systemFieldType;
|
||||
// field.required = (systemFieldType == DescriptionSystemFieldType.TEXT || systemFieldType == DescriptionSystemFieldType.HTML_TEXT) ? true : false;
|
||||
// field.required = (systemFieldType == DescriptionSystemFieldType.TEXT || systemFieldType == DescriptionSystemFieldType.Description) ? true : false;
|
||||
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(field.buildForm()); //TODO: dtziotzios validation path
|
||||
// }
|
||||
|
||||
|
@ -881,7 +881,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
// 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 = DescriptionSectionFieldCategory.EXTRA;
|
||||
// field.category = DescriptionSectionFieldCategory.Extra;
|
||||
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(field.buildForm()); //TODO: dtziotzios validation path
|
||||
// }
|
||||
|
||||
|
|
|
@ -403,8 +403,9 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
|
|||
this.textValue = item.textValue;
|
||||
this.textListValue = item.textListValue;
|
||||
this.dateValue = item.dateValue;
|
||||
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;
|
||||
//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;
|
||||
this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier);
|
||||
}
|
||||
return this;
|
||||
|
@ -559,7 +560,8 @@ export class DescriptionReferenceEditorModel implements DescriptionReferencePers
|
|||
|
||||
fromModel(item: DescriptionReference): DescriptionReferenceEditorModel {
|
||||
this.id = item.id;
|
||||
this.reference = item.reference;
|
||||
//TODO: refactor reference type
|
||||
//this.reference = item.reference;
|
||||
this.hash = item.hash;
|
||||
|
||||
return this;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('pattern')">{{'GENERAL.VALIDATION.URL.MESSAGE' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12">
|
||||
<div class="row">
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12">
|
||||
<!-- <div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '')}}" [formControl]="propertiesFormGroup?.get(field.id).get('textListValue')" [configuration]="multipleAutoCompleteConfiguration">
|
||||
|
@ -32,7 +32,7 @@
|
|||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12">
|
||||
<div class="row">
|
||||
|
@ -56,25 +56,6 @@
|
|||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('textListValue')" [configuration]="multipleAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textListValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textListValue').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textListValue').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('textValue')" [configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<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('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_ENTRIES_DESCRIPTIONS" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
|
@ -204,148 +185,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>\
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAXONOMIES" class="col-12">
|
||||
<div *ngIf="field.data" class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.LICENSES" class="col-12">
|
||||
<div *ngIf="field.data" class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUBLICATIONS" class="col-12">
|
||||
<div *ngIf="field.data" class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REGISTRIES" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="registriesAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="registriesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SERVICES" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="servicesAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="servicesAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAGS" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
|
@ -355,44 +194,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.RESEARCHERS" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="researchersAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="researchersAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.ORGANIZATIONS" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<ng-container *ngIf="field.data.multipleSelect">
|
||||
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('references')" [configuration]="organisationsAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('references').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!(field.data.multipleSelect)">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('reference')" [configuration]="organisationsAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('reference').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
</mat-error>
|
||||
</ng-container>
|
||||
|
||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATASET_IDENTIFIER" class="col-12">
|
||||
<div class="row" *ngIf="datasetIdInitialized">
|
||||
<mat-form-field class="col-md-12">
|
||||
|
|
|
@ -5,10 +5,8 @@ import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|||
import { MatDialog } from "@angular/material/dialog";
|
||||
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
|
||||
import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/description-template-field-validation-type';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { DescriptionTemplateExternalSelectData, DescriptionTemplateExternalSelectSource, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template';
|
||||
import { FetcherReference, Reference } from '@app/core/model/reference/reference';
|
||||
import { ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
|
||||
import { DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template';
|
||||
import { FetcherReference } from '@app/core/model/reference/reference';
|
||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from "@app/core/services/notification/ui-notification-service";
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
|
@ -16,7 +14,6 @@ import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
|||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
|
||||
import { isNullOrUndefined } from '@app/utilities/enhancers/utils';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
@ -41,7 +38,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// @Input() form: UntypedFormGroup;
|
||||
@Input() datasetProfileId: any;
|
||||
@Input() isChild: Boolean = false;
|
||||
autocompleteOptions: DescriptionTemplateExternalSelectSource[];
|
||||
|
||||
visible: boolean = true;
|
||||
|
||||
|
@ -54,20 +50,10 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
|
||||
public singleAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
public multipleAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
|
||||
externalDatasetAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
dataRepositoriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
pubRepositoriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
journalRepositoriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
taxonomiesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
licensesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
publicationsAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
registriesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
servicesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
tagsAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
currencyAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
multipleReferenceAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
|
||||
|
||||
readonly separatorKeysCodes: number[] = [ENTER, COMMA];
|
||||
|
||||
|
@ -154,123 +140,17 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// }
|
||||
// }
|
||||
|
||||
// Setup autocomplete configuration if needed
|
||||
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.EXTERNAL_SELECT) {
|
||||
if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
|
||||
this.singleAutoCompleteConfiguration = {
|
||||
filterFn: this.searchFromAutocomplete.bind(this),
|
||||
initialItems: () => this.searchFromAutocomplete(''),
|
||||
displayFn: (item) => { try { return (item != null && item.length > 1) ? JSON.parse(item).label : item['label'] } catch { return '' } },
|
||||
titleFn: (item) => { try { return item['label'] } catch { return '' } },
|
||||
valueAssign: (item) => { try { return JSON.stringify(item) } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item['source'] ? this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] : this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-NO-SOURCE') } catch { return '' } }
|
||||
};
|
||||
}
|
||||
else {
|
||||
this.multipleAutoCompleteConfiguration = {
|
||||
filterFn: this.searchFromAutocomplete.bind(this),
|
||||
initialItems: () => this.searchFromAutocomplete(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['label'] : item['label'] } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['label'] : item['label'] } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item['source'] ? this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] : this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-NO-SOURCE') } catch { return '' } }
|
||||
}
|
||||
}
|
||||
if (isNullOrUndefined(this.datasetProfileId)) {
|
||||
this.autocompleteOptions = (this.field.data as DescriptionTemplateExternalSelectData).sources;
|
||||
}
|
||||
}
|
||||
|
||||
switch (this.field?.data?.fieldType) {
|
||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||
this.externalDatasetAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalDatasets.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalDatasets(''),//.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
|
||||
this.dataRepositoriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalDataRepositories.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalDataRepositories(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
|
||||
this.pubRepositoriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalPubRepositories.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalPubRepositories(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
|
||||
this.journalRepositoriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalJournalRepositories.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalJournalRepositories(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.TAXONOMIES:
|
||||
this.taxonomiesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalTaxonomies.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalTaxonomies(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.LICENSES:
|
||||
this.licensesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalLicences.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalLicences(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.PUBLICATIONS:
|
||||
this.publicationsAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalPublications.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalPublications(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.REGISTRIES:
|
||||
this.registriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalRegistries.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalRegistries(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.SERVICES:
|
||||
this.servicesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalServices.bind(this),
|
||||
initialItems: () => this.searchDatasetExternalServices(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
//TODO: refactor
|
||||
// this.multipleReferenceAutoCompleteConfiguration = {
|
||||
// filterFn: this.filterOrganisations.bind(this),
|
||||
// initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
||||
// displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
// titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
// subtitleFn: (item) => { try { return item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) } catch { return '' } },
|
||||
// valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
// };
|
||||
break;
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
this.tagsAutoCompleteConfiguration = {
|
||||
|
@ -282,26 +162,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
};
|
||||
this.parseTags();
|
||||
break;
|
||||
case DescriptionTemplateFieldType.RESEARCHERS:
|
||||
this.researchersAutoCompleteConfiguration = {
|
||||
filterFn: this.filterResearchers.bind(this),
|
||||
initialItems: (excludedItems: any[]) => this.filterResearchers('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.ORGANIZATIONS:
|
||||
this.organisationsAutoCompleteConfiguration = {
|
||||
filterFn: this.filterOrganisations.bind(this),
|
||||
initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
subtitleFn: (item) => { try { return item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
||||
// const value = this.propertiesFormGroup.get(this.field.id).get('value').value;
|
||||
// const disabled = this.propertiesFormGroup.get(this.field.id).disabled;
|
||||
|
@ -332,9 +193,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// this.form.disable();
|
||||
// }
|
||||
break;
|
||||
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
|
||||
this.makeAutocompleteConfiguration(this.searchResearchers.bind(this), "name", "tag");
|
||||
break;
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||
this.makeAutocompleteConfiguration(this.searchDatasets.bind(this), "label");
|
||||
break;
|
||||
|
@ -344,7 +202,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
|
||||
// this.form = this.visibilityRulesService.getFormGroup(this.field.id);
|
||||
|
||||
|
||||
//TODO: refactor
|
||||
// this.propertiesFormGroup.get(this.field.id).get('value').valueChanges
|
||||
// .pipe(
|
||||
|
@ -441,7 +299,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
|
||||
makeAutocompleteConfiguration(myfunc: Function, title: string, subtitle?: string): void {
|
||||
if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
|
||||
if (!((this.field.data as DescriptionTemplateLabelAndMultiplicityData).multipleSelect)) {
|
||||
this.singleAutoCompleteConfiguration = {
|
||||
filterFn: myfunc.bind(this),
|
||||
initialItems: (extraData) => myfunc(''),
|
||||
|
@ -463,91 +321,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
}
|
||||
|
||||
searchDatasetExternalDatasets(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new ExternalDatasetCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// //return this.externalSourcesService.searchDatasetSExternalDatasetservice(requestItem);
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.Datasets, requestItem.criteria.like, requestItem.criteria.type);
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Datasets;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
|
||||
searchDatasetExternalDataRepositories(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new DataRepositoryCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.DataRepositories;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
searchDatasetExternalPubRepositories(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new DataRepositoryCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.PubRepositories;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
searchDatasetExternalJournalRepositories(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new DataRepositoryCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.Journals, requestItem.criteria.like, requestItem.criteria.type);
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Journals;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
searchDatasetExternalTaxonomies(query: string): Observable<FetcherReference[]> {
|
||||
//TODO refactor
|
||||
return null;
|
||||
// const requestItem: RequestItem<TaxonomyCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new TaxonomyCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalLicences(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<LicenseCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new LicenseCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
// return this.externalSourcesService.listExternal(ReferenceType.Licenses, requestItem.criteria.like, requestItem.criteria.type);
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Licenses;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
searchDatasetExternalPublications(query: string): Observable<Reference[]> {
|
||||
// const requestItem: RequestItem<PublicationCriteria> = new RequestItem();
|
||||
// requestItem.criteria = new PublicationCriteria();
|
||||
// requestItem.criteria.like = query;
|
||||
// requestItem.criteria.type = '';
|
||||
//return this.externalSourcesService.listExternal(ReferenceType.Publications, requestItem.criteria.like, requestItem.criteria.type);
|
||||
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = query;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Publications;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
|
||||
searchDatasetExternalRegistries(query: string): Observable<FetcherReference[]> {
|
||||
//TODO refactor
|
||||
return null;
|
||||
|
@ -631,26 +404,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// }
|
||||
}
|
||||
|
||||
filterOrganisations(value: string): Observable<Reference[]> {
|
||||
//return this.externalSourcesService.searchDMPOrganizations(value);
|
||||
//return this.externalSourcesService.listExternal(ReferenceType.Organizations, value, '');
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = value;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Organizations;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
|
||||
filterResearchers(value: string): Observable<Reference[]> {
|
||||
//return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } });
|
||||
//return this.externalSourcesService.listExternal(ReferenceType.Researcher, value, '');
|
||||
const lookup = new ReferenceSearchLookup();
|
||||
lookup.like = value;
|
||||
lookup.key = '';
|
||||
lookup.type = ReferenceType.Researcher;
|
||||
return this.referenceService.search(lookup);
|
||||
}
|
||||
|
||||
getDatasetIdControl(name: string): UntypedFormControl {
|
||||
return this.propertiesFormGroup.get(this.field.id).get(name) as UntypedFormControl;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<span *ngIf="description.status === descriptionStatusEnum.Finalized && description.dmp.accessType != dmpAccessTypeEnum.Public" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
|
||||
<span *ngIf="description.status === descriptionStatusEnum.Draft" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
|
||||
<span>.</span>
|
||||
<span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}</span>
|
||||
<span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span>
|
||||
</div>
|
||||
<div class="d-flex flex-direction-row pt-3 pb-3">
|
||||
<div class="col-auto description-subtitle pr-0">{{'DESCRIPTION-LISTING.PART-OF' | translate}}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { MatDialog } from '@angular/material/dialog';
|
|||
import { Router } from '@angular/router';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { Description } from '@app/core/model/description/description';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { DescriptionService } from '@app/core/services/description/description.service';
|
||||
|
@ -14,6 +13,7 @@ import { FileTransformerService } from '@app/core/services/file-transformer/file
|
|||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
|
@ -44,7 +44,6 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
isUserOwner: boolean;
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
dmpAccessTypeEnum = DmpAccessType;
|
||||
referenceTypeEnum = ReferenceType;
|
||||
|
||||
|
||||
constructor(
|
||||
|
@ -61,6 +60,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
private fileUtils: FileUtils,
|
||||
public dmpService: DmpService,
|
||||
public referenceService: ReferenceService,
|
||||
public referenceTypeService: ReferenceTypeService,
|
||||
public fileTransformerService: FileTransformerService
|
||||
) {
|
||||
super();
|
||||
|
|
|
@ -59,9 +59,9 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="referenceService.hasRerefenceOfTypes(description?.dmp?.dmpReferences, [referenceTypeEnum.Grants])">
|
||||
<div *ngIf="referenceService.hasRerefenceOfTypes(description?.dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])">
|
||||
<div class="row header">{{'DESCRIPTION-OVERVIEW.GRANT' | translate}}</div>
|
||||
<div class="row description-label">{{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}</div>
|
||||
<div class="row description-label">{{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</div>
|
||||
</div>
|
||||
|
||||
<div class="row header">{{'DESCRIPTION-OVERVIEW.RESEARCHERS' | translate}}</div>
|
||||
|
|
|
@ -9,7 +9,6 @@ import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
|||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { Description, DescriptionStatusPersist } from '@app/core/model/description/description';
|
||||
import { Dmp, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp';
|
||||
|
@ -22,6 +21,7 @@ import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|||
import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
|
@ -53,7 +53,6 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
lockStatus: Boolean;
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
dmpAccessTypeEnum = DmpAccessType;
|
||||
referenceTypeEnum = ReferenceType;
|
||||
dmpStatusEnum = DmpStatus;
|
||||
dmpUserRoleEnum = DmpUserRole;
|
||||
|
||||
|
@ -72,7 +71,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
public enumUtils: EnumUtils,
|
||||
private matomoService: MatomoService,
|
||||
private fileUtils: FileUtils,
|
||||
public fileTransformerService: FileTransformerService
|
||||
public fileTransformerService: FileTransformerService,
|
||||
private referenceTypeService: ReferenceTypeService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.description = data;
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [ReferenceType.Researcher]);
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
||||
// this.users = this.description.dmp.users;
|
||||
this.checkLockStatus(this.description.id);
|
||||
this.setIsUserOwner();
|
||||
|
@ -117,7 +117,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.description = data;
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [ReferenceType.Researcher]);
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
||||
// this.users = this.description.dmp.users;
|
||||
// const breadCrumbs = [];
|
||||
// breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DESCRIPTIONS'), url: "/explore" });
|
||||
|
|
|
@ -132,12 +132,12 @@
|
|||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div *ngFor="let field of section.fields; let j=index">
|
||||
<div class="heading" *ngIf="!field.label && field.category === dmpBlueprintSectionFieldCategoryEnum.SYSTEM">{{i + 1}}.{{j + 1}} {{enumUtils.toDmpBlueprintSystemFieldTypeString(field.systemFieldType)}}<span *ngIf="field.required">*</span></div>
|
||||
<div class="heading" *ngIf="!field.label && field.category === dmpBlueprintSectionFieldCategoryEnum.System">{{i + 1}}.{{j + 1}} {{enumUtils.toDmpBlueprintSystemFieldTypeString(field.systemFieldType)}}<span *ngIf="field.required">*</span></div>
|
||||
<div class="heading" *ngIf="field.label">{{i + 1}}.{{j + 1}} {{field.label}}<span *ngIf="field.required">*</span></div>
|
||||
<div *ngIf="field.description != null && field.description.length > 0" class="hint">{{field.description}}</div>
|
||||
<div class="input-form">
|
||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.SYSTEM">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.TEXT">
|
||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.System">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Title">
|
||||
<mat-form-field class="w-100">
|
||||
<input matInput placeholder="{{field.placeholder ?? 'DMP-EDITOR.FIELDS.TITLE' | translate}}" type="text" name="label" [formControl]="formGroup.get('label')" required>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">
|
||||
|
@ -146,29 +146,11 @@
|
|||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.HTML_TEXT">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Description">
|
||||
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="field.placeholder ?? 'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
|
||||
</rich-text-editor-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.RESEARCHERS">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Researcher"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.ORGANIZATIONS">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Organizations"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.FUNDER">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Funder"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.GRANT">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Grants"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.PROJECT">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Project"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.LICENSE">
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="referenceTypeEnum.Licenses"></app-reference-field-component>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.LANGUAGE">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Language">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-select [formControl]="formGroup.get('language')" placeholder="{{field.placeholder ?? 'DMP-EDITOR.FIELDS.LANGUAGE' | translate}}" required>
|
||||
<mat-option *ngFor="let lang of getLanguageInfos()" [value]="lang.code">
|
||||
|
@ -179,7 +161,7 @@
|
|||
<mat-error *ngIf="formGroup.get('language').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.CONTACT">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Contact">
|
||||
<div cdkDropList class="col-12" (cdkDropListDropped)="dropContacts($event)">
|
||||
<div *ngFor="let contact of formGroup.get('properties').get('contacts').controls; let contactIndex=index;" cdkDrag class="row align-items-center" [cdkDragDisabled]="formGroup.disabled">
|
||||
<div class="col-auto">
|
||||
|
@ -248,7 +230,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.ACCESS_RIGHTS">
|
||||
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.AccessRights">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-select [formControl]="formGroup.get('accessType')" placeholder="{{field.placeholder ?? 'DMP-EDITOR.FIELDS.ACCESS-TYPE' | translate}}">
|
||||
<mat-option *ngFor="let dmpAccessType of dmpAccessTypeEnumValues" [value]="dmpAccessType">
|
||||
|
@ -260,7 +242,12 @@
|
|||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.EXTRA">
|
||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.ReferenceType">
|
||||
<div>
|
||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="field.referenceType"></app-reference-field-component>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.Extra">
|
||||
<div *ngIf="field.dataType === dmpBlueprintExtraFieldDataTypeEnum.Text">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{field.label}}</mat-label>
|
||||
|
|
|
@ -1,25 +1,36 @@
|
|||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
||||
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-field-type';
|
||||
import { DmpBlueprintSectionFieldCategory } from '@app/core/common/enum/dmp-blueprint-section-field-category';
|
||||
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
|
||||
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
|
||||
import { DmpContactType } from '@app/core/common/enum/dmp-contact-type';
|
||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { DmpBlueprint } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { Dmp, DmpPersist } from '@app/core/model/dmp/dmp';
|
||||
import { LanguageInfo } from '@app/core/model/language-info';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||
import { LanguageInfoService } from '@app/core/services/culture/language-info-service';
|
||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
||||
import { isNullOrUndefined } from '@app/utilities/enhancers/utils';
|
||||
import { BaseEditor } from '@common/base/base-editor';
|
||||
|
@ -33,21 +44,6 @@ import { map, takeUntil } from 'rxjs/operators';
|
|||
import { DmpEditorModel } from './dmp-editor.model';
|
||||
import { DmpEditorResolver } from './dmp-editor.resolver';
|
||||
import { DmpEditorService } from './dmp-editor.service';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { LanguageInfo } from '@app/core/model/language-info';
|
||||
import { LanguageInfoService } from '@app/core/services/culture/language-info-service';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { FormArray, 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';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { DmpContactType } from '@app/core/common/enum/dmp-contact-type';
|
||||
import { MatButtonToggleChange } from '@angular/material/button-toggle';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-editor',
|
||||
|
@ -64,10 +60,9 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
lockStatus: Boolean = false;
|
||||
step: number = 0;
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
dmpBlueprintSectionFieldCategoryEnum = DmpBlueprintSectionFieldCategory;
|
||||
dmpBlueprintSectionFieldCategoryEnum = DmpBlueprintFieldCategory;
|
||||
dmpBlueprintSystemFieldTypeEnum = DmpBlueprintSystemFieldType;
|
||||
dmpBlueprintExtraFieldDataTypeEnum = DmpBlueprintExtraFieldDataType;
|
||||
referenceTypeEnum = ReferenceType;
|
||||
dmpAccessTypeEnum = DmpAccessType;
|
||||
dmpAccessTypeEnumValues = this.enumUtils.getEnumValues<DmpAccessType>(DmpAccessType);
|
||||
dmpContactTypeEnum = DmpContactType;
|
||||
|
@ -580,7 +575,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
|
||||
|
||||
|
||||
// dmpBlueprintSectionFieldCategory = DmpBlueprintSectionFieldCategory;
|
||||
// dmpBlueprintSectionFieldCategory = DmpBlueprintFieldCategory;
|
||||
// dmpBlueprintSystemFieldType = DmpBlueprintSystemFieldType;
|
||||
// //public dmpBlueprintSystemFieldTypeEnum = this.enumUtils.getEnumValues(DmpBlueprintSystemFieldType);
|
||||
// dmpBlueprintExtraFieldDataType = DmpBlueprintExtraFieldDataType;
|
||||
|
@ -1353,7 +1348,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
// private buildExtraFields(): void {
|
||||
// const extraFields = new Array<UntypedFormGroup>();
|
||||
// this.selectedDmpBlueprintDefinition.sections.forEach(section => section.fields.forEach(field => {
|
||||
// if (field.category as unknown == DmpBlueprintSectionFieldCategory.EXTRA) {
|
||||
// if (field.category as unknown == DmpBlueprintFieldCategory.Extra) {
|
||||
// let extraField = new DmpExtraFieldEditorModel();
|
||||
// extraField.id = field.id.toString();
|
||||
// if (!isNullOrUndefined(this.dmp.extraFields)) {
|
||||
|
@ -1382,7 +1377,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
// let hasGrant = false;
|
||||
// this.selectedDmpBlueprintDefinition.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
|
||||
// hasGrant = true;
|
||||
// }
|
||||
// }
|
||||
|
@ -1396,7 +1391,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
// let hasFunder = false;
|
||||
// this.selectedDmpBlueprintDefinition.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
|
||||
// hasFunder = true;
|
||||
// }
|
||||
// }
|
||||
|
@ -1410,7 +1405,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
// let hasProject = false;
|
||||
// this.selectedDmpBlueprintDefinition.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
|
||||
// hasProject = true;
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -269,7 +269,8 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist {
|
|||
fromModel(item: DmpBlueprintValue, dmpReferences: DmpReference[]): DmpBlueprintValueEditorModel {
|
||||
this.fieldId = item.fieldId;
|
||||
this.fieldValue = item.fieldValue;
|
||||
this.references = dmpReferences?.filter(x => x.data?.blueprintFieldId === this.fieldId) || [];
|
||||
//TODO: refactor reference type
|
||||
// this.references = dmpReferences?.filter(x => x.data?.blueprintFieldId === this.fieldId) || [];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -428,7 +429,7 @@ export class DmpReferenceEditorModel implements DmpReferencePersist {
|
|||
|
||||
fromModel(item: DmpReference): DmpReferenceEditorModel {
|
||||
this.id = item.id;
|
||||
this.reference = item.reference;
|
||||
// this.reference = item.reference; //TODO: refactor reference type
|
||||
this.data = item.data;
|
||||
this.hash = item.hash;
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { Description } from '@app/core/model/description/description';
|
||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { Dmp, DmpBlueprintValue, DmpContact, DmpDescriptionTemplate, DmpProperties } from '@app/core/model/dmp/dmp';
|
||||
import { DmpReference, DmpReferenceData } from '@app/core/model/dmp/dmp-reference';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { Reference } from '@app/core/model/reference/reference';
|
||||
import { DmpAssociatedUser, User } from '@app/core/model/user/user';
|
||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||
|
@ -93,13 +94,16 @@ export class DmpEditorResolver extends BaseEditorResolver {
|
|||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.category)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.dataType)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.systemFieldType)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.label)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.placeholder)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.description)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.required)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.ordinal)].join('.')
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.ordinal)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ExtraFieldInSection>(x => x.dataType)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<SystemFieldInSection>(x => x.systemFieldType)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.code)].join('.'),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<span>.</span>
|
||||
<span class="col-auto">{{'DMP-LISTING.VERSION' | translate}} {{dmp.version}}</span>
|
||||
<span>.</span>
|
||||
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}</span>
|
||||
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span>
|
||||
</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ dmp.descriptions?.length }})
|
||||
</div>
|
||||
|
|
|
@ -5,13 +5,14 @@ import { MatDialog } from '@angular/material/dialog';
|
|||
import { Router } from '@angular/router';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { CloneDmpPersist, Dmp } from '@app/core/model/dmp/dmp';
|
||||
import { Dmp } from '@app/core/model/dmp/dmp';
|
||||
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||
import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service';
|
||||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
|
@ -22,12 +23,9 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { takeUntil } from 'rxjs/operators';
|
||||
import { DmpStatus } from '../../../../core/common/enum/dmp-status';
|
||||
import { AuthService } from '../../../../core/services/auth/auth.service';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { FileFormat } from '@app/core/model/file/file-format.model';
|
||||
import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service';
|
||||
import { CloneDmpDialogComponent } from '../../clone-dialog/dmp-clone-dialog.component';
|
||||
import { NewVersionDmpDialogComponent } from '../../new-version-dialog/dmp-new-version-dialog.component';
|
||||
import { DmpInvitationDialogComponent } from '../../invitation/dialog/dmp-invitation-dialog.component';
|
||||
import { NewVersionDmpDialogComponent } from '../../new-version-dialog/dmp-new-version-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-listing-item-component',
|
||||
|
@ -45,7 +43,6 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
isFinalized: boolean;
|
||||
isPublished: boolean;
|
||||
dmpStatusEnum = DmpStatus;
|
||||
referenceTypeEnum = ReferenceType;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -61,6 +58,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
private httpClient: HttpClient,
|
||||
private matomoService: MatomoService,
|
||||
public referenceService: ReferenceService,
|
||||
public referenceTypeService: ReferenceTypeService,
|
||||
public fileTransformerService: FileTransformerService,
|
||||
private fileUtils: FileUtils) {
|
||||
super();
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="referenceService.hasRerefenceOfTypes(dmp?.dmpReferences, [referenceTypeEnum.Grants])">
|
||||
<div *ngIf="referenceService.hasRerefenceOfTypes(dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])">
|
||||
<div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div>
|
||||
<div class="row dmp-label">{{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}</div>
|
||||
<div class="row dmp-label">{{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</div>
|
||||
</div>
|
||||
<div class="row header">{{'DESCRIPTION-OVERVIEW.RESEARCHERS' | translate}}</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -14,7 +14,6 @@ import { Location } from '@angular/common';
|
|||
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration';
|
||||
import { Description } from '@app/core/model/description/description';
|
||||
import { Dmp, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp';
|
||||
|
@ -38,6 +37,7 @@ import * as FileSaver from 'file-saver';
|
|||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-overview',
|
||||
|
@ -66,7 +66,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
|
||||
descriptionStatusEnum = DescriptionStatus;
|
||||
dmpAccessTypeEnum = DmpAccessType;
|
||||
referenceTypeEnum = ReferenceType;
|
||||
dmpStatusEnum = DmpStatus;
|
||||
dmpUserRoleEnum = DmpUserRole;
|
||||
|
||||
|
@ -88,7 +87,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
private fileUtils: FileUtils,
|
||||
public referenceService: ReferenceService,
|
||||
public enumUtils: EnumUtils,
|
||||
public fileTransformerService: FileTransformerService
|
||||
public fileTransformerService: FileTransformerService,
|
||||
private referenceTypeService: ReferenceTypeService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.dmp = data;
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [ReferenceType.Researcher]);
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
||||
if (!this.hasDoi()) {
|
||||
this.selectedModel = this.dmp.entityDois[0];
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.dmp = data;
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [ReferenceType.Researcher]);
|
||||
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
||||
if (!this.hasDoi()) {
|
||||
this.selectedModel = this.dmp.entityDois[0];
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
// let hasGrant = false;
|
||||
// blueprint.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
|
||||
// hasGrant = true;
|
||||
// }
|
||||
// }
|
||||
|
@ -240,7 +240,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
// let hasFunder = false;
|
||||
// blueprint.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
|
||||
// hasFunder = true;
|
||||
// }
|
||||
// }
|
||||
|
@ -254,7 +254,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
// let hasProject = false;
|
||||
// blueprint.sections.forEach(section => section.fields.forEach(
|
||||
// field => {
|
||||
// if (field.category as unknown === DmpBlueprintSectionFieldCategory.SYSTEM && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
|
||||
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
|
||||
// hasProject = true;
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<mat-form-field class="w-100" *ngIf="multipleAutoCompleteSearchConfiguration">
|
||||
<mat-label>{{label ?? enumUtils.toReferenceTypeString(referenceType)}}</mat-label>
|
||||
<app-multiple-auto-complete placeholder = "{{ placeholder ?? enumUtils.toReferenceTypeString(referenceType)}}" [formControl]="form" [configuration]="multipleAutoCompleteSearchConfiguration">
|
||||
<mat-label>{{label ?? referenceType?.name}}</mat-label>
|
||||
<app-multiple-auto-complete placeholder = "{{ placeholder ?? referenceType?.name}}" [formControl]="form" [configuration]="multipleAutoCompleteSearchConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="form.hasError('backendError')">{{form.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Guid } from '@common/types/guid';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reference-field-component',
|
||||
|
@ -16,7 +17,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
|||
@Input() referenceType: ReferenceType = null;
|
||||
@Input() form: UntypedFormGroup = null;
|
||||
@Input() label: string = null;
|
||||
@Input() placeholder: string = "Enter text";
|
||||
@Input() placeholder: string;
|
||||
|
||||
multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;
|
||||
|
||||
|
@ -26,7 +27,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
|||
) { super(); }
|
||||
|
||||
ngOnInit() {
|
||||
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType);
|
||||
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id);
|
||||
}
|
||||
|
||||
addReference() {
|
||||
|
|
|
@ -1604,13 +1604,13 @@
|
|||
"SECTION-PREFIX": "Section",
|
||||
"SECTION-NAME": "Section Name",
|
||||
"SECTION-DESCRIPTION": "Section Description",
|
||||
"SYSTEM-FIELDS": "System Fields",
|
||||
"SYSTEM-FIELD": "System Field",
|
||||
"FIELD-TYPE": "Field Type",
|
||||
"REFERENCE-TYPE": "Reference Type",
|
||||
"SYSTEM-FIELD-TYPE": "System Field",
|
||||
"FIELD-LABEL": "Label",
|
||||
"FIELD-PLACEHOLDER": "Placeholder",
|
||||
"FIELD-DESCRIPTION": "Description",
|
||||
"FIELD-DATA-TYPE": "Data Type",
|
||||
"DATA-TYPE": "Data Type",
|
||||
"CATEGORY": "Field Type",
|
||||
"FIELD-REQUIRED": "Required",
|
||||
"DESCRIPTION-TEMPLATES": "Description Templates",
|
||||
"DESCRIPTION-TEMPLATE": "Description Template",
|
||||
|
@ -1628,9 +1628,8 @@
|
|||
}
|
||||
},
|
||||
"ACTIONS": {
|
||||
"ADD-EXTRA-FIELD": "Add Extra Field",
|
||||
"REMOVE-SYSTEM-FIELD": "Delete",
|
||||
"REMOVE-EXTRA-FIELD": "Delete",
|
||||
"ADD-FIELD": "Add Field",
|
||||
"REMOVE-FIELD": "Delete",
|
||||
"REMOVE-SECTION": "Remove Section",
|
||||
"ADD-DESCRIPTION-TEMPLATE": "Add Description Template",
|
||||
"REMOVE-DESCRIPTION-TEMPLATE": "Remove Description Template",
|
||||
|
@ -2296,16 +2295,10 @@
|
|||
"DRAFT": "Draft"
|
||||
},
|
||||
"DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": {
|
||||
"TEXT": "Title",
|
||||
"HTML_TEXT": "Description",
|
||||
"RESEARCHERS": "Researchers",
|
||||
"ORGANIZATIONS": "Organizations",
|
||||
"TITLE": "Title",
|
||||
"DESCRIPTION": "Description",
|
||||
"LANGUAGE": "Language",
|
||||
"CONTACT": "Contact",
|
||||
"FUNDER": "Funder",
|
||||
"GRANT": "Grant",
|
||||
"PROJECT": "Project",
|
||||
"LICENSE": "License",
|
||||
"ACCESS_RIGHTS": "Access"
|
||||
},
|
||||
"DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": {
|
||||
|
@ -2433,6 +2426,11 @@
|
|||
"DMP-CONTACT-TYPE": {
|
||||
"INTERNAL": "Internal",
|
||||
"EXTERNAL": "External"
|
||||
},
|
||||
"DMP-BLUEPRINT-FIELD-CATEGORY": {
|
||||
"SYSTEM": "System",
|
||||
"EXTRA": "Custom",
|
||||
"REFERENCE-TYPE": "External Reference"
|
||||
}
|
||||
},
|
||||
"ADDRESEARCHERS-EDITOR": {
|
||||
|
|
|
@ -5,15 +5,14 @@ import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pi
|
|||
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
||||
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
|
||||
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
||||
import { ReferenceTypePipe } from './pipes/reference-type.pipe';
|
||||
import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||
import { NotificationTemplateChannelPipe } from './pipes/notification-template-channel.pipe';
|
||||
import { NotificationTemplateKindPipe } from './pipes/notification-template-kind.pipe';
|
||||
import { NotificationTypePipe } from './pipes/notification-type.pipe';
|
||||
import { NotificationContactTypePipe } from './pipes/notification-contact-type.pipe';
|
||||
import { NotificationNotifyStatePipe } from './pipes/notification-notify-state.pipe';
|
||||
import { NotificationTemplateChannelPipe } from './pipes/notification-template-channel.pipe';
|
||||
import { NotificationTemplateKindPipe } from './pipes/notification-template-kind.pipe';
|
||||
import { NotificationTrackingProcessPipe } from './pipes/notification-tracking-process.pipe';
|
||||
import { NotificationTrackingStatePipe } from './pipes/notification-tracking-state.pipe';
|
||||
import { NotificationTypePipe } from './pipes/notification-type.pipe';
|
||||
import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||
|
||||
//
|
||||
//
|
||||
|
@ -31,7 +30,6 @@ import { NotificationTrackingStatePipe } from './pipes/notification-tracking-sta
|
|||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe,
|
||||
ReferenceSourceTypePipe,
|
||||
NotificationTemplateChannelPipe,
|
||||
NotificationTemplateKindPipe,
|
||||
|
@ -51,7 +49,6 @@ import { NotificationTrackingStatePipe } from './pipes/notification-tracking-sta
|
|||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe,
|
||||
ReferenceSourceTypePipe,
|
||||
NotificationTemplateChannelPipe,
|
||||
NotificationTemplateKindPipe,
|
||||
|
@ -71,7 +68,6 @@ import { NotificationTrackingStatePipe } from './pipes/notification-tracking-sta
|
|||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe,
|
||||
ReferenceSourceTypePipe,
|
||||
NotificationTemplateChannelPipe,
|
||||
NotificationTemplateKindPipe,
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
||||
@Pipe({ name: 'ReferenceTypeFormat' })
|
||||
export class ReferenceTypePipe implements PipeTransform {
|
||||
constructor(private enumUtils: EnumUtils) { }
|
||||
|
||||
public transform(value): any {
|
||||
return this.enumUtils.toReferenceTypeString(value);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue