frontend: description template model alignment

This commit is contained in:
Diamantis Tziotzios 2023-10-27 20:10:21 +03:00
parent 9201f265d2
commit 36c17b5853
10 changed files with 289 additions and 76 deletions

View File

@ -0,0 +1,4 @@
export enum DescriptionTemplateFieldDataComboBoxType {
Autocomplete = 'autocomplete',
Wordlist = 'wordlist'
}

View File

@ -0,0 +1,5 @@
export enum DescriptionTemplateFieldDataExternalDatasetType {
ReusedDataset = 'reused_dataset',
ProducedDataset = 'produced_dataset',
Other = 'other'
}

View File

@ -0,0 +1,5 @@
export enum DescriptionTemplateFieldDataInternalDmpEntryType {
Researchers = 'researchers',
Dmps = 'dmps',
Datasets = 'datasets'
}

View File

@ -0,0 +1,27 @@
export enum DescriptionTemplateFieldType {
COMBO_BOX = "combobox",
BOOLEAN_DECISION = "booleanDecision",
RADIO_BOX = "radiobox",
INTERNAL_DMP_ENTRIES = "internalDmpEntities",
CHECK_BOX = "checkBox",
FREE_TEXT = "freetext",
TEXT_AREA = "textarea",
RICH_TEXT_AREA = "richTextarea",
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",
TAGS = "tags",
RESEARCHERS = "researchers",
ORGANIZATIONS = "organizations",
DATASET_IDENTIFIER = "datasetIdentifier",
CURRENCY = "currency",
VALIDATION = "validation"
}

View File

@ -0,0 +1,5 @@
export enum DescriptionTemplateFieldValidationType {
None = 0,
Required = 1,
Url = 2
}

View File

