From 04da845f49ef853fc5ee14f9211124bed5d15632 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Tue, 16 Apr 2024 18:20:43 +0300 Subject: [PATCH] minor fixes --- .../java/eu/eudat/query/ReferenceQuery.java | 1 - .../ExternalFetcherServiceImpl.java | 2 +- .../external-fetcher/external-fetcher.ts | 38 +++++++++---------- .../app/core/query/reference-search.lookup.ts | 3 ++ .../editor/description-editor.component.ts | 1 - .../reference-field.component.ts | 11 ++++++ 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java index a24fda1ae..4e5c8e167 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java @@ -216,7 +216,6 @@ public class ReferenceQuery extends QueryBase { List predicates = new ArrayList<>(); if (userId != null || usePublic) { predicates.add(queryContext.CriteriaBuilder.or( - queryContext.CriteriaBuilder.isNull(queryContext.Root.get(ReferenceEntity._createdById)), userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class) .query(queryContext.Query) diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java index 0590553ff..5fb6b489f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java @@ -216,7 +216,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService { else if (!this.conventionService.isNullOrEmpty(apiSource.getFirstPage())) completedPath = completedPath.replace("{page}", apiSource.getFirstPage()); else completedPath = completedPath.replace("{page}", "1"); - completedPath = completedPath.replace("{pageSize}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPageSize()) ? externalReferenceCriteria.getPageSize() : "60"); + completedPath = completedPath.replace("{pageSize}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPageSize()) ? externalReferenceCriteria.getPageSize() : "50"); completedPath = completedPath.replace("{host}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getHost()) ? externalReferenceCriteria.getHost() : ""); completedPath = completedPath.replace("{path}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPath()) ? externalReferenceCriteria.getPath() : ""); diff --git a/dmp-frontend/src/app/core/model/external-fetcher/external-fetcher.ts b/dmp-frontend/src/app/core/model/external-fetcher/external-fetcher.ts index 3f46a5359..6bb802273 100644 --- a/dmp-frontend/src/app/core/model/external-fetcher/external-fetcher.ts +++ b/dmp-frontend/src/app/core/model/external-fetcher/external-fetcher.ts @@ -3,7 +3,7 @@ import { ReferenceType } from "../reference-type/reference-type"; import { ExternalFetcherSourceType } from "@app/core/common/enum/external-fetcher-source-type"; import { Guid } from "@common/types/guid"; -export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherApiSourceConfiguration, ExternalFetcherStaticOptionSourceConfiguration{ +export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherApiSourceConfiguration, ExternalFetcherStaticOptionSourceConfiguration { type: ExternalFetcherSourceType; key: string; label: string; @@ -11,7 +11,7 @@ export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherA referenceTypeDependencies?: ReferenceType[]; } -export interface ExternalFetcherApiSourceConfiguration{ +export interface ExternalFetcherApiSourceConfiguration { url: string; results: ResultsConfiguration; paginationPath: string; @@ -24,18 +24,18 @@ export interface ExternalFetcherApiSourceConfiguration{ queries?: QueryConfig[]; } -export interface ResultsConfiguration{ +export interface ResultsConfiguration { resultsArrayPath: string; fieldsMapping: ResultFieldsMappingConfiguration[]; } -export interface ResultFieldsMappingConfiguration{ +export interface ResultFieldsMappingConfiguration { code: string; responsePath: string; } -export interface AuthenticationConfiguration{ +export interface AuthenticationConfiguration { enabled: boolean; authUrl: string; authMethod: ExternalFetcherApiHTTPMethodType; @@ -44,13 +44,13 @@ export interface AuthenticationConfiguration{ type: string; } -export interface QueryConfig{ +export interface QueryConfig { name: string; defaultValue: string; cases: QueryCaseConfig[]; } -export interface QueryCaseConfig{ +export interface QueryCaseConfig { likePattern: string, separator: string; value: string; @@ -58,15 +58,15 @@ export interface QueryCaseConfig{ referenceTypeSourceKey: string } -export interface ExternalFetcherStaticOptionSourceConfiguration{ +export interface ExternalFetcherStaticOptionSourceConfiguration { items: Static[]; } -export interface Static{ +export interface Static { options: StaticOption[]; } -export interface StaticOption{ +export interface StaticOption { code: string; value: string; } @@ -75,7 +75,7 @@ export interface StaticOption{ // Persist // -export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalFetcherApiSourceConfigurationPersist, ExternalFetcherStaticOptionSourceConfigurationPersist{ +export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalFetcherApiSourceConfigurationPersist, ExternalFetcherStaticOptionSourceConfigurationPersist { type: ExternalFetcherSourceType; key: string; label: string; @@ -83,7 +83,7 @@ export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalF referenceTypeDependencyIds?: Guid[]; } -export interface ExternalFetcherApiSourceConfigurationPersist{ +export interface ExternalFetcherApiSourceConfigurationPersist { url: string; results: ResultsConfigurationPersist; paginationPath: string; @@ -96,18 +96,18 @@ export interface ExternalFetcherApiSourceConfigurationPersist{ queries?: QueryConfigPersist[]; } -export interface ResultsConfigurationPersist{ +export interface ResultsConfigurationPersist { resultsArrayPath: string; fieldsMapping: ResultFieldsMappingConfigurationPersist[]; } -export interface ResultFieldsMappingConfigurationPersist{ +export interface ResultFieldsMappingConfigurationPersist { code: string; responsePath: string; } -export interface AuthenticationConfigurationPersist{ +export interface AuthenticationConfigurationPersist { enabled: boolean; authUrl: string; authMethod: ExternalFetcherApiHTTPMethodType; @@ -116,13 +116,13 @@ export interface AuthenticationConfigurationPersist{ type: string; } -export interface QueryConfigPersist{ +export interface QueryConfigPersist { name: string; defaultValue: string; cases: QueryCaseConfigPersist[]; } -export interface QueryCaseConfigPersist{ +export interface QueryCaseConfigPersist { likePattern: string, separator: string; value: string; @@ -134,11 +134,11 @@ export interface ExternalFetcherStaticOptionSourceConfigurationPersist { items: StaticPersist[]; } -export interface StaticPersist{ +export interface StaticPersist { options: StaticOptionPersist[]; } -export interface StaticOptionPersist{ +export interface StaticOptionPersist { code: string; value: string; } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/query/reference-search.lookup.ts b/dmp-frontend/src/app/core/query/reference-search.lookup.ts index e6ec053dc..015ad92f5 100644 --- a/dmp-frontend/src/app/core/query/reference-search.lookup.ts +++ b/dmp-frontend/src/app/core/query/reference-search.lookup.ts @@ -1,10 +1,12 @@ import { Lookup } from "@common/model/lookup"; import { Guid } from "@common/types/guid"; +import { Reference } from "../model/reference/reference"; export class ReferenceSearchLookup extends Lookup { like: string; typeId: Guid; key: string; + dependencyReferences: Reference[]; constructor() { super(); @@ -16,6 +18,7 @@ export class ReferenceSearchDefinitionLookup extends Lookup { like: string; typeId: Guid; key: string; + dependencyReferences: Reference[]; constructor() { super(); diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index bc6f32c6a..faf308c90 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -584,7 +584,6 @@ export class DescriptionEditorComponent extends BaseEditor this.onCallbackError(error) ); - } calculateMultiplicityRejectedDmpDescriptionTemplates(section: DmpBlueprintDefinitionSection, descriptions: Description[]) : DmpDescriptionTemplate[]{ diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts index c01fde684..943eb3af0 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts @@ -28,6 +28,8 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { @Input() multiple: boolean = true; @Input() hint: string; @Input() placeholder: string; + @Input() dependencies: UntypedFormGroup = null; + multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration; @@ -84,6 +86,15 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { }; lookup.typeId = typeId; lookup.order = { items: [nameof(x => x.label)] }; + + // const sourcesWithDependencies = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies); + // if (sourcesWithDependencies.length > 0) { + // Object.keys(this.dependencies.controls).forEach(controlName => { + // (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&) + // }); + // lookup.dependencyReferences = []; + // } + return lookup; } }