From f7bd8e8ed94d26ad930bd48a2f216df8782f9461 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 10 Oct 2023 10:41:58 +0200 Subject: [PATCH] fix: parameterization hints not showing in catalog browser (#511) --- CHANGELOG.md | 1 + .../asset-property-grid-group-builder.ts | 42 ++++++++++++++++--- .../api/fake-backend/impl/data/test-assets.ts | 6 +-- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9b2836e..0ceabecfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ EDC 0 compatible version (Connector UI only). #### Patch +- Fixed HTTP Parameterization Hints not showing in Asset Details. - Removed 404-causing login polling from broker UI - Renamed button from cancel to close in json-dialogs - Broker: Fixed popularity not logged when clicking on a data offer diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 858d1230d..726a4866a 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -71,11 +71,7 @@ export class AssetPropertyGridGroupBuilder { label: 'Participant ID', ...this.propertyGridUtils.guessValue(asset.participantId), }, - { - icon: 'category', - label: 'Content Type', - ...this.propertyGridUtils.guessValue(asset.mediaType), - }, + ...this.buildHttpDatasourceFields(asset), ]; if (this.activeFeatureSet.hasMdsFields()) { @@ -88,6 +84,42 @@ export class AssetPropertyGridGroupBuilder { }; } + private buildHttpDatasourceFields(asset: Asset): PropertyGridField[] { + const fields: PropertyGridField[] = []; + + const hints: {label: string; value: boolean | undefined}[] = [ + {label: 'Method', value: asset.httpDatasourceHintsProxyMethod}, + {label: 'Path', value: asset.httpDatasourceHintsProxyPath}, + {label: 'Query Params', value: asset.httpDatasourceHintsProxyQueryParams}, + {label: 'Body', value: asset.httpDatasourceHintsProxyBody}, + ]; + + if (hints.some((hint) => hint.value != null)) { + const text = hints.some((hint) => hint.value) + ? hints + .filter((hint) => hint.value) + .map((hint) => hint.label) + .join(', ') + : 'Disabled'; + + fields.push({ + icon: 'api', + label: 'HTTP Data Source Parameterization', + text, + }); + } + + if (asset.mediaType) { + fields.push({ + icon: 'category', + label: 'Content Type', + ...this.propertyGridUtils.guessValue(asset.mediaType), + }); + } + + return fields; + } + buildAdditionalPropertiesGroup(asset: Asset): PropertyGridGroup { const fields: PropertyGridField[] = []; diff --git a/src/app/core/services/api/fake-backend/impl/data/test-assets.ts b/src/app/core/services/api/fake-backend/impl/data/test-assets.ts index cc6f9c792..68da9ec76 100644 --- a/src/app/core/services/api/fake-backend/impl/data/test-assets.ts +++ b/src/app/core/services/api/fake-backend/impl/data/test-assets.ts @@ -33,9 +33,9 @@ export namespace TestAssets { geoReferenceMethod: 'Lat/Lon', transportMode: 'Rail', httpDatasourceHintsProxyQueryParams: true, - httpDatasourceHintsProxyPath: false, - httpDatasourceHintsProxyMethod: false, - httpDatasourceHintsProxyBody: false, + httpDatasourceHintsProxyPath: true, + httpDatasourceHintsProxyMethod: true, + httpDatasourceHintsProxyBody: true, additionalProperties: { 'http://unknown/usecase': 'my-use-case', },