@ -1,81 +1,235 @@
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { DescriptionTemplateFieldDataComboBoxType } from "@app/core/common/enum/description-template-field-data-combobox-type";
import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/common/enum/description-template-field-data-external-dataset-type";
import { DescriptionTemplateFieldDataInternalDmpEntryType } from "@app/core/common/enum/description-template-field-data-internal-dmp-entry-type";
import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type";
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
import { BaseEntity } from "@common/base/base-entity.model";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { DescriptionTemplateType } from "../description-template-type/description-template-type";
export interface DescriptionTemplate extends BaseEntity { export interface DescriptionTemplate extends BaseEntity {
label: string; label: string;
definition: DescriptionTemplateDefinition;
description: string; description: string;
groupId: Guid;
version: string;
language: string;
type: DescriptionTemplateType;
definition: DescriptionTemplateDefinition;
} }
export interface DescriptionTemplateDefinition { export interface DescriptionTemplateDefinition {
sections?: DescriptionTemplateDefinitionSection[]; pages?: DescriptionTemplatePage[];
sections?: DescriptionTemplateSection[];
} }
export interface DescriptionTemplateDefinitionSection { export interface DescriptionTemplatePage {
id: Guid; id: Guid;
label: string;
description: string;
ordinal: number; ordinal: number;
fields: FieldInSection[]; title: string;
hasTemplates: boolean;
descriptionTemplates?: DescriptionTemplatesInSection[];
} }
export interface DescriptionTemplatesInSection { export interface DescriptionTemplateSection {
id: Guid; id: Guid;
descriptionTemplateId: Guid; ordinal: number;
label: string; defaultVisibility: boolean;
minMultiplicity: number; multiplicity: boolean;
maxMultiplicity: number; numbering: string;
page: string;
title: string;
description: string;
extendedDescription: string;
sections?: DescriptionTemplateSection[];
fieldSets: DescriptionTemplateFieldSet[];
} }
export interface FieldInSection { export interface DescriptionTemplateFieldSet {
id: Guid; id: Guid;
label: string; ordinal: number;
numbering: string;
title: string;
description: string;
extendedDescription: string;
additionalInformation: string;
multiplicity: DescriptionTemplateMultiplicity
hasCommentField: boolean;
fields: DescriptionTemplateField[];
}
export interface DescriptionTemplateField {
id: Guid;
ordinal: number;
numbering: string;
schematics: string[];
defaultValue: string;
visibilityRules: DescriptionTemplateRule[];
validations: DescriptionTemplateFieldValidationType[];
fieldType: DescriptionTemplateFieldType;
includeInExport: boolean;
data: DescriptionTemplateBaseFieldData;
}
export interface DescriptionTemplateRule {
target: string;
value: string;
}
export interface DescriptionTemplateMultiplicity {
min: number;
max: number;
placeholder: string; placeholder: string;
description: string; tableView: boolean;
required: boolean;
ordinal: number;
} }
// export interface DescriptionTemplateBaseFieldData {
// Persist
//
export interface DescriptionTemplatePersist extends BaseEntityPersist {
label: string; label: string;
definition: DescriptionTemplateDefinitionPersist;
description: string;
} }
export interface DescriptionTemplateDefinitionPersist {
sections?: DescriptionTemplateDefinitionSectionPersist[]; //
// Field Types
//
export interface DescriptionTemplateAutoCompleteData extends DescriptionTemplateComboBoxData {
multiAutoComplete: boolean;
autoCompleteSingleDataList: DescriptionTemplateAutoCompleteSingleData[];
} }
export interface DescriptionTemplateDefinitionSectionPersist { export interface DescriptionTemplateBooleanDecisionData extends DescriptionTemplateBaseFieldData {
id: Guid; }
export interface DescriptionTemplateCheckBoxData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateComboBoxData extends DescriptionTemplateBaseFieldData {
type: DescriptionTemplateFieldDataComboBoxType;
}
export interface DescriptionTemplateCurrencyData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDataRepositoryData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateDatasetAutoCompleteData extends DescriptionTemplateInternalDmpBaseData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateDatasetIdentifierData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDatePickerData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDmpAutoCompleteData extends DescriptionTemplateInternalDmpBaseData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateExternalDatasetData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
type: DescriptionTemplateFieldDataExternalDatasetType;
}
export interface DescriptionTemplateFreeTextData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateInternalDmpBaseData extends DescriptionTemplateBaseFieldData {
type: DescriptionTemplateFieldDataInternalDmpEntryType;
}
export interface DescriptionTemplateLicenseData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateOrganizationData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplatePublicationData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData {
options: DescriptionTemplateRadioBoxOption;
}
export interface DescriptionTemplateRegistryData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateResearcherAutoCompleteData extends DescriptionTemplateInternalDmpBaseData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateResearcherData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateRichTextAreaData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateServiceData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateTagData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateTaxonomyData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateTextAreaData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateTextAreaData extends DescriptionTemplateBaseFieldData {
types: DescriptionTemplateUploadOption[];
}
export interface DescriptionTemplateValidationData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateWordListData extends DescriptionTemplateComboBoxData {
options: DescriptionTemplateComboBoxOption[];
multiList: boolean;
}
//
// Others
//
export interface DescriptionTemplateAutoCompleteSingleData {
autocompleteType: string;
url: string;
autoCompleteOptions: DescriptionTemplateComboBoxOption;
optionsRoot: string;
hasAuth: boolean;
auth: DescriptionTemplateAuthAutoCompleteData
method: string;
}
export interface DescriptionTemplateAuthAutoCompleteData {
url: string;
method: string;
body: string;
path: string;
type: string;
}
export interface DescriptionTemplateComboBoxOption {
label: string; label: string;
description: string; value: string;
ordinal: number; source: string;
fields: FieldInSectionPersist[]; uri: string;
hasTemplates: boolean;
descriptionTemplates?: DescriptionTemplatesInSectionPersist[];
} }
export interface DescriptionTemplatesInSectionPersist { export interface DescriptionTemplateRadioBoxOption {
id: Guid;
descriptionTemplateId: Guid;
label: string; label: string;
minMultiplicity: number; value: string;
maxMultiplicity: number;
} }
export interface FieldInSectionPersist { export interface DescriptionTemplateUploadOption {
id: Guid;
label: string; label: string;
placeholder: string; value: string;
description: string;
required: boolean;
ordinal: number;
} }

View File

@ -10,8 +10,9 @@ import { UserInfoListingModel } from "../user/user-info-listing";
import { DmpDatasetProfile } from "./dmp-dataset-profile/dmp-dataset-profile"; import { DmpDatasetProfile } from "./dmp-dataset-profile/dmp-dataset-profile";
import { DmpDynamicField } from "./dmp-dynamic-field"; import { DmpDynamicField } from "./dmp-dynamic-field";
import { DmpExtraField } from "./dmp-extra-field"; import { DmpExtraField } from "./dmp-extra-field";
import { BaseEntity } from '@common/base/base-entity.model'; import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model';
import { Description } from '../description/description'; import { Description } from '../description/description';
import { DmpReference } from '../reference/reference';
export interface DmpModel { export interface DmpModel {
id: string; id: string;
@ -57,24 +58,40 @@ export interface Dmp extends BaseEntity {
finalizedAt: Date; finalizedAt: Date;
blueprint: DmpBlueprint; blueprint: DmpBlueprint;
dmpDescriptions: Description[]; dmpDescriptions: Description[];
dmpReferences: DmpReference
lockable: boolean; lockable: boolean;
grant: GrantListingModel;
project: ProjectModel;
funder: FunderModel;
datasets: DatasetWizardModel[];
datasetsToBeFinalized: string[]; // grant: GrantListingModel;
profiles: DmpDatasetProfile[]; // project: ProjectModel;
organisations: OrganizationModel[]; // funder: FunderModel;
researchers: ResearcherModel[]; // organisations: OrganizationModel[];
associatedUsers: UserModel[]; // researchers: ResearcherModel[];
users: UserInfoListingModel[];
creator: UserModel; // datasets: DatasetWizardModel[];
extraFields: Array<DmpExtraField>; // datasetsToBeFinalized: string[];
dynamicFields: Array<DmpDynamicField>; // profiles: DmpDatasetProfile[];
modified: Date;
extraProperties: Map<String, any>;
language: String;
// associatedUsers: UserModel[];
// users: UserInfoListingModel[];
// creator: UserModel;
// extraFields: Array<DmpExtraField>;
// dynamicFields: Array<DmpDynamicField>;
// extraProperties: Map<String, any>;
// language: String;
}
//
// Persist
//
export interface DmpPersist extends BaseEntityPersist {
label: string;
description: String;
version: number;
status: DmpStatus;
groupId: String;
} }

View File

@ -1,15 +1,15 @@
import { Lookup } from '@common/model/lookup'; import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { ReferenceSourceType } from '../common/enum/reference-source-type';
import { ReferenceType } from '../common/enum/reference-type'; import { ReferenceType } from '../common/enum/reference-type';
import { SourceType } from '../common/enum/source-type';
export class ReferenceLookup extends Lookup implements ReferenceFilter { export class ReferenceLookup extends Lookup implements ReferenceFilter {
ids: Guid[]; ids: Guid[];
excludedIds: Guid[]; excludedIds: Guid[];
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
sourceTypes: SourceType[]; sourceTypes: ReferenceSourceType[];
referenceTypes: ReferenceType[]; referenceTypes: ReferenceType[];
constructor() { constructor() {
@ -22,6 +22,6 @@ export interface ReferenceFilter {
excludedIds: Guid[]; excludedIds: Guid[];
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
sourceTypes: SourceType[]; sourceTypes: ReferenceSourceType[];
referenceTypes: ReferenceType[]; referenceTypes: ReferenceType[];
} }

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { ReferenceType } from '@app/core/common/enum/reference-type'; import { ReferenceType } from '@app/core/common/enum/reference-type';
import { SourceType } from '@app/core/common/enum/source-type';
import { Reference, ReferencePersist } from '@app/core/model/reference/reference'; import { Reference, ReferencePersist } from '@app/core/model/reference/reference';
import { ReferenceLookup } from '@app/core/query/reference.lookup'; import { ReferenceLookup } from '@app/core/query/reference.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
@ -14,6 +13,7 @@ import { catchError, map } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { ConfigurationService } from '../configuration/configuration.service'; import { ConfigurationService } from '../configuration/configuration.service';
import { BaseHttpV2Service } from '../http/base-http-v2.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
@Injectable() @Injectable()
export class ReferenceService { export class ReferenceService {
@ -60,7 +60,7 @@ export class ReferenceService {
// //
// Autocomplete Commons // Autocomplete Commons
// //
public getSingleAutocompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: SourceType[]): SingleAutoCompleteConfiguration { public getSingleAutocompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
return { return {
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes)).pipe(map(x => x.items)), initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery)).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery)).pipe(map(x => x.items)),
@ -71,7 +71,7 @@ export class ReferenceService {
}; };
}; };
public getMultipleAutoCompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: SourceType[]): MultipleAutoCompleteConfiguration { public getMultipleAutoCompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
return { return {
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)), filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
@ -82,7 +82,7 @@ export class ReferenceService {
}; };
} }
private buildAutocompleteLookup(referenceTypes?: ReferenceType[], sourceTypes?: SourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup { private buildAutocompleteLookup(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
const lookup: ReferenceLookup = new ReferenceLookup(); const lookup: ReferenceLookup = new ReferenceLookup();
lookup.page = { size: 100, offset: 0 }; lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }

View File

@ -3,8 +3,10 @@ import { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormContr
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router'; import { ActivatedRoute, Params, Router } from '@angular/router';
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-extra-field-data-type'; import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-extra-field-data-type';
import { DmpBlueprintSectionFieldCategory } from '@app/core/common/enum/dmp-blueprint-section-field-category';
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type'; import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
import { DmpStatus } from '@app/core/common/enum/dmp-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { Role } from '@app/core/common/enum/role'; import { Role } from '@app/core/common/enum/role';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile'; import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
@ -18,8 +20,6 @@ import { LockModel } from '@app/core/model/lock/lock.model';
import { UserModel } from '@app/core/model/user/user'; import { UserModel } from '@app/core/model/user/user';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing'; import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria'; import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria';
import { LicenseCriteria } from '@app/core/query/license/license-criteria';
import { RequestItem } from '@app/core/query/request-item';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LanguageInfoService } from '@app/core/services/culture/language-info-service'; import { LanguageInfoService } from '@app/core/services/culture/language-info-service';
@ -31,8 +31,8 @@ import { LockService } from '@app/core/services/lock/lock.service';
import { MatomoService } from '@app/core/services/matomo/matomo-service'; import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { OrganisationService } from '@app/core/services/organisation/organisation.service'; import { OrganisationService } from '@app/core/services/organisation/organisation.service';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; 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 { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component'; import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model'; import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
@ -56,10 +56,6 @@ import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties
import { FunderFormModel } from '../editor/grant-tab/funder-form-model'; import { FunderFormModel } from '../editor/grant-tab/funder-form-model';
import { GrantTabModel } from '../editor/grant-tab/grant-tab-model'; import { GrantTabModel } from '../editor/grant-tab/grant-tab-model';
import { ProjectFormModel } from '../editor/grant-tab/project-form-model'; import { ProjectFormModel } from '../editor/grant-tab/project-form-model';
import { DmpBlueprintSectionFieldCategory } from '@app/core/common/enum/dmp-blueprint-section-field-category';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { SourceType } from '@app/core/common/enum/source-type';
interface Visible { interface Visible {
value: boolean; value: boolean;